1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8647],{20003:function(e,t,a){var l,s,r,i=a(62714);function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var l in a)({}).hasOwnProperty.call(a,l)&&(e[l]=a[l])}return e}).apply(null,arguments)}t.Z=e=>i.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none"},e),l||(l=i.createElement("circle",{cx:12,cy:12,r:12,fill:"#00C600"})),s||(s=i.createElement("g",{clipPath:"url(#checkGreen_svg__a)"},i.createElement("path",{fill:"#fff",stroke:"#fff",d:"m18.078 9.8-6.75 6.303a1.5 1.5 0 0 1-.472.295 1.52 1.52 0 0 1-1.569-.295l-3.35-3.128a1.3 1.3 0 0 1-.318-.432 1.29 1.29 0 0 1 .304-1.501c.132-.124.289-.22.458-.285l.179.467-.179-.467a1.46 1.46 0 0 1 1.061.008c.167.067.32.165.45.29l2.415 2.255 5.814-5.429c.132-.123.286-.218.453-.283a1.46 1.46 0 0 1 1.504.283zm0 0c.266-.248.422-.592.422-.96 0-.366-.156-.71-.422-.959z"}))),r||(r=i.createElement("defs",null,i.createElement("clipPath",{id:"checkGreen_svg__a"},i.createElement("path",{fill:"#fff",d:"M3.666 4h16.667v16.667H3.666z"})))))},8647:function(e,t,a){a.r(t),a.d(t,{default:function(){return C}});var l=a(2422),s=a(76216),r=a(86092),i=a(20447),n=a(18261),o=a(78665),d=a(4542),c=a(79332),m=a(67868),p=a(72204),u=a(49832),b=a(36107),x=a(63111),h=a(20003),f=a(81038);function g(e){let{currentStep:t}=e,a=(0,i.useTranslations)(),s=[{key:1,label:a("pages.email_template.step1")},{key:2,label:a("pages.email_template.step2")},{key:3,label:a("pages.email_template.step3")}];return(0,l.jsx)("div",{className:"mb-8 flex items-start justify-center",children:s.map((e,a)=>{let r=t>e.key,i=t===e.key;return(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsxs)("div",{className:"flex min-w-[120px] flex-col items-center text-center",children:[(0,l.jsx)("div",{className:"relative z-[2] flex h-10 w-10 items-center justify-center",children:r?(0,l.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"h-10 w-10",children:[(0,l.jsx)("rect",{width:"40",height:"40",rx:"20",fill:"#22C57E"}),(0,l.jsx)("path",{d:"M28.0039 15L18.0039 25L13.0039 20",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})]}):(0,l.jsx)("div",{className:`flex h-10 w-10 items-center justify-center rounded-full leading-none transition-all duration-300 ${i?"border-[5px] border-[#ffcfcf] bg-[#f44336] text-white":"border-2 border-[#C0C2C9] bg-white text-[#C0C2C9]"} `,children:(0,l.jsx)("span",{className:"font-db-bold text-F32",children:e.key})})}),(0,l.jsx)("span",{className:`mt-2 text-F24 ${i?"font-db-medium text-[#333333]":"text-[#C0C2C9]"}`,children:e.label})]}),a<s.length-1&&(0,l.jsx)("div",{className:"flex min-w-[56px] justify-center pt-5",children:(0,l.jsx)("div",{className:"h-[1px] w-10 bg-[#D1D5DB]"})})]},e.key)})})}function y(e){let{selected:t,onSelect:a,onNext:r,onCancel:n,isGenerating:o=!1}=e,d=(0,i.useTranslations)(),[c,m]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let e=setTimeout(()=>m(!0),50);return()=>clearTimeout(e)},[]);let p=[{id:"direct",title:d("pages.email_template.template.direct.title"),description:d("pages.email_template.template.direct.desc")},{id:"hr_friendly",title:d("pages.email_template.template.hr_friendly.title"),description:d("pages.email_template.template.hr_friendly.desc")},{id:"powerful",title:d("pages.email_template.template.powerful.title"),description:d("pages.email_template.template.powerful.desc")}];return(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"transition-all duration-500 ease-out",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(-12px)"},children:[(0,l.jsx)("h2",{className:"mb-1 bg-gradient-to-r from-[#3c91f1] to-[#7e28ed] bg-clip-text font-db-bold text-F32 text-transparent",children:d("pages.email_template.selectTitle")}),(0,l.jsx)("p",{className:"mb-4 font-db-normal text-F22 text-gray-500",children:d("pages.email_template.selectDesc")})]}),(0,l.jsx)("div",{className:"flex flex-col gap-3",children:p.map((e,s)=>{let i=t===e.id;return(0,l.jsx)("div",{className:"transition-all duration-500 ease-out",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(20px)",transitionDelay:`${100+80*s}ms`},children:(0,l.jsxs)("div",{onClick:()=>!o&&a(e.id),className:`flex flex-col justify-between gap-3 rounded-lg border px-4 py-3 transition-all duration-300 ease-in-out hover:shadow-md sm:flex-row sm:items-center ${o?"cursor-not-allowed opacity-60":"cursor-pointer"} ${i?"border-red-500 bg-red-50 shadow-sm shadow-red-100":"border-gray-200 bg-white hover:border-gray-300"} `,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsxs)("div",{className:"relative flex items-center justify-center",children:[i&&(0,l.jsx)("span",{className:"absolute inline-flex h-4 w-4 roun
1ded-full bg-red-400 opacity-40"}),(0,l.jsx)("input",{type:"radio",checked:i,onChange:()=>a(e.id),className:"relative z-10 h-4 w-4 accent-red-500"})]}),(0,l.jsxs)("div",{className:"transition-transform duration-300",style:{transform:i?"translateX(4px)":"translateX(0)"},children:[(0,l.jsx)("div",{className:"font-db-bold text-F22",children:e.title}),(0,l.jsx)("div",{className:"font-db-normal text-F20 text-[#555555]",children:e.description})]})]}),(0,l.jsx)("button",{type:"button",disabled:o,onClick:t=>{t.stopPropagation(),o||(a(e.id),setTimeout(()=>r(e.id),0))},className:`rounded-lg border px-10 py-[5px] font-db-bold text-F20 transition-all duration-200 ease-in-out active:scale-95 disabled:cursor-not-allowed disabled:opacity-60 ${i?"border-red-500 bg-Primary text-white hover:brightness-110":"border-gray-300 text-gray-600 hover:border-gray-400 hover:bg-gray-50"} `,children:i&&o?d("pages.email_template.generating"):d("pages.email_template.select")})]})},e.id)})}),(0,l.jsx)("div",{className:"mt-6 flex justify-center transition-all duration-500 ease-out",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(10px)",transitionDelay:"400ms"},children:(0,l.jsx)("button",{type:"button",onClick:n,className:"w-[200px] rounded-lg border border-gray-300 py-2 font-db-normal text-F22 transition-all duration-200 hover:border-gray-400 hover:bg-gray-50 active:scale-95",children:d("pages.email_template.cancel")})})]})}var j=a(23070),_=a(7657);function v(e){let{emailData:t,onChange:a,onNext:s,onBack:r,selectedTemplate:n}=e,o=(0,i.useTranslations)();return(0,l.jsx)(_.l0,{children:(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"mb-1 font-db-bold text-F32 text-[#ff1111]",children:o("pages.email_template.editTitle")}),(0,l.jsx)("div",{className:"mb-4 rounded border border-red-200 bg-red-50 px-4 py-2 font-db-normal text-F20 text-[#ff1111]",children:o("pages.email_template.editWarning")}),(0,l.jsxs)("p",{className:"mb-4 font-db-medium text-F22",children:[o("pages.email_template.templateLabel")," :"," ",o(`pages.email_template.template.${n}.title`)]}),(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("label",{className:"mb-1 font-db-medium text-F22",children:o("pages.email_template.subject")}),(0,l.jsx)("input",{value:t.subject,readOnly:!0,className:"w-full !resize-y rounded border border-gray-300 bg-gray-50 px-8 py-2 font-db-normal !text-F20 cursor-not-allowed focus:!outline-none focus:!ring-0"})]}),(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsx)("label",{className:"mb-1 block font-db-medium text-F22",children:o("pages.email_template.body")}),(0,l.jsx)(j.Z,{value:t.body,onChange:e=>a({...t,body:e.target.value}),rows:10,className:"w-full !resize-y rounded border border-gray-300 px-8 py-2 font-db-normal !text-F20 hover:!border-blue-500 focus:!border-blue-500"})]}),(0,l.jsxs)("div",{className:"flex justify-center gap-3",children:[(0,l.jsx)("button",{onClick:r,className:"w-[200px] rounded-lg border border-gray-300 py-2 font-db-normal text-F22",children:o("pages.email_template.back")}),(0,l.jsx)("button",{onClick:s,className:"w-[200px] rounded-lg bg-Primary py-2 font-db-medium text-F22 text-white transition-colors hover:bg-Primary/70",children:o("pages.email_template.confirm")})]})]})})}function N(e){let{emailData:t,onConfirm:a,onBack:r}=e,n=(0,i.useTranslations)(),[o,d]=(0,s.useState)(!1),c=async()=>{d(!0);try{await a()}finally{d(!1)}};return(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"mb-1 font-db-bold text-F32 text-[#FF1111]",children:n("pages.email_template.confirmTitle")}),(0,l.jsx)("p",{className:"mb-4 text-F20 text-gray-500",children:n("pages.email_template.confirmDesc")}),(0,l.jsxs)("div",{className:"mb-6 rounded-lg border border-gray-200 p-4 font-db-normal text-F20",children:[(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("p",{className:"text-F22 text-[#777777]",children:n("pages.email_template.subject")}),(0,l.jsx)("p",{children:t.subject})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-F22 text-[#777777]",children:n("pages.email_template.body")}),(0,l.jsx)("div",{className:"mt-2 h-[200px] overflow-y-auto",children:(0,l.jsx)("p",{className:"whitespace-pre-line",children:t.body})})]})]}),(0,l.jsxs)("div",{className:"flex justify-center gap-3",children:[(0,l.jsx)("button",{onClick:r,disabled:o,className:"w-[200px] rounded-lg border border-gray-300 py-2 font-db-normal text-F22",children:n("pages.email_template.back")}),(0,l.jsx)("button",{onClick:c,disabled:o,className:"w-[200px] rounded-lg bg-Primary py-2 font-db-medium text-F22 text-white transition-colors hover:bg-Primary/70",children:n("pages.email_template.confirmApply")})]})]})}var w=a(58896);function k(e){let{selectedTemplate:t,emailData:a,onUse:s,onBack:r}=e,n=(0,i.useTranslations)();return(0,l.jsxs)("div",{children:[(0,l.jsxs)("h2",{className:"font-db-bold text-F32 text-[#FF1111]",children:[n("pages.email_template.modal.emailTemplate.preview_title")," :"," ",n(`pages.email_template.template.${t}.title`)]}),(0,l.jsx)("p",{className:"mb-4 text-F20 text-gray-500",children:n("pages.email_template.modal.emailTemplate.preview_desc")}),(0,l.jsxs)("div",{className:"mb-4 rounded-lg border border-gray-200 p-4 font-db-normal text-F20",children:[(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("p",{className:"text-[#777777]",children:n("pages.email_template.subject")}),(0,l.jsx)("p",{className:"text-[#555555]",children:a.subject})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("p",{className:"text-F20 text-[#777777]",children:[n("pages.email_template.body")," (",n("pages.email_template.modal.emailTemplate.example"),")"]}),(0,l.jsx)("div",{className:"h-[200px] overflow-y-auto",children:(0,l.jsx)("p",{className:"whitespace-pre-line text-F20 text-[#555555]",children:a.body})})]})]}),(0,l.jsxs)("div",{className:"flex justify-center gap-3",children:[(0,l.jsx)("button",{type:"button",onClick:r,className:"w-[200px] rounded-lg border border-gray-300 py-2 font-db-normal text-F22",children:n("pages.email_template.back")}),(0,l.jsx)("button",{type:"button",onClick:s,className:"w-[200px] rounded-lg bg-Primary py-2 font-db-medium text-F22 text-white transition-colors hover:bg-Primary/70",children:n("pages.email_template.usetemplate")})]})]})}
1let F={toast:"!font-db-normal !text-F22 items-start",icon:"!mt-1 !mr-1",title:"!font-db-bold !leading-none",description:"!text-F20 !mt-1"};function C(e){let t=(0,o.TL)(),a=(0,i.useTranslations)(),j=(0,i.useLocale)(),_=(0,r.v9)(c.cl),{data:C,emailToMe:S}=(0,r.v9)(m.CN),{session:T}=(0,p.$)(),[$,A]=(0,s.useState)(1),[E,P]=(0,s.useState)("select"),[Z,L]=(0,s.useState)(""),[D,z]=(0,s.useState)({subject:"",body:""}),[B,I]=(0,s.useState)(!1),[O,R]=(0,s.useState)("50%");(0,s.useEffect)(()=>{let e=()=>{let e=window.innerWidth;e>=1550?R("50%"):e<=790?R("100%"):R(`${(50+50*(1-(e-790)/760)).toFixed(1)}%`)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let Y=()=>{t((0,d.Cc)())},G=async e=>{var t;let l=Number(_.company_id),s=Number(_.jobpost_id),r=Number(null==T?void 0:null===(t=T.user)||void 0===t?void 0:t.id),i=Number(null==C?void 0:C.resume_id);if(!l||!s||!r||!i||Number.isNaN(l)||Number.isNaN(s)||Number.isNaN(r)||Number.isNaN(i)){console.log(l,s,r,i),n.A.error(a("pages.email_template.generate_error_title"),{description:a("pages.email_template.generate_missing_info"),classNames:F});return}I(!0);try{let t=await u.Z.post("https://ai.jobbkk.com/ai_email_template/api/generate-email",{company_id:l,jobpost_id:s,member_id:r,resume_id:i,template_type:e,language:j},{skipAuth:!0}),a=null==t?void 0:t.data;if(!(null==a?void 0:a.subject)||!(null==a?void 0:a.body))throw Error("invalid response");z({subject:a.subject,body:a.body}),P("preview")}catch{n.A.error(a("pages.email_template.generate_error_title"),{description:a("pages.email_template.generate_error_desc"),classNames:F})}finally{I(!1)}},U=async()=>{let e=Number(_.jobpost_id);if(!e||Number.isNaN(e)||!Z||!D.subject||!D.body){n.A.error(a("toast.job_detail.apply_error_title"),{description:a("pages.email_template.generate_missing_info"),classNames:F});return}try{var s,r;let i=new b.Z,o=await i.sendApplyJob({jobpost_id:e,lang:(0,x.I_)(j),email_to_me:S?"yes":"no",template_type:Z,custom_email_subject:D.subject,custom_email_body:D.body},{typeApply:_.type_apply,typeSort:_.type_sort}),c=null==o?void 0:o.data,m=null==c?void 0:null===(s=c.data)||void 0===s?void 0:s.code,p="object"==typeof(null==c?void 0:c.message)?null==c?void 0:null===(r=c.message)||void 0===r?void 0:r[j]:void 0;if("no_resume"===m){n.A.error(a("toast.job_detail.apply_error_title"),{description:p||a("toast.job_detail.no_resume"),classNames:F});return}if((null==c?void 0:c.statusCode)===200){"duplicate_apply"===m?n.A.warning(p||a("toast.job_detail.duplicate_apply"),{classNames:F}):(0,n.A)((0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("div",{className:"relative w-[24px] font-db-normal",children:(0,l.jsx)(h.Z,{})}),(0,l.jsxs)("div",{className:"flex flex-col gap-1 font-db-normal",children:[(0,l.jsx)(f.default,{className:"!text-F24",children:a("toast.job_detail.success")}),(0,l.jsx)(f.default,{className:"!text-F20 !text-paragraph-grey",children:a("toast.job_detail.success_desc")})]})]}),{action:null,icon:(0,l.jsx)(h.Z,{})}),t((0,d.Cc)());return}n.A.error(a("toast.job_detail.apply_error_title"),{description:p||a("toast.job_detail.apply_error_desc"),classNames:F})}catch{n.A.error(a("toast.job_detail.apply_error_title"),{description:a("toast.job_detail.apply_error_desc"),classNames:F})}};return(0,l.jsx)(w.Z,{...e,afterClose:()=>{A(1),P("select"),L(""),z({subject:"",body:""}),I(!1)},width:O,children:(0,l.jsxs)("div",{className:"relative p-5",children:[(0,l.jsx)("h2",{className:"mb-6 text-left font-db-bold text-F32 text-paragraph-black",children:a("button.apply_urgent")}),(0,l.jsx)(g,{currentStep:$}),(()=>{switch($){case 1:if("preview"===E)return(0,l.jsx)(k,{selectedTemplate:Z,emailData:D,onUse:()=>A(2),onBack:()=>P("select")});return(0,l.jsx)(y,{selected:Z,isGenerating:B,onSelect:e=>{L(e)},onNext:e=>{L(e),G(e)},onCancel:Y});case 2:return(0,l.jsx)(v,{emailData:D,onChange:z,onNext:()=>A(3),onBack:()=>{P("preview"),A(1)},selectedTemplate:Z||"direct"});case 3:return(0,l.jsx)(N,{emailData:D,onConfirm:U,onBack:()=>A(2)})}})(),B&&(0,l.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded bg-white/70 backdrop-blur-[2px]",children:(0,l.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,l.jsx)("div",{className:"h-10 w-10 animate-spin rounded-full border-2 border-[#3c91f1] border-t-transparent"}),(0,l.jsx)("p",{className:"font-db-medium text-F20 text-[#555555]",children:a("pages.email_template.generating")})]})})]})})}},58896:function(e,t,a){a.d(t,{Z:function(){return n}});var l=a(2422),s=a(78665),r=a(4542),i=a(3261);function n(e){let t=(0,s.TL)();return(0,l.jsx)(i.Z,{closeIcon:null,zIndex:1e3,onCancel:()=>t((0,r.Cc)()),destroyOnHidden:!0,centered:!0,maskClosable:!0,footer:null,styles:{content:{fontFamily:"inherit !important",padding:"0",overflow:"hidden"},footer:{margin:"0"}},...e,children:e.children})}},23070:function(e,t,a){var l=a(2422),s=a(99269),r=a(76216);let i=(0,r.forwardRef)((e,t)=>{var a;let{className:i,maxLength:n,onChange:o,...d}=e,[c,m]=(0,r.useState)((null===(a=d.defaultValue)||void 0===a?void 0:a.toString().length)||0);return(0,l.jsxs)("div",{className:"relative w-full",children:[(0,l.jsx)("textarea",{ref:t,maxLength:n,onChange:e=>{m(e.target.value.length),null==o||o(e)},className:(0,s.cn)("flex w-full rounded-[8px] border border-[#DBDFEC] bg-white px-4 py-[9px]","font-db-normal text-F22 shadow-sm","placeholder:text-muted-foreground","hover:border-Primary focus:border-Primary focus:outline-none","transition-colors","disabled:cursor-not-allowed disabled:opacity-50","min-h-[40px] pb-6",i),...d}),n&&(0,l.jsxs)("span",{className:"pointer-events-none absolute bottom-1 right-3 text-xs text-muted-foreground",children:[c,"/",n]})]})});i.displayName="InputTextarea",t.Z=i},36107:function(e,t,a){a.d(t,{Z:function(){return s}});var l=a(49832);class s{async getEasyApplyInit(e,t,a,s){let r=new URLSearchParams({language_id:String(a)});return s&&r.set("member_token",s),l.Z.get(`/v1/api/apply_job/easy_apply_new/${e}/${t}?${r.toString()}
1`,{validateStatus:e=>e<400,maxRedirects:0})}async getAttachFileApplyInit(e,t,a,s){let r=new URLSearchParams({language_id:String(a)});return s&&r.set("member_token",s),l.Z.get(`/v1/api/apply_job/attach_file_new/${e}/${t}?${r.toString()}`,{validateStatus:e=>e<400,maxRedirects:0})}async sendApplyJob(e,t){return l.Z.post("/v1/jobs/send_apply_job",{...e,type_apply:(null==t?void 0:t.typeApply)||"jobbkk",...(null==t?void 0:t.typeSort)?{type_sort:t.typeSort}:{}})}async checkResumeOnline(e,t){return l.Z.get(`/v1/resumes/check_resume/${e}/${t}`,{validateStatus:e=>e<500})}}}}]);
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.