1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0fa4e-7238-78d1-b676-06f6487f2325")}catch(e){}}();import{j as e,L as J,dv as d,T as r,f9 as V,eI as ne,eJ as de,d0 as le,i as ce,ab as o,r as c,d_ as O,d as D,bJ as _,bL as oe,d7 as me,gd as xe,Q,bN as G,g as pe,h as he,ge as ue,gf as H,gg as L,a as je}from"./index-DNPvk1fh.js";import{T}from"./tabs-gnkJV4lw.js";import{I as U}from"./infinite-scroll-trigger-K5K7lW1i.js";import{s as Z,P as ge,u as W,a as M}from"./project-action-buttons-DYY5F3cU.js";import{u as z}from"./use-debounced-EjSyOoMy.js";import{E as fe}from"./empty-active-projects-icon-CRbv7KiE.js";import{g as ye,P as Ne}from"./cancel-application-dialog-a5KV0DXk.js";import{P as A,r as be}from"./use-start-unmoderated-project-Cn0IXd9Q.js";import{R as Y}from"./research-method-badge-CH7zaGs7.js";import{i as ve}from"./ArrowRight-BlNTnpB5.js";import{a as Se}from"./badges-DeK0Pa1O.js";import{u as Ie}from"./useInfiniteQuery-DkH4gX5J.js";import"./useHasTabbableChild-BqQHP9YU.js";import"./RefreshCcw01-5nXEfSXH.js";import"./use-clipboard-CBqTbeCo.js";import"./dropdown-CnzWQSKf.js";import"./notifications-DUltP7yn.js";import"./featured-icon-CqaPGTot.js";import"./use-screen-capture-support-Cqj24QBs.js";import"./open-external-url-BB4iatY-.js";import"./confirmation-modal-BXcfGKXj.js";import"./Heading-Cp8x8rEO.js";import"./modal-DVoqDehu.js";import"./useLocation-D7oQb0I1.js";import"./PlaySquare-BQDBymin.js";import"./Building06-RTfipdZv.js";import"./Star04-CkwhWEgD.js";function w({title:t,message:s,footer:a}){return e.jsxs("div",{className:"flex h-1/2 w-full flex-col items-center justify-center gap-6",children:[e.jsx(fe,{}),e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold text-primary",children:t}),e.jsx("p",{className:"text-center text-md text-secondary",children:s})]}),a&&e.jsx("div",{className:"flex justify-center",children:a})]})}function B({userId:t,project:s}){const a=ye(s);return e.jsxs(J,{to:"/participants/projects/$projectId/{-$slug}",params:{projectId:s.projectId},state:{previousRoute:A},className:"block rounded-xl border border-secondary bg-primary p-4 transition-colors hover:border-primary md:rounded-2xl md:p-6","data-testid":`participant-my-project-card-${s.projectId}`,"data-project-id":s.projectId,children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Y,{kindOfResearch:s.kindOfResearch,researchConductType:s.researchConductType}),e.jsx("span",{"data-testid":`participant-my-project-status-${s.projectId}`,children:e.jsx(Ne,{status:s.status,outcome:s.outcome,payout:s.payout,isProjectClosed:s.isStudyOver??!1,isClosedToNewApplications:s.isClosedToNewApplications,isTaskComplete:a?.stage==="complete"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-lg font-semibold text-primary",children:["$",s.respondentRemuneration]}),e.jsx("span",{className:"text-md text-tertiary",children:"USD"})]})]}),e.jsxs("div",{className:"mb-4 flex w-full flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"mb-4 flex min-w-0 flex-1 flex-col gap-1 md:mb-0",children:[e.jsx("h3",{className:"font-heading text-md font-semibold text-primary md:text-lg",children:s.name}),s.status!==d.DRAFT&&s.appliedAt?e.jsx("p",{className:"text-xs font-normal text-tertiary opacity-80",children:e.jsx(r,{id:"tHEcVT",values:{0:V(s.appliedAt)}})}):null,a&&a.stage!=="notStarted"?e.jsx("p",{className:"text-xs font-medium text-secondary","data-testid":`participant-my-project-progress-${s.projectId}`,children:e.jsx(Pe,{taskProgress:a})}):null]}),e.jsx("div",{...Z,className:"min-w-0 shrink-0 md:flex md:justify-end",children:e.jsx(ge,{status:s.status,outcome:s.outcome,cancelBookingUrl:s.cancelBookingUrl,bookingUrl:s.bookingUrl,rescheduleUrl:s.rescheduleUrl,contactUrl:s.contactUrl,projectId:s.projectId,projectName:s.name,payout:s.payout,userId:t,ndaUrl:s.nd
1aUrl,kindOfResearch:s.kindOfResearch,closed:s.closed,isStudyOver:s.isStudyOver,isTargetReached:s.isTargetReached,requiresScreenShare:s.screenRecordingEnabled??!1,taskProgress:a,respondentRemuneration:s.respondentRemuneration,origin:A})})]})]})}function Pe({taskProgress:t}){const a=ne()&&t.stage==="started"?de(t.startedAt):"";return t.stage==="complete"?e.jsx(r,{id:"q99ael"}):a?e.jsx(r,{id:"KhaZCL",values:{startedAgo:a}}):e.jsx(r,{id:"JEGlfK"})}function K({statusFilter:t,searchQuery:s,onSearchChange:a}){return e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center",children:[e.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:t}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(le,{type:"search",placeholder:o._({id:"Fjba0F"}),value:s,onChange:a,icon:ce,size:"md","aria-label":o._({id:"H5KKPz"})})})]})}function k(){return e.jsxs("div",{className:"animate-pulse rounded-xl border border-secondary bg-primary p-4 md:rounded-2xl md:p-6",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-6 w-24 rounded-md bg-tertiary"}),e.jsx("div",{className:"h-6 w-20 rounded-md bg-tertiary"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-6 w-16 rounded-md bg-tertiary"}),e.jsx("div",{className:"h-6 w-10 rounded-md bg-tertiary"})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"mb-2 h-6 w-3/4 rounded-md bg-tertiary"}),e.jsx("div",{className:"mb-1 h-4 w-full rounded-md bg-tertiary"}),e.jsx("div",{className:"h-4 w-5/6 rounded-md bg-tertiary"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-5 rounded bg-tertiary"}),e.jsx("div",{className:"h-4 w-16 rounded-md bg-tertiary"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-5 rounded bg-tertiary"}),e.jsx("div",{className:"h-4 w-20 rounded-md bg-tertiary"})]})]})]})}function y(){return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(k,{}),e.jsx(k,{}),e.jsx(k,{})]})}const X=[d.PENDING],Ee=[...X,d.INVALIDRESPONSE],Te=[{id:d.PENDING,label:o._({id:"wTOwz+"})},{id:d.INVALIDRESPONSE,label:o._({id:"gmWUFC"})}];function we({userId:t}){const[s,a]=c.useState([]),[n,u]=c.useState(""),[h,x]=c.useState("");z(()=>{x(n.trim())},300,[n]);const{data:i,isLoading:m,isFetching:N,error:f,refetch:S,fetchNextPage:I,hasNextPage:b,isFetchingNextPage:g}=W({userId:t,pageSize:20,statuses:s.length>0?s.flatMap(l=>l===d.PENDING?X:[l]):Ee,search:h||void 0}),j=c.useMemo(()=>i?.pages.flatMap(l=>l.results??[])??[],[i]),v=!m&&!g&&N,C=c.useCallback(()=>{I()},[I]),R=!!n.trim(),P=s.length>0||R,E=c.useCallback(()=>{a([]),u(""),x("")},[]);return f?e.jsx("div",{className:"mx-auto max-w-[var(--max-width-container)] px-4 py-8",children:e.jsx(M,{onRetry:()=>{S()}})}):e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(K,{searchQuery:n,onSearchChange:u,statusFilter:e.jsx(O,{size:"md",placeholder:o._({id:"N40H+G"}),items:Te,selectedKeys:s,onSelectionChange:l=>{a([...l])},"aria-label":"Filter by status"})}),m&&e.jsx(y,{}),!m&&j.length===0&&!P&&e.jsx(w,{title:e.jsx(r,{id:"rC+S5C"}),message:e.jsx(r,{id:"qhOVOQ"})}),!m&&j.length===0&&P&&e.jsx(w,{title:e.jsx(r,{id:"l5+KZq"}),message:e.jsx(r,{id:"IEwBRJ"}),footer:e.jsx(D,{iconLeading:e.jsx(_,{className:"size-4"}),onClick:E,children:e.jsx(r,{id:"u8JHrO"})})}),v&&e.jsx(y,{}),!m&&!v&&j.length>0&&e.jsxs(e.Fragment,{children:[j.map(l=>e.jsx(B,{project:l,userId:t},l.projectId)),e.jsx(U,{onLoadMore:C,hasNextPage:b,isFetchingNextPage:g}),g&&e.jsx(y,{}),!b&&e.jsx("div",{className:"py-4 text-center",children:e.jsx("p",{className:"text-sm text-tertiary",children:e.jsx(r,{id:"4gHDPZ"})})})]})]})}function Ce(t){return me({queryKey:Q.participantInvitations.byUserId(t),queryFn:async()=>(await xe({client:G(),path:{userId:t},throwOnError:!0})).data})}function Re(t){return oe({...Ce(t??""),enabled:!!t})}function Ae({invitation:t}){const s=pe(),a=!t.isClosedToNewApplications;return e.jsxs(J,{to:"/participants/projects/$projectId/{-$slug}",params:{projectId:t.projectId},search:{inviteId:t.invitationId},state:{previousRoute:A},className:"block rounded-xl border border-secondary bg-primary p-4 transition-colors hover:border-primary md:rounded-2xl md:p-6","data-testid":`participant-invitation-card-${t.projectId}`,"data-project-id":t.projectId,children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Y,{kindOfResearch:t.kindOfResearch,researchConductType:t.researchConductType}),e.jsx("span",{"data-testid":`participant-invitation-status-${t.projectId}`,children:e.jsx(Se,{color:a?"warning":"gray",className:"border-none bg-transparent p-0 font-semibold ring-transparent",size:"md",children:a?o._({id:"8LLUt7"}):o._({id:"MtO4oy"})})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-lg font-semibold text-primary",children:["$",t.respondentRemuneration]}),e.jsx("span",{className:"text-md text-tertiary",children:"USD"})]})]}),e.jsxs("div",{className:"mb-4 flex w-full flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"mb-4 flex min-w-0 flex-1 flex-col gap-1 md:mb-0",children:[e.jsx("h3",{className:"font-heading text-md font-semibold text-primary md:text-lg",children:t.name}),e.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 text-xs font-normal text-tertiary opacity-80",children:[e.jsx("span",{children:e.jsx(r,{id:"ffEFpO",values:{0:V(t.invitedAt)}})}
1),t.skipScreenerQuestions?e.jsx("span",{children:e.jsx(r,{id:"oAV2jA"})}):null]})]}),a?e.jsx("div",{...Z,className:"min-w-0 shrink-0 md:flex md:justify-end",children:e.jsx(D,{color:"primary",size:"sm",onClick:n=>{n.preventDefault(),n.stopPropagation(),be(t.projectId,A),s({to:"/participants/projects/$projectId/apply",params:{projectId:t.projectId},search:{inviteId:t.invitationId}})},children:e.jsx(r,{id:"DB8zMK"})})}):null]})]})}const ee=[d.DRAFT,d.EXTERNAL_SCREENER_IN_PROGRESS],De=[d.INVITED,d.SCHEDULED,d.ATTENDED,...ee],Fe=[{id:d.INVITED,label:o._({id:"Dn4OyV"})},{id:d.SCHEDULED,label:o._({id:"4ba0NE"})},{id:d.ATTENDED,label:o._({id:"LsdYZ3"})},{id:d.DRAFT,label:o._({id:"eneWvv"})}];function Le({userId:t}){const[s,a]=c.useState([]),[n,u]=c.useState(""),[h,x]=c.useState("");z(()=>{x(n.trim())},300,[n]);const{data:i,isLoading:m,isFetching:N,error:f,refetch:S,fetchNextPage:I,hasNextPage:b,isFetchingNextPage:g}=W({userId:t,pageSize:20,statuses:s.length>0?s.flatMap(p=>p===d.DRAFT?ee:[p]):De,search:h||void 0}),j=c.useMemo(()=>i?.pages.flatMap(p=>p.results??[])??[],[i]),{data:v,isLoading:C,error:R,refetch:P}=Re(t),E=c.useMemo(()=>{if(s.length>0&&!s.includes(d.INVITED))return[];const p=h.toLowerCase();return(v??[]).filter(ie=>!p||ie.name.toLowerCase().includes(p))},[v,s,h]),l=m||C,F=j.length>0||E.length>0,$=!m&&!g&&N,te=c.useCallback(()=>{I()},[I]),ae=!!n.trim(),q=s.length>0||ae,re=c.useCallback(()=>{a([]),u(""),x("")},[]);return f||R?e.jsx("div",{className:"mx-auto max-w-[var(--max-width-container)] px-4 py-8",children:e.jsx(M,{onRetry:()=>{S(),P()}})}):e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(K,{searchQuery:n,onSearchChange:u,statusFilter:e.jsx(O,{size:"md",placeholder:o._({id:"N40H+G"}),items:Fe,selectedKeys:s,onSelectionChange:p=>{a([...p])},"aria-label":"Filter by status"})}),l&&e.jsx(y,{}),!l&&!F&&!q&&e.jsx(w,{title:e.jsx(r,{id:"cw0ggH"}),message:e.jsx(r,{id:"FsmrcK"}),footer:e.jsx(he,{color:"link-color",size:"md",to:"/participants/my-projects",search:{tab:"applied"},iconTrailing:e.jsx(ve,{className:"size-4"}),children:e.jsx(r,{id:"X6e9j1"})})}),!l&&!F&&q&&e.jsx(w,{title:e.jsx(r,{id:"l5+KZq"}),message:e.jsx(r,{id:"IEwBRJ"}),footer:e.jsx(D,{iconLeading:e.jsx(_,{className:"size-4"}),onClick:re,children:e.jsx(r,{id:"u8JHrO"})})}),$&&e.jsx(y,{}),!l&&!$&&F&&e.jsxs(e.Fragment,{children:[E.map(p=>e.jsx(Ae,{invitation:p},p.invitationId)),j.map(p=>e.jsx(B,{project:p,userId:t},p.projectId)),e.jsx(U,{onLoadMore:te,hasNextPage:b,isFetchingNextPage:g}),g&&e.jsx(y,{}),!b&&e.jsx("div",{className:"py-4 text-center",children:e.jsx("p",{className:"text-sm text-tertiary",children:e.jsx(r,{id:"pkRq+Z"})})})]})]})}function ke({userId:t,pageSize:s=20,statuses:a,includeCount:n=!1,search:u}){const h=u?.trim();return Ie({queryKey:[...Q.pastSurveys.byUserId(t??""),"infinite",a,n,h],queryFn:async({pageParam:x})=>{if(!t)throw new Error("User ID is required");const i=await ue({path:{userId:t},client:G(),query:{page:x,pageSize:s,includeCount:n,statuses:a,search:h||void 0}});if(i.error)throw new Error("Failed to fetch past projects");return i.data??{page:x,pageSize:s,results:[]}},enabled:!!t,initialPageParam:1,getNextPageParam:x=>{const{page:i,pageSize:m,results:N,totalResults:f}=x;if(f!==void 0){const S=Math.ceil(f/m);return i<S?i+1:void 0}if(!(!N||N.length<m))return i+1}})}const se=[{id:d.PAID,label:o._({id:"v4nCHK"})},{id:d.CANCELLED,label:o._({id:"vv7kpg"})},{id:d.NOSHOW,label:o._({id:"pmRlVc"})},{id:d.REJECTEDQUALITY,label:o._({id:"DK+j4c"})},{id:H.NOT_A_FIT,label:o._({id:"19Ylow"})},{id:d.INVALIDRESPONSE,label:o._({id:"gmWUFC"})},{id:H.CLOSED,label:o._({id:"D87pha"})}],Oe=se.map(t=>t.id);function _e({userId:t}){const[s,a]=c.useState([]),[n,u]=c.useState(""),[h,x]=c.useState("");z(()=>{x(n.trim())},300,[n]);const{data:i,isLoading:m,isFetching:N,fetchNextPage:f,error:S,refetch:I,hasNextPage:b,isFetchingNextPage:g}=ke({userId:t,pageSize:20,statuses:s.length>0?s:Oe,search:h||void 0}),j=c.useMemo(()=>i?.pages.flatMap(l=>l.results??[])??[],[i]),v=!m&&!g&&N,C=c.useCallback(()=>{f()},[f]),R=!!n.trim(),P=s.length>0||R,E=c.useCallback(()=>{a([]),u(""),x("")},[]);return S?e.jsx("div",{className:"mx-auto max-w-[var(--max-width-container)] px-4 py-8",children:e.jsx(M,{onRetry:()=>{I()}})}):e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(K,{searchQuery:n,onSearchChange:u,statusFilter:e.jsx(O,{size:"md",placeholder:o._({id:"N40H+G"}),items:se,selectedKeys:s,onSelectionChange:l=>{a([...l])},"aria-label":"Filter by status"})}),m&&e.jsx(y,{}),!m&&j.length===0&&!P&&e.jsx(w,{title:e.jsx(r,{id:"hEbOuZ"}),message:e.jsx(r,{id:"qhOVOQ"})}),!m&&j.length===0&&P&&e.jsx(w,{title:e.jsx(r,{id:"l5+KZq"}),message:e.jsx(r,{id:"IEwBRJ"}),footer:e.jsx(D,{iconLeading:e.jsx(_,{className:"size-4"}),onClick:E,children:e.jsx(r,{id:"u8JHrO"})})}),v&&e.jsx(y,{}),!m&&!v&&j.length>
10&&e.jsxs(e.Fragment,{children:[j.map(l=>e.jsx(B,{project:l,userId:t},l.projectId)),e.jsx(U,{onLoadMore:C,hasNextPage:b,isFetchingNextPage:g}),g&&e.jsx(y,{}),!b&&e.jsx("div",{className:"py-4 text-center",children:e.jsx("p",{className:"text-sm text-tertiary",children:e.jsx(r,{id:"UTn7bo"})})})]})]})}const Ue=[{id:"invited",label:"Invited"},{id:"applied",label:"Applied"},{id:"past",label:"Past projects"}];function xs(){const t=L.useNavigate(),s=L.useSearch(),a=je(),n=s.tab,{user:u}=L.useRouteContext(),h=u.id;c.useEffect(()=>{a?.screen({name:"myProjects",attributes:{tab:n}})},[a,n]);const x=c.useCallback(i=>{i!=="invited"&&i!=="applied"&&i!=="past"||t({search:m=>({...m,tab:i})})},[t]);return e.jsxs("div",{className:"mx-auto max-w-(--max-width-container) px-4 py-8 md:px-8",children:[e.jsx("h1",{className:"mx-0 mb-8 font-heading text-2xl font-semibold text-primary",children:e.jsx(r,{id:"pqIZDv"})}),e.jsxs(T,{className:"h-full",selectedKey:n,onSelectionChange:i=>{x(i)},children:[e.jsx(T.List,{type:"underline",size:"md",items:Ue,children:i=>e.jsx(T.Item,{id:i.id,"data-testid":`participant-my-projects-tab-${i.id}`,children:i.label})}),e.jsx(T.Panel,{id:"invited",className:"mt-6 h-full",children:e.jsx(Le,{userId:h})}),e.jsx(T.Panel,{id:"applied",className:"mt-6 h-full",children:e.jsx(we,{userId:h})}),e.jsx(T.Panel,{id:"past",className:"mt-6 h-full",children:e.jsx(_e,{userId:h})})]})]})}export{xs as component}; 2//# sourceMappingURL=index-BCUWkI20.js.map 3 4//# chunkId=01a0fa4e-7238-78d1-b676-06f6487f2325
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.