1(self.webpackChunkAmazingHiring=self.webpackChunkAmazingHiring||[]).push([[7736],{37748:(e,t,n)=>{"use strict";n.d(t,{L:()=>te,Z:()=>ne});var a=n(52628),s=n.n(a),i=n(73955),r=n.n(i),l=n(45578),o=n.n(l),u=n(44908),c=n.n(u),d=n(92742),m=n.n(d),g=n(35937),p=n.n(g),v=n(66604),b=n.n(v),f=n(18446),y=n.n(f),h=n(27361),C=n.n(h),S=n(59242),I=n.n(S),O=n(13311),j=n.n(O),E=n(39693),M=n.n(E),P=n(67294),T=n(86896),x=n(30381),_=n.n(x),A=n(98796),w=n(97683),D=n(48770),X=n(58372),L=n(77750),U=n(30995),$=n(62242),k=n(95996),F=n(79016),R=n(86213),V=n(1122),Z=n(10115),N=n(84555),Y=n(2928),G=n(22404),H=n(32995),B=["sendDelayInfo"],q=["path"];function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach((function(t){K(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function K(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Q(e,t){if(null==e)return{};var n,a,s=function(e,t){if(null==e)return{};var n,a,s={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,s,i,r,l=[],o=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;o=!1}else for(;!(o=(a=i.call(n)).done)&&(l.push(a.value),l.length!==t);o=!0);}catch(e){u=!0,s=e}finally{try{if(!o&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(u)throw s}}return l}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ee(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var te={new:"new",draft:"draft",stopped:"stopped",replied:"replied",preview:"preview"};const ne=e=>{var t=(0,D.I0)(),n=(0,D.tv)(),a=(0,T.Z)().formatMessage,i=W((0,P.useState)(e.permissions),2),l=i[0],u=i[1],d=W((0,P.useState)(e.to),2),g=d[0],v=d[1],f=W((0,P.useState)(""),2),h=f[0],S=f[1],O=W((0,P.useState)({}),2),E=O[0],x=O[1],z=W((0,P.useState)(w.rY.SUCCESS),2),K=z[0],ee=z[1],ne=(0,D.v9)((e=>e.messaging.mailingVariables.data)),ae=e.profile,se=W((0,P.useState)((0,N.O)(e.customData,ne,ae)),2),ie=se[0],re=se[1],le=(0,D.v9)((({messaging:e})=>e.gptGeneration.data)),oe=(0,D.v9)((({app:e})=>e.apps.messaging)).gmail,ue=(0,D.v9)((e=>[...e.messaging.templates.data,...e.messaging.templates.exampleTemplates])),ce=W((0,P.useState)(ne.concat((0,N.Hc)(e.messages.map((({template:e})=>e)),s()(ie),e.customDataText?o()(e.messages.reduce(((e,t)=>[...e,...(t.variables||[]).filter((({id:e})=>!e))]),[]),"name"):void 0))),2),de=ce[0],me=ce[1],ge=(0,D.v9)((e=>e.messaging.sendSingleMessageStatus)),pe=(0,D.v9)((e=>e.messaging.sendTestMessageStatus)),ve=(0,D.v9)((e=>e.app.user)),be=ve.messagingUseSignature&&ve.messagingSignature,fe=(0,P.useCallback)((e=>`${e}${be?(0,R.fU)(be):""}`),[be]),ye=(0,D.D9)(e.messages),he=W((0,P.useReducer)(V.ZP,(0,N.i)(e.messages.map((({readOnly:t,condition:n,invalidFields:a,template:s,body:i,subject:r,attachments:l})=>({condition:n,invalidFields:a,template:s,subject:(0,G.XU)({readOnly:t})(r||""),body:(0,G.XU)({readOnly:t})("new"===e.mod?fe(i):i),attachments:l}))))),2),Ce=he[0],Se=he[1],Ie=(0,Y.Z)({addAttachment:I()(V.eX.addAttachment,Se),changeAttachment:I()(V.eX.changeAttachment,Se),removeAttachment:I()(V.eX.removeAttachment,Se),accessType:l}),Oe=(0,Z.Y)({readOnly:!1,type:"single",useDefaultLaunchInfo:e.mod===te.new}),je=Oe.sendDelayInfo,Ee=Q(Oe,B),Me=(0,P.useCallback)((n=>{var a=n.target.id;e.mailingListId&&e.messages[0].readOnly?t((0,U.Nr)({mailingListId:e.mailingListId,accessType:a,onSuccess:()=>{var t;null===(t=e.onChangePermissionsSuccess)||void 0===t||t.call(e),u(a)}})):u(n.target.id)}),[e.mailingListId,e.messages,e.onChangePermissionsSuccess,t]),Pe=(0,P.useCallback)(((e,t)=>Se(V.eX.changeInvalidFields({invalidFields:e,index:t}))),[]),Te=(0,P.useCallback)((e=>Se(V.eX.setInvalidFields(e))),[]),xe=(0,H.Z)(Te),_e=Ce.map((({attachments:e})=>e)),Ae=e=>{var t=(e.match(/{{[\wа-ÑÐ-Я]+}}/g)||[]).map((e=>m()(e,"{}")));return c()(t)},we=(0,P.useCallback)((e=>{if(v(e),ie.EMAIL_SOURCE){var t=C()(E,e,"");re(J(J({},ie),{},{EMAIL_SOURCE:J(J({},ie.EMAIL_SOURCE),{},{value:t,data:M()([t])})}))}}),[ie,E]),De=(0,P.useCallback)((e=>{var t=Ae(e),n=de.map((e=>{var n=e.path,a=Q(e,q);return J(J({},a),{},{data:"EMAIL_SOURCE"===a.name?M()([C()(E,g,"")]):(0,N.BO)(ae,n||""),used:t.includes(a.name)})})),a=(0,N.Ru)(n);return(0,N.xb)(a,ie)}),[ie,de,ae,E,g]);(0,P.useEffect)((()=>{e.profile&&(t((0,U.f8)({profileId:e.profile.id,onSuccess:e=>{x(e)}})),ve.emailAliases.status!==w.rY.SUCCESS&&null!=oe&&oe.connected&&t((0,X.getEmailAliases)())),e.customDataText&&re
1(De(e.customDataText))}),[]),(0,P.useEffect)((()=>{if(ie.EMAIL_SOURCE&&Object.keys(E).length){var e=C()(E,g,"");re(J(J({},ie),{},{EMAIL_SOURCE:J(J({},ie.EMAIL_SOURCE),{},{value:e,data:M()([e])})}))}}),[E]),(0,P.useEffect)((()=>{var e=c()(Ce.reduce(((e,{template:t})=>[...e,...C()(t,"customVariables",[])]),[]));me([...de.filter((({id:e})=>"template"!==e)),...e.map((e=>({name:e,id:"template",path:""})))])}),[Ce.length,Ce.reduce(((e,{template:t})=>[...e,C()(t,"id")]),[]).join()]);var Xe=(0,P.useCallback)((e=>{re(De(e))}),[De]),Le=e=>{j()(de.filter((({id:e})=>"custom"===e)),["name",e])||me([...de,{name:e,id:"custom",path:""}])},Ue=(0,P.useCallback)((()=>c()(de.filter((({id:e})=>"custom"===e||"template"===e)).map((({name:e})=>e)))),[de]),$e=(0,P.useCallback)(((e,t)=>{n({title:a(k.Z.removeMessage),content:t?null:a(k.Z.removeAllMessages),onConfirm:()=>{A.deleteMessageFollowUp(!1,l),Se(V.eX.removeMessage(e))}})}),[a,n,l]),ke=(0,P.useCallback)((e=>{var t=j()(ue,{id:-1}),n=Ce[Ce.length-1];e||A.addMessageFollowUp(!1,l),Se(V.eX.addMessage({message:(0,N.i)([{template:t,subject:(0,G.XU)({readOnly:!1})((null==e?void 0:e.subject)||`RE: ${Ce[0].subject.getCurrentContent().getPlainText()}`),body:(0,G.XU)({readOnly:!1})(fe((null==e?void 0:e.body)||t.body)),condition:n?{days:n.condition.days||V.U5,hours:n.condition.hours||`${_()().hours()}`,minutes:n.condition.minutes||("0"+10*Math.floor(_()().minutes()/10)).slice(-2),plusMinus:n.condition.plusMinus||"0",utc:n.condition.utc||_()().format("Z").slice(0,3)}:{days:null,hours:"",minutes:"",plusMinus:"0",utc:""},invalidFields:{},attachments:[]}])[0]}))}),[ue,Ce,fe,l]),Fe=Ce.map((({template:n,subject:a,body:s,condition:i,invalidFields:r,attachments:u,selectedDate:c},d)=>{var m=e.messages[d]&&e.messages[d].readOnly||!1,g=o()([...de.filter((({id:e})=>"template"!==e)),...(n&&n.customVariables||[]).map((e=>({name:e,id:null,path:""})))],"name"),v=J(J({},p()(De(s.getCurrentContent().getPlainText()),((e,t)=>g.map((({name:e})=>e)).includes(t)))),De(a.getCurrentContent().getPlainText()));return{template:n,condition:J(J({},i),(0,F.Z)(Se,d,l)),invalidFields:r,readOnly:m,attachments:u,selectedDate:c,setTemplate:e=>((e,t)=>{var n=[...Ce],a=(0,G.XU)({readOnly:!1})(fe(e.body)),s=(0,G.XU)({readOnly:!1})(e.subject);n.splice(t,1),Se(V.eX.changeTemplate({index:t,template:e,subject:s,body:a})),Xe(n.reduce(((e,t)=>e+t.body.getCurrentContent().getPlainText()+t.subject.getCurrentContent().getPlainText()),a.getCurrentContent().getPlainText()+s.getCurrentContent().getPlainText()))})(e,d),customData:v,subject:{readOnly:m,mailingVariables:g,onAddVar:Le,editorState:a,onChange:e=>{Se(V.eX.changeSubject({index:d,subject:e}));var t=[...Ce];t.splice(d,1),Xe(t.reduce(((e,t)=>e+t.subject.getCurrentContent().getPlainText()+t.body.getCurrentContent().getPlainText()),e.getCurrentContent().getPlainText()+Ce[d].body.getCurrentContent().getPlainText()))},getText:()=>a.getCurrentContent().getPlainText()},editor:{readOnly:m,mailingVariables:g,onAddVar:Le,editorState:s,onChange:e=>{Se(V.eX.changeBody({index:d,body:e}));var t=[...Ce];t.splice(d,1),Xe(t.reduce(((e,t)=>e+t.subject.getCurrentContent().getPlainText()+t.body.getCurrentContent().getPlainText()),e.getCurrentContent().getPlainText()+Ce[d].subject.getCurrentContent().getPlainText()))},getHTML:()=>(0,G.l4)(s)},removeMessage:()=>$e(d,d===Ce.length-1),createTemplate:()=>{var n=(0,R.t9)({subject:a,body:s}),i=n.subjectText,r=n.nameText,l=n.bodyText,o=n.bodyHTML;t((0,U.Mn)({name:r,subject:i,body:o,onError:t=>{var n;Pe(t,d),null===(n=e.onSendError)||void 0===n||n.call(e)},onSuccess:n=>{var i;t((0,U.uR)({limit:300})),Se(V.eX.changeTemplate({index:d,template:n,subject:a,body:s})),null===(i=e.onCreateTemplateSuccess)||void 0===i||i.call(e,n)},customVariables:Ae((i||"")+l).filter((e=>!ne.map((({name:e})=>e)).includes(e))),accessType:e.privateEntitiesByDefault?L.Permissions.Private:L.Permissions.Public}))},test:()=>{xe([u])||t((0,U.Xu)({body:(0,G.l4)(s),subject:a.getCurrentContent().getPlainText().trim(),attachmentIds:u.filter((({id:e})=>e)).map((({id:e})=>e)),profileId:ae.id,customData:b()(ie,"value"),onError:t=>{var n;Pe(t,d),null===(n=e.onSendError)||void 0===n||n.call(e)},onSuccess:e.onTestSuccess,customVariables:Ue()})),A.sendTestMessage(l)},uploadFile:Ie(d),removeAttachment:e=>Se(V.eX.removeAttachment({internalId:e,index:d})),setSelectedDate:e=>{Se(V.eX.setSelectedDate({date:e,index:d}))},setDate:e=>{Se(V.eX.setDate({date:e,index:d}))}}})),Re=()=>({templates:Ce.map((({subject:e,body:t})=>({subject:e.getCurrentContent().getPlainText().trim(),body:(0,G.l4)(t)}))),profileId:ae.id,customData:b()(ie,"value"),onError:t=>{var n;null===(n=e.onSendError)||void 0===n||n.call(e),Te(t)},customVariables:de.filter((({id:e})=>"custom"===e||"template"===e)).map((({name:e})=>e))}),Ve=()=>{var n;Se(V.eX.setMessages([{template:j()(ue,{id:-1}),subject:(0,G.XU)({readOnly:!1})(""),body:(0,G.XU)({readOnly:!1})(""),condition:{days:null,hours:"",minutes:"",plusMinus:"0",utc:""},invalidFields:{},attachments:[]}])),t((0,X.stopPingServer)("gpt")),null===(n=e.onGenerateMessagesError)||void 0===n||n.call(e)},Ze=(e,t=!1)=>t?{days:V.U5,hours:`${_()().hours()}`,minutes:("0"+10*Math.floor(_()().minutes()/10)).slice(-2),plusMinus:"0",utc:_()().format("Z").slice(0,3)}:{days:(null==e?void 0:e.condition.days)||V.U5,hours:(null==e?void 0:e.condition.hours)||`${_()().hours()}`,minutes:(null==e?void 0:e.condition.minutes)||("0"+10*Math.floor(_()().minutes()/10)).slice(-2),plusMinus:(null==e?void 0:e.condition.plusMinus)||"0",utc:(null==e?void 0:e.condition.utc)||_()().format("Z").slice(0,3)};return(0,P.useEffect)((()=>
1{if(null!=le&&le.status){if(["generating","finished"].includes(le.status)){var n,a=((e,t)=>e.map(((e,n)=>{var a=j()(ue,{id:-1});return{template:a,subject:(0,G.XU)({readOnly:!1})((null==e?void 0:e.subject)||`RE: ${Ce[0].subject.getCurrentContent().getPlainText()}`),body:(0,G.XU)({readOnly:!1})(fe((null==e?void 0:e.body)||a.body)),condition:Ce.length>0||n>0?Ze(t,Ce.length<=1):{days:null,hours:"",minutes:"",plusMinus:"0",utc:""},invalidFields:{},attachments:[]}})))(le.messages.slice(Ce.length),Ce[Ce.length-1]);if(Se(V.eX.setMessages((0,N.i)([...Ce,...a]))),"finished"===le.status)t((0,X.stopPingServer)("gpt")),null===(n=e.onGenerateMessagesSuccess)||void 0===n||n.call(e)}var s;if("failed"===le.status)t((0,X.stopPingServer)("gpt")),null===(s=e.onGenerateMessagesError)||void 0===s||s.call(e),t((0,U.d2)(null))}}),[null==le?void 0:le.status,null==le?void 0:le.messages,Ce.length]),(0,P.useEffect)((()=>()=>{t((0,X.stopPingServer)("gpt")),t((0,U.d2)(null))}),[]),(0,P.useEffect)((()=>{ye&&e.messages.some(((e,t)=>!y()(e,ye[t])))&&Se(V.eX.setMessages((0,N.i)(e.messages.map((({readOnly:t,condition:n,invalidFields:a,template:s,body:i,subject:r,attachments:l})=>({condition:n,invalidFields:a,template:s,subject:(0,G.XU)({readOnly:t})(r||""),body:(0,G.XU)({readOnly:t})("new"===e.mod?fe(i):i),attachments:l}))))))}),[e.messages,ye,e.mod,fe]),{messages:Fe,contact:g,sendSingleMessageStatus:ge,sendTestMessageStatus:pe,setContact:we,setCustomData:e=>re(J(J({},ie),e)),send:n=>{var a=ve.emailAliases,s=a.baseEmail,i=a.from,r=s!==i.email?i.email:void 0;xe(_e)||t((0,U.l4)({templates:Ce.map((({subject:e,body:t,condition:{days:n,hours:a,minutes:s,plusMinus:i,utc:r},template:l,attachments:o})=>J({subject:e.getCurrentContent().getPlainText().trim(),body:(0,G.l4)(t),base_template:-1===l.id||l.isExample?null:l.id,example_template:l.isExample?l.id:null,attachment_ids:o.filter((({id:e})=>e)).map((({id:e})=>e))},"string"==typeof n&&{send_delay:`${n||0} 00:00:00`,send_condition:"not_replied",send_time_from:`${parseInt(a,10)-parseInt(i,10)}:${s}:00`,send_time_to:`${parseInt(a,10)+parseInt(i,10)}:${s}:00`,send_time_utc_offset:`${parseInt(r,10)}:00:00`}))),contact:g,profileId:ae.id,customData:b()(ie,"value"),params:n,sendDelayInfo:je,sendAsEmail:r,onError:t=>{var n;Te(t),null===(n=e.onSendError)||void 0===n||n.call(e)},onSuccess:(...t)=>{var a;null===(a=e.onSendSuccess)||void 0===a||a.call(e,...t),n&&n.launch&&A.startMailingList(1,Ce.length,!1,!!je.start_time_from,!1,l)},customVariables:Ue(),accessType:l}))},preview:()=>{xe(_e)||t((0,U.dv)(J(J({},Re()),{},{onSuccess:t=>{var n;return null===(n=e.onSuccessPreview)||void 0===n?void 0:n.call(e,t.map((({body:e,subject:t},n)=>({body:e,contact:g,subject:t,condition:Ce[n].condition,readOnly:!0,attachments:Ce[n].attachments}))),g)}}))),A.previewMailingList(!1,l)},checkPreview:n=>{xe(_e)||t((0,U.dv)(J(J({},Re()),{},{onSuccess:()=>{e.mailingListId?t((0,L.getMailingListLaunchInfo)({mailingListId:e.mailingListId,onSuccess:n})):n()}})))},addMessage:ke,templates:ue,customContact:h,onChangeCustomContact:e=>S(e.currentTarget.value),onAddCustomContactClick:()=>{ee(w.rY.LOADING);var e={editable:!0,profileId:ae.docId,saved:!1,type:"email",valid:!0,value:h,_id:r()("custom"),atsSource:"private"};t($.IM.saveContact({contact:e,onSuccess:()=>{ee(w.rY.SUCCESS),we(h),S("")},onError:()=>{ee(w.rY.ERROR),t($.IM.toggleContactsEditing(!1)),t($.IM.removeContact(e))}}))},addCustomContactStatus:K,start:({launch:n=!1}={})=>{if(e.recipientId&&e.mailingListId&&!xe(_e)){var a=ve.emailAliases,s=a.baseEmail,i=a.from,r=s!==i.email?i.email:void 0;t((0,U.Nr)({recipientId:e.recipientId,mailingListId:e.mailingListId,sendAsEmail:r,templates:Ce.map((({subject:t,body:n,condition:{days:a,hours:s,minutes:i,plusMinus:r,utc:l},template:o,attachments:u},c)=>{var d=e.messages[c];return d&&d.readOnly?{id:d.id}:J(J({},d?{id:d.id}:void 0),{},{subject:t.getCurrentContent().getPlainText().trim(),body:(0,G.l4)(n),base_template:-1===o.id||o.isExample?null:o.id,example_template:o.isExample?o.id:null,attachment_ids:u.filter((({id:e})=>e)).map((({id:e})=>e))},"string"==typeof a&&{send_delay:`${a||0} 00:00:00`,send_condition:"not_replied",send_time_from:`${parseInt(s,10)-parseInt(r,10)}:${i}:00`,send_time_to:`${parseInt(s,10)+parseInt(r,10)}:${i}:00`,send_time_utc_offset:`${parseInt(l,10)}:00:00`})})),customData:b()(ie,"value"),sendDelayInfo:je,onError:t=>{var n;Te(t),null===(n=e.onSendError)||void 0===n||n.call(e)},onSuccess:(...t)=>{var n;null===(n=e.onSendSuccess)||void 0===n||n.call(e,...t),A.startMailingList(1,Ce.length,!1,!!je.start_time_from,!1,l)},launch:n,customVariables:Ue(),accessType:l}))}},startMailingListProps:Ee,permissions:l,handlePermissionsChange:Me,addRecipientToSequence:(n,a)=>{e.mailingListId&&e.recipientId&&t((0,U.PI)({sequenceId:e.mailingListId,profileData:{profile_id:e.recipientId,recipient_data:{email:g,custom_data:b()(ie,"value")},source:n},onSuccess:a}))},customData:ie,generateMessages:e=>{ae&&(Se(V.eX.setMessages([])),t((0,U.V6)({profileId:ae.id,vacancyId:e,onError:Ve,onSuccess:e=>{t((0,X.startPingServerForData)({name:"gpt",callback:()=>t((0,U.JK)({id:e,onError:Ve})),updateTimings:{updateTimes:20,updateIntervalTime:1e4}}))}})))}}}},58257:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});n(67294);var a=n(6619);var s=n(85893),i=(0,a.ZP)({container:"PhotoPlaceholder-container___Q9Tv3"});const r=({initials:e,id:t,className:n=""})=>{var a={background:`hsl(${t%360}, 22%, 90%)`};return(0,s.jsx)("div",{className:`${i("container")} ${n}`,style:a,children:e})}},24654:()=>{}}]); 2//# sourceMappingURL=7736.min.5159496f9bdbf7a788ac.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.