@burdenoff/microfe-technospam 2026.1030.6 → 2026.1031.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/technospam/api/technospamApi.d.ts.map +1 -1
- package/dist/technospam/api/technospamApi.js +254 -253
- package/dist/technospam/api/technospamApi.js.map +1 -1
- package/dist/technospam/components/lesson/InteractiveWorkspace.d.ts.map +1 -1
- package/dist/technospam/components/lesson/InteractiveWorkspace.js +87 -80
- package/dist/technospam/components/lesson/InteractiveWorkspace.js.map +1 -1
- package/dist/technospam/lib/errorMessage.d.ts +7 -0
- package/dist/technospam/lib/errorMessage.d.ts.map +1 -0
- package/dist/technospam/lib/errorMessage.js +21 -0
- package/dist/technospam/lib/errorMessage.js.map +1 -0
- package/dist/technospam/lib/toast.js +1 -1
- package/package.json +3 -2
- package/dist/node_modules/sonner/dist/index.js +0 -600
- package/dist/node_modules/sonner/dist/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"technospamApi.js","names":[],"sources":["../../../src/technospam/api/technospamApi.ts"],"sourcesContent":["/**\n * TechnoSpam data layer — Apollo operations + typed hooks over the\n * wspace-technospam-svc subgraph (Tec* fields), reached through the host\n * shell's default workspace ApolloProvider (defaultGateway: \"workspace\").\n *\n * Every page consumes real backend data through these hooks. There is NO mock\n * data. List queries are cursor-paginated: page 1 omits `cursor` entirely\n * (passing cursor: null makes the Prisma cursor resolver 500), \"load more\"\n * passes the previous page's `pageInfo.cursor`.\n */\nimport { useState } from 'react';\nimport { gql, type ErrorLike } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\n\nimport { notify } from '../lib/toast';\n\n/* ------------------------------------------------------------------ enums */\n\nexport type TecCourseLevel = 'BEGINNER' | 'INTERMEDIATE' | 'ADVANCED' | 'EXPERT';\nexport type TecCourseStatus = 'DRAFT' | 'PUBLISHED' | 'ARCHIVED';\nexport type TecLessonKind = 'VIDEO' | 'ARTICLE' | 'INTERACTIVE' | 'QUIZ' | 'PROJECT';\nexport type TecEnrollmentStatus = 'ENROLLED' | 'IN_PROGRESS' | 'COMPLETED' | 'DROPPED';\nexport type TecCertificateStatus = 'ISSUED' | 'REVOKED';\nexport type TecProblemDifficulty = 'EASY' | 'MEDIUM' | 'HARD';\nexport type TecProblemStatus = 'DRAFT' | 'PUBLISHED' | 'ARCHIVED';\nexport type TecInterviewFrequency = 'LOW' | 'MEDIUM' | 'HIGH';\nexport type TecSubmissionVerdict =\n | 'PENDING'\n | 'ACCEPTED'\n | 'WRONG_ANSWER'\n | 'TIME_LIMIT_EXCEEDED'\n | 'RUNTIME_ERROR'\n | 'COMPILE_ERROR';\nexport type TecMentorStatus = 'PENDING' | 'ACTIVE' | 'PAUSED' | 'INACTIVE';\nexport type TecSessionStatus = 'REQUESTED' | 'CONFIRMED' | 'COMPLETED' | 'CANCELLED' | 'NO_SHOW';\nexport type TecHackathonStatus =\n 'DRAFT' | 'REGISTRATION_OPEN' | 'IN_PROGRESS' | 'JUDGING' | 'COMPLETED' | 'CANCELLED';\nexport type TecTeamSubmissionStatus = 'DRAFT' | 'SUBMITTED' | 'DISQUALIFIED' | 'WINNER';\n\n/* ------------------------------------------------------------------ types */\n\nexport interface TecCourse {\n id: string;\n slug: string;\n title: string;\n summary?: string | null;\n topic?: string | null;\n level: TecCourseLevel;\n status: TecCourseStatus;\n tags: string[];\n estimatedMinutes: number;\n instructorId?: string | null;\n /** BOFF-4416: true when this course requires a paid TechnoSpam plan. */\n isPremiumOnly: boolean;\n /**\n * BOFF-4416: computed for the calling workspace — true when this course\n * is `isPremiumOnly` and the workspace has no paid plan. When true, every\n * non-preview lesson's `content` is already null in the API response.\n */\n isLocked: boolean;\n publishedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n lessons?: TecLesson[];\n enrollments?: TecEnrollment[];\n}\n\nexport interface TecLesson {\n id: string;\n courseId: string;\n title: string;\n kind: TecLessonKind;\n content?: string | null;\n position: number;\n estimatedMinutes: number;\n isPreview: boolean;\n /**\n * BOFF-4416: true when this lesson's `content` is gated behind a paid\n * TechnoSpam plan (never true for `isPreview` lessons). `content` is\n * already null in the API response whenever this is true.\n */\n isLocked: boolean;\n /** BOFF-4107 — INTERACTIVE lessons: language slug the workspace runs (e.g. \"python\"). */\n language?: string | null;\n /** INTERACTIVE lessons: code pre-filled in the editor (null when locked). */\n starterCode?: string | null;\n /** INTERACTIVE lessons: default stdin for a run (null when locked). */\n sampleInput?: string | null;\n /** INTERACTIVE lessons: output a correct program prints; a matching run completes the lesson. */\n expectedOutput?: string | null;\n /** QUIZ lessons: questions without the answer key (empty when locked). */\n quizQuestions?: TecQuizQuestion[];\n /** True when the signed-in learner has completed this lesson. */\n completedByMe?: boolean;\n /** Federated wspace-files-svc File (VIDEO lessons); null when locked. */\n file?: {\n id: string;\n name?: string | null;\n mimeType?: string | null;\n downloadUrl?: string | null;\n } | null;\n course?: TecCourse | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** BOFF-4107: a quiz question as a learner sees it (no answer key). */\nexport interface TecQuizQuestion {\n prompt: string;\n options: string[];\n}\n\n/** BOFF-4107: a quiz question with its answer key (lesson-author view). */\nexport interface TecQuizQuestionKey extends TecQuizQuestion {\n correctOption: number;\n explanation?: string | null;\n}\n\nexport type TecLessonRunStatus = 'COMPLETED' | 'WARMING' | 'UNAVAILABLE';\n\nexport interface TecLessonCodeRun {\n lessonId: string;\n status: TecLessonRunStatus;\n language: string;\n stdout: string;\n stderr: string;\n exitCode: number;\n durationMs: number;\n timedOut: boolean;\n memoryLimitExceeded: boolean;\n compileFailed: boolean;\n matchedExpected?: boolean | null;\n lessonCompleted: boolean;\n enrollment?: TecEnrollment | null;\n}\n\nexport interface TecQuizResult {\n lessonId: string;\n score: number;\n correctCount: number;\n totalCount: number;\n passed: boolean;\n passingScore: number;\n results: {\n index: number;\n correct: boolean;\n selectedOption?: number | null;\n correctOption: number;\n explanation?: string | null;\n }[];\n enrollment?: TecEnrollment | null;\n}\n\nexport interface TecEnrollment {\n id: string;\n courseId: string;\n learnerId: string;\n status: TecEnrollmentStatus;\n progressPct: number;\n lessonsCompleted: number;\n startedAt: string;\n lastActiveAt?: string | null;\n completedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n course?: TecCourse | null;\n /** BOFF-4107: first lesson not yet completed; null when every lesson is done. */\n nextLessonId?: string | null;\n}\n\nexport interface TecCertificate {\n id: string;\n courseId: string;\n learnerId: string;\n serial: string;\n score: number;\n status: TecCertificateStatus;\n issuedAt: string;\n revokedAt?: string | null;\n revokeReason?: string | null;\n createdAt: string;\n course?: TecCourse | null;\n}\n\nexport interface TecProblem {\n id: string;\n slug: string;\n title: string;\n statement?: string | null;\n topic?: string | null;\n difficulty: TecProblemDifficulty;\n status: TecProblemStatus;\n tags: string[];\n languages: string[];\n companies: string[];\n roles: string[];\n interviewFrequency?: TecInterviewFrequency | null;\n points: number;\n starterCode?: string | null;\n /** BOFF-4416: true when this problem requires a paid TechnoSpam plan. */\n isPremiumOnly: boolean;\n /**\n * BOFF-4416: computed for the calling workspace — true when this problem\n * is `isPremiumOnly` and the workspace has no paid plan. `statement` /\n * `starterCode` are already null and `publicTestCases` already empty in\n * the API response whenever this is true.\n */\n isLocked: boolean;\n publishedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n submissions?: TecSubmission[];\n /** Worked-example fixtures the grader runs against; PUBLIC cases only. */\n publicTestCases?: TecProblemTestCase[];\n}\n\n/** Visibility of a problem test case. Mirrors TecTestCaseVisibility. */\nexport type TecTestCaseVisibility = 'PUBLIC' | 'HIDDEN';\n\n/** Per-test-case outcome of a graded submission. Mirrors TecTestCaseStatus. */\nexport type TecTestCaseStatus =\n 'PASSED' | 'WRONG_ANSWER' | 'RUNTIME_ERROR' | 'TIME_LIMIT_EXCEEDED' | 'COMPILE_ERROR' | 'SKIPPED';\n\n/**\n * A worked-example fixture shown on the problem page. Only PUBLIC cases are\n * ever returned to a learner, so `input`/`expectedOutput` are always present\n * in practice; they stay optional because the schema allows null for the\n * author-facing redacted shape.\n */\nexport interface TecProblemTestCase {\n id: string;\n problemId: string;\n name: string;\n ordering: number;\n visibility: TecTestCaseVisibility;\n timeLimitMs: number;\n input?: string | null;\n expectedOutput?: string | null;\n}\n\n/** Grading detail for one test case of a submission. */\nexport interface TecTestCaseResult {\n testCaseId: string;\n name: string;\n visibility: TecTestCaseVisibility;\n status: TecTestCaseStatus;\n passed: boolean;\n durationMs: number;\n input?: string | null;\n expectedOutput?: string | null;\n actualOutput?: string | null;\n}\n\nexport interface TecSubmission {\n id: string;\n problemId: string;\n learnerId: string;\n language: string;\n code: string;\n verdict: TecSubmissionVerdict;\n runtimeMs: number;\n pointsAwarded: number;\n passedCount: number;\n totalCount: number;\n stderr?: string | null;\n testResults: TecTestCaseResult[];\n judgedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n problem?: TecProblem | null;\n}\n\nexport interface TecMentor {\n id: string;\n userId: string;\n headline: string;\n role?: string | null;\n bio?: string | null;\n expertise: string[];\n hourlyRate: number;\n currency: string;\n status: TecMentorStatus;\n isAcceptingMentees: boolean;\n ratingAvg: number;\n sessionsCount: number;\n createdAt: string;\n updatedAt: string;\n sessions?: TecMentorSession[];\n}\n\nexport interface TecMentorSession {\n id: string;\n mentorId: string;\n menteeId: string;\n topic: string;\n agenda?: string | null;\n scheduledAt: string;\n durationMinutes: number;\n status: TecSessionStatus;\n meetingUrl?: string | null;\n /** Snapshotted from the mentor's rate at booking time (smallest currency unit). */\n costAmount: number;\n currency: string;\n platformFeeAmount: number;\n rating?: number | null;\n feedback?: string | null;\n completedAt?: string | null;\n cancelledAt?: string | null;\n createdAt: string;\n updatedAt: string;\n mentor?: TecMentor | null;\n}\n\n/** Read-only pricing preview for a not-yet-booked session (see tecCalculateSessionCost). */\nexport interface TecSessionCostEstimate {\n mentorId: string;\n durationMinutes: number;\n hourlyRate: number;\n currency: string;\n costAmount: number;\n platformFeeAmount: number;\n platformFeeBps: number;\n netAmount: number;\n}\n\n/** Calculation/ledger-only record of what a mentor is owed for a completed session (see tecMyPayouts). */\nexport type TecPayoutStatus = 'PENDING' | 'PAID';\n\nexport interface TecMentorPayout {\n id: string;\n mentorId: string;\n sessionId: string;\n grossAmount: number;\n platformFeeAmount: number;\n netAmount: number;\n currency: string;\n status: TecPayoutStatus;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface TecHackathon {\n id: string;\n slug: string;\n title: string;\n theme?: string | null;\n description?: string | null;\n status: TecHackathonStatus;\n startAt: string;\n endAt: string;\n submissionDeadline?: string | null;\n prizePool: number;\n currency: string;\n maxTeamSize: number;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n teams?: TecHackathonTeam[];\n}\n\nexport interface TecHackathonTeam {\n id: string;\n hackathonId: string;\n name: string;\n captainId: string;\n memberIds: string[];\n projectName?: string | null;\n projectUrl?: string | null;\n repoUrl?: string | null;\n pitch?: string | null;\n status: TecTeamSubmissionStatus;\n score: number;\n submittedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n hackathon?: TecHackathon | null;\n}\n\nexport interface TecPageInfo {\n cursor?: string | null;\n hasMore: boolean;\n}\n\nexport interface PaginationInput {\n limit?: number;\n cursor?: string | null;\n}\n\n/** Build a pagination arg that NEVER sends cursor:null (page-1 500 guard). */\nexport function pageArg(limit = 50, cursor?: string | null): { limit: number; cursor?: string } {\n return cursor ? { limit, cursor } : { limit };\n}\n\n/* -------------------------------------------------------------- fragments */\n\nconst COURSE_FIELDS = gql`\n fragment CourseFields on TecCourse {\n id\n slug\n title\n summary\n topic\n level\n status\n tags\n estimatedMinutes\n instructorId\n isPremiumOnly\n isLocked\n publishedAt\n createdAt\n updatedAt\n }\n`;\n\nconst LESSON_FIELDS = gql`\n fragment LessonFields on TecLesson {\n id\n courseId\n title\n kind\n content\n position\n estimatedMinutes\n isPreview\n isLocked\n language\n starterCode\n sampleInput\n expectedOutput\n quizQuestions {\n prompt\n options\n }\n completedByMe\n createdAt\n updatedAt\n }\n`;\n\nconst ENROLLMENT_FIELDS = gql`\n fragment EnrollmentFields on TecEnrollment {\n id\n courseId\n learnerId\n status\n progressPct\n lessonsCompleted\n startedAt\n lastActiveAt\n completedAt\n createdAt\n updatedAt\n }\n`;\n\nconst PROBLEM_FIELDS = gql`\n fragment ProblemFields on TecProblem {\n id\n slug\n title\n statement\n topic\n difficulty\n status\n tags\n languages\n companies\n roles\n interviewFrequency\n points\n starterCode\n isPremiumOnly\n isLocked\n publishedAt\n createdAt\n updatedAt\n }\n`;\n\nconst SUBMISSION_FIELDS = gql`\n fragment SubmissionFields on TecSubmission {\n id\n problemId\n learnerId\n language\n code\n verdict\n runtimeMs\n pointsAwarded\n passedCount\n totalCount\n stderr\n testResults {\n testCaseId\n name\n visibility\n status\n passed\n durationMs\n input\n expectedOutput\n actualOutput\n }\n judgedAt\n createdAt\n updatedAt\n }\n`;\n\nconst PROBLEM_TEST_CASE_FIELDS = gql`\n fragment ProblemTestCaseFields on TecProblemTestCase {\n id\n problemId\n name\n ordering\n visibility\n timeLimitMs\n input\n expectedOutput\n }\n`;\n\nconst MENTOR_FIELDS = gql`\n fragment MentorFields on TecMentor {\n id\n userId\n headline\n role\n bio\n expertise\n hourlyRate\n currency\n status\n isAcceptingMentees\n ratingAvg\n sessionsCount\n createdAt\n updatedAt\n }\n`;\n\nconst SESSION_FIELDS = gql`\n fragment SessionFields on TecMentorSession {\n id\n mentorId\n menteeId\n topic\n agenda\n scheduledAt\n durationMinutes\n status\n meetingUrl\n costAmount\n currency\n platformFeeAmount\n rating\n feedback\n completedAt\n cancelledAt\n createdAt\n updatedAt\n }\n`;\n\nconst HACKATHON_FIELDS = gql`\n fragment HackathonFields on TecHackathon {\n id\n slug\n title\n theme\n description\n status\n startAt\n endAt\n submissionDeadline\n prizePool\n currency\n maxTeamSize\n tags\n createdAt\n updatedAt\n }\n`;\n\nconst TEAM_FIELDS = gql`\n fragment TeamFields on TecHackathonTeam {\n id\n hackathonId\n name\n captainId\n memberIds\n projectName\n projectUrl\n repoUrl\n pitch\n status\n score\n submittedAt\n createdAt\n updatedAt\n }\n`;\n\nconst CERTIFICATE_FIELDS = gql`\n fragment CertificateFields on TecCertificate {\n id\n courseId\n learnerId\n serial\n score\n status\n issuedAt\n revokedAt\n revokeReason\n createdAt\n }\n`;\n\n/* --------------------------------------------------------------- queries */\n\nconst LIST_COURSES = gql`\n ${COURSE_FIELDS}\n query TecListCourses(\n $level: TecCourseLevel\n $status: TecCourseStatus\n $pagination: PaginationInput\n ) {\n tecListCourses(level: $level, status: $status, pagination: $pagination) {\n items {\n ...CourseFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst GET_COURSE = gql`\n ${COURSE_FIELDS}\n ${LESSON_FIELDS}\n ${ENROLLMENT_FIELDS}\n query TecCourse($id: ID!) {\n tecCourse(id: $id) {\n ...CourseFields\n lessons {\n ...LessonFields\n }\n enrollments {\n ...EnrollmentFields\n }\n }\n }\n`;\n\nconst LIST_ENROLLMENTS = gql`\n ${ENROLLMENT_FIELDS}\n ${COURSE_FIELDS}\n query TecListEnrollments(\n $learnerId: ID\n $courseId: ID\n $pagination: PaginationInput\n $startDate: DateTime\n $endDate: DateTime\n ) {\n tecListEnrollments(\n learnerId: $learnerId\n courseId: $courseId\n pagination: $pagination\n startDate: $startDate\n endDate: $endDate\n ) {\n items {\n ...EnrollmentFields\n course {\n ...CourseFields\n }\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst LIST_CERTIFICATES = gql`\n ${CERTIFICATE_FIELDS}\n ${COURSE_FIELDS}\n query TecListCertificates($learnerId: ID, $courseId: ID) {\n tecListCertificates(learnerId: $learnerId, courseId: $courseId) {\n ...CertificateFields\n course {\n ...CourseFields\n }\n }\n }\n`;\n\n/**\n * The calling learner's OWN certificates. Self-scoped (`@rbac(scopeType:\n * \"self\")`) — the resolver forces `learnerId = ctx.actor.id`, so no learnerId\n * variable is ever sent. Learner-facing surfaces must use this instead of\n * `tecListCertificates`, which is gated behind the cross-learner `list-all`\n * action that a plain workspace member does not hold.\n */\nconst MY_CERTIFICATES = gql`\n ${CERTIFICATE_FIELDS}\n ${COURSE_FIELDS}\n query TecMyCertificates($courseId: ID) {\n tecMyCertificates(courseId: $courseId) {\n ...CertificateFields\n course {\n ...CourseFields\n }\n }\n }\n`;\n\nconst LIST_PROBLEMS = gql`\n ${PROBLEM_FIELDS}\n query TecListProblems(\n $difficulty: TecProblemDifficulty\n $status: TecProblemStatus\n $topic: String\n $company: String\n $role: String\n $interviewFrequency: TecInterviewFrequency\n $pagination: PaginationInput\n ) {\n tecListProblems(\n difficulty: $difficulty\n status: $status\n topic: $topic\n company: $company\n role: $role\n interviewFrequency: $interviewFrequency\n pagination: $pagination\n ) {\n items {\n ...ProblemFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst GET_PROBLEM = gql`\n ${PROBLEM_FIELDS}\n ${SUBMISSION_FIELDS}\n ${PROBLEM_TEST_CASE_FIELDS}\n query TecProblem($id: ID!) {\n tecProblem(id: $id) {\n ...ProblemFields\n publicTestCases {\n ...ProblemTestCaseFields\n }\n submissions {\n ...SubmissionFields\n }\n }\n }\n`;\n\nconst REGRADE_SUBMISSION = gql`\n ${SUBMISSION_FIELDS}\n mutation TecRegradeSubmission($id: ID!) {\n tecRegradeSubmission(id: $id) {\n ...SubmissionFields\n }\n }\n`;\n\nconst LIST_SUBMISSIONS = gql`\n ${SUBMISSION_FIELDS}\n ${PROBLEM_FIELDS}\n query TecListSubmissions(\n $learnerId: ID\n $problemId: ID\n $pagination: PaginationInput\n $startDate: DateTime\n $endDate: DateTime\n ) {\n tecListSubmissions(\n learnerId: $learnerId\n problemId: $problemId\n pagination: $pagination\n startDate: $startDate\n endDate: $endDate\n ) {\n items {\n ...SubmissionFields\n problem {\n ...ProblemFields\n }\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst LIST_MENTORS = gql`\n ${MENTOR_FIELDS}\n query TecListMentors($status: TecMentorStatus, $pagination: PaginationInput) {\n tecListMentors(status: $status, pagination: $pagination) {\n items {\n ...MentorFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst GET_MENTOR = gql`\n ${MENTOR_FIELDS}\n ${SESSION_FIELDS}\n query TecMentor($id: ID!) {\n tecMentor(id: $id) {\n ...MentorFields\n sessions {\n ...SessionFields\n }\n }\n }\n`;\n\nconst LIST_SESSIONS = gql`\n ${SESSION_FIELDS}\n ${MENTOR_FIELDS}\n query TecListSessions(\n $mentorId: ID\n $menteeId: ID\n $status: TecSessionStatus\n $pagination: PaginationInput\n ) {\n tecListSessions(\n mentorId: $mentorId\n menteeId: $menteeId\n status: $status\n pagination: $pagination\n ) {\n items {\n ...SessionFields\n mentor {\n ...MentorFields\n }\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst CALCULATE_SESSION_COST = gql`\n query TecCalculateSessionCost($mentorId: ID!, $durationMinutes: Int) {\n tecCalculateSessionCost(mentorId: $mentorId, durationMinutes: $durationMinutes) {\n mentorId\n durationMinutes\n hourlyRate\n currency\n costAmount\n platformFeeAmount\n platformFeeBps\n netAmount\n }\n }\n`;\n\nconst PAYOUT_FIELDS = gql`\n fragment PayoutFields on TecMentorPayout {\n id\n mentorId\n sessionId\n grossAmount\n platformFeeAmount\n netAmount\n currency\n status\n createdAt\n updatedAt\n }\n`;\n\nconst MY_PAYOUTS = gql`\n ${PAYOUT_FIELDS}\n query TecMyPayouts($status: TecPayoutStatus, $pagination: PaginationInput) {\n tecMyPayouts(status: $status, pagination: $pagination) {\n items {\n ...PayoutFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst LIST_HACKATHONS = gql`\n ${HACKATHON_FIELDS}\n query TecListHackathons($status: TecHackathonStatus, $pagination: PaginationInput) {\n tecListHackathons(status: $status, pagination: $pagination) {\n items {\n ...HackathonFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst GET_HACKATHON = gql`\n ${HACKATHON_FIELDS}\n ${TEAM_FIELDS}\n query TecHackathon($id: ID!) {\n tecHackathon(id: $id) {\n ...HackathonFields\n teams {\n ...TeamFields\n }\n }\n }\n`;\n\nconst LIST_TEAMS = gql`\n ${TEAM_FIELDS}\n query TecListTeams($hackathonId: ID!, $pagination: PaginationInput) {\n tecListTeams(hackathonId: $hackathonId, pagination: $pagination) {\n items {\n ...TeamFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst LIST_LESSONS = gql`\n ${LESSON_FIELDS}\n query TecListLessons($courseId: ID!, $pagination: PaginationInput) {\n tecListLessons(courseId: $courseId, pagination: $pagination) {\n items {\n ...LessonFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\n/* ------------------------------------------------------- response typings */\n\ntype Conn<K extends string, T> = Record<K, { items: T[]; pageInfo: TecPageInfo }>;\n\n/* ---------------------------------------------------------- query hooks */\n\nexport const useCoursesQuery = (vars: {\n level?: TecCourseLevel;\n status?: TecCourseStatus;\n pagination?: { limit: number; cursor?: string };\n}) =>\n useQuery<Conn<'tecListCourses', TecCourse>>(LIST_COURSES, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useCourseQuery = (id: string) =>\n useQuery<{ tecCourse: TecCourse | null }>(GET_COURSE, {\n variables: { id },\n skip: !id,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useEnrollmentsQuery = (vars: {\n learnerId?: string;\n courseId?: string;\n startDate?: string;\n endDate?: string;\n}) =>\n useQuery<Conn<'tecListEnrollments', TecEnrollment>>(LIST_ENROLLMENTS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\n/**\n * Cross-learner certificate read (instructor/admin). Requires the `list-all`\n * action — learner surfaces want `useMyCertificatesQuery` instead.\n */\nexport const useCertificatesQuery = (vars: { learnerId?: string; courseId?: string }) =>\n useQuery<{ tecListCertificates: TecCertificate[] }>(LIST_CERTIFICATES, {\n variables: vars,\n fetchPolicy: 'cache-and-network',\n });\n\n/** The signed-in learner's own certificates (self-scoped; no learnerId sent). */\nexport const useMyCertificatesQuery = (vars: { courseId?: string } = {}) =>\n useQuery<{ tecMyCertificates: TecCertificate[] }>(MY_CERTIFICATES, {\n variables: vars,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useProblemsQuery = (vars: {\n difficulty?: TecProblemDifficulty;\n status?: TecProblemStatus;\n topic?: string;\n company?: string;\n role?: string;\n interviewFrequency?: TecInterviewFrequency;\n pagination?: { limit: number; cursor?: string };\n}) =>\n useQuery<Conn<'tecListProblems', TecProblem>>(LIST_PROBLEMS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useProblemQuery = (id: string) =>\n useQuery<{ tecProblem: TecProblem | null }>(GET_PROBLEM, {\n variables: { id },\n skip: !id,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useSubmissionsQuery = (vars: {\n learnerId?: string;\n problemId?: string;\n startDate?: string;\n endDate?: string;\n}) =>\n useQuery<Conn<'tecListSubmissions', TecSubmission>>(LIST_SUBMISSIONS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useMentorsQuery = (vars: {\n status?: TecMentorStatus;\n pagination?: { limit: number; cursor?: string };\n}) =>\n useQuery<Conn<'tecListMentors', TecMentor>>(LIST_MENTORS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useMentorQuery = (id: string) =>\n useQuery<{ tecMentor: TecMentor | null }>(GET_MENTOR, {\n variables: { id },\n skip: !id,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useSessionsQuery = (vars: {\n mentorId?: string;\n menteeId?: string;\n status?: TecSessionStatus;\n pagination?: { limit: number; cursor?: string };\n}) =>\n useQuery<Conn<'tecListSessions', TecMentorSession>>(LIST_SESSIONS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\n/**\n * Live pricing preview for a not-yet-booked session -- refetches whenever\n * mentorId/durationMinutes change (Apollo re-runs on variable change), so\n * the booking form always shows the cost that would actually be snapshotted\n * onto the session by tecBookSession. `skip` while mentorId is empty.\n */\nexport const useSessionCostEstimate = (mentorId: string, durationMinutes: number) =>\n useQuery<{ tecCalculateSessionCost: TecSessionCostEstimate }>(CALCULATE_SESSION_COST, {\n variables: { mentorId, durationMinutes },\n skip: !mentorId || !Number.isFinite(durationMinutes) || durationMinutes <= 0,\n fetchPolicy: 'cache-and-network',\n });\n\n/** The calling mentor's own payout ledger (calculation-only -- see BOFF-4433). */\nexport const useMyPayoutsQuery = (\n vars: { status?: TecPayoutStatus; pagination?: { limit: number; cursor?: string } } = {}\n) =>\n useQuery<Conn<'tecMyPayouts', TecMentorPayout>>(MY_PAYOUTS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useHackathonsQuery = (vars: {\n status?: TecHackathonStatus;\n pagination?: { limit: number; cursor?: string };\n}) =>\n useQuery<Conn<'tecListHackathons', TecHackathon>>(LIST_HACKATHONS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useHackathonQuery = (id: string) =>\n useQuery<{ tecHackathon: TecHackathon | null }>(GET_HACKATHON, {\n variables: { id },\n skip: !id,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useTeamsQuery = (\n hackathonId: string,\n pagination?: { limit: number; cursor?: string }\n) =>\n useQuery<Conn<'tecListTeams', TecHackathonTeam>>(LIST_TEAMS, {\n variables: { hackathonId, pagination: pagination ?? pageArg(50) },\n skip: !hackathonId,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useLessonsQuery = (\n courseId: string,\n pagination?: { limit: number; cursor?: string }\n) =>\n useQuery<Conn<'tecListLessons', TecLesson>>(LIST_LESSONS, {\n variables: { courseId, pagination: pagination ?? pageArg(50) },\n skip: !courseId,\n fetchPolicy: 'cache-and-network',\n });\n\n/* ------------------------------------------------------------ mutations */\n\nconst onMutationError = (error: ErrorLike): void => {\n notify.error('Something went wrong', error.message || 'Please try again.');\n};\n\nconst REFETCH = {\n courses: 'TecListCourses',\n enrollments: 'TecListEnrollments',\n problems: 'TecListProblems',\n submissions: 'TecListSubmissions',\n mentors: 'TecListMentors',\n sessions: 'TecListSessions',\n hackathons: 'TecListHackathons',\n} as const;\n\nconst ENROLL = gql`\n ${ENROLLMENT_FIELDS}\n mutation TecEnroll($input: TecEnrollInput!) {\n tecEnroll(input: $input) {\n ...EnrollmentFields\n }\n }\n`;\n\nconst SUBMIT_SOLUTION = gql`\n ${SUBMISSION_FIELDS}\n mutation TecSubmitSolution($input: TecSubmitSolutionInput!) {\n tecSubmitSolution(input: $input) {\n ...SubmissionFields\n }\n }\n`;\n\nconst BOOK_SESSION = gql`\n ${SESSION_FIELDS}\n mutation TecBookSession($input: TecBookSessionInput!) {\n tecBookSession(input: $input) {\n ...SessionFields\n }\n }\n`;\n\nconst CANCEL_SESSION = gql`\n ${SESSION_FIELDS}\n mutation TecCancelSession($id: ID!) {\n tecCancelSession(id: $id) {\n ...SessionFields\n }\n }\n`;\n\nconst BECOME_MENTOR = gql`\n ${MENTOR_FIELDS}\n mutation TecBecomeMentor($input: TecCreateMentorInput!) {\n tecBecomeMentor(input: $input) {\n ...MentorFields\n }\n }\n`;\n\nconst REGISTER_TEAM = gql`\n ${TEAM_FIELDS}\n mutation TecRegisterTeam($input: TecRegisterTeamInput!) {\n tecRegisterTeam(input: $input) {\n ...TeamFields\n }\n }\n`;\n\nconst SUBMIT_PROJECT = gql`\n ${TEAM_FIELDS}\n mutation TecSubmitProject($input: TecSubmitProjectInput!) {\n tecSubmitProject(input: $input) {\n ...TeamFields\n }\n }\n`;\n\n/* ------- admin / authoring mutations ------- */\n\nconst CREATE_COURSE = gql`\n ${COURSE_FIELDS}\n mutation TecCreateCourse($input: TecCreateCourseInput!) {\n tecCreateCourse(input: $input) {\n ...CourseFields\n }\n }\n`;\n\nconst PUBLISH_COURSE = gql`\n ${COURSE_FIELDS}\n mutation TecPublishCourse($id: ID!) {\n tecPublishCourse(id: $id) {\n ...CourseFields\n }\n }\n`;\n\nconst ARCHIVE_COURSE = gql`\n mutation TecArchiveCourse($id: ID!) {\n tecArchiveCourse(id: $id)\n }\n`;\n\nconst CREATE_LESSON = gql`\n ${LESSON_FIELDS}\n mutation TecCreateLesson($input: TecCreateLessonInput!) {\n tecCreateLesson(input: $input) {\n ...LessonFields\n }\n }\n`;\n\nconst UPDATE_LESSON = gql`\n ${LESSON_FIELDS}\n mutation TecUpdateLesson($id: ID!, $input: TecUpdateLessonInput!) {\n tecUpdateLesson(id: $id, input: $input) {\n ...LessonFields\n }\n }\n`;\n\nconst CREATE_PROBLEM = gql`\n ${PROBLEM_FIELDS}\n mutation TecCreateProblem($input: TecCreateProblemInput!) {\n tecCreateProblem(input: $input) {\n ...ProblemFields\n }\n }\n`;\n\nconst PUBLISH_PROBLEM = gql`\n ${PROBLEM_FIELDS}\n mutation TecPublishProblem($id: ID!) {\n tecPublishProblem(id: $id) {\n ...ProblemFields\n }\n }\n`;\n\nconst CREATE_HACKATHON = gql`\n ${HACKATHON_FIELDS}\n mutation TecCreateHackathon($input: TecCreateHackathonInput!) {\n tecCreateHackathon(input: $input) {\n ...HackathonFields\n }\n }\n`;\n\nconst OPEN_REGISTRATION = gql`\n ${HACKATHON_FIELDS}\n mutation TecOpenRegistration($id: ID!) {\n tecOpenRegistration(id: $id) {\n ...HackathonFields\n }\n }\n`;\n\nconst APPROVE_MENTOR = gql`\n ${MENTOR_FIELDS}\n mutation TecApproveMentor($id: ID!) {\n tecApproveMentor(id: $id) {\n ...MentorFields\n }\n }\n`;\n\nconst SCORE_TEAM = gql`\n ${TEAM_FIELDS}\n mutation TecScoreTeam($id: ID!, $score: Int!, $winner: Boolean) {\n tecScoreTeam(id: $id, score: $score, winner: $winner) {\n ...TeamFields\n }\n }\n`;\n\nconst CONFIRM_SESSION = gql`\n ${SESSION_FIELDS}\n mutation TecConfirmSession($id: ID!, $meetingUrl: String) {\n tecConfirmSession(id: $id, meetingUrl: $meetingUrl) {\n ...SessionFields\n }\n }\n`;\n\nconst COMPLETE_SESSION = gql`\n ${SESSION_FIELDS}\n mutation TecCompleteSession($id: ID!, $rating: Int, $feedback: String) {\n tecCompleteSession(id: $id, rating: $rating, feedback: $feedback) {\n ...SessionFields\n }\n }\n`;\n\nconst GRADE_SUBMISSION = gql`\n ${SUBMISSION_FIELDS}\n mutation TecGradeSubmission($id: ID!, $verdict: TecSubmissionVerdict!, $runtimeMs: Int) {\n tecGradeSubmission(id: $id, verdict: $verdict, runtimeMs: $runtimeMs) {\n ...SubmissionFields\n }\n }\n`;\n\nconst ISSUE_CERTIFICATE = gql`\n ${CERTIFICATE_FIELDS}\n mutation TecIssueCertificate($courseId: ID!, $learnerId: ID!, $score: Int!) {\n tecIssueCertificate(courseId: $courseId, learnerId: $learnerId, score: $score) {\n ...CertificateFields\n }\n }\n`;\n\nconst REVOKE_CERTIFICATE = gql`\n ${CERTIFICATE_FIELDS}\n mutation TecRevokeCertificate($id: ID!, $reason: String) {\n tecRevokeCertificate(id: $id, reason: $reason) {\n ...CertificateFields\n }\n }\n`;\n\nconst START_HACKATHON = gql`\n ${HACKATHON_FIELDS}\n mutation TecStartHackathon($id: ID!) {\n tecStartHackathon(id: $id) {\n ...HackathonFields\n }\n }\n`;\n\nconst START_JUDGING = gql`\n ${HACKATHON_FIELDS}\n mutation TecStartJudging($id: ID!) {\n tecStartJudging(id: $id) {\n ...HackathonFields\n }\n }\n`;\n\nconst COMPLETE_HACKATHON = gql`\n ${HACKATHON_FIELDS}\n mutation TecCompleteHackathon($id: ID!) {\n tecCompleteHackathon(id: $id) {\n ...HackathonFields\n }\n }\n`;\n\n/* ---------------------------------------------------------- mutation hooks */\n\nexport const useEnroll = () =>\n useMutation<{ tecEnroll: TecEnrollment }>(ENROLL, {\n onError: onMutationError,\n refetchQueries: [REFETCH.enrollments, REFETCH.courses],\n });\n\nexport const useSubmitSolution = () =>\n useMutation<{ tecSubmitSolution: TecSubmission }>(SUBMIT_SOLUTION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.submissions],\n });\n\n/**\n * Re-run the grader for a submission. Used by the problem page when a verdict\n * came back PENDING (grader unavailable at submit time) so a learner can retry\n * without resubmitting identical code.\n */\nexport const useRegradeSubmission = () =>\n useMutation<{ tecRegradeSubmission: TecSubmission }>(REGRADE_SUBMISSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.submissions],\n });\n\nexport const useBookSession = () =>\n useMutation<{ tecBookSession: TecMentorSession }>(BOOK_SESSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.sessions, REFETCH.mentors],\n });\n\nexport const useCancelSession = () =>\n useMutation<{ tecCancelSession: TecMentorSession }>(CANCEL_SESSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.sessions],\n });\n\nexport const useBecomeMentor = () =>\n useMutation<{ tecBecomeMentor: TecMentor }>(BECOME_MENTOR, {\n onError: onMutationError,\n refetchQueries: [REFETCH.mentors],\n });\n\nexport const useRegisterTeam = () =>\n useMutation<{ tecRegisterTeam: TecHackathonTeam }>(REGISTER_TEAM, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\nexport const useSubmitProject = () =>\n useMutation<{ tecSubmitProject: TecHackathonTeam }>(SUBMIT_PROJECT, {\n onError: onMutationError,\n });\n\nexport const useCreateCourse = () =>\n useMutation<{ tecCreateCourse: TecCourse }>(CREATE_COURSE, {\n onError: onMutationError,\n refetchQueries: [REFETCH.courses],\n });\n\nexport const usePublishCourse = () =>\n useMutation<{ tecPublishCourse: TecCourse }>(PUBLISH_COURSE, {\n onError: onMutationError,\n refetchQueries: [REFETCH.courses],\n });\n\nexport const useArchiveCourse = () =>\n useMutation<{ tecArchiveCourse: boolean }>(ARCHIVE_COURSE, {\n onError: onMutationError,\n refetchQueries: [REFETCH.courses],\n });\n\nexport const useCreateLesson = () =>\n useMutation<{ tecCreateLesson: TecLesson }>(CREATE_LESSON, { onError: onMutationError });\n\n/**\n * Edit an already-authored lesson (title/kind/content/minutes/preview/position).\n * Every field on TecUpdateLessonInput is optional — send only what changed.\n */\nexport const useUpdateLesson = () =>\n useMutation<{ tecUpdateLesson: TecLesson }>(UPDATE_LESSON, { onError: onMutationError });\n\nexport const useCreateProblem = () =>\n useMutation<{ tecCreateProblem: TecProblem }>(CREATE_PROBLEM, {\n onError: onMutationError,\n refetchQueries: [REFETCH.problems],\n });\n\nexport const usePublishProblem = () =>\n useMutation<{ tecPublishProblem: TecProblem }>(PUBLISH_PROBLEM, {\n onError: onMutationError,\n refetchQueries: [REFETCH.problems],\n });\n\nexport const useCreateHackathon = () =>\n useMutation<{ tecCreateHackathon: TecHackathon }>(CREATE_HACKATHON, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\nexport const useOpenRegistration = () =>\n useMutation<{ tecOpenRegistration: TecHackathon }>(OPEN_REGISTRATION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\nexport const useApproveMentor = () =>\n useMutation<{ tecApproveMentor: TecMentor }>(APPROVE_MENTOR, {\n onError: onMutationError,\n refetchQueries: [REFETCH.mentors],\n });\n\nexport const useScoreTeam = () =>\n useMutation<{ tecScoreTeam: TecHackathonTeam }>(SCORE_TEAM, { onError: onMutationError });\n\nexport const useConfirmSession = () =>\n useMutation<{ tecConfirmSession: TecMentorSession }>(CONFIRM_SESSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.sessions],\n });\n\nexport const useCompleteSession = () =>\n useMutation<{ tecCompleteSession: TecMentorSession }>(COMPLETE_SESSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.sessions],\n });\n\nexport const useGradeSubmission = () =>\n useMutation<{ tecGradeSubmission: TecSubmission }>(GRADE_SUBMISSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.submissions],\n });\n\nexport const useIssueCertificate = () =>\n useMutation<{ tecIssueCertificate: TecCertificate }>(ISSUE_CERTIFICATE, {\n onError: onMutationError,\n });\n\nexport const useRevokeCertificate = () =>\n useMutation<{ tecRevokeCertificate: TecCertificate }>(REVOKE_CERTIFICATE, {\n onError: onMutationError,\n });\n\nexport const useStartHackathon = () =>\n useMutation<{ tecStartHackathon: TecHackathon }>(START_HACKATHON, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\nexport const useStartJudging = () =>\n useMutation<{ tecStartJudging: TecHackathon }>(START_JUDGING, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\nexport const useCompleteHackathon = () =>\n useMutation<{ tecCompleteHackathon: TecHackathon }>(COMPLETE_HACKATHON, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\n/* ============================================================ Study Planner\n * BOFF-4415 — deterministic, rule-based goal -> plan scheduler. NOT an LLM\n * feature; see the backend StudyPlanService honesty note. Every query/\n * mutation below is self-scoped (learnerId comes from the authenticated\n * actor server-side) so no learnerId variable is ever sent from the client.\n * ========================================================================= */\n\nexport type TecStudyPlanStatus = 'ACTIVE' | 'COMPLETED' | 'ARCHIVED';\nexport type TecStudyPlanStepKind = 'COURSE' | 'PROBLEM';\nexport type TecStudyPlanStepStatus = 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'SKIPPED';\n\nexport interface TecStudyPlanStep {\n id: string;\n order: number;\n kind: TecStudyPlanStepKind;\n targetId: string;\n title: string;\n scheduledWeek: number;\n status: TecStudyPlanStepStatus;\n rationale: string;\n estimatedMinutes: number;\n completedAt?: string | null;\n}\n\nexport interface TecStudyPlan {\n id: string;\n goal: string;\n topic?: string | null;\n timeframeWeeks: number;\n status: TecStudyPlanStatus;\n targetCompletionDate?: string | null;\n progressPct: number;\n totalSteps: number;\n completedSteps: number;\n createdAt: string;\n steps: TecStudyPlanStep[];\n}\n\nconst STUDY_PLAN_STEP_FIELDS = gql`\n fragment StudyPlanStepFields on TecStudyPlanStep {\n id\n order\n kind\n targetId\n title\n scheduledWeek\n status\n rationale\n estimatedMinutes\n completedAt\n }\n`;\n\nconst STUDY_PLAN_FIELDS = gql`\n ${STUDY_PLAN_STEP_FIELDS}\n fragment StudyPlanFields on TecStudyPlan {\n id\n goal\n topic\n timeframeWeeks\n status\n targetCompletionDate\n progressPct\n totalSteps\n completedSteps\n createdAt\n steps {\n ...StudyPlanStepFields\n }\n }\n`;\n\nconst LIST_MY_STUDY_PLANS = gql`\n ${STUDY_PLAN_FIELDS}\n query TecMyStudyPlans {\n tecMyStudyPlans {\n items {\n ...StudyPlanFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst GENERATE_STUDY_PLAN = gql`\n ${STUDY_PLAN_FIELDS}\n mutation TecGenerateStudyPlan($input: TecGenerateStudyPlanInput!) {\n tecGenerateStudyPlan(input: $input) {\n ...StudyPlanFields\n }\n }\n`;\n\nconst UPDATE_STUDY_PLAN_STEP_STATUS = gql`\n ${STUDY_PLAN_STEP_FIELDS}\n mutation TecUpdateStudyPlanStepStatus($input: TecUpdateStudyPlanStepStatusInput!) {\n tecUpdateStudyPlanStepStatus(input: $input) {\n ...StudyPlanStepFields\n }\n }\n`;\n\nconst ARCHIVE_STUDY_PLAN = gql`\n mutation TecArchiveStudyPlan($id: ID!) {\n tecArchiveStudyPlan(id: $id)\n }\n`;\n\nexport const useMyStudyPlansQuery = () =>\n useQuery<{ tecMyStudyPlans: { items: TecStudyPlan[]; pageInfo: TecPageInfo } }>(\n LIST_MY_STUDY_PLANS,\n {\n fetchPolicy: 'cache-and-network',\n }\n );\n\nexport const useGenerateStudyPlan = () =>\n useMutation<{ tecGenerateStudyPlan: TecStudyPlan }>(GENERATE_STUDY_PLAN, {\n onError: onMutationError,\n refetchQueries: ['TecMyStudyPlans'],\n });\n\nexport const useUpdateStudyPlanStepStatus = () =>\n useMutation<{ tecUpdateStudyPlanStepStatus: TecStudyPlanStep }>(UPDATE_STUDY_PLAN_STEP_STATUS, {\n onError: onMutationError,\n refetchQueries: ['TecMyStudyPlans'],\n });\n\nexport const useArchiveStudyPlan = () =>\n useMutation<{ tecArchiveStudyPlan: boolean }>(ARCHIVE_STUDY_PLAN, {\n onError: onMutationError,\n refetchQueries: ['TecMyStudyPlans'],\n });\n\n/* ================================================================ Portfolio\n * BOFF-4432 — learner-curated showcase of real completed hackathon\n * projects, certificates, and courses. `tecPublicPortfolio` is a public,\n * unauthenticated field (@rbac public: true) reached through the same\n * gateway; there is no separate unauthenticated *page* wired up yet (see\n * ApplicationsPortfolioPagePage's deferred-scope note).\n * ========================================================================= */\n\nexport type TecPortfolioItemKind = 'HACKATHON_PROJECT' | 'CERTIFICATE' | 'COURSE_COMPLETION';\n\nexport interface TecPortfolioItem {\n id: string;\n kind: TecPortfolioItemKind;\n sourceId: string;\n title: string;\n description?: string | null;\n link?: string | null;\n completionDate: string;\n order: number;\n}\n\nexport interface TecPortfolio {\n id: string;\n isPublished: boolean;\n publicSlug?: string | null;\n publishedAt?: string | null;\n items: TecPortfolioItem[];\n}\n\nconst PORTFOLIO_ITEM_FIELDS = gql`\n fragment PortfolioItemFields on TecPortfolioItem {\n id\n kind\n sourceId\n title\n description\n link\n completionDate\n order\n }\n`;\n\nconst PORTFOLIO_FIELDS = gql`\n ${PORTFOLIO_ITEM_FIELDS}\n fragment PortfolioFields on TecPortfolio {\n id\n isPublished\n publicSlug\n publishedAt\n items {\n ...PortfolioItemFields\n }\n }\n`;\n\nconst GET_MY_PORTFOLIO = gql`\n ${PORTFOLIO_FIELDS}\n query TecMyPortfolio {\n tecMyPortfolio {\n ...PortfolioFields\n }\n }\n`;\n\nconst ADD_PORTFOLIO_ITEM = gql`\n ${PORTFOLIO_ITEM_FIELDS}\n mutation TecAddPortfolioItem($input: TecAddPortfolioItemInput!) {\n tecAddPortfolioItem(input: $input) {\n ...PortfolioItemFields\n }\n }\n`;\n\nconst REORDER_PORTFOLIO_ITEMS = gql`\n ${PORTFOLIO_FIELDS}\n mutation TecReorderPortfolioItems($input: TecReorderPortfolioItemsInput!) {\n tecReorderPortfolioItems(input: $input) {\n ...PortfolioFields\n }\n }\n`;\n\nconst REMOVE_PORTFOLIO_ITEM = gql`\n mutation TecRemovePortfolioItem($id: ID!) {\n tecRemovePortfolioItem(id: $id)\n }\n`;\n\nconst PUBLISH_PORTFOLIO = gql`\n ${PORTFOLIO_FIELDS}\n mutation TecPublishPortfolio {\n tecPublishPortfolio {\n ...PortfolioFields\n }\n }\n`;\n\nconst UNPUBLISH_PORTFOLIO = gql`\n ${PORTFOLIO_FIELDS}\n mutation TecUnpublishPortfolio {\n tecUnpublishPortfolio {\n ...PortfolioFields\n }\n }\n`;\n\nexport const useMyPortfolioQuery = () =>\n useQuery<{ tecMyPortfolio: TecPortfolio }>(GET_MY_PORTFOLIO, {\n fetchPolicy: 'cache-and-network',\n });\n\nconst REFETCH_PORTFOLIO = ['TecMyPortfolio'];\n\nexport const useAddPortfolioItem = () =>\n useMutation<{ tecAddPortfolioItem: TecPortfolioItem }>(ADD_PORTFOLIO_ITEM, {\n onError: onMutationError,\n refetchQueries: REFETCH_PORTFOLIO,\n });\n\nexport const useReorderPortfolioItems = () =>\n useMutation<{ tecReorderPortfolioItems: TecPortfolio }>(REORDER_PORTFOLIO_ITEMS, {\n onError: onMutationError,\n });\n\nexport const useRemovePortfolioItem = () =>\n useMutation<{ tecRemovePortfolioItem: boolean }>(REMOVE_PORTFOLIO_ITEM, {\n onError: onMutationError,\n refetchQueries: REFETCH_PORTFOLIO,\n });\n\nexport const usePublishPortfolio = () =>\n useMutation<{ tecPublishPortfolio: TecPortfolio }>(PUBLISH_PORTFOLIO, {\n onError: onMutationError,\n refetchQueries: REFETCH_PORTFOLIO,\n });\n\nexport const useUnpublishPortfolio = () =>\n useMutation<{ tecUnpublishPortfolio: TecPortfolio }>(UNPUBLISH_PORTFOLIO, {\n onError: onMutationError,\n refetchQueries: REFETCH_PORTFOLIO,\n });\n\n/* ------------------------------------------------ TechnoSage review (BOFF-3841) */\n\nexport type TecReviewSource = 'AI' | 'RULES';\n\n/**\n * TechnoSage's explanation of one of the caller's own graded submissions.\n * It explains the grader's verdict and never changes it. `source` says who\n * wrote it: a model (AI) or the grader output alone (RULES).\n */\nexport interface TecSubmissionReview {\n id: string;\n submissionId: string;\n problemId: string;\n verdict: TecSubmissionVerdict;\n summary: string;\n failureExplanation: string;\n conceptsToRevisit: string[];\n suggestedProblems: Array<Pick<TecProblem, 'id' | 'title' | 'difficulty' | 'topic'>>;\n source: TecReviewSource;\n model: string | null;\n createdAt: string;\n}\n\nconst SUBMISSION_REVIEW_FIELDS = gql`\n fragment SubmissionReviewFields on TecSubmissionReview {\n id\n submissionId\n problemId\n verdict\n summary\n failureExplanation\n conceptsToRevisit\n suggestedProblems {\n id\n title\n difficulty\n topic\n }\n source\n model\n createdAt\n }\n`;\n\nconst MY_SUBMISSION_REVIEW = gql`\n ${SUBMISSION_REVIEW_FIELDS}\n query TecMySubmissionReview($submissionId: ID!) {\n tecMySubmissionReview(submissionId: $submissionId) {\n ...SubmissionReviewFields\n }\n }\n`;\n\nconst REVIEW_SUBMISSION = gql`\n ${SUBMISSION_REVIEW_FIELDS}\n mutation TecReviewSubmission($submissionId: ID!) {\n tecReviewSubmission(submissionId: $submissionId) {\n ...SubmissionReviewFields\n }\n }\n`;\n\n/** The stored review of a submission, if the learner already asked for one. */\nexport const useMySubmissionReviewQuery = (submissionId: string | null) =>\n useQuery<{ tecMySubmissionReview: TecSubmissionReview | null }>(MY_SUBMISSION_REVIEW, {\n variables: { submissionId: submissionId ?? '' },\n skip: !submissionId,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useReviewSubmission = () =>\n useMutation<{ tecReviewSubmission: TecSubmissionReview }>(REVIEW_SUBMISSION, {\n onError: onMutationError,\n refetchQueries: ['TecMySubmissionReview'],\n });\n\n/* ------------------------------------------------------- pagination helper */\n\nexport interface PageLimit {\n limit: number;\n more: () => void;\n}\n\n/**\n * Simple, robust \"load more\". The backend paginates with `take = limit + 1`\n * (offset is ignored; only `cursor` shifts the window), so a larger `limit`\n * simply fetches more rows from the top and `pageInfo.hasMore` reports whether\n * still more exist. Growing the limit avoids cursor-merge/fetchMore complexity\n * and never sends `cursor: null` (the page-1 500 guard). Pass `limit` into the\n * query's `pageArg` and render <LoadMore hasMore={...} onClick={more} />.\n */\nexport function usePageLimit(step = 24, initial = 24): PageLimit {\n const [limit, setLimit] = useState(initial);\n return { limit, more: () => setLimit((l) => l + step) };\n}\n\n/* ------------------------------------------------- lesson player (BOFF-4107) */\n\nconst GET_LESSON_PLAYER = gql`\n ${LESSON_FIELDS}\n ${COURSE_FIELDS}\n ${ENROLLMENT_FIELDS}\n query TecLessonPlayer($lessonId: ID!, $courseId: ID!) {\n tecLesson(id: $lessonId) {\n ...LessonFields\n file {\n id\n name\n mimeType\n downloadUrl\n }\n }\n tecCourse(id: $courseId) {\n ...CourseFields\n lessons {\n id\n courseId\n title\n kind\n position\n estimatedMinutes\n isPreview\n isLocked\n completedByMe\n }\n }\n tecMyEnrollments(courseId: $courseId, pagination: { limit: 1 }) {\n items {\n ...EnrollmentFields\n nextLessonId\n }\n }\n }\n`;\n\n/**\n * The signed-in learner's own enrollments with where \"Resume\" should land.\n * Self-scoped (`tecMyEnrollments`); used by My Learning and the dashboard to\n * deep-link straight into the next lesson.\n */\nconst MY_NEXT_LESSONS = gql`\n query TecMyNextLessons($pagination: PaginationInput) {\n tecMyEnrollments(pagination: $pagination) {\n items {\n id\n courseId\n nextLessonId\n }\n }\n }\n`;\n\nconst LESSON_QUIZ_KEY = gql`\n query TecLessonQuizKey($lessonId: ID!) {\n tecLessonQuizKey(lessonId: $lessonId) {\n prompt\n options\n correctOption\n explanation\n }\n }\n`;\n\nconst COMPLETE_LESSON = gql`\n ${ENROLLMENT_FIELDS}\n mutation TecCompleteLesson($lessonId: ID!) {\n tecCompleteLesson(lessonId: $lessonId) {\n ...EnrollmentFields\n nextLessonId\n }\n }\n`;\n\nconst SUBMIT_LESSON_QUIZ = gql`\n ${ENROLLMENT_FIELDS}\n mutation TecSubmitLessonQuiz($lessonId: ID!, $answers: [Int!]!) {\n tecSubmitLessonQuiz(lessonId: $lessonId, answers: $answers) {\n lessonId\n score\n correctCount\n totalCount\n passed\n passingScore\n results {\n index\n correct\n selectedOption\n correctOption\n explanation\n }\n enrollment {\n ...EnrollmentFields\n nextLessonId\n }\n }\n }\n`;\n\nconst RUN_LESSON_CODE = gql`\n ${ENROLLMENT_FIELDS}\n mutation TecRunLessonCode($input: TecRunLessonCodeInput!) {\n tecRunLessonCode(input: $input) {\n lessonId\n status\n language\n stdout\n stderr\n exitCode\n durationMs\n timedOut\n memoryLimitExceeded\n compileFailed\n matchedExpected\n lessonCompleted\n enrollment {\n ...EnrollmentFields\n nextLessonId\n }\n }\n }\n`;\n\nexport interface LessonPlayerData {\n tecLesson: TecLesson | null;\n tecCourse: TecCourse | null;\n tecMyEnrollments: { items: TecEnrollment[] };\n}\n\nexport const useLessonPlayerQuery = (courseId: string, lessonId: string) =>\n useQuery<LessonPlayerData>(GET_LESSON_PLAYER, {\n variables: { courseId, lessonId },\n skip: !courseId || !lessonId,\n fetchPolicy: 'cache-and-network',\n });\n\n/** courseId → next lesson id for the signed-in learner's enrollments. */\nexport const useMyNextLessonsQuery = () =>\n useQuery<{\n tecMyEnrollments: { items: Pick<TecEnrollment, 'id' | 'courseId' | 'nextLessonId'>[] };\n }>(MY_NEXT_LESSONS, {\n variables: { pagination: pageArg(100) },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useLessonQuizKeyQuery = (lessonId: string, skip = false) =>\n useQuery<{ tecLessonQuizKey: TecQuizQuestionKey[] }>(LESSON_QUIZ_KEY, {\n variables: { lessonId },\n skip: skip || !lessonId,\n fetchPolicy: 'network-only',\n });\n\nconst LESSON_PROGRESS_REFETCH = [\n 'TecLessonPlayer',\n 'TecCourse',\n 'TecMyNextLessons',\n REFETCH.enrollments,\n];\n\nexport const useCompleteLesson = () =>\n useMutation<{ tecCompleteLesson: TecEnrollment }>(COMPLETE_LESSON, {\n onError: onMutationError,\n refetchQueries: LESSON_PROGRESS_REFETCH,\n });\n\nexport const useSubmitLessonQuiz = () =>\n useMutation<{ tecSubmitLessonQuiz: TecQuizResult }>(SUBMIT_LESSON_QUIZ, {\n onError: onMutationError,\n refetchQueries: LESSON_PROGRESS_REFETCH,\n });\n\n/**\n * Runs code for an INTERACTIVE lesson. No refetch here: the page refetches\n * only when a run actually completed the lesson, so polling a warming\n * sandbox does not reload the page each time.\n */\nexport const useRunLessonCode = () =>\n useMutation<{ tecRunLessonCode: TecLessonCodeRun }>(RUN_LESSON_CODE, {\n onError: onMutationError,\n });\n"],"mappings":";;;;;AAqYA,SAAgB,EAAQ,IAAQ,IAAI,GAA4D;AAC9F,QAAO,IAAS;EAAE;EAAO;EAAQ,GAAG,EAAE,UAAO;;AAK/C,IAAM,IAAgB,CAAG;;;;;;;;;;;;;;;;;;GAoBnB,IAAgB,CAAG;;;;;;;;;;;;;;;;;;;;;;;GAyBnB,IAAoB,CAAG;;;;;;;;;;;;;;GAgBvB,IAAiB,CAAG;;;;;;;;;;;;;;;;;;;;;;GAwBpB,IAAoB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BvB,IAA2B,CAAG;;;;;;;;;;;GAa9B,IAAgB,CAAG;;;;;;;;;;;;;;;;;GAmBnB,IAAiB,CAAG;;;;;;;;;;;;;;;;;;;;;GAuBpB,IAAmB,CAAG;;;;;;;;;;;;;;;;;;GAoBtB,IAAc,CAAG;;;;;;;;;;;;;;;;;GAmBjB,IAAqB,CAAG;;;;;;;;;;;;;GAiBxB,IAAe,CAAG;IACpB,EAAc;;;;;;;;;;;;;;;;GAkBZ,KAAa,CAAG;IAClB,EAAc;IACd,EAAc;IACd,EAAkB;;;;;;;;;;;;GAchB,KAAmB,CAAG;IACxB,EAAkB;IAClB,EAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BZ,KAAoB,CAAG;IACzB,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;;;;;;GAYrB,KAAkB,CAAG;;;;;;;;;GAWrB,KAAkB,CAAG;IACvB,EAAkB;;;;;;;GAShB,KAAqB,CAAG;IAC1B,EAAkB;;;;;;;;;;;;;;;;;;;;;;GAwBhB,KAAkB,CAAG;IACvB,EAAkB;;;;;;;;;;;;;;;;;;;;;GA6BT,MAAwB,GAAkB,MACrD,EAA2B,IAAmB;CAC5C,WAAW;EAAE;EAAU;EAAU;CACjC,MAAM,CAAC,KAAY,CAAC;CACpB,aAAa;CACd,CAAC,EAGS,WACX,EAEG,IAAiB;CAClB,WAAW,EAAE,YAAY,EAAQ,IAAI,EAAE;CACvC,aAAa;CACd,CAAC,EAES,KAAyB,GAAkB,IAAO,OAC7D,EAAqD,IAAiB;CACpE,WAAW,EAAE,aAAU;CACvB,MAAM,KAAQ,CAAC;CACf,aAAa;CACd,CAAC,EAEE,IAA0B;CAC9B;CACA;CACA;CACA,EAAQ;CACT,EAEY,WACX,EAAkD,IAAiB;CACjE,SAAS;CACT,gBAAgB;CACjB,CAAC,EAES,WACX,EAAoD,IAAoB;CACtE,SAAS;CACT,gBAAgB;CACjB,CAAC,EAOS,WACX,EAAoD,IAAiB,EACnE,SAAS,GACV,CAAC"}
|
|
1
|
+
{"version":3,"file":"technospamApi.js","names":[],"sources":["../../../src/technospam/api/technospamApi.ts"],"sourcesContent":["/**\n * TechnoSpam data layer — Apollo operations + typed hooks over the\n * wspace-technospam-svc subgraph (Tec* fields), reached through the host\n * shell's default workspace ApolloProvider (defaultGateway: \"workspace\").\n *\n * Every page consumes real backend data through these hooks. There is NO mock\n * data. List queries are cursor-paginated: page 1 omits `cursor` entirely\n * (passing cursor: null makes the Prisma cursor resolver 500), \"load more\"\n * passes the previous page's `pageInfo.cursor`.\n */\nimport { useState } from 'react';\nimport { gql, type ErrorLike } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\n\nimport { notify } from '../lib/toast';\nimport { userMessageFromError } from '../lib/errorMessage';\n\n/* ------------------------------------------------------------------ enums */\n\nexport type TecCourseLevel = 'BEGINNER' | 'INTERMEDIATE' | 'ADVANCED' | 'EXPERT';\nexport type TecCourseStatus = 'DRAFT' | 'PUBLISHED' | 'ARCHIVED';\nexport type TecLessonKind = 'VIDEO' | 'ARTICLE' | 'INTERACTIVE' | 'QUIZ' | 'PROJECT';\nexport type TecEnrollmentStatus = 'ENROLLED' | 'IN_PROGRESS' | 'COMPLETED' | 'DROPPED';\nexport type TecCertificateStatus = 'ISSUED' | 'REVOKED';\nexport type TecProblemDifficulty = 'EASY' | 'MEDIUM' | 'HARD';\nexport type TecProblemStatus = 'DRAFT' | 'PUBLISHED' | 'ARCHIVED';\nexport type TecInterviewFrequency = 'LOW' | 'MEDIUM' | 'HIGH';\nexport type TecSubmissionVerdict =\n | 'PENDING'\n | 'ACCEPTED'\n | 'WRONG_ANSWER'\n | 'TIME_LIMIT_EXCEEDED'\n | 'RUNTIME_ERROR'\n | 'COMPILE_ERROR';\nexport type TecMentorStatus = 'PENDING' | 'ACTIVE' | 'PAUSED' | 'INACTIVE';\nexport type TecSessionStatus = 'REQUESTED' | 'CONFIRMED' | 'COMPLETED' | 'CANCELLED' | 'NO_SHOW';\nexport type TecHackathonStatus =\n 'DRAFT' | 'REGISTRATION_OPEN' | 'IN_PROGRESS' | 'JUDGING' | 'COMPLETED' | 'CANCELLED';\nexport type TecTeamSubmissionStatus = 'DRAFT' | 'SUBMITTED' | 'DISQUALIFIED' | 'WINNER';\n\n/* ------------------------------------------------------------------ types */\n\nexport interface TecCourse {\n id: string;\n slug: string;\n title: string;\n summary?: string | null;\n topic?: string | null;\n level: TecCourseLevel;\n status: TecCourseStatus;\n tags: string[];\n estimatedMinutes: number;\n instructorId?: string | null;\n /** BOFF-4416: true when this course requires a paid TechnoSpam plan. */\n isPremiumOnly: boolean;\n /**\n * BOFF-4416: computed for the calling workspace — true when this course\n * is `isPremiumOnly` and the workspace has no paid plan. When true, every\n * non-preview lesson's `content` is already null in the API response.\n */\n isLocked: boolean;\n publishedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n lessons?: TecLesson[];\n enrollments?: TecEnrollment[];\n}\n\nexport interface TecLesson {\n id: string;\n courseId: string;\n title: string;\n kind: TecLessonKind;\n content?: string | null;\n position: number;\n estimatedMinutes: number;\n isPreview: boolean;\n /**\n * BOFF-4416: true when this lesson's `content` is gated behind a paid\n * TechnoSpam plan (never true for `isPreview` lessons). `content` is\n * already null in the API response whenever this is true.\n */\n isLocked: boolean;\n /** BOFF-4107 — INTERACTIVE lessons: language slug the workspace runs (e.g. \"python\"). */\n language?: string | null;\n /** INTERACTIVE lessons: code pre-filled in the editor (null when locked). */\n starterCode?: string | null;\n /** INTERACTIVE lessons: default stdin for a run (null when locked). */\n sampleInput?: string | null;\n /** INTERACTIVE lessons: output a correct program prints; a matching run completes the lesson. */\n expectedOutput?: string | null;\n /** QUIZ lessons: questions without the answer key (empty when locked). */\n quizQuestions?: TecQuizQuestion[];\n /** True when the signed-in learner has completed this lesson. */\n completedByMe?: boolean;\n /** Federated wspace-files-svc File (VIDEO lessons); null when locked. */\n file?: {\n id: string;\n name?: string | null;\n mimeType?: string | null;\n downloadUrl?: string | null;\n } | null;\n course?: TecCourse | null;\n createdAt: string;\n updatedAt: string;\n}\n\n/** BOFF-4107: a quiz question as a learner sees it (no answer key). */\nexport interface TecQuizQuestion {\n prompt: string;\n options: string[];\n}\n\n/** BOFF-4107: a quiz question with its answer key (lesson-author view). */\nexport interface TecQuizQuestionKey extends TecQuizQuestion {\n correctOption: number;\n explanation?: string | null;\n}\n\nexport type TecLessonRunStatus = 'COMPLETED' | 'WARMING' | 'UNAVAILABLE';\n\nexport interface TecLessonCodeRun {\n lessonId: string;\n status: TecLessonRunStatus;\n language: string;\n stdout: string;\n stderr: string;\n exitCode: number;\n durationMs: number;\n timedOut: boolean;\n memoryLimitExceeded: boolean;\n compileFailed: boolean;\n matchedExpected?: boolean | null;\n lessonCompleted: boolean;\n enrollment?: TecEnrollment | null;\n}\n\nexport interface TecQuizResult {\n lessonId: string;\n score: number;\n correctCount: number;\n totalCount: number;\n passed: boolean;\n passingScore: number;\n results: {\n index: number;\n correct: boolean;\n selectedOption?: number | null;\n correctOption: number;\n explanation?: string | null;\n }[];\n enrollment?: TecEnrollment | null;\n}\n\nexport interface TecEnrollment {\n id: string;\n courseId: string;\n learnerId: string;\n status: TecEnrollmentStatus;\n progressPct: number;\n lessonsCompleted: number;\n startedAt: string;\n lastActiveAt?: string | null;\n completedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n course?: TecCourse | null;\n /** BOFF-4107: first lesson not yet completed; null when every lesson is done. */\n nextLessonId?: string | null;\n}\n\nexport interface TecCertificate {\n id: string;\n courseId: string;\n learnerId: string;\n serial: string;\n score: number;\n status: TecCertificateStatus;\n issuedAt: string;\n revokedAt?: string | null;\n revokeReason?: string | null;\n createdAt: string;\n course?: TecCourse | null;\n}\n\nexport interface TecProblem {\n id: string;\n slug: string;\n title: string;\n statement?: string | null;\n topic?: string | null;\n difficulty: TecProblemDifficulty;\n status: TecProblemStatus;\n tags: string[];\n languages: string[];\n companies: string[];\n roles: string[];\n interviewFrequency?: TecInterviewFrequency | null;\n points: number;\n starterCode?: string | null;\n /** BOFF-4416: true when this problem requires a paid TechnoSpam plan. */\n isPremiumOnly: boolean;\n /**\n * BOFF-4416: computed for the calling workspace — true when this problem\n * is `isPremiumOnly` and the workspace has no paid plan. `statement` /\n * `starterCode` are already null and `publicTestCases` already empty in\n * the API response whenever this is true.\n */\n isLocked: boolean;\n publishedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n submissions?: TecSubmission[];\n /** Worked-example fixtures the grader runs against; PUBLIC cases only. */\n publicTestCases?: TecProblemTestCase[];\n}\n\n/** Visibility of a problem test case. Mirrors TecTestCaseVisibility. */\nexport type TecTestCaseVisibility = 'PUBLIC' | 'HIDDEN';\n\n/** Per-test-case outcome of a graded submission. Mirrors TecTestCaseStatus. */\nexport type TecTestCaseStatus =\n 'PASSED' | 'WRONG_ANSWER' | 'RUNTIME_ERROR' | 'TIME_LIMIT_EXCEEDED' | 'COMPILE_ERROR' | 'SKIPPED';\n\n/**\n * A worked-example fixture shown on the problem page. Only PUBLIC cases are\n * ever returned to a learner, so `input`/`expectedOutput` are always present\n * in practice; they stay optional because the schema allows null for the\n * author-facing redacted shape.\n */\nexport interface TecProblemTestCase {\n id: string;\n problemId: string;\n name: string;\n ordering: number;\n visibility: TecTestCaseVisibility;\n timeLimitMs: number;\n input?: string | null;\n expectedOutput?: string | null;\n}\n\n/** Grading detail for one test case of a submission. */\nexport interface TecTestCaseResult {\n testCaseId: string;\n name: string;\n visibility: TecTestCaseVisibility;\n status: TecTestCaseStatus;\n passed: boolean;\n durationMs: number;\n input?: string | null;\n expectedOutput?: string | null;\n actualOutput?: string | null;\n}\n\nexport interface TecSubmission {\n id: string;\n problemId: string;\n learnerId: string;\n language: string;\n code: string;\n verdict: TecSubmissionVerdict;\n runtimeMs: number;\n pointsAwarded: number;\n passedCount: number;\n totalCount: number;\n stderr?: string | null;\n testResults: TecTestCaseResult[];\n judgedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n problem?: TecProblem | null;\n}\n\nexport interface TecMentor {\n id: string;\n userId: string;\n headline: string;\n role?: string | null;\n bio?: string | null;\n expertise: string[];\n hourlyRate: number;\n currency: string;\n status: TecMentorStatus;\n isAcceptingMentees: boolean;\n ratingAvg: number;\n sessionsCount: number;\n createdAt: string;\n updatedAt: string;\n sessions?: TecMentorSession[];\n}\n\nexport interface TecMentorSession {\n id: string;\n mentorId: string;\n menteeId: string;\n topic: string;\n agenda?: string | null;\n scheduledAt: string;\n durationMinutes: number;\n status: TecSessionStatus;\n meetingUrl?: string | null;\n /** Snapshotted from the mentor's rate at booking time (smallest currency unit). */\n costAmount: number;\n currency: string;\n platformFeeAmount: number;\n rating?: number | null;\n feedback?: string | null;\n completedAt?: string | null;\n cancelledAt?: string | null;\n createdAt: string;\n updatedAt: string;\n mentor?: TecMentor | null;\n}\n\n/** Read-only pricing preview for a not-yet-booked session (see tecCalculateSessionCost). */\nexport interface TecSessionCostEstimate {\n mentorId: string;\n durationMinutes: number;\n hourlyRate: number;\n currency: string;\n costAmount: number;\n platformFeeAmount: number;\n platformFeeBps: number;\n netAmount: number;\n}\n\n/** Calculation/ledger-only record of what a mentor is owed for a completed session (see tecMyPayouts). */\nexport type TecPayoutStatus = 'PENDING' | 'PAID';\n\nexport interface TecMentorPayout {\n id: string;\n mentorId: string;\n sessionId: string;\n grossAmount: number;\n platformFeeAmount: number;\n netAmount: number;\n currency: string;\n status: TecPayoutStatus;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface TecHackathon {\n id: string;\n slug: string;\n title: string;\n theme?: string | null;\n description?: string | null;\n status: TecHackathonStatus;\n startAt: string;\n endAt: string;\n submissionDeadline?: string | null;\n prizePool: number;\n currency: string;\n maxTeamSize: number;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n teams?: TecHackathonTeam[];\n}\n\nexport interface TecHackathonTeam {\n id: string;\n hackathonId: string;\n name: string;\n captainId: string;\n memberIds: string[];\n projectName?: string | null;\n projectUrl?: string | null;\n repoUrl?: string | null;\n pitch?: string | null;\n status: TecTeamSubmissionStatus;\n score: number;\n submittedAt?: string | null;\n createdAt: string;\n updatedAt: string;\n hackathon?: TecHackathon | null;\n}\n\nexport interface TecPageInfo {\n cursor?: string | null;\n hasMore: boolean;\n}\n\nexport interface PaginationInput {\n limit?: number;\n cursor?: string | null;\n}\n\n/** Build a pagination arg that NEVER sends cursor:null (page-1 500 guard). */\nexport function pageArg(limit = 50, cursor?: string | null): { limit: number; cursor?: string } {\n return cursor ? { limit, cursor } : { limit };\n}\n\n/* -------------------------------------------------------------- fragments */\n\nconst COURSE_FIELDS = gql`\n fragment CourseFields on TecCourse {\n id\n slug\n title\n summary\n topic\n level\n status\n tags\n estimatedMinutes\n instructorId\n isPremiumOnly\n isLocked\n publishedAt\n createdAt\n updatedAt\n }\n`;\n\nconst LESSON_FIELDS = gql`\n fragment LessonFields on TecLesson {\n id\n courseId\n title\n kind\n content\n position\n estimatedMinutes\n isPreview\n isLocked\n language\n starterCode\n sampleInput\n expectedOutput\n quizQuestions {\n prompt\n options\n }\n completedByMe\n createdAt\n updatedAt\n }\n`;\n\nconst ENROLLMENT_FIELDS = gql`\n fragment EnrollmentFields on TecEnrollment {\n id\n courseId\n learnerId\n status\n progressPct\n lessonsCompleted\n startedAt\n lastActiveAt\n completedAt\n createdAt\n updatedAt\n }\n`;\n\nconst PROBLEM_FIELDS = gql`\n fragment ProblemFields on TecProblem {\n id\n slug\n title\n statement\n topic\n difficulty\n status\n tags\n languages\n companies\n roles\n interviewFrequency\n points\n starterCode\n isPremiumOnly\n isLocked\n publishedAt\n createdAt\n updatedAt\n }\n`;\n\nconst SUBMISSION_FIELDS = gql`\n fragment SubmissionFields on TecSubmission {\n id\n problemId\n learnerId\n language\n code\n verdict\n runtimeMs\n pointsAwarded\n passedCount\n totalCount\n stderr\n testResults {\n testCaseId\n name\n visibility\n status\n passed\n durationMs\n input\n expectedOutput\n actualOutput\n }\n judgedAt\n createdAt\n updatedAt\n }\n`;\n\nconst PROBLEM_TEST_CASE_FIELDS = gql`\n fragment ProblemTestCaseFields on TecProblemTestCase {\n id\n problemId\n name\n ordering\n visibility\n timeLimitMs\n input\n expectedOutput\n }\n`;\n\nconst MENTOR_FIELDS = gql`\n fragment MentorFields on TecMentor {\n id\n userId\n headline\n role\n bio\n expertise\n hourlyRate\n currency\n status\n isAcceptingMentees\n ratingAvg\n sessionsCount\n createdAt\n updatedAt\n }\n`;\n\nconst SESSION_FIELDS = gql`\n fragment SessionFields on TecMentorSession {\n id\n mentorId\n menteeId\n topic\n agenda\n scheduledAt\n durationMinutes\n status\n meetingUrl\n costAmount\n currency\n platformFeeAmount\n rating\n feedback\n completedAt\n cancelledAt\n createdAt\n updatedAt\n }\n`;\n\nconst HACKATHON_FIELDS = gql`\n fragment HackathonFields on TecHackathon {\n id\n slug\n title\n theme\n description\n status\n startAt\n endAt\n submissionDeadline\n prizePool\n currency\n maxTeamSize\n tags\n createdAt\n updatedAt\n }\n`;\n\nconst TEAM_FIELDS = gql`\n fragment TeamFields on TecHackathonTeam {\n id\n hackathonId\n name\n captainId\n memberIds\n projectName\n projectUrl\n repoUrl\n pitch\n status\n score\n submittedAt\n createdAt\n updatedAt\n }\n`;\n\nconst CERTIFICATE_FIELDS = gql`\n fragment CertificateFields on TecCertificate {\n id\n courseId\n learnerId\n serial\n score\n status\n issuedAt\n revokedAt\n revokeReason\n createdAt\n }\n`;\n\n/* --------------------------------------------------------------- queries */\n\nconst LIST_COURSES = gql`\n ${COURSE_FIELDS}\n query TecListCourses(\n $level: TecCourseLevel\n $status: TecCourseStatus\n $pagination: PaginationInput\n ) {\n tecListCourses(level: $level, status: $status, pagination: $pagination) {\n items {\n ...CourseFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst GET_COURSE = gql`\n ${COURSE_FIELDS}\n ${LESSON_FIELDS}\n ${ENROLLMENT_FIELDS}\n query TecCourse($id: ID!) {\n tecCourse(id: $id) {\n ...CourseFields\n lessons {\n ...LessonFields\n }\n enrollments {\n ...EnrollmentFields\n }\n }\n }\n`;\n\nconst LIST_ENROLLMENTS = gql`\n ${ENROLLMENT_FIELDS}\n ${COURSE_FIELDS}\n query TecListEnrollments(\n $learnerId: ID\n $courseId: ID\n $pagination: PaginationInput\n $startDate: DateTime\n $endDate: DateTime\n ) {\n tecListEnrollments(\n learnerId: $learnerId\n courseId: $courseId\n pagination: $pagination\n startDate: $startDate\n endDate: $endDate\n ) {\n items {\n ...EnrollmentFields\n course {\n ...CourseFields\n }\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst LIST_CERTIFICATES = gql`\n ${CERTIFICATE_FIELDS}\n ${COURSE_FIELDS}\n query TecListCertificates($learnerId: ID, $courseId: ID) {\n tecListCertificates(learnerId: $learnerId, courseId: $courseId) {\n ...CertificateFields\n course {\n ...CourseFields\n }\n }\n }\n`;\n\n/**\n * The calling learner's OWN certificates. Self-scoped (`@rbac(scopeType:\n * \"self\")`) — the resolver forces `learnerId = ctx.actor.id`, so no learnerId\n * variable is ever sent. Learner-facing surfaces must use this instead of\n * `tecListCertificates`, which is gated behind the cross-learner `list-all`\n * action that a plain workspace member does not hold.\n */\nconst MY_CERTIFICATES = gql`\n ${CERTIFICATE_FIELDS}\n ${COURSE_FIELDS}\n query TecMyCertificates($courseId: ID) {\n tecMyCertificates(courseId: $courseId) {\n ...CertificateFields\n course {\n ...CourseFields\n }\n }\n }\n`;\n\nconst LIST_PROBLEMS = gql`\n ${PROBLEM_FIELDS}\n query TecListProblems(\n $difficulty: TecProblemDifficulty\n $status: TecProblemStatus\n $topic: String\n $company: String\n $role: String\n $interviewFrequency: TecInterviewFrequency\n $pagination: PaginationInput\n ) {\n tecListProblems(\n difficulty: $difficulty\n status: $status\n topic: $topic\n company: $company\n role: $role\n interviewFrequency: $interviewFrequency\n pagination: $pagination\n ) {\n items {\n ...ProblemFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst GET_PROBLEM = gql`\n ${PROBLEM_FIELDS}\n ${SUBMISSION_FIELDS}\n ${PROBLEM_TEST_CASE_FIELDS}\n query TecProblem($id: ID!) {\n tecProblem(id: $id) {\n ...ProblemFields\n publicTestCases {\n ...ProblemTestCaseFields\n }\n submissions {\n ...SubmissionFields\n }\n }\n }\n`;\n\nconst REGRADE_SUBMISSION = gql`\n ${SUBMISSION_FIELDS}\n mutation TecRegradeSubmission($id: ID!) {\n tecRegradeSubmission(id: $id) {\n ...SubmissionFields\n }\n }\n`;\n\nconst LIST_SUBMISSIONS = gql`\n ${SUBMISSION_FIELDS}\n ${PROBLEM_FIELDS}\n query TecListSubmissions(\n $learnerId: ID\n $problemId: ID\n $pagination: PaginationInput\n $startDate: DateTime\n $endDate: DateTime\n ) {\n tecListSubmissions(\n learnerId: $learnerId\n problemId: $problemId\n pagination: $pagination\n startDate: $startDate\n endDate: $endDate\n ) {\n items {\n ...SubmissionFields\n problem {\n ...ProblemFields\n }\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst LIST_MENTORS = gql`\n ${MENTOR_FIELDS}\n query TecListMentors($status: TecMentorStatus, $pagination: PaginationInput) {\n tecListMentors(status: $status, pagination: $pagination) {\n items {\n ...MentorFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst GET_MENTOR = gql`\n ${MENTOR_FIELDS}\n ${SESSION_FIELDS}\n query TecMentor($id: ID!) {\n tecMentor(id: $id) {\n ...MentorFields\n sessions {\n ...SessionFields\n }\n }\n }\n`;\n\nconst LIST_SESSIONS = gql`\n ${SESSION_FIELDS}\n ${MENTOR_FIELDS}\n query TecListSessions(\n $mentorId: ID\n $menteeId: ID\n $status: TecSessionStatus\n $pagination: PaginationInput\n ) {\n tecListSessions(\n mentorId: $mentorId\n menteeId: $menteeId\n status: $status\n pagination: $pagination\n ) {\n items {\n ...SessionFields\n mentor {\n ...MentorFields\n }\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst CALCULATE_SESSION_COST = gql`\n query TecCalculateSessionCost($mentorId: ID!, $durationMinutes: Int) {\n tecCalculateSessionCost(mentorId: $mentorId, durationMinutes: $durationMinutes) {\n mentorId\n durationMinutes\n hourlyRate\n currency\n costAmount\n platformFeeAmount\n platformFeeBps\n netAmount\n }\n }\n`;\n\nconst PAYOUT_FIELDS = gql`\n fragment PayoutFields on TecMentorPayout {\n id\n mentorId\n sessionId\n grossAmount\n platformFeeAmount\n netAmount\n currency\n status\n createdAt\n updatedAt\n }\n`;\n\nconst MY_PAYOUTS = gql`\n ${PAYOUT_FIELDS}\n query TecMyPayouts($status: TecPayoutStatus, $pagination: PaginationInput) {\n tecMyPayouts(status: $status, pagination: $pagination) {\n items {\n ...PayoutFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst LIST_HACKATHONS = gql`\n ${HACKATHON_FIELDS}\n query TecListHackathons($status: TecHackathonStatus, $pagination: PaginationInput) {\n tecListHackathons(status: $status, pagination: $pagination) {\n items {\n ...HackathonFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst GET_HACKATHON = gql`\n ${HACKATHON_FIELDS}\n ${TEAM_FIELDS}\n query TecHackathon($id: ID!) {\n tecHackathon(id: $id) {\n ...HackathonFields\n teams {\n ...TeamFields\n }\n }\n }\n`;\n\nconst LIST_TEAMS = gql`\n ${TEAM_FIELDS}\n query TecListTeams($hackathonId: ID!, $pagination: PaginationInput) {\n tecListTeams(hackathonId: $hackathonId, pagination: $pagination) {\n items {\n ...TeamFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst LIST_LESSONS = gql`\n ${LESSON_FIELDS}\n query TecListLessons($courseId: ID!, $pagination: PaginationInput) {\n tecListLessons(courseId: $courseId, pagination: $pagination) {\n items {\n ...LessonFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\n/* ------------------------------------------------------- response typings */\n\ntype Conn<K extends string, T> = Record<K, { items: T[]; pageInfo: TecPageInfo }>;\n\n/* ---------------------------------------------------------- query hooks */\n\nexport const useCoursesQuery = (vars: {\n level?: TecCourseLevel;\n status?: TecCourseStatus;\n pagination?: { limit: number; cursor?: string };\n}) =>\n useQuery<Conn<'tecListCourses', TecCourse>>(LIST_COURSES, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useCourseQuery = (id: string) =>\n useQuery<{ tecCourse: TecCourse | null }>(GET_COURSE, {\n variables: { id },\n skip: !id,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useEnrollmentsQuery = (vars: {\n learnerId?: string;\n courseId?: string;\n startDate?: string;\n endDate?: string;\n}) =>\n useQuery<Conn<'tecListEnrollments', TecEnrollment>>(LIST_ENROLLMENTS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\n/**\n * Cross-learner certificate read (instructor/admin). Requires the `list-all`\n * action — learner surfaces want `useMyCertificatesQuery` instead.\n */\nexport const useCertificatesQuery = (vars: { learnerId?: string; courseId?: string }) =>\n useQuery<{ tecListCertificates: TecCertificate[] }>(LIST_CERTIFICATES, {\n variables: vars,\n fetchPolicy: 'cache-and-network',\n });\n\n/** The signed-in learner's own certificates (self-scoped; no learnerId sent). */\nexport const useMyCertificatesQuery = (vars: { courseId?: string } = {}) =>\n useQuery<{ tecMyCertificates: TecCertificate[] }>(MY_CERTIFICATES, {\n variables: vars,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useProblemsQuery = (vars: {\n difficulty?: TecProblemDifficulty;\n status?: TecProblemStatus;\n topic?: string;\n company?: string;\n role?: string;\n interviewFrequency?: TecInterviewFrequency;\n pagination?: { limit: number; cursor?: string };\n}) =>\n useQuery<Conn<'tecListProblems', TecProblem>>(LIST_PROBLEMS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useProblemQuery = (id: string) =>\n useQuery<{ tecProblem: TecProblem | null }>(GET_PROBLEM, {\n variables: { id },\n skip: !id,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useSubmissionsQuery = (vars: {\n learnerId?: string;\n problemId?: string;\n startDate?: string;\n endDate?: string;\n}) =>\n useQuery<Conn<'tecListSubmissions', TecSubmission>>(LIST_SUBMISSIONS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useMentorsQuery = (vars: {\n status?: TecMentorStatus;\n pagination?: { limit: number; cursor?: string };\n}) =>\n useQuery<Conn<'tecListMentors', TecMentor>>(LIST_MENTORS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useMentorQuery = (id: string) =>\n useQuery<{ tecMentor: TecMentor | null }>(GET_MENTOR, {\n variables: { id },\n skip: !id,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useSessionsQuery = (vars: {\n mentorId?: string;\n menteeId?: string;\n status?: TecSessionStatus;\n pagination?: { limit: number; cursor?: string };\n}) =>\n useQuery<Conn<'tecListSessions', TecMentorSession>>(LIST_SESSIONS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\n/**\n * Live pricing preview for a not-yet-booked session -- refetches whenever\n * mentorId/durationMinutes change (Apollo re-runs on variable change), so\n * the booking form always shows the cost that would actually be snapshotted\n * onto the session by tecBookSession. `skip` while mentorId is empty.\n */\nexport const useSessionCostEstimate = (mentorId: string, durationMinutes: number) =>\n useQuery<{ tecCalculateSessionCost: TecSessionCostEstimate }>(CALCULATE_SESSION_COST, {\n variables: { mentorId, durationMinutes },\n skip: !mentorId || !Number.isFinite(durationMinutes) || durationMinutes <= 0,\n fetchPolicy: 'cache-and-network',\n });\n\n/** The calling mentor's own payout ledger (calculation-only -- see BOFF-4433). */\nexport const useMyPayoutsQuery = (\n vars: { status?: TecPayoutStatus; pagination?: { limit: number; cursor?: string } } = {}\n) =>\n useQuery<Conn<'tecMyPayouts', TecMentorPayout>>(MY_PAYOUTS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useHackathonsQuery = (vars: {\n status?: TecHackathonStatus;\n pagination?: { limit: number; cursor?: string };\n}) =>\n useQuery<Conn<'tecListHackathons', TecHackathon>>(LIST_HACKATHONS, {\n variables: { pagination: pageArg(50), ...vars },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useHackathonQuery = (id: string) =>\n useQuery<{ tecHackathon: TecHackathon | null }>(GET_HACKATHON, {\n variables: { id },\n skip: !id,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useTeamsQuery = (\n hackathonId: string,\n pagination?: { limit: number; cursor?: string }\n) =>\n useQuery<Conn<'tecListTeams', TecHackathonTeam>>(LIST_TEAMS, {\n variables: { hackathonId, pagination: pagination ?? pageArg(50) },\n skip: !hackathonId,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useLessonsQuery = (\n courseId: string,\n pagination?: { limit: number; cursor?: string }\n) =>\n useQuery<Conn<'tecListLessons', TecLesson>>(LIST_LESSONS, {\n variables: { courseId, pagination: pagination ?? pageArg(50) },\n skip: !courseId,\n fetchPolicy: 'cache-and-network',\n });\n\n/* ------------------------------------------------------------ mutations */\n\nconst onMutationError = (error: ErrorLike): void => {\n notify.error('Something went wrong', userMessageFromError(error));\n};\n\nconst REFETCH = {\n courses: 'TecListCourses',\n enrollments: 'TecListEnrollments',\n problems: 'TecListProblems',\n submissions: 'TecListSubmissions',\n mentors: 'TecListMentors',\n sessions: 'TecListSessions',\n hackathons: 'TecListHackathons',\n} as const;\n\nconst ENROLL = gql`\n ${ENROLLMENT_FIELDS}\n mutation TecEnroll($input: TecEnrollInput!) {\n tecEnroll(input: $input) {\n ...EnrollmentFields\n }\n }\n`;\n\nconst SUBMIT_SOLUTION = gql`\n ${SUBMISSION_FIELDS}\n mutation TecSubmitSolution($input: TecSubmitSolutionInput!) {\n tecSubmitSolution(input: $input) {\n ...SubmissionFields\n }\n }\n`;\n\nconst BOOK_SESSION = gql`\n ${SESSION_FIELDS}\n mutation TecBookSession($input: TecBookSessionInput!) {\n tecBookSession(input: $input) {\n ...SessionFields\n }\n }\n`;\n\nconst CANCEL_SESSION = gql`\n ${SESSION_FIELDS}\n mutation TecCancelSession($id: ID!) {\n tecCancelSession(id: $id) {\n ...SessionFields\n }\n }\n`;\n\nconst BECOME_MENTOR = gql`\n ${MENTOR_FIELDS}\n mutation TecBecomeMentor($input: TecCreateMentorInput!) {\n tecBecomeMentor(input: $input) {\n ...MentorFields\n }\n }\n`;\n\nconst REGISTER_TEAM = gql`\n ${TEAM_FIELDS}\n mutation TecRegisterTeam($input: TecRegisterTeamInput!) {\n tecRegisterTeam(input: $input) {\n ...TeamFields\n }\n }\n`;\n\nconst SUBMIT_PROJECT = gql`\n ${TEAM_FIELDS}\n mutation TecSubmitProject($input: TecSubmitProjectInput!) {\n tecSubmitProject(input: $input) {\n ...TeamFields\n }\n }\n`;\n\n/* ------- admin / authoring mutations ------- */\n\nconst CREATE_COURSE = gql`\n ${COURSE_FIELDS}\n mutation TecCreateCourse($input: TecCreateCourseInput!) {\n tecCreateCourse(input: $input) {\n ...CourseFields\n }\n }\n`;\n\nconst PUBLISH_COURSE = gql`\n ${COURSE_FIELDS}\n mutation TecPublishCourse($id: ID!) {\n tecPublishCourse(id: $id) {\n ...CourseFields\n }\n }\n`;\n\nconst ARCHIVE_COURSE = gql`\n mutation TecArchiveCourse($id: ID!) {\n tecArchiveCourse(id: $id)\n }\n`;\n\nconst CREATE_LESSON = gql`\n ${LESSON_FIELDS}\n mutation TecCreateLesson($input: TecCreateLessonInput!) {\n tecCreateLesson(input: $input) {\n ...LessonFields\n }\n }\n`;\n\nconst UPDATE_LESSON = gql`\n ${LESSON_FIELDS}\n mutation TecUpdateLesson($id: ID!, $input: TecUpdateLessonInput!) {\n tecUpdateLesson(id: $id, input: $input) {\n ...LessonFields\n }\n }\n`;\n\nconst CREATE_PROBLEM = gql`\n ${PROBLEM_FIELDS}\n mutation TecCreateProblem($input: TecCreateProblemInput!) {\n tecCreateProblem(input: $input) {\n ...ProblemFields\n }\n }\n`;\n\nconst PUBLISH_PROBLEM = gql`\n ${PROBLEM_FIELDS}\n mutation TecPublishProblem($id: ID!) {\n tecPublishProblem(id: $id) {\n ...ProblemFields\n }\n }\n`;\n\nconst CREATE_HACKATHON = gql`\n ${HACKATHON_FIELDS}\n mutation TecCreateHackathon($input: TecCreateHackathonInput!) {\n tecCreateHackathon(input: $input) {\n ...HackathonFields\n }\n }\n`;\n\nconst OPEN_REGISTRATION = gql`\n ${HACKATHON_FIELDS}\n mutation TecOpenRegistration($id: ID!) {\n tecOpenRegistration(id: $id) {\n ...HackathonFields\n }\n }\n`;\n\nconst APPROVE_MENTOR = gql`\n ${MENTOR_FIELDS}\n mutation TecApproveMentor($id: ID!) {\n tecApproveMentor(id: $id) {\n ...MentorFields\n }\n }\n`;\n\nconst SCORE_TEAM = gql`\n ${TEAM_FIELDS}\n mutation TecScoreTeam($id: ID!, $score: Int!, $winner: Boolean) {\n tecScoreTeam(id: $id, score: $score, winner: $winner) {\n ...TeamFields\n }\n }\n`;\n\nconst CONFIRM_SESSION = gql`\n ${SESSION_FIELDS}\n mutation TecConfirmSession($id: ID!, $meetingUrl: String) {\n tecConfirmSession(id: $id, meetingUrl: $meetingUrl) {\n ...SessionFields\n }\n }\n`;\n\nconst COMPLETE_SESSION = gql`\n ${SESSION_FIELDS}\n mutation TecCompleteSession($id: ID!, $rating: Int, $feedback: String) {\n tecCompleteSession(id: $id, rating: $rating, feedback: $feedback) {\n ...SessionFields\n }\n }\n`;\n\nconst GRADE_SUBMISSION = gql`\n ${SUBMISSION_FIELDS}\n mutation TecGradeSubmission($id: ID!, $verdict: TecSubmissionVerdict!, $runtimeMs: Int) {\n tecGradeSubmission(id: $id, verdict: $verdict, runtimeMs: $runtimeMs) {\n ...SubmissionFields\n }\n }\n`;\n\nconst ISSUE_CERTIFICATE = gql`\n ${CERTIFICATE_FIELDS}\n mutation TecIssueCertificate($courseId: ID!, $learnerId: ID!, $score: Int!) {\n tecIssueCertificate(courseId: $courseId, learnerId: $learnerId, score: $score) {\n ...CertificateFields\n }\n }\n`;\n\nconst REVOKE_CERTIFICATE = gql`\n ${CERTIFICATE_FIELDS}\n mutation TecRevokeCertificate($id: ID!, $reason: String) {\n tecRevokeCertificate(id: $id, reason: $reason) {\n ...CertificateFields\n }\n }\n`;\n\nconst START_HACKATHON = gql`\n ${HACKATHON_FIELDS}\n mutation TecStartHackathon($id: ID!) {\n tecStartHackathon(id: $id) {\n ...HackathonFields\n }\n }\n`;\n\nconst START_JUDGING = gql`\n ${HACKATHON_FIELDS}\n mutation TecStartJudging($id: ID!) {\n tecStartJudging(id: $id) {\n ...HackathonFields\n }\n }\n`;\n\nconst COMPLETE_HACKATHON = gql`\n ${HACKATHON_FIELDS}\n mutation TecCompleteHackathon($id: ID!) {\n tecCompleteHackathon(id: $id) {\n ...HackathonFields\n }\n }\n`;\n\n/* ---------------------------------------------------------- mutation hooks */\n\nexport const useEnroll = () =>\n useMutation<{ tecEnroll: TecEnrollment }>(ENROLL, {\n onError: onMutationError,\n refetchQueries: [REFETCH.enrollments, REFETCH.courses],\n });\n\nexport const useSubmitSolution = () =>\n useMutation<{ tecSubmitSolution: TecSubmission }>(SUBMIT_SOLUTION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.submissions],\n });\n\n/**\n * Re-run the grader for a submission. Used by the problem page when a verdict\n * came back PENDING (grader unavailable at submit time) so a learner can retry\n * without resubmitting identical code.\n */\nexport const useRegradeSubmission = () =>\n useMutation<{ tecRegradeSubmission: TecSubmission }>(REGRADE_SUBMISSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.submissions],\n });\n\nexport const useBookSession = () =>\n useMutation<{ tecBookSession: TecMentorSession }>(BOOK_SESSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.sessions, REFETCH.mentors],\n });\n\nexport const useCancelSession = () =>\n useMutation<{ tecCancelSession: TecMentorSession }>(CANCEL_SESSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.sessions],\n });\n\nexport const useBecomeMentor = () =>\n useMutation<{ tecBecomeMentor: TecMentor }>(BECOME_MENTOR, {\n onError: onMutationError,\n refetchQueries: [REFETCH.mentors],\n });\n\nexport const useRegisterTeam = () =>\n useMutation<{ tecRegisterTeam: TecHackathonTeam }>(REGISTER_TEAM, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\nexport const useSubmitProject = () =>\n useMutation<{ tecSubmitProject: TecHackathonTeam }>(SUBMIT_PROJECT, {\n onError: onMutationError,\n });\n\nexport const useCreateCourse = () =>\n useMutation<{ tecCreateCourse: TecCourse }>(CREATE_COURSE, {\n onError: onMutationError,\n refetchQueries: [REFETCH.courses],\n });\n\nexport const usePublishCourse = () =>\n useMutation<{ tecPublishCourse: TecCourse }>(PUBLISH_COURSE, {\n onError: onMutationError,\n refetchQueries: [REFETCH.courses],\n });\n\nexport const useArchiveCourse = () =>\n useMutation<{ tecArchiveCourse: boolean }>(ARCHIVE_COURSE, {\n onError: onMutationError,\n refetchQueries: [REFETCH.courses],\n });\n\nexport const useCreateLesson = () =>\n useMutation<{ tecCreateLesson: TecLesson }>(CREATE_LESSON, { onError: onMutationError });\n\n/**\n * Edit an already-authored lesson (title/kind/content/minutes/preview/position).\n * Every field on TecUpdateLessonInput is optional — send only what changed.\n */\nexport const useUpdateLesson = () =>\n useMutation<{ tecUpdateLesson: TecLesson }>(UPDATE_LESSON, { onError: onMutationError });\n\nexport const useCreateProblem = () =>\n useMutation<{ tecCreateProblem: TecProblem }>(CREATE_PROBLEM, {\n onError: onMutationError,\n refetchQueries: [REFETCH.problems],\n });\n\nexport const usePublishProblem = () =>\n useMutation<{ tecPublishProblem: TecProblem }>(PUBLISH_PROBLEM, {\n onError: onMutationError,\n refetchQueries: [REFETCH.problems],\n });\n\nexport const useCreateHackathon = () =>\n useMutation<{ tecCreateHackathon: TecHackathon }>(CREATE_HACKATHON, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\nexport const useOpenRegistration = () =>\n useMutation<{ tecOpenRegistration: TecHackathon }>(OPEN_REGISTRATION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\nexport const useApproveMentor = () =>\n useMutation<{ tecApproveMentor: TecMentor }>(APPROVE_MENTOR, {\n onError: onMutationError,\n refetchQueries: [REFETCH.mentors],\n });\n\nexport const useScoreTeam = () =>\n useMutation<{ tecScoreTeam: TecHackathonTeam }>(SCORE_TEAM, { onError: onMutationError });\n\nexport const useConfirmSession = () =>\n useMutation<{ tecConfirmSession: TecMentorSession }>(CONFIRM_SESSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.sessions],\n });\n\nexport const useCompleteSession = () =>\n useMutation<{ tecCompleteSession: TecMentorSession }>(COMPLETE_SESSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.sessions],\n });\n\nexport const useGradeSubmission = () =>\n useMutation<{ tecGradeSubmission: TecSubmission }>(GRADE_SUBMISSION, {\n onError: onMutationError,\n refetchQueries: [REFETCH.submissions],\n });\n\nexport const useIssueCertificate = () =>\n useMutation<{ tecIssueCertificate: TecCertificate }>(ISSUE_CERTIFICATE, {\n onError: onMutationError,\n });\n\nexport const useRevokeCertificate = () =>\n useMutation<{ tecRevokeCertificate: TecCertificate }>(REVOKE_CERTIFICATE, {\n onError: onMutationError,\n });\n\nexport const useStartHackathon = () =>\n useMutation<{ tecStartHackathon: TecHackathon }>(START_HACKATHON, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\nexport const useStartJudging = () =>\n useMutation<{ tecStartJudging: TecHackathon }>(START_JUDGING, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\nexport const useCompleteHackathon = () =>\n useMutation<{ tecCompleteHackathon: TecHackathon }>(COMPLETE_HACKATHON, {\n onError: onMutationError,\n refetchQueries: [REFETCH.hackathons],\n });\n\n/* ============================================================ Study Planner\n * BOFF-4415 — deterministic, rule-based goal -> plan scheduler. NOT an LLM\n * feature; see the backend StudyPlanService honesty note. Every query/\n * mutation below is self-scoped (learnerId comes from the authenticated\n * actor server-side) so no learnerId variable is ever sent from the client.\n * ========================================================================= */\n\nexport type TecStudyPlanStatus = 'ACTIVE' | 'COMPLETED' | 'ARCHIVED';\nexport type TecStudyPlanStepKind = 'COURSE' | 'PROBLEM';\nexport type TecStudyPlanStepStatus = 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'SKIPPED';\n\nexport interface TecStudyPlanStep {\n id: string;\n order: number;\n kind: TecStudyPlanStepKind;\n targetId: string;\n title: string;\n scheduledWeek: number;\n status: TecStudyPlanStepStatus;\n rationale: string;\n estimatedMinutes: number;\n completedAt?: string | null;\n}\n\nexport interface TecStudyPlan {\n id: string;\n goal: string;\n topic?: string | null;\n timeframeWeeks: number;\n status: TecStudyPlanStatus;\n targetCompletionDate?: string | null;\n progressPct: number;\n totalSteps: number;\n completedSteps: number;\n createdAt: string;\n steps: TecStudyPlanStep[];\n}\n\nconst STUDY_PLAN_STEP_FIELDS = gql`\n fragment StudyPlanStepFields on TecStudyPlanStep {\n id\n order\n kind\n targetId\n title\n scheduledWeek\n status\n rationale\n estimatedMinutes\n completedAt\n }\n`;\n\nconst STUDY_PLAN_FIELDS = gql`\n ${STUDY_PLAN_STEP_FIELDS}\n fragment StudyPlanFields on TecStudyPlan {\n id\n goal\n topic\n timeframeWeeks\n status\n targetCompletionDate\n progressPct\n totalSteps\n completedSteps\n createdAt\n steps {\n ...StudyPlanStepFields\n }\n }\n`;\n\nconst LIST_MY_STUDY_PLANS = gql`\n ${STUDY_PLAN_FIELDS}\n query TecMyStudyPlans {\n tecMyStudyPlans {\n items {\n ...StudyPlanFields\n }\n pageInfo {\n cursor\n hasMore\n }\n }\n }\n`;\n\nconst GENERATE_STUDY_PLAN = gql`\n ${STUDY_PLAN_FIELDS}\n mutation TecGenerateStudyPlan($input: TecGenerateStudyPlanInput!) {\n tecGenerateStudyPlan(input: $input) {\n ...StudyPlanFields\n }\n }\n`;\n\nconst UPDATE_STUDY_PLAN_STEP_STATUS = gql`\n ${STUDY_PLAN_STEP_FIELDS}\n mutation TecUpdateStudyPlanStepStatus($input: TecUpdateStudyPlanStepStatusInput!) {\n tecUpdateStudyPlanStepStatus(input: $input) {\n ...StudyPlanStepFields\n }\n }\n`;\n\nconst ARCHIVE_STUDY_PLAN = gql`\n mutation TecArchiveStudyPlan($id: ID!) {\n tecArchiveStudyPlan(id: $id)\n }\n`;\n\nexport const useMyStudyPlansQuery = () =>\n useQuery<{ tecMyStudyPlans: { items: TecStudyPlan[]; pageInfo: TecPageInfo } }>(\n LIST_MY_STUDY_PLANS,\n {\n fetchPolicy: 'cache-and-network',\n }\n );\n\nexport const useGenerateStudyPlan = () =>\n useMutation<{ tecGenerateStudyPlan: TecStudyPlan }>(GENERATE_STUDY_PLAN, {\n onError: onMutationError,\n refetchQueries: ['TecMyStudyPlans'],\n });\n\nexport const useUpdateStudyPlanStepStatus = () =>\n useMutation<{ tecUpdateStudyPlanStepStatus: TecStudyPlanStep }>(UPDATE_STUDY_PLAN_STEP_STATUS, {\n onError: onMutationError,\n refetchQueries: ['TecMyStudyPlans'],\n });\n\nexport const useArchiveStudyPlan = () =>\n useMutation<{ tecArchiveStudyPlan: boolean }>(ARCHIVE_STUDY_PLAN, {\n onError: onMutationError,\n refetchQueries: ['TecMyStudyPlans'],\n });\n\n/* ================================================================ Portfolio\n * BOFF-4432 — learner-curated showcase of real completed hackathon\n * projects, certificates, and courses. `tecPublicPortfolio` is a public,\n * unauthenticated field (@rbac public: true) reached through the same\n * gateway; there is no separate unauthenticated *page* wired up yet (see\n * ApplicationsPortfolioPagePage's deferred-scope note).\n * ========================================================================= */\n\nexport type TecPortfolioItemKind = 'HACKATHON_PROJECT' | 'CERTIFICATE' | 'COURSE_COMPLETION';\n\nexport interface TecPortfolioItem {\n id: string;\n kind: TecPortfolioItemKind;\n sourceId: string;\n title: string;\n description?: string | null;\n link?: string | null;\n completionDate: string;\n order: number;\n}\n\nexport interface TecPortfolio {\n id: string;\n isPublished: boolean;\n publicSlug?: string | null;\n publishedAt?: string | null;\n items: TecPortfolioItem[];\n}\n\nconst PORTFOLIO_ITEM_FIELDS = gql`\n fragment PortfolioItemFields on TecPortfolioItem {\n id\n kind\n sourceId\n title\n description\n link\n completionDate\n order\n }\n`;\n\nconst PORTFOLIO_FIELDS = gql`\n ${PORTFOLIO_ITEM_FIELDS}\n fragment PortfolioFields on TecPortfolio {\n id\n isPublished\n publicSlug\n publishedAt\n items {\n ...PortfolioItemFields\n }\n }\n`;\n\nconst GET_MY_PORTFOLIO = gql`\n ${PORTFOLIO_FIELDS}\n query TecMyPortfolio {\n tecMyPortfolio {\n ...PortfolioFields\n }\n }\n`;\n\nconst ADD_PORTFOLIO_ITEM = gql`\n ${PORTFOLIO_ITEM_FIELDS}\n mutation TecAddPortfolioItem($input: TecAddPortfolioItemInput!) {\n tecAddPortfolioItem(input: $input) {\n ...PortfolioItemFields\n }\n }\n`;\n\nconst REORDER_PORTFOLIO_ITEMS = gql`\n ${PORTFOLIO_FIELDS}\n mutation TecReorderPortfolioItems($input: TecReorderPortfolioItemsInput!) {\n tecReorderPortfolioItems(input: $input) {\n ...PortfolioFields\n }\n }\n`;\n\nconst REMOVE_PORTFOLIO_ITEM = gql`\n mutation TecRemovePortfolioItem($id: ID!) {\n tecRemovePortfolioItem(id: $id)\n }\n`;\n\nconst PUBLISH_PORTFOLIO = gql`\n ${PORTFOLIO_FIELDS}\n mutation TecPublishPortfolio {\n tecPublishPortfolio {\n ...PortfolioFields\n }\n }\n`;\n\nconst UNPUBLISH_PORTFOLIO = gql`\n ${PORTFOLIO_FIELDS}\n mutation TecUnpublishPortfolio {\n tecUnpublishPortfolio {\n ...PortfolioFields\n }\n }\n`;\n\nexport const useMyPortfolioQuery = () =>\n useQuery<{ tecMyPortfolio: TecPortfolio }>(GET_MY_PORTFOLIO, {\n fetchPolicy: 'cache-and-network',\n });\n\nconst REFETCH_PORTFOLIO = ['TecMyPortfolio'];\n\nexport const useAddPortfolioItem = () =>\n useMutation<{ tecAddPortfolioItem: TecPortfolioItem }>(ADD_PORTFOLIO_ITEM, {\n onError: onMutationError,\n refetchQueries: REFETCH_PORTFOLIO,\n });\n\nexport const useReorderPortfolioItems = () =>\n useMutation<{ tecReorderPortfolioItems: TecPortfolio }>(REORDER_PORTFOLIO_ITEMS, {\n onError: onMutationError,\n });\n\nexport const useRemovePortfolioItem = () =>\n useMutation<{ tecRemovePortfolioItem: boolean }>(REMOVE_PORTFOLIO_ITEM, {\n onError: onMutationError,\n refetchQueries: REFETCH_PORTFOLIO,\n });\n\nexport const usePublishPortfolio = () =>\n useMutation<{ tecPublishPortfolio: TecPortfolio }>(PUBLISH_PORTFOLIO, {\n onError: onMutationError,\n refetchQueries: REFETCH_PORTFOLIO,\n });\n\nexport const useUnpublishPortfolio = () =>\n useMutation<{ tecUnpublishPortfolio: TecPortfolio }>(UNPUBLISH_PORTFOLIO, {\n onError: onMutationError,\n refetchQueries: REFETCH_PORTFOLIO,\n });\n\n/* ------------------------------------------------ TechnoSage review (BOFF-3841) */\n\nexport type TecReviewSource = 'AI' | 'RULES';\n\n/**\n * TechnoSage's explanation of one of the caller's own graded submissions.\n * It explains the grader's verdict and never changes it. `source` says who\n * wrote it: a model (AI) or the grader output alone (RULES).\n */\nexport interface TecSubmissionReview {\n id: string;\n submissionId: string;\n problemId: string;\n verdict: TecSubmissionVerdict;\n summary: string;\n failureExplanation: string;\n conceptsToRevisit: string[];\n suggestedProblems: Array<Pick<TecProblem, 'id' | 'title' | 'difficulty' | 'topic'>>;\n source: TecReviewSource;\n model: string | null;\n createdAt: string;\n}\n\nconst SUBMISSION_REVIEW_FIELDS = gql`\n fragment SubmissionReviewFields on TecSubmissionReview {\n id\n submissionId\n problemId\n verdict\n summary\n failureExplanation\n conceptsToRevisit\n suggestedProblems {\n id\n title\n difficulty\n topic\n }\n source\n model\n createdAt\n }\n`;\n\nconst MY_SUBMISSION_REVIEW = gql`\n ${SUBMISSION_REVIEW_FIELDS}\n query TecMySubmissionReview($submissionId: ID!) {\n tecMySubmissionReview(submissionId: $submissionId) {\n ...SubmissionReviewFields\n }\n }\n`;\n\nconst REVIEW_SUBMISSION = gql`\n ${SUBMISSION_REVIEW_FIELDS}\n mutation TecReviewSubmission($submissionId: ID!) {\n tecReviewSubmission(submissionId: $submissionId) {\n ...SubmissionReviewFields\n }\n }\n`;\n\n/** The stored review of a submission, if the learner already asked for one. */\nexport const useMySubmissionReviewQuery = (submissionId: string | null) =>\n useQuery<{ tecMySubmissionReview: TecSubmissionReview | null }>(MY_SUBMISSION_REVIEW, {\n variables: { submissionId: submissionId ?? '' },\n skip: !submissionId,\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useReviewSubmission = () =>\n useMutation<{ tecReviewSubmission: TecSubmissionReview }>(REVIEW_SUBMISSION, {\n onError: onMutationError,\n refetchQueries: ['TecMySubmissionReview'],\n });\n\n/* ------------------------------------------------------- pagination helper */\n\nexport interface PageLimit {\n limit: number;\n more: () => void;\n}\n\n/**\n * Simple, robust \"load more\". The backend paginates with `take = limit + 1`\n * (offset is ignored; only `cursor` shifts the window), so a larger `limit`\n * simply fetches more rows from the top and `pageInfo.hasMore` reports whether\n * still more exist. Growing the limit avoids cursor-merge/fetchMore complexity\n * and never sends `cursor: null` (the page-1 500 guard). Pass `limit` into the\n * query's `pageArg` and render <LoadMore hasMore={...} onClick={more} />.\n */\nexport function usePageLimit(step = 24, initial = 24): PageLimit {\n const [limit, setLimit] = useState(initial);\n return { limit, more: () => setLimit((l) => l + step) };\n}\n\n/* ------------------------------------------------- lesson player (BOFF-4107) */\n\nconst GET_LESSON_PLAYER = gql`\n ${LESSON_FIELDS}\n ${COURSE_FIELDS}\n ${ENROLLMENT_FIELDS}\n query TecLessonPlayer($lessonId: ID!, $courseId: ID!) {\n tecLesson(id: $lessonId) {\n ...LessonFields\n file {\n id\n name\n mimeType\n downloadUrl\n }\n }\n tecCourse(id: $courseId) {\n ...CourseFields\n lessons {\n id\n courseId\n title\n kind\n position\n estimatedMinutes\n isPreview\n isLocked\n completedByMe\n }\n }\n tecMyEnrollments(courseId: $courseId, pagination: { limit: 1 }) {\n items {\n ...EnrollmentFields\n nextLessonId\n }\n }\n }\n`;\n\n/**\n * The signed-in learner's own enrollments with where \"Resume\" should land.\n * Self-scoped (`tecMyEnrollments`); used by My Learning and the dashboard to\n * deep-link straight into the next lesson.\n */\nconst MY_NEXT_LESSONS = gql`\n query TecMyNextLessons($pagination: PaginationInput) {\n tecMyEnrollments(pagination: $pagination) {\n items {\n id\n courseId\n nextLessonId\n }\n }\n }\n`;\n\nconst LESSON_QUIZ_KEY = gql`\n query TecLessonQuizKey($lessonId: ID!) {\n tecLessonQuizKey(lessonId: $lessonId) {\n prompt\n options\n correctOption\n explanation\n }\n }\n`;\n\nconst COMPLETE_LESSON = gql`\n ${ENROLLMENT_FIELDS}\n mutation TecCompleteLesson($lessonId: ID!) {\n tecCompleteLesson(lessonId: $lessonId) {\n ...EnrollmentFields\n nextLessonId\n }\n }\n`;\n\nconst SUBMIT_LESSON_QUIZ = gql`\n ${ENROLLMENT_FIELDS}\n mutation TecSubmitLessonQuiz($lessonId: ID!, $answers: [Int!]!) {\n tecSubmitLessonQuiz(lessonId: $lessonId, answers: $answers) {\n lessonId\n score\n correctCount\n totalCount\n passed\n passingScore\n results {\n index\n correct\n selectedOption\n correctOption\n explanation\n }\n enrollment {\n ...EnrollmentFields\n nextLessonId\n }\n }\n }\n`;\n\nconst RUN_LESSON_CODE = gql`\n ${ENROLLMENT_FIELDS}\n mutation TecRunLessonCode($input: TecRunLessonCodeInput!) {\n tecRunLessonCode(input: $input) {\n lessonId\n status\n language\n stdout\n stderr\n exitCode\n durationMs\n timedOut\n memoryLimitExceeded\n compileFailed\n matchedExpected\n lessonCompleted\n enrollment {\n ...EnrollmentFields\n nextLessonId\n }\n }\n }\n`;\n\nexport interface LessonPlayerData {\n tecLesson: TecLesson | null;\n tecCourse: TecCourse | null;\n tecMyEnrollments: { items: TecEnrollment[] };\n}\n\nexport const useLessonPlayerQuery = (courseId: string, lessonId: string) =>\n useQuery<LessonPlayerData>(GET_LESSON_PLAYER, {\n variables: { courseId, lessonId },\n skip: !courseId || !lessonId,\n fetchPolicy: 'cache-and-network',\n });\n\n/** courseId → next lesson id for the signed-in learner's enrollments. */\nexport const useMyNextLessonsQuery = () =>\n useQuery<{\n tecMyEnrollments: { items: Pick<TecEnrollment, 'id' | 'courseId' | 'nextLessonId'>[] };\n }>(MY_NEXT_LESSONS, {\n variables: { pagination: pageArg(100) },\n fetchPolicy: 'cache-and-network',\n });\n\nexport const useLessonQuizKeyQuery = (lessonId: string, skip = false) =>\n useQuery<{ tecLessonQuizKey: TecQuizQuestionKey[] }>(LESSON_QUIZ_KEY, {\n variables: { lessonId },\n skip: skip || !lessonId,\n fetchPolicy: 'network-only',\n });\n\nconst LESSON_PROGRESS_REFETCH = [\n 'TecLessonPlayer',\n 'TecCourse',\n 'TecMyNextLessons',\n REFETCH.enrollments,\n];\n\nexport const useCompleteLesson = () =>\n useMutation<{ tecCompleteLesson: TecEnrollment }>(COMPLETE_LESSON, {\n onError: onMutationError,\n refetchQueries: LESSON_PROGRESS_REFETCH,\n });\n\nexport const useSubmitLessonQuiz = () =>\n useMutation<{ tecSubmitLessonQuiz: TecQuizResult }>(SUBMIT_LESSON_QUIZ, {\n onError: onMutationError,\n refetchQueries: LESSON_PROGRESS_REFETCH,\n });\n\n/**\n * Runs code for an INTERACTIVE lesson. No refetch here: the page refetches\n * only when a run actually completed the lesson, so polling a warming\n * sandbox does not reload the page each time.\n */\nexport const useRunLessonCode = () =>\n useMutation<{ tecRunLessonCode: TecLessonCodeRun }>(RUN_LESSON_CODE, {\n onError: onMutationError,\n });\n"],"mappings":";;;;;;AAsYA,SAAgB,EAAQ,IAAQ,IAAI,GAA4D;AAC9F,QAAO,IAAS;EAAE;EAAO;EAAQ,GAAG,EAAE,UAAO;;AAK/C,IAAM,IAAgB,CAAG;;;;;;;;;;;;;;;;;;GAoBnB,IAAgB,CAAG;;;;;;;;;;;;;;;;;;;;;;;GAyBnB,IAAoB,CAAG;;;;;;;;;;;;;;GAgBvB,IAAiB,CAAG;;;;;;;;;;;;;;;;;;;;;;GAwBpB,IAAoB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BvB,IAA2B,CAAG;;;;;;;;;;;GAa9B,IAAgB,CAAG;;;;;;;;;;;;;;;;;GAmBnB,IAAiB,CAAG;;;;;;;;;;;;;;;;;;;;;GAuBpB,IAAmB,CAAG;;;;;;;;;;;;;;;;;;GAoBtB,IAAc,CAAG;;;;;;;;;;;;;;;;;GAmBjB,IAAqB,CAAG;;;;;;;;;;;;;GAiBxB,IAAe,CAAG;IACpB,EAAc;;;;;;;;;;;;;;;;GAkBZ,K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,YAAY,GAAU,MAAM,IAAI,EAAK;EAAE;;AAKzD,IAAM,KAAoB,CAAG;IACzB,EAAc;IACd,EAAc;IACd,EAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuChB,IAAkB,CAAG;;;;;;;;;;GAYrB,KAAkB,CAAG;;;;;;;;;GAWrB,KAAkB,CAAG;IACvB,EAAkB;;;;;;;GAShB,KAAqB,CAAG;IAC1B,EAAkB;;;;;;;;;;;;;;;;;;;;;;GAwBhB,KAAkB,CAAG;IACvB,EAAkB;;;;;;;;;;;;;;;;;;;;;GA6BT,MAAwB,GAAkB,MACrD,EAA2B,IAAmB;CAC5C,WAAW;EAAE;EAAU;EAAU;CACjC,MAAM,CAAC,KAAY,CAAC;CACpB,aAAa;CACd,CAAC,EAGS,WACX,EAEG,GAAiB;CAClB,WAAW,EAAE,YAAY,EAAQ,IAAI,EAAE;CACvC,aAAa;CACd,CAAC,EAES,MAAyB,GAAkB,IAAO,OAC7D,EAAqD,IAAiB;CACpE,WAAW,EAAE,aAAU;CACvB,MAAM,KAAQ,CAAC;CACf,aAAa;CACd,CAAC,EAEE,IAA0B;CAC9B;CACA;CACA;CACA,EAAQ;CACT,EAEY,WACX,EAAkD,IAAiB;CACjE,SAAS;CACT,gBAAgB;CACjB,CAAC,EAES,WACX,EAAoD,IAAoB;CACtE,SAAS;CACT,gBAAgB;CACjB,CAAC,EAOS,WACX,EAAoD,IAAiB,EACnE,SAAS,GACV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractiveWorkspace.d.ts","sourceRoot":"","sources":["../../../../src/technospam/components/lesson/InteractiveWorkspace.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InteractiveWorkspace.d.ts","sourceRoot":"","sources":["../../../../src/technospam/components/lesson/InteractiveWorkspace.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAoB,KAAK,SAAS,EAAyB,MAAM,yBAAyB,CAAC;AAwBlG;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,WAAW,GACZ,EAAE;IACD,MAAM,EAAE,SAAS,CAAC;IAClB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,+BA8MA"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { cn as e } from "../../utils/cn.js";
|
|
2
2
|
import { humanizeEnum as t } from "../../utils/format.js";
|
|
3
3
|
import { IoBlock as n } from "../SubmissionViews.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { userMessageFromError as r } from "../../lib/errorMessage.js";
|
|
5
|
+
import { useRunLessonCode as i } from "../../api/technospamApi.js";
|
|
6
|
+
import { useEffect as a, useRef as o, useState as s } from "react";
|
|
7
|
+
import { CheckCircle2 as c, Clock as l, Code2 as u, Loader2 as d, Play as f, RotateCcw as p, Terminal as m, XCircle as h } from "lucide-react";
|
|
8
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
9
|
+
import { Button as v, Textarea as y } from "@burdenoff/fe-libs/ui";
|
|
9
10
|
//#region src/technospam/components/lesson/InteractiveWorkspace.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
11
|
+
var b = 4e3, x = 4 * 6e4;
|
|
12
|
+
function S(e) {
|
|
12
13
|
return e.compileFailed ? {
|
|
13
14
|
tone: "error",
|
|
14
15
|
text: "Compile error"
|
|
@@ -32,160 +33,166 @@ function x(e) {
|
|
|
32
33
|
text: `Exited with code ${e.exitCode}`
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
function C({ lesson: C, onCompleted: w }) {
|
|
37
|
+
let T = C.starterCode ?? "", [E, D] = s(T), [O, k] = s(C.sampleInput ?? ""), [A, j] = s(null), [M, N] = s(!1), [P, F] = s(!1), [I, L] = s(null), R = o(null), z = o(null), [B] = i();
|
|
38
|
+
a(() => () => {
|
|
39
|
+
z.current && clearTimeout(z.current);
|
|
39
40
|
}, []);
|
|
40
|
-
let
|
|
41
|
-
|
|
41
|
+
let V = async () => {
|
|
42
|
+
F(!0), L(null);
|
|
42
43
|
try {
|
|
43
|
-
let e =
|
|
44
|
-
lessonId:
|
|
45
|
-
language:
|
|
46
|
-
code:
|
|
47
|
-
stdin:
|
|
48
|
-
} } })
|
|
49
|
-
if (!
|
|
50
|
-
|
|
44
|
+
let e = await B({ variables: { input: {
|
|
45
|
+
lessonId: C.id,
|
|
46
|
+
language: C.language ?? void 0,
|
|
47
|
+
code: E,
|
|
48
|
+
stdin: O
|
|
49
|
+
} } }), t = e.data?.tecRunLessonCode;
|
|
50
|
+
if (!t) {
|
|
51
|
+
N(!1), R.current = null, j(null), L(r(e.error, "Your code could not be run. Please try again."));
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
|
-
if (
|
|
54
|
-
if (
|
|
55
|
-
|
|
54
|
+
if (t.status === "WARMING") {
|
|
55
|
+
if (R.current ??= Date.now(), Date.now() - R.current < x) {
|
|
56
|
+
N(!0), z.current = setTimeout(() => void V(), b);
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
...
|
|
59
|
+
N(!1), R.current = null, j({
|
|
60
|
+
...t,
|
|
60
61
|
status: "UNAVAILABLE"
|
|
61
62
|
});
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
+
N(!1), R.current = null, j(t), t.lessonCompleted && w();
|
|
65
66
|
} finally {
|
|
66
|
-
|
|
67
|
+
F(!1);
|
|
67
68
|
}
|
|
68
|
-
},
|
|
69
|
-
return /* @__PURE__ */
|
|
69
|
+
}, H = P || M, U = A && A.status === "COMPLETED" ? S(A) : null;
|
|
70
|
+
return /* @__PURE__ */ _("div", {
|
|
70
71
|
className: "space-y-4",
|
|
71
72
|
children: [
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ _("div", {
|
|
73
74
|
className: "overflow-hidden rounded-xl border border-border-strong bg-bg-sunken shadow-sm",
|
|
74
|
-
children: [/* @__PURE__ */
|
|
75
|
+
children: [/* @__PURE__ */ _("div", {
|
|
75
76
|
className: "flex items-center justify-between gap-2 border-b border-border-seam bg-bg-canvas/40 px-4 py-2",
|
|
76
|
-
children: [/* @__PURE__ */
|
|
77
|
+
children: [/* @__PURE__ */ _("div", {
|
|
77
78
|
className: "flex items-center gap-1.5",
|
|
78
79
|
children: [
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ g("span", { className: "h-2.5 w-2.5 rounded-full bg-status-error-border" }),
|
|
81
|
+
/* @__PURE__ */ g("span", { className: "h-2.5 w-2.5 rounded-full bg-status-warning-border" }),
|
|
82
|
+
/* @__PURE__ */ g("span", { className: "h-2.5 w-2.5 rounded-full bg-status-success-border" })
|
|
82
83
|
]
|
|
83
|
-
}), /* @__PURE__ */
|
|
84
|
+
}), /* @__PURE__ */ _("span", {
|
|
84
85
|
className: "inline-flex items-center gap-1.5 font-mono text-xs text-text-muted",
|
|
85
86
|
children: [
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ g(u, { size: 13 }),
|
|
87
88
|
" ",
|
|
88
|
-
|
|
89
|
+
C.language ? t(C.language) : "code"
|
|
89
90
|
]
|
|
90
91
|
})]
|
|
91
|
-
}), /* @__PURE__ */
|
|
92
|
+
}), /* @__PURE__ */ g(y, {
|
|
92
93
|
"aria-label": "Lesson code editor",
|
|
93
|
-
value:
|
|
94
|
-
onChange: (e) =>
|
|
94
|
+
value: E,
|
|
95
|
+
onChange: (e) => D(e.target.value),
|
|
95
96
|
placeholder: "Write your code…",
|
|
96
97
|
className: "min-h-[260px] resize-y rounded-none border-0 bg-transparent font-mono text-xs leading-relaxed focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
97
98
|
spellCheck: !1
|
|
98
99
|
})]
|
|
99
100
|
}),
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
htmlFor: `tec-lesson-stdin-${
|
|
101
|
+
/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
|
|
102
|
+
htmlFor: `tec-lesson-stdin-${C.id}`,
|
|
102
103
|
className: "mb-1 block text-xs font-medium uppercase tracking-wide text-text-muted",
|
|
103
104
|
children: "Input (stdin)"
|
|
104
|
-
}), /* @__PURE__ */
|
|
105
|
-
id: `tec-lesson-stdin-${
|
|
106
|
-
value:
|
|
107
|
-
onChange: (e) =>
|
|
105
|
+
}), /* @__PURE__ */ g(y, {
|
|
106
|
+
id: `tec-lesson-stdin-${C.id}`,
|
|
107
|
+
value: O,
|
|
108
|
+
onChange: (e) => k(e.target.value),
|
|
108
109
|
placeholder: "Optional input your program reads",
|
|
109
110
|
className: "min-h-[64px] font-mono text-xs",
|
|
110
111
|
spellCheck: !1
|
|
111
112
|
})] }),
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ _("div", {
|
|
113
114
|
className: "flex flex-wrap items-center gap-2",
|
|
114
115
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
onClick: () => void
|
|
117
|
-
disabled:
|
|
118
|
-
children: [
|
|
116
|
+
/* @__PURE__ */ _(v, {
|
|
117
|
+
onClick: () => void V(),
|
|
118
|
+
disabled: H || !E.trim(),
|
|
119
|
+
children: [H ? /* @__PURE__ */ g(d, {
|
|
119
120
|
size: 16,
|
|
120
121
|
className: "animate-spin"
|
|
121
|
-
}) : /* @__PURE__ */
|
|
122
|
+
}) : /* @__PURE__ */ g(f, { size: 16 }), M ? "Starting sandbox…" : P ? "Running…" : "Run code"]
|
|
122
123
|
}),
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ _(v, {
|
|
124
125
|
variant: "outline",
|
|
125
126
|
onClick: () => {
|
|
126
|
-
|
|
127
|
+
D(T), j(null), L(null);
|
|
127
128
|
},
|
|
128
|
-
disabled:
|
|
129
|
-
children: [/* @__PURE__ */
|
|
129
|
+
disabled: H || E === T,
|
|
130
|
+
children: [/* @__PURE__ */ g(p, { size: 15 }), " Reset to starter"]
|
|
130
131
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ g("span", {
|
|
132
133
|
className: "text-xs text-text-muted",
|
|
133
134
|
children: "Runs in an isolated sandbox."
|
|
134
135
|
})
|
|
135
136
|
]
|
|
136
137
|
}),
|
|
137
|
-
|
|
138
|
+
M ? /* @__PURE__ */ g("p", {
|
|
138
139
|
role: "status",
|
|
139
140
|
className: "rounded-lg border border-border-seam bg-bg-sunken px-3 py-2 text-sm text-text-secondary",
|
|
140
141
|
children: "The code sandbox is starting up. Your code will run automatically as soon as it is ready."
|
|
141
142
|
}) : null,
|
|
142
|
-
|
|
143
|
+
I ? /* @__PURE__ */ g("p", {
|
|
144
|
+
role: "alert",
|
|
145
|
+
"data-testid": "lesson-run-error",
|
|
146
|
+
className: "rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
147
|
+
children: I
|
|
148
|
+
}) : null,
|
|
149
|
+
A?.status === "UNAVAILABLE" ? /* @__PURE__ */ g("p", {
|
|
143
150
|
role: "alert",
|
|
144
151
|
className: "rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
145
152
|
children: "The code sandbox is not available right now. Please try again in a moment."
|
|
146
153
|
}) : null,
|
|
147
|
-
|
|
154
|
+
A && U ? /* @__PURE__ */ _("div", {
|
|
148
155
|
className: "space-y-3 rounded-xl border border-border-seam p-4",
|
|
149
156
|
"data-testid": "lesson-run-output",
|
|
150
157
|
children: [
|
|
151
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ _("div", {
|
|
152
159
|
className: "flex flex-wrap items-center gap-3",
|
|
153
160
|
children: [
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
className: e("inline-flex items-center gap-1.5 text-sm font-medium",
|
|
156
|
-
children: [
|
|
161
|
+
/* @__PURE__ */ _("span", {
|
|
162
|
+
className: e("inline-flex items-center gap-1.5 text-sm font-medium", U.tone === "success" && "text-status-success-text", U.tone === "error" && "text-status-error-text", U.tone === "neutral" && "text-text-primary"),
|
|
163
|
+
children: [U.tone === "error" ? /* @__PURE__ */ g(h, { size: 16 }) : /* @__PURE__ */ g(c, { size: 16 }), U.text]
|
|
157
164
|
}),
|
|
158
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ _("span", {
|
|
159
166
|
className: "inline-flex items-center gap-1 text-xs text-text-muted",
|
|
160
167
|
children: [
|
|
161
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ g(l, { size: 12 }),
|
|
162
169
|
" ",
|
|
163
|
-
|
|
170
|
+
A.durationMs,
|
|
164
171
|
" ms"
|
|
165
172
|
]
|
|
166
173
|
}),
|
|
167
|
-
|
|
174
|
+
A.lessonCompleted ? /* @__PURE__ */ g("span", {
|
|
168
175
|
className: "rounded-full border border-status-success-border bg-status-success-bg-subtle px-2 py-0.5 text-xs font-medium text-status-success-text",
|
|
169
176
|
children: "Lesson completed"
|
|
170
177
|
}) : null
|
|
171
178
|
]
|
|
172
179
|
}),
|
|
173
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ _("div", {
|
|
174
181
|
className: "grid grid-cols-1 gap-3 md:grid-cols-2",
|
|
175
|
-
children: [/* @__PURE__ */
|
|
182
|
+
children: [/* @__PURE__ */ g(n, {
|
|
176
183
|
label: "Output",
|
|
177
|
-
value:
|
|
178
|
-
}),
|
|
184
|
+
value: A.stdout
|
|
185
|
+
}), C.expectedOutput ? /* @__PURE__ */ g(n, {
|
|
179
186
|
label: "Expected output",
|
|
180
|
-
value:
|
|
187
|
+
value: C.expectedOutput
|
|
181
188
|
}) : null]
|
|
182
189
|
}),
|
|
183
|
-
|
|
190
|
+
A.stderr ? /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ _("p", {
|
|
184
191
|
className: "mb-1 flex items-center gap-1 text-xs font-medium uppercase tracking-wide text-text-muted",
|
|
185
|
-
children: [/* @__PURE__ */
|
|
186
|
-
}), /* @__PURE__ */
|
|
192
|
+
children: [/* @__PURE__ */ g(m, { size: 12 }), " Errors"]
|
|
193
|
+
}), /* @__PURE__ */ g("pre", {
|
|
187
194
|
className: "overflow-auto rounded-lg bg-status-error-bg-subtle px-3 py-2 font-mono text-xs text-status-error-text",
|
|
188
|
-
children:
|
|
195
|
+
children: A.stderr
|
|
189
196
|
})] }) : null
|
|
190
197
|
]
|
|
191
198
|
}) : null
|
|
@@ -193,6 +200,6 @@ function S({ lesson: S, onCompleted: C }) {
|
|
|
193
200
|
});
|
|
194
201
|
}
|
|
195
202
|
//#endregion
|
|
196
|
-
export {
|
|
203
|
+
export { C as InteractiveWorkspace };
|
|
197
204
|
|
|
198
205
|
//# sourceMappingURL=InteractiveWorkspace.js.map
|