PageSourceSearch

https://login.commonsku.com/dist/react/components-ContactRouter.d21dc497.chunk.js

js commonsku.com collected 2026-10-02 03:15:38 UTC 37,317 bytes, 2 lines download raw bytes

1"use strict";(globalThis.__LOADABLE_LOADED_CHUNKS__=globalThis.__LOADABLE_LOADED_CHUNKS__||[]).push([[3495],{60999(t,e,n){n.r(e),n.d(e,{default:()=>ot});var a=n(41594),s=n.n(a),i=n(98483),c=n(47203),o=n(42732),l=n(22224),r=n.n(l),d=n(3602),h=n(73021),m=n(51904),p=n(2596),_=n(46237),u=n(3976),g=n(46023),x=n(89861),j=n(31238),C=n(84685),y=n(63988);const v=t=>{let{showEditContactBtn:e,displayNone:n,company_contact_id:a,onCreateAddTemp:s}=t;const i=(0,c.Zp)();return(0,y.jsx)("a",{"data-test-name":"EditContactBtn",className:"hollow button save-contact-button",onClick:()=>{s(),window.scrollTo(0,0),i(`/contact/${a}`)},style:e?null:n,children:"Edit Contact"})};class f extends a.Component{constructor(t){super(t),this.state={editContact:t.editContact,editName:!!t.editContact,editClient:!!t.editContact,editSocial:!!t.editContact,contact_first_name:t.contact.contact_first_name,contact_last_name:t.contact.contact_last_name,contact_position:t.contact.contact_position,company_name:t.contact.company_name,contact_facebook:t.contact.contact_facebook,contact_twitter:t.contact.contact_twitter,contact_linkedin:t.contact.contact_linkedin,showNewProjectPopup:!1},this.handleChangeValue=this.handleChangeValue.bind(this),this.handleFinishUpdateContactTitle=this.handleFinishUpdateContactTitle.bind(this),this.renderActionMenu=this.renderActionMenu.bind(this),this.handleClickNewProject=this.handleClickNewProject.bind(this)}UNSAFE_componentWillReceiveProps(t){this.setState({contact_first_name:t.contact.contact_first_name,contact_last_name:t.contact.contact_last_name,contact_position:t.contact.contact_position,company_name:t.contact.company_name,contact_twitter:t.contact.contact_twitter,contact_facebook:t.contact.contact_facebook,contact_linkedin:t.contact.contact_linkedin,editContact:!!t.editContact,editName:!!t.editContact,editClient:!!t.editContact,editSocial:!!t.editContact})}handleChangeValue(t,e){this.setState({[e]:t})}handleFinishUpdateContactTitle(){this.props.onSaveContact(),this.setState({editName:!1,editClient:!1,editSocial:!1,editContact:!1})}handleClickNewProject(){this.setState({showNewProjectPopup:!0})}renderActionMenu(){const t=(0,l.filter)([{value:(0,y.jsx)("div",{children:"New Project"}),show:!0,hideOnClick:!0,onClick:this.handleClickNewProject},{value:(0,y.jsx)("a",{rel:"opener",href:`/send_email.php?parent_type=CLIENT&parent_id=${this.props.contact.company_id}&company_type=CLIENT&contact_id=${this.props.contact.contact_id}`,target:"_blank",children:"Send Email"}),show:!0,hideOnClick:!0}],{show:!0});return(0,y.jsx)(u.Ay,{"data-test-name":"ContactTitle.renderActionMenu",className:"actions-dropdown action-menu",options:t,align:"right",children:(0,y.jsx)(u.cQ,{children:(0,y.jsx)("a",{className:"button",children:"Actions"})})})}render(){const{contact:t,showEditContactBtn:e,onCreateUpdateContact:n,onCreateAddTemp:a}=this.props,s=`${this.state.contact_first_name} ${this.state.contact_last_name}`,i=this.state.contact_position?`${this.state.contact_position} at `:null,c=`/client.php?id=${t.company_id}`,o={display:"none"},l={color:"gray"};return(0,y.jsxs)("div",{"data-test-name":"ContactTitle.render",children:[(0,y.jsxs)("div",{className:"large-8 columns",style:this.state.editName&&this.state.editClient&&this.state.editSocial?{marginTop:"50px"}:null,children:[this.state.editName||this.state.editSocial?(0,y.jsxs)("div",{className:"small-12",children:[(0,y.jsx)("div",{className:"medium-6 columns",style:{paddingLeft:0},children:(0,y.jsx)(_.A,{className:"small-12",label:"First Name",type:"text",placeholder:"first name",value:this.state.contact_first_name,onChange:t=>this.handleChangeValue(t,"contact_first_name"),onBlur:n(t.company_contact_id,t.company_id,"contact_first_name",t.contact_contact_first_name)})}),(0,y.jsx)("div",{className:"medium-6 columns",children:(0,y.jsx)(_.A,{className:"small-12",label:"Last Name",type:"text",placeholder:"last name",value:this.state.contact_last_name,onChange:t=>this.handleChangeValue(t,"contact_last_name"),onBlur:n(t.company_contact_id,t.company_id,"contact_last_name",t.contact_last_name)})})]}):(0,y.jsx)("div",{className:"row no-maxWidth",children:(0,y.jsxs)("div",{className:"social-media-links",style:{display:"inline-block"},children:[(0,y.jsx)("h2",{style:{float:"left"},children:s}),0==t.active&&(0,y.jsx)("span",{style:{marginLeft:"1rem"},children:"(Inactive)"}),(0,y.jsx)("a",{href:""!=this.state.contact_twitter?this.state.contact_twitter:"javascript:void(0);",target:"_blank",className:"social-media-link",children:(0,y.jsx)("i",{className:"fi-social-twitter",style:""==this.state.contact_twitter?l:null})}),(0,y.jsx)("a",{href:""!=this.state.contact_facebook?this.state.contact_facebook:"javascript:void(0);",target:"_blank",className:"social-media-link",children:(0,y.jsx)("i",{className:"fi-social-facebook",style:""==this.state.contact_facebook?l:null})}),(0,y.jsx)("a",{href:""!=this.state.contact_linkedin?this.state.contact_linkedin:"javascript:void(0);",target:"_blank",className:"social-media-link",children:(0,y.jsx)("i",{className:"fi-social-linkedin",style:""==this.state.contact_linkedin?l:null})})]})}),this.state.editClient?(0,y.jsx)("div",{className:"small-12",children:(0,y.jsx)("div",{className:"medium-6 columns",style:{paddingLeft:0},children:(0,y.jsx)(_.A,{className:"small-12",label:"Contact Position",type:"text",placeholder:"contact position",value:this.state.contact_position,onChange:t=>this.handleChangeValue(t,"contact_position"),onBlur:n(t.company_contact_id,t.company_id,"contact_position",t.contact_position)})})}):(0,y.jsxs)("h4",{children:[i,(0,y.jsxs)("a",{href:c,target:"_blank",children:[this.state.company_name,"  "]})]})]}),(0,y.jsx)("div",{className:"large-4 columns social-media-links",children:this.state.editContact?(0,y.jsxs)("div",{children:[(0,y.jsx)("a",{className:"hollow button save-contact-button",onClick:this.handleFinishUpdateContactTitle,style:e?null:o,children:"Save Contact"})," ",this.renderActionMenu(),(0,y.jsxs)("div",{className:"small-12 columns",children:[(0,y.jsx)(_.A,{className:"small-12",label:"Twitter",type:"text",placeholder:"twitter handle",value:this.state.contact_twitter,onChange:t=>this.handleChangeValue(t,"contact_twitter"),onBlur:n(t.company_contact_id,t.company_id,"contact_twitter",t.contact_twitter)}),(0,y.jsx)(_.A,{className:"small-12",label:"Facebook",type:"text",placeholder:"facebook handle",value:this.state.contact_facebook,onChange:t=>this.handleChangeValue(t,"contact_facebook"),onBlur:n(t.company_contact_id,t.company_id,"contact_facebook",t.contact_facebook)}),(0,y.jsx)(_.A,{className:"small-12",label:"Linkedin",type:"text",placeholder:"linkedin public profile url",value:this.state.contact_linkedin,onChange:t=>this.handleChangeValue(t,"contact_linkedin"),onBlur:n(t.company_contact_id,t.company_id,"contact_linkedin",t.contact_linkedin)})]})]}
1):1==t.active?(0,y.jsxs)("div",{children:[(0,y.jsx)(v,{company_contact_id:t.company_contact_id,displayNone:o,onCreateAddTemp:a,showEditContactBtn:e})," ",this.renderActionMenu()]}):(0,y.jsx)("div",{children:(0,y.jsx)("a",{className:"button save-contact-button",onClick:()=>n(t.company_contact_id,t.company_id,"active",0)(1),children:"Reactivate"})})}),this.state.showNewProjectPopup&&(0,y.jsx)(j.A,{client_id:t.company_id,billing_contact_id:t.contact_id,onClose:()=>this.setState({showNewProjectPopup:!1})})]})}}const b=(0,C.y)((0,i.Ng)((t,e)=>{const n=!(e.router.location.pathname.match(/projects/)||e.router.location.pathname.match(/marketing-platform/));return{editContact:!(!t.temp["edit-contact"]||!n),showEditContactBtn:n}},(t,e)=>({onCreateUpdateContact:(e,n,a,s)=>i=>{t((0,g.QX)(e,n,a,s,i))},onSaveContact:()=>{t((0,x.mA)("edit-contact"))},onCreateAddTemp:()=>{t((0,x.Qg)("edit-contact",!0))}}))(f));n(75158);var N=n(22078);const k=t=>{let{isActive:e}=t;return e?"active":""};class w extends a.Component{render(){const{contact:t,identity:e,isMpContact:n}=this.props,{hasCapabilities:a}=(0,N.el)(e),s=a("COMPANY-TYPE-DISTRIBUTOR");return(0,y.jsxs)(y.Fragment,{children:[s?(0,y.jsx)("div",{className:"sub-right-menu-top",children:(0,y.jsx)(d.Text,{as:"p",className:"sub-right-menu-top-title",children:"Contact"})}):null,(0,y.jsxs)("ul",{className:"vertical menu",children:[(0,y.jsx)("li",{className:"show-for-small-only",children:(0,y.jsx)("a",{href:e.user_flags.includes("DASHBOARD-HOME")?"/dashboard.php":"/home.php",children:"Home"})}),(0,y.jsx)("li",{children:(0,y.jsx)(o.k2,{end:!0,to:`/contact/${t.company_contact_id}`,onClick:t=>{document.body.scrollTop=0},className:k,children:"Overview"})}),(0,y.jsx)("li",{children:(0,y.jsx)(o.k2,{end:!0,to:`/contact/${t.company_contact_id}/projects`,className:k,children:"Projects"})}),n?(0,y.jsx)("li",{children:(0,y.jsx)(o.k2,{end:!0,to:`/contact/${t.company_contact_id}/marketing-platform`,className:k,children:"Marketing"})}):null]})]})}}const A=(0,i.Ng)((t,e)=>({identity:t.identity}),(t,e)=>({}))(w);var T=n(73882),S=n(28989),E=n(30596),M=n(21992),P=n(83176);class R extends a.Component{constructor(t){super(t),this.state={files:[],showReminder:0,reminder_date:"",reminder_user_id:t.default_reminder_user_id,publisher_text_value:this.props.message?this.props.message:"",note_type:"",date_complete:""},this.handleAddMessage=this.handleAddMessage.bind(this),this.renderPreview=this.renderPreview.bind(this),this.handleToggleReminder=this.handleToggleReminder.bind(this),this.handleChangeDate=this.handleChangeDate.bind(this),this.handleChangeReminderUser=this.handleChangeReminderUser.bind(this),this.handlePublisherText=this.handlePublisherText.bind(this),this.handleChangeNoteType=this.handleChangeNoteType.bind(this),this.closePublisher=this.closePublisher.bind(this),this.handleChangeDateCompleted=this.handleChangeDateCompleted.bind(this),this.getCurrentTime=this.getCurrentTime.bind(this)}UNSAFE_componentWillReceiveProps(t){!1===t.loading&&this.setState({files:[],showReminder:0,reminder_user_id:this.props.default_reminder_user_id,publisher_text_value:""})}componentWillUnmount(){this.props.onCreateAddTemp("message",this.state.publisher_text_value)}renderPreview(t){this.setState({files:t})}handleAddMessage(t,e,n,a,s,i,c,o,l){let r,d=/(@[A-z0-9]+)/g,h=[];do{r=d.exec(e),r&&0!=this.props.mention_users.filter(t=>t.mask==r[0].slice(1)).length&&h.push(this.props.mention_users.filter(t=>t.mask==r[0].slice(1))[0].user_id)}while(r);let m=h.toString();this.props.onAddContactMessage(t,e,n,a,s,m,c,null,null,o,l),this.setState(Object.assign({},this.state,{files:[]})),this.setState({showReminder:0,reminder_user_id:this.props.default_reminder_user_id,publisher_text_value:"",note_type:""})}handleToggleReminder(t){1==t?this.setState({showReminder:0}):this.setState({showReminder:1})}handleChangeDate(t){this.setState({reminder_date:t})}handleChangeDateCompleted(t){this.setState({date_complete:t})}handleChangeReminderUser(t){this.setState({reminder_user_id:t})}handleChangeNoteType(t){this.setState({note_type:t})}closePublisher(){this.setState({files:[],showReminder:0,reminder_date:"",reminder_user_id:this.props.default_reminder_user_id,publisher_text_value:"",note_type:"",date_complete:""})}handlePublisherText(t){this.setState({publisher_text_value:t})}getCurrentTime(){return Date.now()}render(){const{contact_id:t,client_id:e,users:n,mention_users:a,default_reminder_user_id:s,loading:i}=this.props,{files:c,reminder_date:o,reminder_user_id:l,note_type:r,date_complete:h}=this.state,m=this.state.publisher_text_value,p={display:"none"};return(0,y.jsx)("div",{"data-test-name":"PublisherContact.render",children:""==this.state.note_type?(0,y.jsxs)("div",{className:"publisher pre-publisher row no-maxWidth",children:[(0,y.jsx)("div",{className:"large-4 columns",children:(0,y.jsxs)("a",{className:"button small",onClick:t=>{t.preventDefault(),this.handleChangeNoteType("NOTE")},children:[(0,y.jsx)("i",{className:"fi-clipboard-notes"})," Note"]})}),(0,y.jsx)("div",{className:"large-4 columns",children:(0,y.jsxs)("a",{className:"button small",onClick:t=>{t.preventDefault(),this.handleChangeNoteType("CALL")},children:[(0,y.jsx)("i",{className:"fi-telephone"})," Call"]})}),(0,y.jsx)("div",{className:"large-4 columns",children:(0,y.jsxs)("a",{className:"button small",onClick:t=>{t.preventDefault(),this.handleChangeNoteType("MEETING")},children:[(0,y.jsx)("i",{className:"fi-torsos-all"})," Meeting"]})})]}):(0,y.jsx)("div",{className:"publisher",children:(0,y.jsxs)("div",{className:"row no-maxWidth",children:[(0,y.jsxs)("div",{className:"medium-12 columns",children:[(0,y.jsx)(S.A,{placeholder:"Add a note, call or a meeting...",value:m,mention_users:a,onChange:this.handlePublisherText}),(0,y.jsxs)("div",{className:"medium-8 columns",children:[c[0]&&c[0].name.match(/\.(jpg|jpeg|png|gif)$/)?(0,y.jsx)("img",{className:"attachment-preview",src:c[0].preview}
1):null,c[0]&&!c[0].name.match(/\.(jpg|jpeg|png|gif)$/)?`${c[0].name} ready to be uploaded.`:null]}),(0,y.jsx)("div",{className:"medium-4 columns",children:i?(0,y.jsxs)("div",{className:"text-center",children:[(0,y.jsx)("br",{}),(0,y.jsx)("img",{src:"/images/gears.gif"}),(0,y.jsx)("br",{})]}):null})]}),(0,y.jsx)("div",{className:"large-3 columns",style:{paddingRight:0},children:"CALL"===r||"MEETING"===r?(0,y.jsx)("div",{children:(0,y.jsx)(P.Ay,{value:h,onChange:this.handleChangeDateCompleted,onBlur:this.handleChangeDateCompleted,dateFormat:"yyyy-mm-dd HH:mm",inputFormat:"YYYY-MM-DD HH:mm",outputFormat:"YYYY-MM-DD HH:mm",placeholder:"YYYY-MM-DD HH:mm",showTimeInput:!0,updateOnDateClick:!1,collapseOnDateClick:!1,showOkButton:!0,showCancelButton:!0,showTodayButton:!0,defaultValue:this.getCurrentTime})}):null}),(0,y.jsx)("div",{className:"NOTE"==this.state.note_type&&1==this.state.showReminder?"large-4 columns":"large-3 columns",children:(0,y.jsxs)("a",{className:"button",onClick:t=>{t.preventDefault(),this.handleToggleReminder(this.state.showReminder)},children:[(0,y.jsx)("i",{className:"fi-clock",children:"  "})," Reminder"]})}),(0,y.jsx)("div",{className:"NOTE"==this.state.note_type&&1==this.state.showReminder?"large-4 columns":"large-3 columns",children:(0,y.jsx)("a",{className:"button",children:(0,y.jsx)(d.Dropzone,{onDrop:this.renderPreview,style:{border:"none"},multiple:!1,children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("i",{className:"fi-paperclip",children:"  "})," File"]})})})}),(0,y.jsx)("div",{className:"NOTE"==this.state.note_type&&1==this.state.showReminder?"large-4 columns":"large-3 columns",children:(0,y.jsx)("a",{className:"button",onClick:this.closePublisher,children:"Cancel"})}),(0,y.jsx)("div",{className:"large-6 columns",style:0==this.state.showReminder?p:null,children:(0,y.jsx)(T.A,{ref:"publisher_reminder_user_id",value:l,options:n,change:this.handleChangeReminderUser})}),(0,y.jsx)("div",{className:"large-3 columns",style:0==this.state.showReminder?p:null,children:(0,y.jsx)(P.Ay,{value:this.state.reminder_date,onChange:this.handleChangeDate,showClock:!1})}),(0,y.jsx)("div",{className:"large-3 columns",children:(0,y.jsx)("a",{className:"button alt",onClick:n=>{n.preventDefault(),this.handleAddMessage(t,m,l,o,c,s,e,r,h)},disabled:""==m,style:{float:"right"},children:"Post"})})]})})})}}const O=(0,i.Ng)((t,e)=>({default_reminder_user_id:t.identity.user_id,users:(0,E.I6)(t),mention_users:Object.values(t.entities.users).filter(t=>0!=t.mask),loading:t.display.loading.upload_file,message:t.temp.message}),t=>({onAddContactMessage:(e,n,a,s,i,c,o,l,r,d,h)=>{t((0,M.ZR)(e,n,a,s,i,c,o,l,r,d,h))},onCreateDeleteTemp:e=>{t((0,x.mA)(e))},onCreateAddTemp:(e,n)=>{t((0,x.Qg)(e,n))}}))(R);var L=n(16881),D=n(72361),$=n(16040),F=n(82252),B=n(67564);class I extends a.Component{constructor(t){super(t),this.state=Object.values(t.contact.phones).reduce((t,e)=>(t[`phone_number_${e.phone_id}
1`]=e.phone_number,t[`phone_extension_${e.phone_id}`]=e.phone_extension,t),{}),this.state.contact_email=t.contact.contact_email,this.state.contact_department_id=t.contact.contact_department_id,this.state.contact_default_address_id=t.contact.contact_default_address_id,this.state.contact_no_marketing=t.contact.contact_no_marketing,this.state.newTags=t.beforeTags,this.state.editContact=t.editContact,this.state.syncReplaced=!1,this.handleChangeValue=this.handleChangeValue.bind(this),this.handleAddPhone=this.handleAddPhone.bind(this),this.loadGoogleMap=this.loadGoogleMap.bind(this),this.handleReplaceMpOtherContact=this.handleReplaceMpOtherContact.bind(this)}UNSAFE_componentWillMount(){this.loadGoogleMap()}loadGoogleMap(){let t=this.state.contact_default_address_id?this.props.address_details[this.state.contact_default_address_id]:null;if(t){B.Al.getElementById("map_canvas")&&(B.Al.getElementById("map_canvas").style.display="block");let e=`${t.address_line_1} ${t.address_line_2} ${t.address_city} ${t.address_state} ${t.address_country} ${t.address_postal}`;r().isUndefined(B.x.google)||(new B.x.google.maps.Geocoder).geocode({address:e},function(t,e){if(e==B.x.google.maps.GeocoderStatus.OK){let e=t[0].geometry.location.lat(),n=t[0].geometry.location.lng(),a={zoom:11,center:new B.x.google.maps.LatLng(e,n)},s=new B.x.google.maps.Map(B.Al.getElementById("map_canvas"),a);new B.x.google.maps.Marker({position:new B.x.google.maps.LatLng(e,n),map:s,title:""})}else console.log("Geostatus: "+e)})}else B.Al.getElementById("map_canvas")&&(B.Al.getElementById("map_canvas").style.display="none")}UNSAFE_componentWillReceiveProps(t){this.setState({contact_email:t.contact.contact_email,contact_department_id:t.contact.contact_department_id,contact_default_address_id:t.contact.contact_default_address_id,editContact:t.editContact,contact_no_marketing:t.contact.contact_no_marketing}),this.loadGoogleMap()}handleChangeValue(t,e){this.setState({[e]:t})}handleAddPhone(){this.props.onCreateAddContactPhone(this.props.contact.company_contact_id,this.props.contact.company_id,"","WORK","","")}renderAddress(){const{address_details:t}=this.props,{contact_default_address_id:e}=this.state,n=r().get(t,e);return n?(0,y.jsxs)("div",{"data-test-name":"ContactBriefing.renderAddress",children:[(0,y.jsx)("p",{style:{marginTop:"1rem",marginBottom:0},children:n.address_name}),r().map(r().pick(n,["address_line_1","address_line_2","address_line_3","address_line_4"]),(t,e)=>t?(0,y.jsxs)("div",{children:[t,", "]},e):null),(0,y.jsx)("div",{children:r().filter(r().pick(n,["address_city","address_state","address_country","address_postal"]),t=>!!t).join(", ")})]}):null}getMpOtherContact(){const t=this.props.contact.mp_other_contact;return r().isEmpty(t)?null:(t.platform="",t.mp_data.mailchimp_sync_status?t.platform="Mailchimp":t.mp_data.hubspot_sync_status&&(t.platform="Hubspot"),t.full_name="",(t.contact_first_name||t.contact_last_name)&&(t.full_name=t.contact_first_name+" "+t.contact_last_name),t.contact_link=`/contact/${t.company_contact_id}`,t)}handleReplaceMpOtherContact(t){(0,N.oD)("POST","marketing-platform/",{action:"replace-mp-contact",contact_id:t,new_contact_id:this.props.contact.contact_id}).then(t=>{this.setState({syncReplaced:!0}),this.props.setShowMarketingLink()})}render(){const{contact:t,addresses:e,departments:n,tags:a,onCreateUpdateContact:s,onCreateUpdateContactPhone:i,onCreateDeleteContactPhone:c}=this.props,o=this.getMpOtherContact(),{newTags:h}=this.state,m=(0,l.map)(a,t=>({...t,key:t.tag_id}));return(0,y.jsx)("div",{"data-test-name":"ContactBriefing.render",className:"row",children:(0,y.jsxs)("div",{className:"small-12 columns",children:[this.state.editContact?(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)("div",{children:[(0,y.jsx)(_.A,{className:"small-12",label:"Email",type:"text",value:this.state.contact_email,onChange:t=>this.handleChangeValue(t,"contact_email"),onBlur:s(t.company_contact_id,t.company_id,"contact_email",t.contact_email)}),(0,y.jsx)($.A,{className:"small-12",label:"No Marketing",value:this.state.contact_no_marketing,onChange:e=>{this.handleChangeValue(e,"contact_no_marketing"),s(t.company_contact_id,t.company_id,"contact_no_marketing",t.contact_no_marketing)(e)}}),(0,y.jsxs)("label",{labelfor:"phones",children:["Phones  ",(0,y.jsx)("small",{children:(0,y.jsx)("a",{onClick:this.handleAddPhone,children:"add phone"})})]}),Object.values(t.phones).map(e=>(0,y.jsxs)("div",{children:[(0,y.jsx)("a",{style:{float:"left",marginRight:"5px"},onClick:n=>{n.preventDefault(),c(t.company_contact_id,e.phone_id)},children:"x "}),(0,y.jsxs)("select",{value:e.phone_type,style:{width:"29%",float:"left",fontSize:"12px"},onChange:n=>i(t.company_contact_id,t.company_id,e.phone_id,n.target.value,e.phone_number,e.phone_extension),children:[(0,y.jsx)("option",{value:"WORK",children:"WORK"}),(0,y.jsx)("option",{value:"CELL",children:"CELL"}),(0,y.jsx)("option",{value:"HOME",children:"HOME"}),(0,y.jsx)("option",{value:"FAX",children:"FAX"})]}),(0,y.jsx)("input",{type:"text",value:this.state[`phone_number_${e.phone_id}`],style:{width:"45%",float:"left",fontSize:"12px"},onChange:t=>this.handleChangeValue(t.target.value,`phone_number_${e.phone_id}`),onBlur:n=>i(t.company_contact_id,t.company_id,e.phone_id,e.phone_type,n.target.value,e.phone_extension)}),(0,y.jsx)("input",{type:"text",value:this.state[`phone_extension_${e.phone_id}`],style:{width:"20%",fontSize:"12px"},onChange:t=>this.handleChangeValue(t.target.value,`phone_extension_${e.phone_id}`),onBlur:n=>i(t.company_contact_id,t.company_id,e.phone_id,e.phone_type,e.phone_number,n.target.value)})]},e.phone_id)),(0,y.jsx)(D.A,{className:"small-12",label:"Department",value:this.state.contact_department_id,options:n,onChange:s(t.company_contact_id,t.company_id,"contact_department_id",t.contact_department_id)}),(0,y.jsx)("label",{children:"Tags"}),(0,y.jsx)(F.A,{value:(0,l.map)(h,t=>(0,l.find)(m,{label:t})||{label:t}),tags:m,onChange:e=>{const n=(0,l.map)(e,"label");this.setState({newTags:n}),this.props.onUpdateContactTags(t.company_contact_id,t.company_id,n.join(","))}}),(0,y.jsx)(D.A,{className:"small-12",label:"Location",value:this.state.contact_default_address_id,options:[{key:"",value:""},...e],onChange:s(t.company_contact_id,t.company_id,"contact_default_address_id",t.contact_default_address_id)})]})}):(0,y.jsxs)("div",{style:{marginBottom:"10px"},children:[(0,y.jsx)("label",{labelfor:"email",children:"Email"}),(0,y.jsx)("p",{children:t.contact_email}),(0,y.jsx)("label",{labelfor:"email",children:"Marketing"}),(0,y.jsx)("p",{children:1==this.state.contact_no_marketing?(0,y.jsx)(d.MarketingStatusIcon,{}):""}),!this.state.syncReplaced&&o?(0,y.jsxs)("div",{children:[(0,y.jsxs)(d.Text,{as:"p",style:{background:"#fef3c2",padding:10},children:["Another Contact with this email is being synced with ",r().get(o,"platform",null),":",(0,y.jsxs)(d.Link,{as:"a",href:o.contact_link,target:"_blank",children:[" "," ",o.full_name||o.contact_email]})]}),(0,y.jsx)("button",{className:"button expanded",onClick:t=>this.handleReplaceMpOtherContact(o.contact_id),children:"Sync this Contact instead"})]}):null,(0,y.jsx)("label",{labelfor:"phones",children:"Phones"}
1),Object.values(t.phones).map(t=>(0,y.jsxs)("p",{children:[(0,N.Sn)(t.phone_type),": ",t.phone_number," ",""!=t.phone_extension?`ext. ${t.phone_extension}`:null]},t.phone_id)),(0,y.jsx)("p",{children:t.contact_deparment}),(0,y.jsx)("label",{children:"Tags"}),(0,l.map)(h,t=>(0,y.jsx)("div",{className:"contact-static-tag",children:t}))]}),this.renderAddress(),(0,y.jsx)("br",{}),(0,y.jsx)("div",{id:"map_canvas",style:{position:"absolute",width:"25%",height:"300px"}})]})})}}const U=(0,i.Ng)((t,e)=>{const n=(0,E.F4)(t,{parent_id:e.contact.company_id}),a=(0,E.Nc)(t),s=t.entities.addresses,i=e.contact.contact_tags,c=!!t.temp["edit-contact"],o=e.contact.message;return{addresses:n,departments:a,address_details:s,beforeTags:i,tags:(0,E.Q2)(t),editContact:c,message:o}},t=>({onCreateUpdateContact:(e,n,a,s)=>i=>{t((0,g.QX)(e,n,a,s,i))},onCreateUpdateContactPhone:(e,n,a,s,i,c)=>{t((0,g.w9)(e,n,a,s,i,c))},onCreateAddContactPhone:(e,n,a,s,i,c)=>{t((0,g.MD)(e,n,a,s,i,c))},onCreateDeleteContactPhone:(e,n)=>{t((0,g.CZ)(e,n))},onUpdateContactTags:(e,n,a)=>{t((0,g.f1)(e,n,a))}}))(I);var V=n(33408),W=n(53261);class H extends a.Component{constructor(t){super(t),this.state={messages:t.messages},r().bindAll(this,["loadMessagesFromServer","loadContactProjectsFromServer","startRefresh","stopRefresh"])}UNSAFE_componentWillMount(){this.props.editContact&&this.props.onEditContact()}UNSAFE_componentWillReceiveProps(t){this.setState({messages:Object.values(t.messages).sort((t,e)=>e.latest_update-t.latest_update)}),t.editContact&&this.props.onEditContact(),t.commenting!==this.props.commenting&&(t.commenting?this.stopRefresh():this.startRefresh())}componentDidMount(){this.props.commenting||this.startRefresh(),this.loadContactProjectsFromServer()}componentWillUnmount(){this.stopRefresh(),this.props.onStopCommenting()}startRefresh(){this.interval&&clearInterval(this.interval),this.interval=setInterval(this.loadMessagesFromServer,this.props.newsfeed_refresh_interval)}stopRefresh(){this.interval&&(clearInterval(this.interval),this.interval=null)}loadMessagesFromServer(){const t={company_contact_id:this.props.contact.company_contact_id};return(0,N.oD)("GET","newsfeed/contact",t).then(t=>{let{json:e}=t;this.props.onSyncMessages(e.contactFeed)})}loadContactProjectsFromServer(){const t={id:this.props.contact.company_contact_id,type:"renderContactProjects"};return(0,N.oD)("GET","contact/renderContactProjects",t).then(t=>{let{json:e}=t;this.props.onloadContactProjects(e.projects)})}render(){const{contact:t,messages:e,editContact:n,onSyncMessages:a,onloadContactProjects:s,setShowMarketingLink:i}=this.props;return(0,y.jsxs)("div",{"data-test-name":"ContactNotes.render",className:"main-content project-notes",children:[(0,y.jsxs)("div",{className:"medium-12 large-8 columns",children:[(0,y.jsx)(O,{contact_id:t.contact_id,client_id:t.company_id}),(0,y.jsx)(V.A,{posts:Object.values(this.state.messages),filters:[V.A.ContactFilter,V.A.SearchFilter],children:(0,y.jsx)(L.A,{comment_allowed:!0})})]}),(0,y.jsx)("div",{className:"medium-12 large-4 columns",children:(0,y.jsx)("div",{children:(0,y.jsx)(U,{contact:t,setShowMarketingLink:i})})})]})}}const Y=(0,C.y)((0,i.Ng)((t,e)=>{const n="#edit-contact"==e.router.location.hash;return{contact:t.entities.company_contacts[Object.keys(t.entities.company_contacts)[0]],messages:t.entities.messages,editContact:n,commenting:t.display.commenting,newsfeed_refresh_interval:t.display.newsfeed_refresh_interval}},(t,e)=>({onSyncMessages:e=>t((0,M.CH)(e)),onloadContactProjects:e=>t((0,g.VC)(e)),onStopCommenting:()=>t((0,W.jR)(!1)),onEditContact:()=>{t((0,x.Qg)("edit-contact",!0))}}))(H)),G={OPPORTUNITY:0,PRESENTATION:1,ESTIMATE:2,"SALES ORDER":3,INVOICE:4};class z extends a.Component{constructor(t){super(t),this.state={filterValue:"",filterType:""},this.handleChangeInput=this.handleChangeInput.bind(this),this.handleChangeFilterType=this.handleChangeFilterType.bind(this)}componentDidMount(){const{onCreateDeleteTemp:t,onLoadContactProjects:e,company_contact_id:n,projects:a}=this.props;if(t(),0===Object.values(a).length){const t={id:n,type:"renderContactProjects"};(0,N.oD)("GET","contact/renderContactProjects",t).then(t=>{let{json:n}=t;return e(n.projects)})}}handleChangeInput(t){this.setState({filterValue:t.target.value})}handleChangeFilterType(t){this.setState({filterType:t.target.value})}render(){const{filterValue:t,filterType:e}=this.state,n=t.toLowerCase(),a=Object.values(this.props.projects).filter(t=>!(e&&!t.order_types.includes(e))&&(!n||`${t.job_number}`.indexOf(n)>-1||t.job_name.toLowerCase().indexOf(n)>-1||`${t.sales_rep.user_first_name} ${t.sales_rep.user_last_name}`.toLowerCase().indexOf(n)>-1||`${t.client_rep.user_first_name} ${t.client_rep.user_last_name}`.toLowerCase().indexOf(n)>-1)).sort((t,e)=>e.job_number-t.job_number);return(0,y.jsxs)("div",{"data-test-name":"ContactProjects.render",className:"main-content",children:[(0,y.jsxs)("div",{className:"small-12 columns project-row row no-maxWidth",children:[(0,y.jsx)("div",{className:"small-3 columns",children:(0,y.jsx)("input",{value:t,placeholder:"Filter by number, name, or rep…",style:{height:"2.4375rem",width:"100%"},onChange:this.handleChangeInput})}),(0,y.jsx)("div",{className:"small-3 columns",children:(0,y.jsxs)("select",{value:e,onCh
1ange:this.handleChangeFilterType,children:[(0,y.jsx)("option",{value:"",children:"Order types"}),(0,y.jsx)("option",{value:"PRESENTATION",children:"Presentation"}),(0,y.jsx)("option",{value:"ESTIMATE",children:"Estimate"}),(0,y.jsx)("option",{value:"SALES ORDER",children:"Sales Order"}),(0,y.jsx)("option",{value:"INVOICE",children:"Invoice"})]})}),(0,y.jsx)("div",{className:"small-3 columns",children:" "})]}),a.map(t=>(0,y.jsxs)("div",{className:"small-12 columns project-row row no-maxWidth",children:[(0,y.jsx)("div",{className:"small-2 columns large-number",children:(0,y.jsxs)("a",{href:`/project/${t.job_number}`,target:"_blank",children:["#",t.job_number]})}),(0,y.jsxs)("div",{className:"small-3 columns",children:[(0,y.jsxs)("a",{href:`/project/${t.job_number}`,target:"_blank",style:{wordBreak:"break-word"},children:[t.job_name," ($",(0,N.up)(t.latest_total_amount),")"]}),(0,y.jsx)("br",{}),(0,y.jsxs)("small",{children:["Created on ",(0,N.Yq)(t.date_created)]})]}),(0,y.jsxs)("div",{className:"small-4 columns",children:[r().isEmpty(t.client_rep)?null:(0,y.jsxs)("div",{className:"rep-block",children:[(0,y.jsx)("img",{src:(0,N.Lt)(t.client_rep),className:"avatar"}),(0,y.jsx)("small",{children:"Client Rep"}),(0,y.jsx)("br",{}),(0,y.jsx)("a",{href:`/user.php?id=${t.client_rep.user_id}`,target:"_blank",children:`${t.client_rep.user_first_name} ${t.client_rep.user_last_name}`})]}),r().isEmpty(t.sales_rep)?null:(0,y.jsxs)("div",{className:"rep-block",children:[(0,y.jsx)("img",{src:(0,N.Lt)(t.sales_rep),className:"avatar"}),(0,y.jsx)("small",{children:"Order Rep"}),(0,y.jsx)("br",{}),(0,y.jsx)("a",{href:`/user.php?id=${t.sales_rep.user_id}`,target:"_blank",children:`${t.sales_rep.user_first_name} ${t.sales_rep.user_last_name}`})]})]}),(0,y.jsx)("div",{className:"small-3 columns projects-icons",children:t.order_types.filter(t=>"OPPORTUNITY"!==t).sort((t,e)=>{var n,a;return(null!==(n=G[t])&&void 0!==n?n:0)-(null!==(a=G[e])&&void 0!==a?a:0)}).map((t,e)=>(0,y.jsx)("div",{className:"order-icon",children:t.charAt(0)},`${t}-${e}`))})]},t.job_id))]})}}const Q=(0,i.Ng)(t=>{var e,n,a;return{projects:t.entities.projects,company_contact_id:null===(e=Object.values(null!==(a=t.entities.company_contacts)&&void 0!==a?a:{}))||void 0===e||null===(n=e[0])||void 0===n?void 0:n.company_contact_id}},(t,e)=>({onLoadContactProjects:e=>{t((0,g.VC)(e))},onCreateDeleteTemp:()=>{t((0,x.mA)("edit-contact"))}}))(z);var K=n(64128),q=n(48059),X=n(64982);const Z=`1px solid ${d.colors.primary0}`;function J(t){let{campaign:e,contactCampaignStats:n}=t;return e&&n?(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)(d.Row,{children:[(0,y.jsx)(d.Col,{xs:6,children:r().get(e,"campaignName","")}),(0,y.jsx)(d.Col,{xs:3,style:{color:"#2c3e50"},children:(0,y.jsxs)(d.Text,{children:[(0,y.jsx)("strong",{children:"Opens:"})," ",n.Opens,", ",(0,y.jsx)("strong",{children:"Clicks:"})," ",n.Clicks]})}),(0,y.jsx)(d.Col,{xs:3,style:{color:"#2c3e50"},children:(0,y.jsx)(d.Text,{children:(0,X.Sz)(r().get(e,"send_time",null))})})]})}):null}function tt(t){let{platform:e,activity:n,campaignId:a}=t;const c=(0,i.d4)(q.Tp.mp_campaigns),o=s().useMemo(()=>"mailchimp"===e?(0,X.W0)({campaigns:c,activity:n,campaignId:a}):"hubspot"===e?(0,X.NL)({campaigns:c,activity:n,campaignId:a}):{},[e,c,n,a]);return(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)(d.Row,{children:[(0,y.jsx)(d.Col,{xs:!0,padded:!0,style:{marginBottom:10,borderBottom:Z},children:(0,y.jsxs)(d.Row,{children:[(0,y.jsx)(d.Col,{xs:6,padded:!0,style:{fontWeight:"bold"},children:"Campaign"}),(0,y.jsx)(d.Col,{xs:6,padded:!0,style:{fontWeight:"bold"},children:"Action"})]})}),(0,y.jsx)(d.Col,{xs:!0,padded:!0,children:(0,y.jsx)(d.CollapsiblePanels,{spaceBetween:!0,panels:Object.keys(o).map((t,n)=>{const a=o[t];return{title:(0,y.jsx)(J,{platform:e,campaign:r().get(r().first(a),"campaign",null),contactCampaignStats:r().get(r().first(a),"contactCampaignStats",null)},`ContactActivityPanelTitle_${n}`),children:a.map((t,e)=>{const s=e<a.length-1?{borderBottom:Z}:{};return(0,y.jsx)(y.Fragment,{children:(0,y.jsxs)(d.Row,{style:s,children:[(0,y.jsx)(d.Col,{xs:6,padded:!0}),(0,y.jsx)(d.Col,{xs:3,padded:!0,children:(0,y.jsx)(d.Text,{children:t.action})}),(0,y.jsx)(d.Col,{xs:3,padded:!0,children:(0,y.jsx)(d.Text,{children:t.actionDateStr})})]},"collapse_campaign_"+n+"_"+e)})})}})})})]})})}const et=(0,K.A)((0,i.Ng)(null,null)(function(t){const e=(0,i.wA)(),n=(0,i.d4)(q.Tp.loading),c=t.isMpContact,o=(0,i.d4)(q.Tp.platform),l=(0,i.d4)(t=>{let{entities:e}=t;return e.company_contacts[Object.keys(e.company_contacts)[0]]}),r=(0,i.d4)(q.Tp.mp_contact_activity),h=s().useMemo(()=>(0,X.Oc)(l?l.mp_contact:{}),[l]);if((0,a.useEffect)(()=>{e((0,q.RE)({check_mp_contact:0,contact_id:l.contact_id,email:l.contact_email}))},[]),(0,a.useEffect)(()=>
1{if(c){const t={check_mp_contact:0};e((0,q.xl)(l.contact_email,l.contact_id,t))}},[c,l]),!c)return(0,y.jsx)(y.Fragment,{children:(0,y.jsx)("div",{className:"main-content",children:(0,y.jsx)(d.Row,{style:{paddingLeft:10,paddingRight:10},children:(0,y.jsx)(d.Col,{xs:!0,style:{textAlign:"center"},children:n?(0,y.jsx)(d.Loading,{}):(0,y.jsx)(y.Fragment,{children:(0,y.jsx)(d.Text,{style:{color:d.colors.cta,fontSize:"1.5em"},children:"This contact does not exist in the marketing platform"})})})})})});const m={platform:o,activity:r};return(0,y.jsx)(d.Theme,{"data-test-name":"MarketingPlatformContact",children:(0,y.jsx)("div",{className:"main-content",children:(0,y.jsxs)(d.Row,{style:{paddingLeft:10,paddingRight:10},children:[(0,y.jsx)(d.Col,{xs:!0,children:h.sync_status?(0,y.jsxs)(d.H2,{children:[h.mp," ",(0,y.jsxs)(d.Text,{style:{fontSize:12,fontStyle:"italic"},children:[(0,y.jsx)(d.Badge,{style:{backgroundColor:["FAILED","FAILED_EMAIL","FAILED-EMAIL"].includes(h.sync_status)?d.colors.cta:"PENDING"==h.sync_status?d.colors.primary100:d.colors.primary,verticalAlign:"super"},children:h.sync_status}),(0,y.jsxs)(d.Text,{children:[(0,y.jsx)("br",{}),"Last Synced: ",(0,y.jsx)(d.Text,{style:{fontWeight:50},children:(0,X.Sz)(h.last_synced)})]})]})]}):null}),(0,y.jsx)(d.Col,{xs:!0,md:8,mdOffset:2,children:n?(0,y.jsx)(d.Loading,{}):(0,y.jsx)(tt,{...m})})]})})})}),{[q.Ay.name]:q.Ay.reducer});var nt=n(28027);class at extends a.Component{constructor(t){super(t),this.state={editContact:t.editContact,showMarketingLink:!1},this.handleEditContactView=this.handleEditContactView.bind(this),this.setShowMarketingLink=this.setShowMarketingLink.bind(this)}UNSAFE_componentWillReceiveProps(t){this.setState({editContact:t.editContact})}handleEditContactView(){this.setState({editContact:!0}),this.props.onEditContact()}setShowMarketingLink(){this.setState({showMarketingLink:!0})}renderPanel(t){const{project:e,order:n,showMarketingLink:a}=this.state,s=a||null!=this.props.contact.mp_contact;switch(t){case"notes":return(0,y.jsx)(Y,{"data-test-name":"ContactApp.renderPanel",setShowMarketingLink:this.setShowMarketingLink});case"projects":return(0,y.jsx)(Q,{"data-test-name":"ContactApp.renderPanel"});case"marketing-platform":return s?(0,y.jsx)(et,{isMpContact:s}):(0,y.jsx)("div",{className:"main-content",children:(0,y.jsx)("p",{style:{color:d.colors.cta,textAlign:"center",fontSize:"1.5em"},children:"This contact does not exist in the marketing platform"})});default:return null}}render(){const{panel:t,contact:e,location:n,editContact:a,popups:s}=this.props,i=this.state.showMarketingLink||null!=this.props.contact.mp_contact,c=(0,y.jsx)(A,{contact:e,isMpContact:i});return(0,y.jsxs)(p.A,{"data-test-name":"ContactApp.render",children:[(0,y.jsx)(h.A,{menu:c,children:(0,y.jsx)(b,{contact:e,location:n,handleEditContactView:this.handleEditContactView})}),(0,y.jsx)(m.A,{menu:c,children:this.renderPanel(t)}),s.map((t,e)=>(0,nt.A)(t,e))]})}}const st=(0,i.Ng)((t,e)=>{const n=!!t.temp["edit-contact"];return{contact:t.entities.company_contacts[Object.keys(t.entities.company_contacts)[0]],editContact:n,popups:r().get(t,"display.popups",[])}},(t,e)=>({onEditContact:()=>{t((0,x.Qg)("edit-contact",!0))}}))(at);var it=n(20652);const ct=s().memo(t=>{let{panel:e}=t;const n=(0,c.g)(),a=(0,c.zy)();return e?(0,y.jsx)(st,{panel:e,params:n,location:a}):(0,y.jsx)(it.A,{location:a})}),ot=(0,i.Ng)(t=>({contact_first_name:t.entities.company_contacts[Object.keys(t.entities.company_contacts)[0]].contact_first_name,contact_last_name:t.entities.company_contacts[Object.keys(t.entities.company_contacts)[0]].contact_last_name}))(t=>{let{contact_first_name:e,contact_last_name:n,location:s}=t;return(0,a.useEffect)(()=>{document.title=`${e} ${n}`},[e,n]),(0,y.jsx)(o.Kd,{"data-test-name":"ContactRouter",basename:s,children:(0,y.jsxs)(c.BV,{children:[(0,y.jsx)(c.qh,{path:"/contact/:company_contact_id",element:(0,y.jsx)(ct,{panel:"notes"}),ErrorBoundary:p.A}),(0,y.jsx)(c.qh,{path:"/contact/:company_contact_id/projects",element:(0,y.jsx)(ct,{panel:"projects"}),ErrorBoundary:p.A}),(0,y.jsx)(c.qh,{path:"/contact/:company_contact_id/marketing-platform",element:(0,y.jsx)(ct,{panel:"marketing-platform"}),ErrorBoundary:p.A}),(0,y.jsx)(c.qh,{path:"*",element:(0,y.jsx)(ct,{noMatch:!0}),ErrorBoundary:p.A})]})})})}}]);
2//# sourceMappingURL=components-ContactRouter.d21dc497.chunk.js.map

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.