PageSourceSearch

https://www.internships.com/assets/ops.apply._requestId-BvmRog3-.js

js internships.com collected 2026-09-24 18:27:16 UTC 17,999 bytes, 1 lines download raw bytes

1import{j as e,r,aV as ie,aK as ce,L as z,gA as me,gD as ue,gE as xe,gF as J,gG as pe,ag as X,gH as be,gI as he}from"./main-DmDsGTCr.js";import{u as h}from"./useMutation-BXaTcy4a.js";import{t as fe}from"./product-events-DE71XA68.js";import{a as ge}from"./standard-questions-CVX3_8hm.js";import{b as je,c as Ne,d as ye,m as ke,r as ve,e as _e,s as Re}from"./useApplyQueue-ngQGInSL.js";import{u as we}from"./use-focus-trap-fahQvZeG.js";import{u as Ee}from"./use-ops-reply-channel-NrWi_W0W.js";import"./payload-validation-C-pMPr5Y.js";import"./student-endpoints-BEkq0l27.js";import"./use-feature-flag-C9iVprKR.js";const Se={operator_messaged_student:"messaged the student"};function Ce(s){return Se[s]??s}function Ae({events:s}){return s.length===0?null:e.jsx("ul",{className:"space-y-1.5",children:s.map(o=>e.jsxs("li",{className:"text-sm text-text-muted",children:[e.jsx("span",{className:"font-semibold text-text",children:o.actorLabel})," ",Ce(o.eventType),o.message?e.jsxs("span",{className:"text-text",children:[": ",o.message]}):null]},o.id))})}function Te({studentName:s,roleTitle:o,company:l,pending:i,error:f,onConfirm:y,onDismiss:m}){const k=r.useId(),u=r.useId(),v=r.useRef(null);we(v,!0),r.useEffect(()=>{const p=g=>{g.key==="Escape"&&!i&&m()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[m,i]);const x=o??"this application",_=l?`${x} at ${l}`:x;return e.jsx("div",{ref:v,role:"dialog","aria-modal":"true","aria-labelledby":k,"aria-describedby":u,onClick:p=>p.stopPropagation(),className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:e.jsxs("div",{className:"relative mx-4 w-full max-w-sm rounded-xl bg-surface p-6 shadow-xl",children:[e.jsx("h3",{id:k,className:"font-semibold text-base text-text",children:"Put this request back in the queue?"}),e.jsxs("p",{id:u,className:"mt-2 text-sm text-text-muted",children:[s?`${s}'s request for `:"The request for ",e.jsx("span",{className:"text-text",children:_})," returns to In queue, and any operator can claim it. The student's tracked job goes back to applied."]}),f?e.jsx("p",{className:"mt-3 rounded-md bg-danger-tint px-3 py-2 text-danger text-sm",children:"That didn't go through — the request may have changed. Refresh and try again."}):null,e.jsxs("div",{className:"mt-5 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:m,disabled:i,"data-amp-track-surface":"ops_apply","data-amp-track-action":"dismiss_reopen",className:"font-medium text-sm text-text-muted hover:text-text disabled:opacity-50",children:"Cancel"}),e.jsx("button",{type:"button",onClick:y,disabled:i,"data-amp-track-surface":"ops_apply","data-amp-track-action":"confirm_reopen",className:"rounded-lg bg-purple px-4 py-2 font-medium text-sm text-white hover:opacity-90 disabled:opacity-50",children:i?"Re-opening…":"Re-open"})]})]})})}const qe={ssn:"a Social Security number",date_of_birth:"a date of birth",home_address:"a home address",phone_number:"a phone number",government_id:"a government ID",bank_details:"bank details",immigration_document:"an immigration document"};function Le(s){return(s&&qe[s])??"personal information"}const De={NO_RECIPIENT:"This student has no email address on file.",NOT_CONFIGURED:"Messaging isn't configured in this environment.",CHANNEL_DISABLED:"The reply channel is off in this environment.",EMPTY_BODY:"Write a message before sending.",REPLY_UNAVAILABLE:"That employer reply is no longer available to forward.",NOT_FOUND:"This request no longer exists.",FORBIDDEN:"You don't have access to send here.",SEND_FAILED:"Couldn't send — please try again."};function Fe(s){return(s&&De[s])??"Couldn't send — please try again."}const Ie=[{key:"fullName",label:"Full name"},{key:"email",label:"Email"},{key:"phone",label:"Phone"},{key:"school",label:"School"},{key:"major",label:"Major"},{key:"grad",label:"Grad year"},{key:"linkedinUrl",label:"LinkedIn"},{key:"githubUrl",label:"GitHub"},{key:"portfolioUrl",label:"Portfolio"}];function M({className:s,children:o}){return e.jsx("div",{className:X("rounded-md bg-danger-tint px-3 py-2 text-danger text-sm",s),children:o})}function P({className:s}){return e.jsx(M,{className:s,children:"That action isn't possible right now — the request may have changed. Refresh and try again."})}function Oe({requestId:s}){const o=ie(),{data:l,isLoading:i}=ce(je(s)),[f,y]=r.useState(""),[m,k]=r.useState(""),[u,v]=r.useState(""),[x,_]=r.useState(""),[p,g]=r.useState(!1),[B,Z]=r.useState("messages"),$=r.useRef(null),U=r.useId(),Q=r.useId(),G=r.useId(),ee=Ee(),b=()=>{o.invalidateQueries({queryKey:["ops","apply-detail",s]}),o.invalidateQueries({queryKey:["ops","apply-queue"]})},R=h({mutationFn:()=>Ne({data:{requestId:s}}),onSuccess:b}),d=h({mutationFn:()=>ye({data:{requestId:s,question:f}}),onSuccess:t=>{t.ok&&y(""),!t.ok&&"detector"in t.error&&fe("operator_pii_question_blocked",{c
1ategory:t.error.category??"unknown",detector:t.error.detector}),b()}}),w=h({mutationFn:()=>ke({data:{requestId:s,confirmationReference:m||void 0}}),onSuccess:b}),E=h({mutationFn:()=>ve({data:{requestId:s}}),onSuccess:t=>{t.ok&&g(!1),b()}}),S=h({mutationFn:()=>_e({data:{requestId:s,reason:u}}),onSuccess:b}),a=h({mutationFn:t=>Re({data:{requestId:s,body:t.body,forwardMessageRef:t.forwardMessageRef}}),onSuccess:(t,c)=>{t.ok&&!c.forwardMessageRef&&_(""),b()}}),Y=a.isError?"SEND_FAILED":a.data&&!a.data.ok?a.data.error.code:void 0;if(i)return e.jsx("p",{className:"p-8 text-sm text-text-muted",children:"Loading…"});if(!l?.ok)return e.jsxs("div",{className:"p-8",children:[e.jsx("p",{className:"text-sm text-danger",children:l&&"error"in l&&l.error.code==="FORBIDDEN"?"You don't have access to this request.":"Request not found."}),e.jsx(z,{to:"/ops/apply",className:"mt-3 inline-block text-purple text-sm hover:underline",children:"← Back to queue"})]});const{detail:te}=l,{request:n,profile:se,standardAnswers:K,student:L,materials:W,events:H,replies:C,studentReplies:A}=te,T=me(n.status),ae=ue(n.status),D=xe(n.status),F=J(n.status,"submitted"),I=J(n.status,"cannot_complete"),ne=!D&&!F&&!I,O=d.data&&!d.data.ok&&"detector"in d.data.error?d.data.error:null,re=R.data&&!R.data.ok,oe=d.data&&!d.data.ok&&!O,le=w.data&&!w.data.ok||S.data&&!S.data.ok,de=C.length+A.length,j=[...ee?[{id:"email",label:"Email",count:de}]:[],...D?[{id:"messages",label:"Messages"}]:[],...H.length>0?[{id:"logs",label:"Logs"}]:[]],N=j.some(t=>t.id===B)?B:j[0]?.id,V=j.length>1;return e.jsxs("div",{className:"mx-auto w-full max-w-4xl px-6 py-8",children:[e.jsx(z,{to:"/ops/apply",className:"text-purple text-sm hover:underline",children:"← Back to queue"}),e.jsxs("header",{className:"mt-3 flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"font-bold text-xl text-text",children:[n.roleTitle??"Application",n.company?` · ${n.company}`:""]}),e.jsxs("p",{className:"text-sm text-text-muted",children:[L.name," · ",L.email]})]}),e.jsxs("div",{className:"ml-auto flex shrink-0 flex-col items-end gap-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`aa-status-chip aa-status-${T.tone}`,children:T.label}),pe(n.status)?e.jsx("button",{type:"button",onClick:()=>g(!0),className:"font-bold text-purple text-sm hover:underline","data-amp-track-surface":"ops_apply","data-amp-track-action":"reopen",children:"Re-open"}):null]}),e.jsx("p",{className:"max-w-xs text-right text-text-muted text-xs",children:T.description})]})]}),p?e.jsx(Te,{studentName:L.name,roleTitle:n.roleTitle,company:n.company,pending:E.isPending,error:!!(E.data&&!E.data.ok),onConfirm:()=>E.mutate(),onDismiss:()=>g(!1)}):null,e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsx("a",{href:n.applyUrl,target:"_blank",rel:"noreferrer noopener",className:"inline-flex h-9 items-center rounded-md bg-purple px-4 font-bold text-sm text-white hover:bg-purple-hover","data-amp-track-surface":"ops_apply","data-amp-track-action":"open_posting",children:"Open posting ↗"}),e.jsx("a",{href:W.resumeUrl,className:"inline-flex h-9 items-center rounded-md border border-border px-4 font-bold text-sm text-text hover:border-border-hover","data-amp-track-surface":"ops_apply","data-amp-track-action":"download_resume",children:"Resume PDF"}),e.jsx("a",{href:W.coverLetterUrl,className:"inline-flex h-9 items-center rounded-md border border-border px-4 font-bold text-sm text-text hover:border-border-hover","data-amp-track-surface":"ops_apply","data-amp-track-action":"download_cover_letter",children:"Cover letter PDF"}),n.status==="queued"?e.jsx("button",{type:"button",onClick:()=>R.mutate(),disabled:R.isPending,className:"inline-flex h-9 items-center rounded-md border border-purple px-4 font-bold text-purple text-sm hover:bg-purple-tint","data-amp-track-surface":"ops_apply","data-amp-track-action":"claim",children:"Claim"}):null]}),re?e.jsx(P,{className:"mt-3"}):null,Y?e.jsxs(M,{className:"mt-3",children:[a.variables?.forwardMessageRef?"Forward to the student failed":"Message to the student failed"," ","— ",Fe(Y)]}):null,e.jsxs("div",{className:"mt-6 grid gap-6 md:grid-cols-2",children:[e.jsxs("section",{children:[e.jsx("h2",{className:"mb-2 font-bold text-sm text-text",children:"Student details"}),e.jsx("dl",{className:"rounded-lg border border-border",children:Ie.map(t=>e.jsxs("div",{className:"flex justify-between gap-3 border-border/60 border-b px-3 py-2 text-sm last:border-0",children:[e.jsx("dt",{className:"text-text-muted",children:t.label}),e.jsx("dd",{className:"text-right text-text",children:se[t.key]??e.jsx("span",{className:"text-text-muted",children:"—"})})]},t.key))})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-2 font-bold text-sm text-text",children:"Application answers"}),e.jsx("dl",{className:"rounded-lg border border-border",children:Object.entries(ge).map(([t,c])=>{const q=K[t];return q?e.jsxs("div",{className:"border-border/60 border-b px-3 py-2 text-sm last:border-0",children:[e.jsx("dt",{className:"text-text-muted text-xs",children:c.prompt}),e.jsx("dd",{className:"text-text",children:q})]},t):null})}),Object.keys(K).length===0?e.jsx("p",{className:"mt-1 text-text-muted text-xs",children:"No saved answers."}):null]})]}),F||I?e.jsxs("section",{className:"mt-6","data-testid":"aa-outcome-actions",children:[le?e.jsx(P,{className:"mb-4"}):null,e.jsxs("div",{className:"space-y-4",children:[F?e.jsxs("div",{className:"border-border border-t pt-4 first:border-t-0 first:pt-0",children:[e.jsx("label",{className:"mb-1 block font-bold text-sm text-text",htmlFor:Q,children:"Confirmation reference (optional)"}),e.jsx("input",{id:Q,value:m,onChange:t=>k(t.target.value),placeholder:"e.g. Greenhouse confirmation #",className:"h-9 w-full rounded-md border border-border px-3 text-sm"}),e.jsx("button",{type:"button",onClick:()=>w.mutate(),disabled:w.isPending,className:"mt-2 inline-flex h-9 items-center rounded-md bg-success px-4 font-bold text-sm text-white hover:opacity-90 disabled:opacity-50","data-amp-track-surface":"ops_apply","data-amp-track-action":"mark_submitted",children:"Mark submitted → applied"})]}
1):null,I?e.jsxs("div",{className:"border-border border-t pt-4 first:border-t-0 first:pt-0",children:[e.jsx("label",{className:"mb-1 block font-bold text-sm text-text",htmlFor:G,children:"Can't complete? Tell the student why"}),e.jsx("input",{id:G,value:u,onChange:t=>v(t.target.value),placeholder:"e.g. Posting is closed / requires an account",className:"h-9 w-full rounded-md border border-border px-3 text-sm"}),e.jsx("button",{type:"button",onClick:()=>S.mutate(),disabled:S.isPending||!u.trim(),className:"mt-2 inline-flex h-9 items-center rounded-md border border-danger px-4 font-bold text-danger text-sm hover:bg-danger-tint disabled:opacity-50","data-amp-track-surface":"ops_apply","data-amp-track-action":"mark_cannot_complete",children:"Can't complete"})]}):null]})]}):null,ne?e.jsx("p",{className:"mt-6 text-sm text-text-muted",children:ae?`This request is closed (${T.label}).`:"No operator action is available from this status."}):null,V?e.jsx("div",{className:"mt-8 flex gap-1 border-border border-b",children:j.map(t=>e.jsxs("button",{type:"button","aria-pressed":N===t.id,onClick:()=>Z(t.id),"data-testid":`aa-tab-${t.id}`,className:X("-mb-px flex items-center gap-1.5 border-b-2 px-3 py-2 font-bold text-sm",N===t.id?"border-purple text-purple":"border-transparent text-text-muted hover:text-text"),children:[t.label,t.count!==void 0?e.jsx("span",{className:"rounded-full bg-surface-raised px-1.5 py-0.5 text-text-muted text-xs",children:t.count}):null]},t.id))}):null,j.length>0?e.jsxs("div",{className:"mt-6",children:[N==="email"?e.jsxs("div",{"data-testid":"aa-email-section",className:"space-y-6",children:[e.jsxs("div",{"data-testid":"aa-message-student",children:[e.jsx("h3",{className:"mb-2 font-bold text-sm text-text",children:"Message student"}),e.jsx("textarea",{value:x,onChange:t=>_(t.target.value),placeholder:"Write a message to the student…",rows:3,className:"w-full rounded-lg border border-border bg-surface p-2 text-sm text-text"}),e.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[e.jsx("button",{type:"button",disabled:a.isPending||!x.trim(),onClick:()=>a.mutate({body:x}),"data-amp-track-surface":"ops_apply","data-amp-track-action":"send_to_student",className:"inline-flex h-9 items-center rounded-md bg-purple px-4 font-bold text-sm text-white hover:bg-purple-hover disabled:opacity-50",children:"Send to student"}),a.data?.ok&&!a.variables?.forwardMessageRef?e.jsxs("span",{className:"text-success text-xs",children:["Sent to ",a.data.sentTo,"."]}):null]})]}),A.length>0?e.jsxs("div",{"data-testid":"aa-student-replies",children:[e.jsxs("h3",{className:"mb-2 flex items-center gap-2 font-bold text-sm text-text",children:["Student replies",e.jsxs("span",{className:"aa-status-chip aa-student-reply-chip",children:["💬 ",A.length]})]}),e.jsx("ul",{className:"overflow-hidden rounded-lg border border-border",children:A.map((t,c)=>e.jsxs("li",{className:"px-3 py-2 text-sm even:bg-surface-raised",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"font-medium text-text",children:t.from}),e.jsx("span",{className:"shrink-0 text-text-muted text-xs",children:new Date(t.receivedAt).toLocaleString()})]}),e.jsx("div",{className:"text-text",children:t.subject?.trim()||e.jsx("span",{className:"text-text-muted",children:"(no subject)"})})]},`${t.messageRef}-${c}`))})]}):null,C.length>0?e.jsxs("div",{"data-testid":"aa-employer-replies",children:[e.jsxs("h3",{className:"mb-2 flex items-center gap-2 font-bold text-sm text-text",children:["Employer replies",e.jsxs("span",{className:"aa-status-chip aa-reply-chip",children:["✉ ",C.length]})]}),e.jsx("ul",{className:"overflow-hidden rounded-lg border border-border",children:C.map((t,c)=>e.jsxs("li",{className:"px-3 py-2 text-sm even:bg-surface-raised",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"font-medium text-text",children:t.from}),e.jsx("span",{className:"shrink-0 text-text-muted text-xs",children:new Date(t.receivedAt).toLocaleString()})]}),e.jsx("div",{className:"text-text",children:t.subject?.trim()||e.jsx("span",{className:"text-text-muted",children:"(no subject)"})}),e.jsxs("div",{className:"mt-0.5 text-text-muted text-xs",children:["Application:"," ",t.attribution.status==="determined"?[t.attribution.companyName,t.attribution.roleTitle].filter(q=>q?.trim()).join(" — ")||"tracked application":"undetermined"]}),e.jsx("button",{type:"button",disabled:a.isPending,onClick:()=>a.mutate({body:"",forwardMessageRef:t.messageRef}),"data-amp-track-surface":"ops_apply","data-amp-track-action":"forward_to_student",className:"mt-1.5 rounded border border-border px-2 py-1 font-medium text-purple text-xs hover:bg-surface-raised disabled:opacity-50",children:"Forward to student"}),a.variables?.forwardMessageRef===t.messageRef&&a.data?.ok?e.jsxs("span",{className:"mt-1.5 block text-success text-xs",children:["Forwarded to ",a.data.sentTo,"."]}):null]},`${t.from}
1-${new Date(t.receivedAt).getTime()}-${c}`))})]}):null]}):null,N==="messages"?e.jsxs("div",{"data-testid":"aa-messages-section",children:[oe?e.jsx(P,{className:"mb-4"}):null,O?e.jsxs(M,{className:"mb-4",children:[e.jsxs("p",{className:"font-bold",children:["Question blocked — it asks the student for"," ",Le(O.category),"."]}),e.jsx("p",{className:"mt-1",children:"Chegg can't collect that from students through this channel. Revise your question and send it again."}),e.jsx("button",{type:"button",onClick:()=>$.current?.focus(),className:"mt-2 inline-flex h-8 items-center rounded-md border border-danger px-3 font-bold text-danger text-xs hover:bg-danger/10","data-amp-track-surface":"ops_apply","data-amp-track-action":"pii_blocked_revise",children:"Revise question"})]}):null,e.jsx("div",{className:"space-y-4",children:D?e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block font-bold text-sm text-text",htmlFor:U,children:"Need something from the student?"}),e.jsx("textarea",{ref:$,id:U,rows:2,value:f,onChange:t=>y(t.target.value),placeholder:"e.g. What's your expected graduation term?",className:"af-textarea"}),e.jsx("button",{type:"button",onClick:()=>d.mutate(),disabled:d.isPending||!f.trim(),className:"mt-2 inline-flex h-9 items-center rounded-md border border-border px-4 font-bold text-sm text-text hover:border-border-hover disabled:opacity-50","data-amp-track-surface":"ops_apply","data-amp-track-action":"ask_info","data-amp-track-ask-kind":be(n.status),children:"Ask student"})]}):null})]}):null,N==="logs"?e.jsxs("div",{"data-testid":"aa-activity-log",children:[V?null:e.jsx("h2",{className:"mb-2 font-bold text-sm text-text",children:"Activity"}),e.jsx(Ae,{events:H})]}):null]}):null]})}function He(){const{requestId:s}=he.useParams();return e.jsx(Oe,{requestId:s})}export{He as component};

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.