@tinyweb_dev/oe-exam-sdk 0.1.18 → 0.1.20
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/api/exam-taking.js +1 -1
- package/dist/api/exam-taking.types.d.ts +1 -0
- package/dist/components/exams/take/ExamTakingPageContainer.js +1 -1
- package/dist/components/themes/index.d.ts +1 -0
- package/dist/components/themes/index.js +1 -1
- package/dist/components/themes/summer-sky/SummerSkyExitModal.d.ts +8 -0
- package/dist/components/themes/summer-sky/SummerSkyExitModal.js +1 -0
- package/dist/components/themes/summer-sky/assets/images/cancel_exam.jpg +0 -0
- package/dist/components/themes/summer-sky/assets/images/continue_exam.png +0 -0
- package/dist/shared/constants/ApiConstant.d.ts +1 -0
- package/dist/shared/constants/ApiConstant.js +1 -1
- package/package.json +1 -1
package/dist/api/exam-taking.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{API_BASE_URL as t,API_ENDPOINTS as e}from"../shared/constants/ApiConstant";export function createExamTakingApi(
|
|
1
|
+
import{API_BASE_URL as t,API_ENDPOINTS as e}from"../shared/constants/ApiConstant";export function createExamTakingApi(T={}){const n=function({baseUrl:e=t??"",fetcher:T=fetch,headers:n}){return async function(t,a){const o="undefined"!=typeof FormData&&a?.body instanceof FormData,s=await T(`${e}${t}`,{credentials:"include",...a,headers:{...!o&&{"Content-Type":"application/json"},...n,...a?.headers}});if(!s.ok)throw new Error(await async function(t){const e=await t.json().catch(()=>{});return"object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:t.statusText}(s));if(204!==s.status)return s.json()}}(T);return{getActiveAttempt:t=>n(e.STUDENT.ATTEMPTS_ACTIVE_BY_ROOM(t)),getActive:()=>n(e.STUDENT.ATTEMPTS_ACTIVE),getAttempt:(t,T)=>n(`${e.STUDENT.ATTEMPT_DETAIL(t)}${T?`?token=${encodeURIComponent(T)}`:""}`),deleteAttempt:t=>n(e.STUDENT.ATTEMPT_DELETE(t),{method:"DELETE"}),getRoom:t=>n(e.STUDENT.ROOM_DETAIL(t)),startAttempt:t=>n(e.STUDENT.ATTEMPTS_START,{method:"POST",body:JSON.stringify({examRoomId:t})}),getQuestions:t=>n(e.STUDENT.ATTEMPT_QUESTIONS(t)),saveAnswers:async({attemptId:t,answers:T,keepalive:a})=>{await n(e.STUDENT.ATTEMPT_ANSWERS(t),{method:"POST",keepalive:a,body:JSON.stringify({answers:T})})},submitAttempt:t=>n(e.STUDENT.ATTEMPT_SUBMIT(t),{method:"POST"}),cancelAttempt:t=>n(e.STUDENT.ATTEMPT_CANCEL(t),{method:"POST"}),uploadAudioAnswer:({attemptId:t,questionId:T,audioBlob:a,durationMs:o})=>{const s=new FormData,i="audio/webm"===a.type?"webm":"audio/ogg"===a.type?"ogg":"mp3";return s.append("file",a,`recording.${i}`),s.append("questionId",T),void 0!==o&&s.append("durationMs",String(o)),n(e.STUDENT.ATTEMPT_AUDIO_ANSWER(t),{method:"POST",body:s})},uploadProctoringSnapshot:({attemptId:t,imageBlob:T})=>{const a=new FormData;return a.append("file",T,"snapshot.jpg"),n(e.STUDENT.ATTEMPT_PROCTORING_SNAPSHOT(t),{method:"POST",body:a})},realtimeGradeSingle:({attemptId:t,questionId:T,audioKey:a})=>n(e.SHARED.SPEAKING_REALTIME_GRADE,{method:"POST",body:JSON.stringify({attemptId:t,questionId:T,audioKey:a})}),getGradingSummary:t=>n(e.STUDENT.ATTEMPT_GRADING_SUMMARY(t)),getAnswerDetail:(t,T)=>n(e.STUDENT.ATTEMPT_ANSWER_DETAIL(t,T)),getAnswersGradingStatus:(t,T)=>n(e.STUDENT.ATTEMPT_ANSWERS_GRADING_STATUS(t),{method:"POST",body:JSON.stringify({answerIds:T})})}}export function createMockExamTakingApi(t){const e=new Map;return{getActiveAttempt:async()=>t.attempt,startAttempt:async()=>t.attempt,getQuestions:async()=>t.questions,saveAnswers:async({answers:t})=>{t.forEach(t=>e.set(t.questionId,t.answer))},submitAttempt:async()=>({answers:Object.fromEntries(e)})}}
|
|
@@ -116,6 +116,7 @@ export interface ExamTakingSdkApi {
|
|
|
116
116
|
getQuestions: (attemptId: string) => Promise<ApiData<ExamTakingQuestionsResult> | ExamTakingQuestionsResult>;
|
|
117
117
|
saveAnswers?: (input: SaveExamTakingAnswersInput) => Promise<void>;
|
|
118
118
|
submitAttempt: (attemptId: string) => Promise<ApiData<SubmitExamTakingAttemptResult> | SubmitExamTakingAttemptResult | unknown>;
|
|
119
|
+
cancelAttempt?: (attemptId: string) => Promise<unknown>;
|
|
119
120
|
uploadAudioAnswer?: (input: {
|
|
120
121
|
attemptId: string;
|
|
121
122
|
questionId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useEffect as i,useRef as s,useState as r,useMemo as a,useCallback as o}from"react";import d from"next/image";import l from"../../../components/themes/summer-sky/assets/images/clock.png";import m from"../../../components/themes/summer-sky/assets/images/submit.png";import c from"../../../components/themes/summer-sky/assets/images/has_answered.png";import{toast as p}from"sonner";import{Loader2 as u}from"lucide-react";import{t as g}from"../../../shared/lib/i18n";import{transformAnswersForSubmission as h}from"./utils/answer-transformers";import{getThemeForLevel as x,normalizeExamTheme as b}from"../../../shared/lib/themes";import{useExamTakingStore as I}from"../../../shared/lib/stores/examTakingStore";import{useGradingTransientStore as f}from"../../../shared/lib/stores/gradingTransientStore";import{AlertDialog as w,AlertDialogAction as E,AlertDialogCancel as S,AlertDialogContent as _,AlertDialogDescription as y,AlertDialogFooter as v,AlertDialogHeader as N,AlertDialogTitle as A}from"../../../components/ui/alert-dialog";import{useExamTimer as T}from"./hooks/useExamTimer";import{useAutoSave as C}from"./hooks/useAutoSave";import{useProctoringCamera as k}from"./hooks/useProctoringCamera";import{getStandardExamTheme as P}from"../../../components/themes";import{QuestionRenderer as q}from"./components/QuestionRenderer";import{FullscreenLoading as M}from"../entry/fullscreen-loading";import{SummerSkySubmitModal as R}from"../../../components/themes/summer-sky/SummerSkySubmitModal";import{EnglishCertificationExamLayout as D,EnglishCertificationQuestionRenderer as L,scrollToEnglishCertQuestion as G}from"../../../components/themes/english-certification";import{groupQuestionsByPart as Q}from"./utils/question-transformers";import{unwrap as B,unwrapAttempt as O}from"./exam-taking.utils";import{ExamTakingApiProvider as Y}from"./ExamTakingApiContext";function F({roomId:Y,api:F,onNavigate:K,resultPath:U=e=>`/student/results/${e}`,fallbackPath:$="/student/contests/discover",proctoringEnabled:V=!1,achieversExamTitle:j,onSubmitted:H}){const z=I(),W=s(!1),J=o((e,t=!1)=>{K?K(e,{replace:t}):"undefined"!=typeof window&&(t?window.location.replace(e):window.location.href=e)},[K]),{isCameraActive:X}=k({api:F,attemptId:z.attemptId,intervalMs:1e4,enabled:V}),[Z,ee]=r(!0),te=z.currentPartIndex,ne=z.currentQuestionGlobalIndex,ie=o(e=>{const t=I.getState().currentPartIndex,n="function"==typeof e?e(t):e;I.getState().setCurrentPartIndex(n)},[]),se=o(e=>{const t=I.getState().currentQuestionGlobalIndex,n="function"==typeof e?e(t):e;I.getState().setCurrentQuestionGlobalIndex(n)},[]),[re,ae]=r([]),[oe,de]=r("SUMMER_SKY"),[le,me]=r(""),[ce,pe]=r(!1),[ue,ge]=r(null),[he,xe]=r(""),be=o(e=>{I.getState().markIntroPlayed(e)},[]),Ie="TOEIC"===z.examType||"ENGLISH_CERTIFICATION"===le,fe=a(()=>{if(!Ie||0===z.parts.length)return te;const e=z.currentIndex;for(let t=0;t<z.parts.length;t++){const n=z.parts[t],i=n.startIndex??0,s=n.endIndex??i;if(e>=i&&e<=s)return t}return 0},[Ie,z.currentIndex,z.parts,te]);i(()=>{(async()=>{try{ee(!0);let e=B(await F.getActiveAttempt(Y));e||(e=O(B(await F.startAttempt(Y))));let t=null;try{t=F.getRoom?B(await F.getRoom(Y)):null,t&&ge(t)}catch{}const{examTemplate:n,questions:i}=B(await F.getQuestions(e.id));n?.title&&xe(n.title);const s=n?.parts??e.exam?.template?.parts,r=Q(i,s),a=n?.subTitle??null,o=(r.every(e=>e.questions.every(e=>"SPEAKING"===e.question_skill_type)),r.some(e=>"SPEAKING"===e.category||e.questions.every(e=>"SPEAKING"===e.question_skill_type)));ae(r);const d=n?.theme||e?.exam?.template?.theme||e?.exam?.theme||t?.exam?.template?.theme||t?.exam?.theme||"",l=b(d);if(o){const e=["SUMMER_SKY"].includes(d);de(e?d:"SUMMER_SKY")}const m=new Date(e.startedAt),c=60*e.durationMinutes*1e3,u=m.getTime()+c,h=Date.now();if(0===Math.max(0,u-h)){p.info(g("student.exam.take.timeExpired"));try{await F.submitAttempt(e.id)}catch{}return I.persist.clearStorage(),void J(U(e.id))}z.hydrateFromServer({attemptId:e.id,examRoomId:Y,questions:i.map(e=>({id:e.id,question_type:e.question_type,content:e.content,is_example:e.is_example,total_points:e.total_points,part_id:e.part_id,part_no:e.part_no,question_number:e.question_number})),durationMinutes:e.durationMinutes,startedAt:e.startedAt,examType:a??void 0,examTitle:n?.title??void 0,parts:s}),a&&z.setExamType(a),me(l),s&&z.setParts(s),ee(!1)}catch(e){const t=e?.response?.data?.errorCode;if("ATTEMPT_ALREADY_SUBMITTED"===t)return p.info(g("student.exam.take.submitted")),void J($,!0);console.error("Failed to load exam data:",e),p.error(g("student.exam.take.loadError")),J($,!0)}})()},[Y]);const we=a(()=>re.length>0&&re.every(e=>e.questions.every(e=>"SPEAKING"===e.question_skill_type)),[re]),Ee=a(()=>{const e=re[te];return!!e&&(("SPEAKING_DESCRIBE_IMAGE"!==e.questionType&&"SPONTANEOUS_QA"!==e.questionType&&"SPEAKING_CUE_CARD"!==e.questionType&&"READ_DISPLAYED_CONTENT"!==e.questionType||"CAMBRIDGE_YLE"!==le)&&("SPEAKING"===e.category||e.questions.every(e=>"SPEAKING"===e.question_skill_type)))},[re,te,le]),{remainingSeconds:Se,warningLevel:_e}=T({onTimeExpired:async()=>{p.info(g("student.exam.take.autoSubmit")),await Ae()},onWarningThreshold:we||Ie?void 0:()=>{p.warning(g("student.exam.take.timeWarning"))},warningThresholdSeconds:we||Ie?void 0:300,warningThresholds:Ie?[{seconds:900,level:"warning",callback:()=>p.warning("Còn 15 phút!",{duration:3e3})},{seconds:300,level:"critical",callback:()=>p.warning("Còn 5 phút! Hãy nộp bài ngay!",{duration:5e3})}]:we?[{seconds:300,level:"warning",callback:()=>p.warning("Còn 5 phút! Hãy hoàn thành bài thi.",{duration:5e3})},{seconds:120,level:"critical",callback:()=>p.warning("Còn 2 phút! Bài thi sẽ được tự động nộp.",{duration:5e3})}]:void 0}),ye=C({api:F,attemptId:z.attemptId||"",parts:re,intervalMs:Ie?15e3:3e4,onSaveError:e=>{console.error("Save error:",e)}}),ve=s(ye.saveNow),Ne=s(re);i(()=>{ve.current=ye.saveNow,Ne.current=re}),i(()=>{const e=()=>{const e=I.getState();if(!e.attemptId||!e.isDirty||e.isSubmitting)return;const t=h(e.answers,Ne.current);if(0!==t.length)try{F.saveAnswers?.({attemptId:e.attemptId,answers:t,keepalive:!0})}catch{}},t=()=>{"hidden"===document.visibilityState&&e()},n=()=>{const e=I.getState();e.isDirty&&!e.isSubmitting&&ve.current()};return document.addEventListener("visibilitychange",t),window.addEventListener("pagehide",e),window.addEventListener("online",n),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("pagehide",e),window.removeEventListener("online",n)}},[]),i(()=>{we||ve.current()},[z.currentIndex,te,ne,we]);const Ae=async()=>{if(!W.current){W.current=!0,z.setIsSubmitting(!0),pe(!1);try{z.isDirty&&await ye.saveNow();const e=B(await F.submitAttempt(z.attemptId)),t=e?.pendingAnswerIds??[];z.attemptId&&(f.getState().setPending(z.attemptId,t),H?.({attemptId:z.attemptId,pendingAnswerIds:t})),0===t.length?p.success(g("student.exam.take.submitSuccess")):p.success(g("student.exam.take.submittedAIGradingInProgress")),I.persist.clearStorage(),J(U(z.attemptId),!0)}catch(e){console.error("Failed to submit exam:",e);const t=e?.response?.data?.errorCode;if("ATTEMPT_ALREADY_SUBMITTED"===t)return I.persist.clearStorage(),void J(U(z.attemptId),!0);p.warning(g("student.exam.take.submitError")),W.current=!1,z.setIsSubmitting(!1)}}},Te=o(()=>{pe(!0)},[]),Ce=s(new Map),ke=s([]),Pe=o((e,t)=>{z.setAnswer(e,t);const n=Ce.current.get(e)||e,i=ke.current.findIndex(e=>e.questionId===n);-1!==i&&se(e=>e!==i?i:e)},[]),qe=s("forward"),Me=e=>{if("CAMBRIDGE_YLE"!==le)return!1;const t=re[e];return"SPEAKING_DESCRIBE_IMAGE"===t?.questionType||"SPONTANEOUS_QA"===t?.questionType||"SPEAKING_CUE_CARD"===t?.questionType||"READ_DISPLAYED_CONTENT"===t?.questionType},Re=()=>{const e=()=>{window.scrollTo({top:0,behavior:"smooth"});const e=document.getElementById("exam-main-scroll-area");if(e){e.scrollTo({top:0,behavior:"smooth"});e.querySelectorAll(".overflow-y-auto").forEach(e=>{e.scrollTo({top:0,behavior:"smooth"})})}};requestAnimationFrame(e),setTimeout(e,100),setTimeout(e,250)},De=()=>{if("ENGLISH_CERTIFICATION"===le){const e=z.parts[fe+1];e&&z.goToQuestion(e.startIndex??0)}else if(Ie)z.goToQuestion(Math.min(z.currentIndex+1,z.questions.length-1));else if("CAMBRIDGE_YLE"===le&&Me(te)){const e=ne+1,t=$e[e];t&&(t.partIndex!==te&&(qe.current="forward",ie(t.partIndex)),se(e))}else qe.current="forward",ie(e=>{const t=Math.min(e+1,re.length-1);if("CAMBRIDGE_YLE"===le){const e=$e.find(e=>e.partIndex===t);e&&se(e.globalIndex)}return t});Re()},Le=()=>{if("ENGLISH_CERTIFICATION"===le){const e=z.parts[fe-1];e&&z.goToQuestion(e.startIndex??0)}else if(Ie)z.goToQuestion(Math.max(z.currentIndex-1,0));else if("CAMBRIDGE_YLE"===le&&Me(te)){const e=ne-1,t=$e[e];t&&(t.partIndex!==te&&(qe.current="backward",ie(t.partIndex)),se(e))}else qe.current="backward",ie(e=>{const t=Math.max(e-1,0);if("CAMBRIDGE_YLE"===le){const e=$e.find(e=>e.partIndex===t);e&&se(e.globalIndex)}return t});Re()},Ge=()=>{J($)},Qe=a(()=>re.reduce((e,t)=>e+("CAMBRIDGE_YLE"===le?t.questions.length:t.questions.filter(e=>!e.is_example).length),0),[re,le]),Be=a(()=>{const e=new Map;return re.forEach(t=>{t.questions.forEach(n=>{if(n.is_example)return;const i=n.content;if("FILL_MISSING_WORDS_IN_GRID"===t.questionType&&i?.grid&&i.grid.forEach((t,i)=>{t.forEach((t,s)=>{e.set(`${i}-${s}`,n.id)})}),"LABEL_THE_PICTURE"===t.questionType&&i?.labels&&i.labels.forEach(t=>{t.id&&e.set(t.id,n.id)}),"READ_AND_COLOR_OBJECTS"===t.questionType){const t=i?.regions||i?.regionNodes;t?.forEach(t=>{t.id&&e.set(t.id,n.id)})}if("IMAGE_OBJECT_MATCHING"===t.questionType){const t=i?.regions||i?.regionNodes;t?.forEach(t=>{t.id&&e.set(t.id,n.id)})}if("LOOK_PICTURE_FILL_WORD_HINT"===t.questionType){const t=i?.word;if(t&&"string"==typeof t){const i=/\{(\d+)\}/g;let s;for(;null!==(s=i.exec(t));){const t=s[1];e.set(`${n.id}-blank-${t}`,n.id)}}}})}),e},[re]);i(()=>{Ce.current=Be},[Be]);const Oe=a(()=>{if(!z.answers)return new Set;const e=new Set(re.flatMap(e=>e.questions.filter(e=>!e.is_example).map(e=>e.id))),t=new Set;return Object.keys(z.answers).forEach(n=>{const i=z.answers[n];if(void 0===i||""===i)return;if(e.has(n))return void t.add(n);const s=Be.get(n);s&&e.has(s)&&t.add(s)}),t},[z.answers,re,Be]),Ye=Oe.size+("CAMBRIDGE_YLE"===le?re.reduce((e,t)=>e+t.questions.filter(e=>e.is_example).length,0):0),Fe=a(()=>ue?.exam?.name||ue?.name||(Ie?"TOEIC Listening and Reading Test":"Bài thi"),[ue,Ie]),Ke=a(()=>x(ue?.exam?.level).displayName,[ue?.exam?.level]),{sidebarParts:Ue,sidebarQuestions:$e}=a(()=>{const e=[],t=[];let n=0;return re.forEach((i,s)=>{const r="CAMBRIDGE_YLE"===le?i.questions:i.questions.filter(e=>!e.is_example);let a=0;r.forEach(e=>{const r=!("CAMBRIDGE_YLE"!==le||!e.is_example)||Oe.has(e.id);r&&a++;const o=i.questions.findIndex(t=>t.id===e.id);t.push({globalIndex:n,partIndex:s,indexInPart:o,questionNumber:e.question_number,isAnswered:r,questionId:e.id,isExample:e.is_example}),n++}),e.push({partIndex:s,partNo:i.partNo,name:i.name,category:i.category,points:i.points,totalQuestions:"CAMBRIDGE_YLE"===le?i.questions.length:i.questions.filter(e=>!e.is_example).length,answeredCount:a})}),{sidebarParts:e,sidebarQuestions:t}},[re,Oe,le]);if(i(()=>{ke.current=$e},[$e]),Z)return e(M,{});const Ve=te,je=re[Ve];if(!je)return e("div",{className:"flex min-h-screen items-center justify-center",children:t("div",{className:"text-center",children:[e("p",{className:"text-lg font-semibold text-red-500",children:"Không tìm thấy câu há»i"}),e("button",{type:"button",onClick:()=>J($),className:"mt-4 rounded-lg bg-blue-500 px-4 py-2 text-white hover:bg-blue-600",children:"Quay lại"})]})});if(Ee)return t(n,{children:[e(q,{part:je,answers:z.answers||{},onAnswerChange:Pe,isReviewMode:!1,onExit:Ge,onPartComplete:Ve<re.length-1?De:Te,onPartBack:Ve>0?Le:void 0,speakingTheme:oe,initialQuestionIndex:"backward"===qe.current?je.questions.length-1:0,skipTeacherVideo:z.playedIntroParts.has(Ve)||he!==j,onTeacherIntroPlayed:()=>be(Ve)},`${je.partId}-${Ve}`),"SUMMER_SKY"===oe?ce&&e(R,{onClose:()=>pe(!1),onSubmit:Ae,isSubmitting:z.isSubmitting}):e(w,{open:ce,onOpenChange:pe,children:t(_,{children:[t(N,{children:[e(A,{children:"Nộp bài thi"}),e(y,{children:"Bạn có chắc chắn muốn nộp bài không? Sau khi nộp, bạn sẽ không thể thay đổi câu trả lời."})]}),t(v,{children:[e(S,{disabled:z.isSubmitting,children:"Quay lại"}),e(E,{onClick:Ae,disabled:z.isSubmitting,children:z.isSubmitting?t(n,{children:[e(u,{className:"mr-2 h-4 w-4 animate-spin"}),"Đang nộp..."]}):"Nộp bài"})]})]})}),t("div",{className:"fixed top-8 right-6 z-[100] flex flex-col items-end gap-4 sm:gap-6 lg:top-10 lg:right-16",children:[t("div",{className:"flex items-center gap-4 sm:gap-6",children:[Se>0&&t("div",{className:"flex items-center w-[130px] sm:w-[170px] h-[40px] sm:h-[50px] rounded-[33.5px] backdrop-blur-[8px] transition-all duration-300 ease-in-out border-none shadow-[0_4px_20px_rgba(0,0,0,0.25)] "+("critical"===_e?"bg-[rgba(220,38,38,0.85)] shadow-[0_0_24px_rgba(220,38,38,0.5)] animate-pulse":"warning"===_e?"bg-[rgba(180,120,0,0.85)]":"bg-[#001590]"),children:[e(d,{src:l,alt:"clock",width:75,height:75,className:"w-[50px] h-[50px] sm:w-[75px] sm:h-[75px] -ml-[5px] sm:-ml-[10px] -mt-[10px] sm:-mt-[15px] shrink-0 drop-shadow-[0_2px_6px_rgba(0,0,0,0.2)] pointer-events-none z-10"}),t("span",{className:"flex-1 text-center font-bold text-[18px] sm:text-[25px] leading-none tracking-[-0.03em] uppercase text-white pr-[10px] sm:pr-[16px]",style:{fontFamily:"'SVN-Volte Rounded', 'Quicksand', sans-serif",textShadow:"0 2px 4px rgba(0, 0, 0, 0.2)"},children:[Math.floor(Se/60).toString().padStart(2,"0"),":",(Se%60).toString().padStart(2,"0")]})]}),t("div",{className:"flex items-center w-[130px] sm:w-[170px] h-[40px] sm:h-[50px] rounded-[33.5px] bg-[#FF9900] shadow-[0_4px_20px_rgba(0,0,0,0.25)] border-none shrink-0",title:"Số câu hỏi đã hoàn thành",children:[e(d,{src:c,alt:"Progress",width:75,height:75,className:"w-[50px] h-[50px] sm:w-[75px] sm:h-[75px] -ml-[5px] sm:-ml-[10px] -mt-[10px] sm:-mt-[15px] shrink-0 drop-shadow-[0_2px_6px_rgba(0,0,0,0.2)] pointer-events-none z-10"}),t("span",{className:"flex-1 text-center font-bold text-[18px] sm:text-[25px] leading-none tracking-[-0.03em] uppercase text-white pr-[10px] sm:pr-[16px]",style:{fontFamily:'"SVN-Volte Rounded", "Quicksand", sans-serif',textShadow:"0 2px 4px rgba(0,0,0,0.2)"},children:[Ye,"/",Qe]})]})]}),t("button",{onClick:Te,disabled:z.isSubmitting,className:"group cursor-pointer flex items-center h-[40px] sm:h-[50px] w-[130px] sm:w-[170px] rounded-[33.5px] shadow-[0_4px_20px_rgba(0,0,0,0.25)] transition-all duration-300 hover:scale-105 active:scale-95 disabled:pointer-events-none disabled:opacity-60 border-none "+(z.isSubmitting?"bg-slate-400":"bg-[#16CA3B] hover:bg-[#15b736]"),children:[e(d,{src:m,alt:"Submit",width:75,height:75,className:"w-[50px] h-[50px] sm:w-[75px] sm:h-[75px] -ml-[5px] sm:-ml-[10px] -mt-[10px] sm:-mt-[15px] shrink-0 drop-shadow-[0_2px_6px_rgba(0,0,0,0.2)] pointer-events-none transition-transform duration-300 group-hover:scale-110 z-10"}),z.isSubmitting?e("div",{className:"flex-1 flex justify-center pr-[10px] sm:pr-[16px]",children:e(u,{className:"h-6 w-6 animate-spin text-white"})}):e("span",{className:"flex-1 text-center font-bold text-[18px] sm:text-[25px] leading-none tracking-[-0.03em] uppercase text-white pr-[10px] sm:pr-[16px]",style:{fontFamily:'"SVN-Volte Rounded", "Quicksand", sans-serif',textShadow:"0 2px 4px rgba(0,0,0,0.2)"},children:"Nộp bài"})]})]}),z.isSubmitting&&e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:t("div",{className:"rounded-xl bg-white p-8 text-center shadow-2xl",children:[e(u,{className:"mx-auto h-12 w-12 animate-spin text-green-500"}),e("p",{className:"mt-4 text-lg font-semibold text-gray-700",children:"Đang nộp bài..."}),e("p",{className:"mt-2 text-sm text-gray-500",children:"Vui lòng đợi trong giây lát"})]})})]});if(Ie){const i=re[fe],s=z.parts[fe],r=s?Math.max(0,z.currentIndex-(s.startIndex??0)):0,a=(s?.startIndex??0)+1,o=(s?.endIndex??a-1)+1,d={examName:Fe,remainingSeconds:z.remainingSeconds,totalQuestions:Qe,answeredCount:Ye,isSubmitting:z.isSubmitting,onSubmit:Ae,onClose:Ge,lastSavedAt:z.lastSavedAt,isSaving:ye.isSaving,partLabel:(s?.name||i?.name||"").toUpperCase()||void 0,partSubLabel:s?.category||void 0,questionRange:a===o?`${a}`:`${a}–${o}`},l=i?.questions?.[r],m="ENGLISH_CERTIFICATION"===le,c={onPrevious:Le,onClear:m?void 0:()=>{l&&Pe(l.id,{optionId:null})},onToggleMark:m?void 0:()=>{l&&z.toggleFlag(l.id)},onNext:De,isMarked:!!l&&z.flaggedQuestions.has(l.id),showSecondaryActions:!m,isPreviousDisabled:m?fe<=0:z.currentIndex<=0,isNextDisabled:m?fe>=z.parts.length-1:z.currentIndex>=z.questions.length-1},p={parts:z.parts,questions:z.questions,answers:z.answers,flaggedQuestions:z.flaggedQuestions,currentIndex:z.currentIndex,onQuestionClick:e=>{z.goToQuestion(e);const t=z.questions[e];t&&G(t.id,{behavior:"smooth",block:"start"})},onPartClick:e=>{const t=z.parts[e];if(t){const n=t.startIndex??0;z.goToQuestion(n),z.setCurrentPartIndex(e);const i=z.questions[n];i&&G(i.id,{behavior:"smooth",block:"start"})}}};if(i&&s)return t(n,{children:[e(D,{headerProps:d,navigationProps:p,footerProps:c,children:e(L,{part:i,partConfig:s,currentQuestionIndex:r,answers:z.answers,flaggedQuestions:z.flaggedQuestions,onAnswerChange:Pe,onToggleFlag:e=>z.toggleFlag(e),isReviewMode:!1,isAudioPlayed:z.playedListeningAudioParts.has(i.partId),onAudioFirstPlay:()=>z.markListeningAudioPlayed(i.partId)})}),z.isSubmitting&&e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:t("div",{className:"rounded-xl bg-white p-8 text-center shadow-2xl",children:[e(u,{className:"mx-auto h-12 w-12 animate-spin text-green-500"}),e("p",{className:"mt-4 text-lg font-semibold text-gray-700",children:"Đang nộp bài..."}),e("p",{className:"mt-2 text-sm text-gray-500",children:"Vui lòng đợi trong giây lát"})]})})]})}return t(n,{children:[(()=>{const{Layout:n,QuestionCard:i}=P(le),s={headerProps:{examName:Fe,examType:"EXAM",levelLabel:Ke,totalQuestions:Qe,answeredCount:Ye,remainingSeconds:z.remainingSeconds,isSubmitting:z.isSubmitting,isCameraActive:X,onSubmit:Te},onPrevious:Le,onNext:De,onClose:Ge,isNavDisabled:z.isNavDisabled,partName:je?.name||(je?.partNo?`PART ${je.partNo}`:void 0)};if("CAMBRIDGE_YLE"===le){const e=Me(Ve);s.isFirstQuestion=e?0===ne:0===Ve,s.isLastQuestion=e?ne===$e.length-1:Ve===re.length-1,s.sidebarProps={parts:Ue,questions:$e,currentQuestionGlobalIndex:ne,isNavDisabled:z.isNavDisabled,onPartClick:e=>{if(z.isNavDisabled)return;qe.current=e>Ve?"forward":"backward",ie(e);const t=$e.find(t=>t.partIndex===e);t&&se(t.globalIndex),Re()},onQuestionClick:e=>{if(z.isNavDisabled)return;const t=$e[e];t&&t.partIndex!==Ve&&(qe.current=t.partIndex>Ve?"forward":"backward",ie(t.partIndex)),se(e),t&&setTimeout(()=>{const e=document.getElementById(`question-${t.questionId}`);e&&e.scrollIntoView({behavior:"smooth",block:"center"})},100)}}}else s.isFirstQuestion=0===Ve,s.isLastQuestion=Ve===re.length-1;const r="CAMBRIDGE_YLE"===le&&("SPEAKING_DESCRIBE_IMAGE"===je?.questionType||"SPONTANEOUS_QA"===je?.questionType||"SPEAKING_CUE_CARD"===je?.questionType||"READ_DISPLAYED_CONTENT"===je?.questionType),a=$e[ne],o=r&&a?.partIndex===Ve?a.indexInPart:void 0;return t(n,{...s,children:[e(i,{partName:je?.name||(je?.partNo?`PART ${je.partNo}`:void 0),children:e(q,{part:je,answers:z.answers||{},onAnswerChange:Pe,isReviewMode:!1,currentQuestionIndex:o,onExit:Ge,onPartComplete:Ve<re.length-1?De:Te,onPartBack:Ve>0?Le:void 0,speakingTheme:"CAMBRIDGE_YLE"===le?"CAMBRIDGE_YLE":oe,initialQuestionIndex:"backward"===qe.current?je?.questions.length-1:0,skipTeacherVideo:z.playedIntroParts.has(Ve)||he!==j,onTeacherIntroPlayed:()=>be(Ve)})}),z.isSubmitting&&e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:t("div",{className:"rounded-xl bg-white p-8 text-center shadow-2xl",children:[e(u,{className:"mx-auto h-12 w-12 animate-spin text-green-500"}),e("p",{className:"mt-4 text-lg font-semibold text-gray-700",children:"Đang nộp bài..."}),e("p",{className:"mt-2 text-sm text-gray-500",children:"Vui lòng đợi trong giây lát"})]})})]})})(),"CAMBRIDGE_YLE"===le?ce&&e(R,{onClose:()=>pe(!1),onSubmit:Ae,isSubmitting:z.isSubmitting}):e(w,{open:ce,onOpenChange:pe,children:t(_,{children:[t(N,{children:[e(A,{children:"Nộp bài thi"}),e(y,{children:"Bạn có chắc chắn muốn nộp bài không? Sau khi nộp, bạn sẽ không thể thay đổi câu trả lời."})]}),t(v,{children:[e(S,{disabled:z.isSubmitting,children:"Quay lại"}),e(E,{onClick:Ae,disabled:z.isSubmitting,children:z.isSubmitting?t(n,{children:[e(u,{className:"mr-2 h-4 w-4 animate-spin"}),"Äang ná»™p..."]}):"Nộp bài"})]})]})})]})}export function ExamTakingPageContainer(t){return e(Y,{api:t.api,children:e(F,{...t})})}
|
|
1
|
+
"use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useEffect as i,useRef as s,useState as r,useMemo as a,useCallback as o}from"react";import d from"next/image";import l from"../../../components/themes/summer-sky/assets/images/clock.png";import c from"../../../components/themes/summer-sky/assets/images/submit.png";import m from"../../../components/themes/summer-sky/assets/images/has_answered.png";import{toast as p}from"sonner";import{Loader2 as u}from"lucide-react";import{t as g}from"../../../shared/lib/i18n";import{transformAnswersForSubmission as h}from"./utils/answer-transformers";import{getThemeForLevel as x,normalizeExamTheme as b}from"../../../shared/lib/themes";import{useExamTakingStore as f}from"../../../shared/lib/stores/examTakingStore";import{useGradingTransientStore as I}from"../../../shared/lib/stores/gradingTransientStore";import{AlertDialog as w,AlertDialogAction as E,AlertDialogCancel as S,AlertDialogContent as y,AlertDialogDescription as _,AlertDialogFooter as v,AlertDialogHeader as N,AlertDialogTitle as A}from"../../../components/ui/alert-dialog";import{useExamTimer as T}from"./hooks/useExamTimer";import{useAutoSave as C}from"./hooks/useAutoSave";import{useProctoringCamera as k}from"./hooks/useProctoringCamera";import{getStandardExamTheme as P}from"../../../components/themes";import{QuestionRenderer as q}from"./components/QuestionRenderer";import{FullscreenLoading as M}from"../entry/fullscreen-loading";import{SummerSkySubmitModal as R}from"../../../components/themes/summer-sky/SummerSkySubmitModal";import{SummerSkyExitModal as D}from"../../../components/themes/summer-sky/SummerSkyExitModal";import{EnglishCertificationExamLayout as L,EnglishCertificationQuestionRenderer as G,scrollToEnglishCertQuestion as Q}from"../../../components/themes/english-certification";import{groupQuestionsByPart as B}from"./utils/question-transformers";import{unwrap as O,unwrapAttempt as Y}from"./exam-taking.utils";import{ExamTakingApiProvider as F}from"./ExamTakingApiContext";function K({roomId:F,api:K,onNavigate:U,resultPath:$=e=>`/student/results/${e}`,fallbackPath:V="/student/contests/discover",proctoringEnabled:j=!1,achieversExamTitle:H,onSubmitted:z}){const W=f(),J=s(!1),X=o((e,t=!1)=>{U?U(e,{replace:t}):"undefined"!=typeof window&&(t?window.location.replace(e):window.location.href=e)},[U]),{isCameraActive:Z}=k({api:K,attemptId:W.attemptId,intervalMs:1e4,enabled:j}),[ee,te]=r(!0),ne=W.currentPartIndex,ie=W.currentQuestionGlobalIndex,se=o(e=>{const t=f.getState().currentPartIndex,n="function"==typeof e?e(t):e;f.getState().setCurrentPartIndex(n)},[]),re=o(e=>{const t=f.getState().currentQuestionGlobalIndex,n="function"==typeof e?e(t):e;f.getState().setCurrentQuestionGlobalIndex(n)},[]),[ae,oe]=r([]),[de,le]=r("SUMMER_SKY"),[ce,me]=r(""),[pe,ue]=r(!1),[ge,he]=r(!1),[xe,be]=r(null),[fe,Ie]=r(""),we=o(e=>{f.getState().markIntroPlayed(e)},[]),Ee="TOEIC"===W.examType||"ENGLISH_CERTIFICATION"===ce,Se=a(()=>{if(!Ee||0===W.parts.length)return ne;const e=W.currentIndex;for(let t=0;t<W.parts.length;t++){const n=W.parts[t],i=n.startIndex??0,s=n.endIndex??i;if(e>=i&&e<=s)return t}return 0},[Ee,W.currentIndex,W.parts,ne]);i(()=>{(async()=>{try{te(!0);let e=O(await K.getActiveAttempt(F));e||(e=Y(O(await K.startAttempt(F))));let t=null;try{t=K.getRoom?O(await K.getRoom(F)):null,t&&be(t)}catch{}const{examTemplate:n,questions:i}=O(await K.getQuestions(e.id));n?.title&&Ie(n.title);const s=n?.parts??e.exam?.template?.parts,r=B(i,s),a=n?.subTitle??null,o=(r.every(e=>e.questions.every(e=>"SPEAKING"===e.question_skill_type)),r.some(e=>"SPEAKING"===e.category||e.questions.every(e=>"SPEAKING"===e.question_skill_type)));oe(r);const d=n?.theme||e?.exam?.template?.theme||e?.exam?.theme||t?.exam?.template?.theme||t?.exam?.theme||"",l=b(d);if(o){const e=["SUMMER_SKY"].includes(d);le(e?d:"SUMMER_SKY")}const c=new Date(e.startedAt),m=60*e.durationMinutes*1e3,u=c.getTime()+m,h=Date.now();if(0===Math.max(0,u-h)){p.info(g("student.exam.take.timeExpired"));try{await K.submitAttempt(e.id)}catch{}return f.persist.clearStorage(),void X($(e.id))}W.hydrateFromServer({attemptId:e.id,examRoomId:F,questions:i.map(e=>({id:e.id,question_type:e.question_type,content:e.content,is_example:e.is_example,total_points:e.total_points,part_id:e.part_id,part_no:e.part_no,question_number:e.question_number})),durationMinutes:e.durationMinutes,startedAt:e.startedAt,examType:a??void 0,examTitle:n?.title??void 0,parts:s}),a&&W.setExamType(a),me(l),s&&W.setParts(s),te(!1)}catch(e){const t=e?.response?.data?.errorCode;if("ATTEMPT_ALREADY_SUBMITTED"===t)return p.info(g("student.exam.take.submitted")),void X(V,!0);console.error("Failed to load exam data:",e),p.error(g("student.exam.take.loadError")),X(V,!0)}})()},[F]);const ye=a(()=>ae.length>0&&ae.every(e=>e.questions.every(e=>"SPEAKING"===e.question_skill_type)),[ae]),_e=a(()=>{const e=ae[ne];return!!e&&(("SPEAKING_DESCRIBE_IMAGE"!==e.questionType&&"SPONTANEOUS_QA"!==e.questionType&&"SPEAKING_CUE_CARD"!==e.questionType&&"READ_DISPLAYED_CONTENT"!==e.questionType||"CAMBRIDGE_YLE"!==ce)&&("SPEAKING"===e.category||e.questions.every(e=>"SPEAKING"===e.question_skill_type)))},[ae,ne,ce]),{remainingSeconds:ve,warningLevel:Ne}=T({onTimeExpired:async()=>{p.info(g("student.exam.take.autoSubmit")),await ke()},onWarningThreshold:ye||Ee?void 0:()=>{p.warning(g("student.exam.take.timeWarning"))},warningThresholdSeconds:ye||Ee?void 0:300,warningThresholds:Ee?[{seconds:900,level:"warning",callback:()=>p.warning("Còn 15 phút!",{duration:3e3})},{seconds:300,level:"critical",callback:()=>p.warning("Còn 5 phút! Hãy nộp bài ngay!",{duration:5e3})}]:ye?[{seconds:300,level:"warning",callback:()=>p.warning("Còn 5 phút! Hãy hoàn thành bài thi.",{duration:5e3})},{seconds:120,level:"critical",callback:()=>p.warning("Còn 2 phút! Bài thi sẽ được tự động nộp.",{duration:5e3})}]:void 0}),Ae=C({api:K,attemptId:W.attemptId||"",parts:ae,intervalMs:Ee?15e3:3e4,onSaveError:e=>{console.error("Save error:",e)}}),Te=s(Ae.saveNow),Ce=s(ae);i(()=>{Te.current=Ae.saveNow,Ce.current=ae}),i(()=>{const e=()=>{const e=f.getState();if(!e.attemptId||!e.isDirty||e.isSubmitting)return;const t=h(e.answers,Ce.current);if(0!==t.length)try{K.saveAnswers?.({attemptId:e.attemptId,answers:t,keepalive:!0})}catch{}},t=()=>{"hidden"===document.visibilityState&&e()},n=()=>{const e=f.getState();e.isDirty&&!e.isSubmitting&&Te.current()};return document.addEventListener("visibilitychange",t),window.addEventListener("pagehide",e),window.addEventListener("online",n),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("pagehide",e),window.removeEventListener("online",n)}},[]),i(()=>{ye||Te.current()},[W.currentIndex,ne,ie,ye]);const ke=async()=>{if(!J.current){J.current=!0,W.setIsSubmitting(!0),ue(!1);try{W.isDirty&&await Ae.saveNow();const e=O(await K.submitAttempt(W.attemptId)),t=e?.pendingAnswerIds??[];W.attemptId&&(I.getState().setPending(W.attemptId,t),z?.({attemptId:W.attemptId,pendingAnswerIds:t})),0===t.length?p.success(g("student.exam.take.submitSuccess")):p.success(g("student.exam.take.submittedAIGradingInProgress")),f.persist.clearStorage(),X($(W.attemptId),!0)}catch(e){console.error("Failed to submit exam:",e);const t=e?.response?.data?.errorCode;if("ATTEMPT_ALREADY_SUBMITTED"===t)return f.persist.clearStorage(),void X($(W.attemptId),!0);p.warning(g("student.exam.take.submitError")),J.current=!1,W.setIsSubmitting(!1)}}},Pe=o(()=>{ue(!0)},[]),qe=s(new Map),Me=s([]),Re=o((e,t)=>{W.setAnswer(e,t);const n=qe.current.get(e)||e,i=Me.current.findIndex(e=>e.questionId===n);-1!==i&&re(e=>e!==i?i:e)},[]),De=s("forward"),Le=e=>{if("CAMBRIDGE_YLE"!==ce)return!1;const t=ae[e];return"SPEAKING_DESCRIBE_IMAGE"===t?.questionType||"SPONTANEOUS_QA"===t?.questionType||"SPEAKING_CUE_CARD"===t?.questionType||"READ_DISPLAYED_CONTENT"===t?.questionType},Ge=()=>{const e=()=>{window.scrollTo({top:0,behavior:"smooth"});const e=document.getElementById("exam-main-scroll-area");if(e){e.scrollTo({top:0,behavior:"smooth"});e.querySelectorAll(".overflow-y-auto").forEach(e=>{e.scrollTo({top:0,behavior:"smooth"})})}};requestAnimationFrame(e),setTimeout(e,100),setTimeout(e,250)},Qe=()=>{if("ENGLISH_CERTIFICATION"===ce){const e=W.parts[Se+1];e&&W.goToQuestion(e.startIndex??0)}else if(Ee)W.goToQuestion(Math.min(W.currentIndex+1,W.questions.length-1));else if("CAMBRIDGE_YLE"===ce&&Le(ne)){const e=ie+1,t=We[e];t&&(t.partIndex!==ne&&(De.current="forward",se(t.partIndex)),re(e))}else De.current="forward",se(e=>{const t=Math.min(e+1,ae.length-1);if("CAMBRIDGE_YLE"===ce){const e=We.find(e=>e.partIndex===t);e&&re(e.globalIndex)}return t});Ge()},Be=()=>{if("ENGLISH_CERTIFICATION"===ce){const e=W.parts[Se-1];e&&W.goToQuestion(e.startIndex??0)}else if(Ee)W.goToQuestion(Math.max(W.currentIndex-1,0));else if("CAMBRIDGE_YLE"===ce&&Le(ne)){const e=ie-1,t=We[e];t&&(t.partIndex!==ne&&(De.current="backward",se(t.partIndex)),re(e))}else De.current="backward",se(e=>{const t=Math.max(e-1,0);if("CAMBRIDGE_YLE"===ce){const e=We.find(e=>e.partIndex===t);e&&re(e.globalIndex)}return t});Ge()},[Oe,Ye]=r(!1),Fe=()=>{he(!0)},Ke=a(()=>ae.reduce((e,t)=>e+("CAMBRIDGE_YLE"===ce?t.questions.length:t.questions.filter(e=>!e.is_example).length),0),[ae,ce]),Ue=a(()=>{const e=new Map;return ae.forEach(t=>{t.questions.forEach(n=>{if(n.is_example)return;const i=n.content;if("FILL_MISSING_WORDS_IN_GRID"===t.questionType&&i?.grid&&i.grid.forEach((t,i)=>{t.forEach((t,s)=>{e.set(`${i}-${s}`,n.id)})}),"LABEL_THE_PICTURE"===t.questionType&&i?.labels&&i.labels.forEach(t=>{t.id&&e.set(t.id,n.id)}),"READ_AND_COLOR_OBJECTS"===t.questionType){const t=i?.regions||i?.regionNodes;t?.forEach(t=>{t.id&&e.set(t.id,n.id)})}if("IMAGE_OBJECT_MATCHING"===t.questionType){const t=i?.regions||i?.regionNodes;t?.forEach(t=>{t.id&&e.set(t.id,n.id)})}if("LOOK_PICTURE_FILL_WORD_HINT"===t.questionType){const t=i?.word;if(t&&"string"==typeof t){const i=/\{(\d+)\}/g;let s;for(;null!==(s=i.exec(t));){const t=s[1];e.set(`${n.id}-blank-${t}`,n.id)}}}})}),e},[ae]);i(()=>{qe.current=Ue},[Ue]);const $e=a(()=>{if(!W.answers)return new Set;const e=new Set(ae.flatMap(e=>e.questions.filter(e=>!e.is_example).map(e=>e.id))),t=new Set;return Object.keys(W.answers).forEach(n=>{const i=W.answers[n];if(void 0===i||""===i)return;if(e.has(n))return void t.add(n);const s=Ue.get(n);s&&e.has(s)&&t.add(s)}),t},[W.answers,ae,Ue]),Ve=$e.size+("CAMBRIDGE_YLE"===ce?ae.reduce((e,t)=>e+t.questions.filter(e=>e.is_example).length,0):0),je=a(()=>xe?.exam?.name||xe?.name||(Ee?"TOEIC Listening and Reading Test":"Bài thi"),[xe,Ee]),He=a(()=>x(xe?.exam?.level).displayName,[xe?.exam?.level]),{sidebarParts:ze,sidebarQuestions:We}=a(()=>{const e=[],t=[];let n=0;return ae.forEach((i,s)=>{const r="CAMBRIDGE_YLE"===ce?i.questions:i.questions.filter(e=>!e.is_example);let a=0;r.forEach(e=>{const r=!("CAMBRIDGE_YLE"!==ce||!e.is_example)||$e.has(e.id);r&&a++;const o=i.questions.findIndex(t=>t.id===e.id);t.push({globalIndex:n,partIndex:s,indexInPart:o,questionNumber:e.question_number,isAnswered:r,questionId:e.id,isExample:e.is_example}),n++}),e.push({partIndex:s,partNo:i.partNo,name:i.name,category:i.category,points:i.points,totalQuestions:"CAMBRIDGE_YLE"===ce?i.questions.length:i.questions.filter(e=>!e.is_example).length,answeredCount:a})}),{sidebarParts:e,sidebarQuestions:t}},[ae,$e,ce]);if(i(()=>{Me.current=We},[We]),ee)return e(M,{});const Je=ne,Xe=ae[Je];if(!Xe)return e("div",{className:"flex min-h-screen items-center justify-center",children:t("div",{className:"text-center",children:[e("p",{className:"text-lg font-semibold text-red-500",children:"Không tìm thấy câu há»i"}),e("button",{type:"button",onClick:()=>X(V),className:"mt-4 rounded-lg bg-blue-500 px-4 py-2 text-white hover:bg-blue-600",children:"Quay lại"})]})});if(_e)return t(n,{children:[e(q,{part:Xe,answers:W.answers||{},onAnswerChange:Re,isReviewMode:!1,onExit:Fe,onPartComplete:Je<ae.length-1?Qe:Pe,onPartBack:Je>0?Be:void 0,speakingTheme:de,initialQuestionIndex:"backward"===De.current?Xe.questions.length-1:0,skipTeacherVideo:W.playedIntroParts.has(Je)||fe!==H,onTeacherIntroPlayed:()=>we(Je)},`${Xe.partId}-${Je}`),"SUMMER_SKY"===de?pe&&e(R,{onClose:()=>ue(!1),onSubmit:ke,isSubmitting:W.isSubmitting}):e(w,{open:pe,onOpenChange:ue,children:t(y,{children:[t(N,{children:[e(A,{children:"Nộp bài thi"}),e(_,{children:"Bạn có chắc chắn muốn nộp bài không? Sau khi nộp, bạn sẽ không thể thay đổi câu trả lời."})]}),t(v,{children:[e(S,{disabled:W.isSubmitting,children:"Quay lại"}),e(E,{onClick:ke,disabled:W.isSubmitting,children:W.isSubmitting?t(n,{children:[e(u,{className:"mr-2 h-4 w-4 animate-spin"}),"Đang nộp..."]}):"Nộp bài"})]})]})}),t("div",{className:"fixed top-8 right-6 z-[100] flex flex-col items-end gap-4 sm:gap-6 lg:top-10 lg:right-16",children:[t("div",{className:"flex items-center gap-4 sm:gap-6",children:[ve>0&&t("div",{className:"flex items-center w-[130px] sm:w-[170px] h-[40px] sm:h-[50px] rounded-[33.5px] backdrop-blur-[8px] transition-all duration-300 ease-in-out border-none shadow-[0_4px_20px_rgba(0,0,0,0.25)] "+("critical"===Ne?"bg-[rgba(220,38,38,0.85)] shadow-[0_0_24px_rgba(220,38,38,0.5)] animate-pulse":"warning"===Ne?"bg-[rgba(180,120,0,0.85)]":"bg-[#001590]"),children:[e(d,{src:l,alt:"clock",width:75,height:75,className:"w-[50px] h-[50px] sm:w-[75px] sm:h-[75px] -ml-[5px] sm:-ml-[10px] -mt-[10px] sm:-mt-[15px] shrink-0 drop-shadow-[0_2px_6px_rgba(0,0,0,0.2)] pointer-events-none z-10"}),t("span",{className:"flex-1 text-center font-bold text-[18px] sm:text-[25px] leading-none tracking-[-0.03em] uppercase text-white pr-[10px] sm:pr-[16px]",style:{fontFamily:"'SVN-Volte Rounded', 'Quicksand', sans-serif",textShadow:"0 2px 4px rgba(0, 0, 0, 0.2)"},children:[Math.floor(ve/60).toString().padStart(2,"0"),":",(ve%60).toString().padStart(2,"0")]})]}),t("div",{className:"flex items-center w-[130px] sm:w-[170px] h-[40px] sm:h-[50px] rounded-[33.5px] bg-[#FF9900] shadow-[0_4px_20px_rgba(0,0,0,0.25)] border-none shrink-0",title:"Số câu hỏi đã hoàn thành",children:[e(d,{src:m,alt:"Progress",width:75,height:75,className:"w-[50px] h-[50px] sm:w-[75px] sm:h-[75px] -ml-[5px] sm:-ml-[10px] -mt-[10px] sm:-mt-[15px] shrink-0 drop-shadow-[0_2px_6px_rgba(0,0,0,0.2)] pointer-events-none z-10"}),t("span",{className:"flex-1 text-center font-bold text-[18px] sm:text-[25px] leading-none tracking-[-0.03em] uppercase text-white pr-[10px] sm:pr-[16px]",style:{fontFamily:'"SVN-Volte Rounded", "Quicksand", sans-serif',textShadow:"0 2px 4px rgba(0,0,0,0.2)"},children:[Ve,"/",Ke]})]})]}),t("button",{onClick:Pe,disabled:W.isSubmitting,className:"group cursor-pointer flex items-center h-[40px] sm:h-[50px] w-[130px] sm:w-[170px] rounded-[33.5px] shadow-[0_4px_20px_rgba(0,0,0,0.25)] transition-all duration-300 hover:scale-105 active:scale-95 disabled:pointer-events-none disabled:opacity-60 border-none "+(W.isSubmitting?"bg-slate-400":"bg-[#16CA3B] hover:bg-[#15b736]"),children:[e(d,{src:c,alt:"Submit",width:75,height:75,className:"w-[50px] h-[50px] sm:w-[75px] sm:h-[75px] -ml-[5px] sm:-ml-[10px] -mt-[10px] sm:-mt-[15px] shrink-0 drop-shadow-[0_2px_6px_rgba(0,0,0,0.2)] pointer-events-none transition-transform duration-300 group-hover:scale-110 z-10"}),W.isSubmitting?e("div",{className:"flex-1 flex justify-center pr-[10px] sm:pr-[16px]",children:e(u,{className:"h-6 w-6 animate-spin text-white"})}):e("span",{className:"flex-1 text-center font-bold text-[18px] sm:text-[25px] leading-none tracking-[-0.03em] uppercase text-white pr-[10px] sm:pr-[16px]",style:{fontFamily:'"SVN-Volte Rounded", "Quicksand", sans-serif',textShadow:"0 2px 4px rgba(0,0,0,0.2)"},children:"Nộp bài"})]})]}),W.isSubmitting&&e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:t("div",{className:"rounded-xl bg-white p-8 text-center shadow-2xl",children:[e(u,{className:"mx-auto h-12 w-12 animate-spin text-green-500"}),e("p",{className:"mt-4 text-lg font-semibold text-gray-700",children:"Đang nộp bài..."}),e("p",{className:"mt-2 text-sm text-gray-500",children:"Vui lòng đợi trong giây lát"})]})})]});if(Ee){const i=ae[Se],s=W.parts[Se],r=s?Math.max(0,W.currentIndex-(s.startIndex??0)):0,a=(s?.startIndex??0)+1,o=(s?.endIndex??a-1)+1,d={examName:je,remainingSeconds:W.remainingSeconds,totalQuestions:Ke,answeredCount:Ve,isSubmitting:W.isSubmitting,onSubmit:ke,onClose:Fe,lastSavedAt:W.lastSavedAt,isSaving:Ae.isSaving,partLabel:(s?.name||i?.name||"").toUpperCase()||void 0,partSubLabel:s?.category||void 0,questionRange:a===o?`${a}`:`${a}–${o}`},l=i?.questions?.[r],c="ENGLISH_CERTIFICATION"===ce,m={onPrevious:Be,onClear:c?void 0:()=>{l&&Re(l.id,{optionId:null})},onToggleMark:c?void 0:()=>{l&&W.toggleFlag(l.id)},onNext:Qe,isMarked:!!l&&W.flaggedQuestions.has(l.id),showSecondaryActions:!c,isPreviousDisabled:c?Se<=0:W.currentIndex<=0,isNextDisabled:c?Se>=W.parts.length-1:W.currentIndex>=W.questions.length-1},p={parts:W.parts,questions:W.questions,answers:W.answers,flaggedQuestions:W.flaggedQuestions,currentIndex:W.currentIndex,onQuestionClick:e=>{W.goToQuestion(e);const t=W.questions[e];t&&Q(t.id,{behavior:"smooth",block:"start"})},onPartClick:e=>{const t=W.parts[e];if(t){const n=t.startIndex??0;W.goToQuestion(n),W.setCurrentPartIndex(e);const i=W.questions[n];i&&Q(i.id,{behavior:"smooth",block:"start"})}}};if(i&&s)return t(n,{children:[e(L,{headerProps:d,navigationProps:p,footerProps:m,children:e(G,{part:i,partConfig:s,currentQuestionIndex:r,answers:W.answers,flaggedQuestions:W.flaggedQuestions,onAnswerChange:Re,onToggleFlag:e=>W.toggleFlag(e),isReviewMode:!1,isAudioPlayed:W.playedListeningAudioParts.has(i.partId),onAudioFirstPlay:()=>W.markListeningAudioPlayed(i.partId)})}),W.isSubmitting&&e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:t("div",{className:"rounded-xl bg-white p-8 text-center shadow-2xl",children:[e(u,{className:"mx-auto h-12 w-12 animate-spin text-green-500"}),e("p",{className:"mt-4 text-lg font-semibold text-gray-700",children:"Đang nộp bài..."}),e("p",{className:"mt-2 text-sm text-gray-500",children:"Vui lòng đợi trong giây lát"})]})})]})}return t(n,{children:[(()=>{const{Layout:n,QuestionCard:i}=P(ce),s={headerProps:{examName:je,examType:"EXAM",levelLabel:He,totalQuestions:Ke,answeredCount:Ve,remainingSeconds:W.remainingSeconds,isSubmitting:W.isSubmitting,isCameraActive:Z,onSubmit:Pe},onPrevious:Be,onNext:Qe,onClose:Fe,isNavDisabled:W.isNavDisabled,partName:Xe?.name||(Xe?.partNo?`PART ${Xe.partNo}`:void 0)};if("CAMBRIDGE_YLE"===ce){const e=Le(Je);s.isFirstQuestion=e?0===ie:0===Je,s.isLastQuestion=e?ie===We.length-1:Je===ae.length-1,s.sidebarProps={parts:ze,questions:We,currentQuestionGlobalIndex:ie,isNavDisabled:W.isNavDisabled,onPartClick:e=>{if(W.isNavDisabled)return;De.current=e>Je?"forward":"backward",se(e);const t=We.find(t=>t.partIndex===e);t&&re(t.globalIndex),Ge()},onQuestionClick:e=>{if(W.isNavDisabled)return;const t=We[e];t&&t.partIndex!==Je&&(De.current=t.partIndex>Je?"forward":"backward",se(t.partIndex)),re(e),t&&setTimeout(()=>{const e=document.getElementById(`question-${t.questionId}`);e&&e.scrollIntoView({behavior:"smooth",block:"center"})},100)}}}else s.isFirstQuestion=0===Je,s.isLastQuestion=Je===ae.length-1;const r="CAMBRIDGE_YLE"===ce&&("SPEAKING_DESCRIBE_IMAGE"===Xe?.questionType||"SPONTANEOUS_QA"===Xe?.questionType||"SPEAKING_CUE_CARD"===Xe?.questionType||"READ_DISPLAYED_CONTENT"===Xe?.questionType),a=We[ie],o=r&&a?.partIndex===Je?a.indexInPart:void 0;return t(n,{...s,children:[e(i,{partName:Xe?.name||(Xe?.partNo?`PART ${Xe.partNo}`:void 0),children:e(q,{part:Xe,answers:W.answers||{},onAnswerChange:Re,isReviewMode:!1,currentQuestionIndex:o,onExit:Fe,onPartComplete:Je<ae.length-1?Qe:Pe,onPartBack:Je>0?Be:void 0,speakingTheme:"CAMBRIDGE_YLE"===ce?"CAMBRIDGE_YLE":de,initialQuestionIndex:"backward"===De.current?Xe?.questions.length-1:0,skipTeacherVideo:W.playedIntroParts.has(Je)||fe!==H,onTeacherIntroPlayed:()=>we(Je)})}),W.isSubmitting&&e("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:t("div",{className:"rounded-xl bg-white p-8 text-center shadow-2xl",children:[e(u,{className:"mx-auto h-12 w-12 animate-spin text-green-500"}),e("p",{className:"mt-4 text-lg font-semibold text-gray-700",children:"Đang nộp bài..."}),e("p",{className:"mt-2 text-sm text-gray-500",children:"Vui lòng đợi trong giây lát"})]})})]})})(),"CAMBRIDGE_YLE"===ce?pe&&e(R,{onClose:()=>ue(!1),onSubmit:ke,isSubmitting:W.isSubmitting}):e(w,{open:pe,onOpenChange:ue,children:t(y,{children:[t(N,{children:[e(A,{children:"Nộp bài thi"}),e(_,{children:"Bạn có chắc chắn muốn nộp bài không? Sau khi nộp, bạn sẽ không thể thay đổi câu trả lời."})]}),t(v,{children:[e(S,{disabled:W.isSubmitting,children:"Quay lại"}),e(E,{onClick:ke,disabled:W.isSubmitting,children:W.isSubmitting?t(n,{children:[e(u,{className:"mr-2 h-4 w-4 animate-spin"}),"Äang ná»™p..."]}):"Nộp bài"})]})]})}),ge&&e(D,{onClose:()=>he(!1),onConfirmExit:async()=>{if(!Oe){Ye(!0);try{const e=W.attemptId;e&&K.cancelAttempt&&await K.cancelAttempt(e)}catch(e){console.error("Failed to cancel attempt:",e)}finally{Ye(!1),he(!1),f.persist.clearStorage(),X(V)}}},isCancelling:Oe})]})}export function ExamTakingPageContainer(t){return e(F,{api:t.api,children:e(K,{...t})})}
|
|
@@ -3,6 +3,7 @@ import type { SpeakingLayoutProps, StandardExamLayoutProps, StandardQuestionCard
|
|
|
3
3
|
export * from './cambridge-yle';
|
|
4
4
|
export * from './english-certification';
|
|
5
5
|
export * from './summer-sky/SummerSkyAudioPlayer';
|
|
6
|
+
export * from './summer-sky/SummerSkyExitModal';
|
|
6
7
|
export * from './summer-sky/SummerSkyLayout';
|
|
7
8
|
export * from './summer-sky/SummerSkySubmitModal';
|
|
8
9
|
export * from './summer-sky/SummerSkyWaitingRoom';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SummerSkyLayout as r}from"./summer-sky/SummerSkyLayout";import{CambridgeYleExamLayout as m}from"./cambridge-yle/CambridgeYleExamLayout";import e from"./cambridge-yle/CambridgeYleQuestionCard";export*from"./cambridge-yle";export*from"./english-certification";export*from"./summer-sky/SummerSkyAudioPlayer";export*from"./summer-sky/SummerSkyLayout";export*from"./summer-sky/SummerSkySubmitModal";export*from"./summer-sky/SummerSkyWaitingRoom";const o={SUMMER_SKY:r},t="SUMMER_SKY";export function getSpeakingLayout(r){return o[r||t]||o[t]}const u={CAMBRIDGE_YLE:{Layout:m,QuestionCard:e}},a="CAMBRIDGE_YLE";export function getStandardExamTheme(r){return u[r||a]||u[a]}
|
|
1
|
+
import{SummerSkyLayout as r}from"./summer-sky/SummerSkyLayout";import{CambridgeYleExamLayout as m}from"./cambridge-yle/CambridgeYleExamLayout";import e from"./cambridge-yle/CambridgeYleQuestionCard";export*from"./cambridge-yle";export*from"./english-certification";export*from"./summer-sky/SummerSkyAudioPlayer";export*from"./summer-sky/SummerSkyExitModal";export*from"./summer-sky/SummerSkyLayout";export*from"./summer-sky/SummerSkySubmitModal";export*from"./summer-sky/SummerSkyWaitingRoom";const o={SUMMER_SKY:r},t="SUMMER_SKY";export function getSpeakingLayout(r){return o[r||t]||o[t]}const u={CAMBRIDGE_YLE:{Layout:m,QuestionCard:e}},a="CAMBRIDGE_YLE";export function getStandardExamTheme(r){return u[r||a]||u[a]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SummerSkyExitModalProps {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onConfirmExit: () => void;
|
|
5
|
+
/** True while cancel-without-grading request is in flight. */
|
|
6
|
+
isCancelling?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function SummerSkyExitModal({ onClose, onConfirmExit, isCancelling, }: SummerSkyExitModalProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import s from"next/image";import a from"./assets/images/background-noticesubmit.png";import n from"./assets/images/x-noticesubmit.png.png";import i from"./assets/images/ong.png";import l from"./assets/images/title-notisubmit.png";import r from"./assets/images/continue_exam.png";import o from"./assets/images/cancel_exam.jpg";export function SummerSkyExitModal({onClose:c,onConfirmExit:m,isCancelling:d}){return e("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",children:e("div",{className:"relative w-[480px] max-w-[90vw] flex flex-col items-center justify-center mt-6",children:t("div",{className:"relative w-full shadow-[0_15px_40px_rgba(0,0,0,0.4)] rounded-[20px]",children:[e(s,{src:a,alt:"Background",className:"w-full h-auto block rounded-[40px]"}),e("button",{onClick:c,disabled:d,className:"absolute top-[11%] right-[-9%] transition-transform hover:scale-110 active:scale-95 cursor-pointer z-50 border-none bg-transparent p-0 disabled:opacity-50 disabled:pointer-events-none",children:e(s,{src:n,alt:"Close",className:"w-[42px] h-auto object-contain drop-shadow-md"})}),e("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 -translate-y-[40%] z-20 w-[55%] flex justify-center pointer-events-none",children:e(s,{src:l,alt:"Notice Title",className:"w-full h-auto"})}),e("div",{className:"absolute top-[-20%] left-[0%] z-30 pointer-events-none w-[15%]",children:e(s,{src:i,alt:"Bee Mascot",className:"w-full h-auto drop-shadow-xl"})}),t("div",{className:"absolute inset-0 flex flex-col items-center justify-center z-10 pt-[14%] pb-[18%] text-center px-[8%]",children:[e("p",{className:"text-[#D9383A] font-bold text-lg mb-1",style:{fontFamily:'"SVN-Volte Rounded", sans-serif'},children:"Bạn muốn rời khỏi bài thi?"}),t("p",{className:"text-[#646464]",style:{fontFamily:'"SVN-Volte Rounded", sans-serif',fontWeight:600,fontSize:"15px",lineHeight:"22px",letterSpacing:"-0.01em",textAlign:"center"},children:["Nếu rời khỏi lúc này, bài thi sẽ bị",e("br",{}),e("span",{className:"text-[#D9383A] font-bold whitespace-nowrap",children:"HỦY"}),". Hệ thống không chấm điểm và bạn không thể làm lại."]})]}),t("div",{className:"absolute bottom-[-8%] left-1/2 -translate-x-1/2 z-40 flex items-center justify-center gap-3 w-[88%]",children:[e("button",{onClick:c,disabled:d,className:"transition-transform hover:scale-105 active:scale-95 border-none bg-transparent p-0 w-[46%] flex items-center justify-center cursor-pointer disabled:opacity-50",children:e(s,{src:r,alt:"Quay lại làm tiếp",className:"w-full h-auto drop-shadow-xl"})}),t("button",{onClick:m,disabled:d,className:"transition-transform hover:scale-105 active:scale-95 border-none bg-transparent p-0 w-[46%] flex items-center justify-center relative "+(d?"cursor-not-allowed opacity-70":"cursor-pointer"),children:[d?e("div",{className:"absolute inset-0 flex items-center justify-center z-50",children:e("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-white border-t-transparent"})}):null,e(s,{src:o,alt:"Hủy bài thi và thoát",className:"w-full h-auto drop-shadow-xl rounded-full"})]})]})]})})})}
|
|
Binary file
|
|
@@ -173,6 +173,7 @@ export declare const API_ENDPOINTS: {
|
|
|
173
173
|
readonly ATTEMPT_QUESTIONS: (id: string) => string;
|
|
174
174
|
readonly ATTEMPT_ANSWERS: (id: string) => string;
|
|
175
175
|
readonly ATTEMPT_SUBMIT: (id: string) => string;
|
|
176
|
+
readonly ATTEMPT_CANCEL: (id: string) => string;
|
|
176
177
|
readonly ATTEMPT_AUDIO_ANSWER: (id: string) => string;
|
|
177
178
|
readonly ATTEMPT_PROCTORING_SNAPSHOT: (id: string) => string;
|
|
178
179
|
readonly ATTEMPT_GRADING_SUMMARY: (id: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const API_VERSION="v1";export const API_BASE_URL="undefined"==typeof process?void 0:process.env.NEXT_PUBLIC_API_URL;export const API_ENDPOINTS={AUTH:{LOGIN:"/api/v1/auth/login",LOGOUT:"/api/v1/auth/logout",REFRESH:"/api/v1/auth/refresh",CHANGE_PASSWORD:"/api/v1/auth/change-password",ME:"/api/v1/auth/me",UPGRADE_ACCOUNT:"/api/v1/auth/upgrade-account",STUDENT_REGISTER:"/api/v1/auth/student/register",REGISTER_SIMPLE:"/api/v1/auth/register-simple",PERMISSIONS:"/api/v1/auth/permissions"},MANAGE:{USERS:"/api/v1/manage/users",USER_DETAIL:a=>`/api/v1/manage/users/${a}`,SYNC_EBM:"/api/v1/manage/users/sync-ebm",BRANCHES:"/api/v1/manage/branches",BRANCH_DETAIL:a=>`/api/v1/manage/branches/${a}`,BRANCHES_STATISTICS:"/api/v1/manage/branches/statistics",BRANCHES_MANAGERS:"/api/v1/manage/branches/managers",BRANCHES_TEACHERS:"/api/v1/manage/branches/teachers",QUESTIONS:"/api/v1/manage/questions",QUESTION_DETAIL:a=>`/api/v1/manage/questions/${a}`,QUESTIONS_BATCH:"/api/v1/manage/questions/batch",QUESTIONS_GENERATE_AUDIO:"/api/v1/manage/questions/generate-audio",QUESTIONS_BY_EXAM:a=>`/api/v1/manage/questions/by-exam/${a}`,EXAMS:"/api/v1/manage/exams",EXAM_DETAIL:a=>`/api/v1/manage/exams/${a}`,EXAM_QUESTIONS:a=>`/api/v1/manage/exams/${a}/questions`,EXAM_SHUFFLE:a=>`/api/v1/manage/exams/${a}/shuffle`,EXAM_COPY:a=>`/api/v1/manage/exams/${a}/copy`,EXAM_CLASSES:"/api/v1/manage/exam-classes",EXAM_CLASS_DETAIL:a=>`/api/v1/manage/exam-classes/${a}`,EXAM_SESSIONS:"/api/v1/manage/exam-sessions",EXAM_SESSION_DETAIL:a=>`/api/v1/manage/exam-sessions/${a}`,EXAM_ROOMS:"/api/v1/manage/rooms",EXAM_ROOM_DETAIL:a=>`/api/v1/manage/rooms/${a}`,ROOM_TEACHERS:"/api/v1/manage/rooms/teachers",ROOM_STUDENTS:"/api/v1/manage/rooms/students",ROOM_EXAMS:"/api/v1/manage/rooms/exams",ROOM_CONTESTS:"/api/v1/manage/rooms/contests",ROOM_STATISTICS:"/api/v1/manage/rooms/statistics",ROOM_CLASSES:"/api/v1/manage/rooms/classes",ROOM_BRANCHES:"/api/v1/manage/rooms/branches",ROOM_TAGS:"/api/v1/manage/rooms/tags",ROOM_REGISTRATIONS:a=>`/api/v1/manage/rooms/${a}/registrations`,ROOM_REGISTRATION_DETAIL:(a,s)=>`/api/v1/manage/rooms/${a}/registrations/${s}`,ROOM_REGISTRATIONS_BULK_REVIEW:a=>`/api/v1/manage/rooms/${a}/registrations/bulk-review`,ROOM_INVITE_LINK:a=>`/api/v1/manage/rooms/${a}/invite-link`,ROOM_MANUAL_GRADING:a=>`/api/v1/manage/rooms/${a}/manual-grading`,ROOM_UPLOAD_ANSWER_SHEETS:a=>`/api/v1/manage/rooms/${a}/upload-answer-sheets`,ROOM_EXTERNAL_ANSWER_SHEETS:a=>`/api/v1/manage/rooms/${a}/external-answer-sheets`,ROOM_EXTERNAL_ANSWER_SHEET_DETAIL:(a,s)=>`/api/v1/manage/rooms/${a}/external-answer-sheets/${s}`,ROOM_EXTERNAL_UPLOAD_TOKEN:a=>`/api/v1/manage/rooms/${a}/external-answer-sheets/upload-token`,ROOM_EXTERNAL_ANSWER_SHEET_REGRADE:(a,s)=>`/api/v1/manage/rooms/${a}/external-answer-sheets/${s}/re-grade`,ROOM_EXTERNAL_ANSWER_SHEETS_REGRADE_ALL:a=>`/api/v1/manage/rooms/${a}/external-answer-sheets/re-grade-all`,ROOM_EXTERNAL_ANSWER_SHEET_REPROCESS:(a,s)=>`/api/v1/manage/rooms/${a}/external-answer-sheets/${s}/re-process`,ROOM_EXTERNAL_ANSWER_SHEETS_REPROCESS_ALL:a=>`/api/v1/manage/rooms/${a}/external-answer-sheets/re-process-all`,CONTESTS:"/api/v1/manage/contests",CONTEST_DETAIL:a=>`/api/v1/manage/contests/${a}`,CONTEST_SUMMARY:"/api/v1/manage/contests/summary",CONTEST_TOP_STUDENTS_LATEST:"/api/v1/manage/contests/top-students-latest",CONTEST_TOP_STUDENTS_ALL_TIME:"/api/v1/manage/contests/top-students-all-time",CONTEST_STATISTICS_LIST:"/api/v1/manage/contests/statistics-list",CONTEST_STUDENT_HISTORY:a=>`/api/v1/manage/contests/student-contest-history/${a}`,CONTEST_STUDENT_STATISTICS:a=>`/api/v1/manage/contests/student-statistics/${a}`,CONTEST_STATISTICS:a=>`/api/v1/manage/contests/${a}/statistics`,CONTEST_STAFF:a=>`/api/v1/manage/contests/${a}/staff`,CONTEST_STAFF_BY_GROUP:a=>`/api/v1/manage/contests/${a}/staff/by-group`,CONTEST_STAFF_DETAIL:(a,s)=>`/api/v1/manage/contests/${a}/staff/${s}`,CONTEST_GALLERY:a=>`/api/v1/manage/contests/${a}/gallery`,CONTEST_GALLERY_DETAIL:(a,s)=>`/api/v1/manage/contests/${a}/gallery/${s}`,CONTEST_CONVERT_MULTI_ROUND:a=>`/api/v1/manage/contests/${a}/convert-to-multi-round`,CONTEST_ROUNDS:a=>`/api/v1/manage/contests/${a}/rounds`,CONTEST_ROUND_DETAIL:(a,s)=>`/api/v1/manage/contests/${a}/rounds/${s}`,CONTEST_REGISTRATIONS:a=>`/api/v1/manage/contests/${a}/registrations`,CONTEST_REGISTRATION_DETAIL:(a,s)=>`/api/v1/manage/contests/${a}/registrations/${s}`,CONTEST_REGISTRATIONS_BULK_REVIEW:a=>`/api/v1/manage/contests/${a}/registrations/bulk-review`,CONTEST_RESULTS:a=>`/api/v1/manage/contests/${a}/results`,CONTEST_OVERVIEW_STATS:a=>`/api/v1/manage/contests/${a}/overview-stats`,QUESTION_BANKS:"/api/v1/manage/question-banks",QUESTION_BANK_DETAIL:a=>`/api/v1/manage/question-banks/${a}`,QUESTION_BANKS_STATISTICS:"/api/v1/manage/question-banks/statistics",SCHEDULES_SUMMARY:"/api/v1/manage/schedules/summary",SCHEDULES_CALENDAR:"/api/v1/manage/schedules/calendar",SCHEDULES:"/api/v1/manage/schedules",STUDENT_TEST_PARTICIPANTS:"/api/v1/manage/students/test-participants",REPORTS:"/api/v1/manage/reports",REPORT_OVERVIEW:"/api/v1/manage/reports/overview",REPORT_CLASSES:"/api/v1/manage/reports/classes",REPORT_BRANCHES:"/api/v1/manage/reports/branches",REPORT_SKILLS:"/api/v1/manage/reports/skills",REPORT_TRENDS:"/api/v1/manage/reports/trends",REPORT_CUSTOM:"/api/v1/manage/reports/custom",REPORT_CUSTOM_DETAIL:a=>`/api/v1/manage/reports/custom/${a}`,REPORT_CUSTOM_DOWNLOAD:a=>`/api/v1/manage/reports/custom/${a}/download`,REPORT_ROOMS:"/api/v1/manage/reports/rooms",REPORT_CONTESTS:"/api/v1/manage/reports/contests",REPORT_COMPETENCY:"/api/v1/manage/reports/competency",REPORT_COMPETENCY_EXAM_ROOMS:"/api/v1/manage/reports/competency/exam-rooms",DASHBOARD_SUMMARY:"/api/v1/manage/dashboard/summary",DASHBOARD_USER_GROWTH:"/api/v1/manage/dashboard/user-growth",DASHBOARD_EXAM_STATS:"/api/v1/manage/dashboard/exam-statistics",DASHBOARD_ACTIVITIES:"/api/v1/manage/dashboard/recent-activities",DASHBOARD_ROOMS:"/api/v1/manage/dashboard/rooms",DASHBOARD_CHARTS:"/api/v1/manage/dashboard/charts",DASHBOARD_UPCOMING_ROOMS:"/api/v1/manage/dashboard/upcoming-rooms",DASHBOARD_PENDING_GRADING:"/api/v1/manage/dashboard/pending-grading",ROLES:"/api/v1/manage/roles",ROLE_DETAIL:a=>`/api/v1/manage/roles/${a}`,ROLE_PERMISSIONS:a=>`/api/v1/manage/roles/${a}/permissions`,PERMISSIONS:"/api/v1/manage/permissions",PERMISSIONS_GROUPED:"/api/v1/manage/permissions/grouped",USER_ROLES:a=>`/api/v1/manage/users/${a}/roles`,USER_ROLE_DETAIL:(a,s)=>`/api/v1/manage/users/${a}/roles/${s}`,ROOM_OPEN:a=>`/api/v1/manage/rooms/${a}/open`,ROOM_CLOSE:a=>`/api/v1/manage/rooms/${a}/close`,ROOM_TOGGLE_LOCK:a=>`/api/v1/manage/rooms/${a}/toggle-lock`,GRADING_ATTEMPT:a=>`/api/v1/manage/grading/${a}`,GRADING_ANSWER:(a,s)=>`/api/v1/manage/grading/${a}/answers/${s}`,EXAM_VARIANTS:a=>`/api/v1/manage/exams/${a}/variants`,EXAM_TEMPLATE:a=>`/api/v1/manage/exams/${a}/template`},get ADMIN(){return this.MANAGE},SYSTEM_ADMIN:{BRANCHES:"/api/v1/system-admin/branches",BRANCH_DETAIL:a=>`/api/v1/system-admin/branches/${a}`,BRANCHES_STATISTICS:"/api/v1/system-admin/branches/statistics",USERS:"/api/v1/system-admin/users",USER_DETAIL:a=>`/api/v1/system-admin/users/${a}`,USERS_IMPORT:"/api/v1/system-admin/users/import",USERS_IMPORT_TEMPLATE:"/api/v1/system-admin/users/import/template",USERS_BULK_UPDATE_PASSWORD:"/api/v1/system-admin/users/bulk-update-password",USER_GROUPS:"/api/v1/system-admin/user-groups",USER_GROUP_DETAIL:a=>`/api/v1/system-admin/user-groups/${a}`,USER_GROUP_MEMBERS:a=>`/api/v1/system-admin/user-groups/${a}/members`,USER_GROUP_MEMBERS_BY_EMAIL:a=>`/api/v1/system-admin/user-groups/${a}/members/by-email`,TAGS:"/api/v1/system-admin/tags",TAG_DETAIL:a=>`/api/v1/system-admin/tags/${a}`,TAG_CATEGORIES:"/api/v1/system-admin/tags/categories",BULK_ROOMS_PREVIEW:"/api/v1/system-admin/bulk-rooms/preview",BULK_ROOMS_COMMIT:"/api/v1/system-admin/bulk-rooms/commit",BULK_ROOMS_EBM_BRANCHES:"/api/v1/system-admin/bulk-rooms/ebm-branches",BULK_ASSIGN_EXAMS_MATCH:"/api/v1/system-admin/bulk-assign-exams/match",BULK_ASSIGN_EXAMS_APPLY:"/api/v1/system-admin/bulk-assign-exams/apply",ASSIGN_STUDENTS_TO_ROOMS_IMPORT:"/api/v1/system-admin/rooms/assign-students/import",OEA_RESULTS_IMPORT:"/api/v1/system-admin/oea-results/import",OEA_RESULTS_CLEAR:"/api/v1/system-admin/oea-results/clear",OEA_RESULTS_COUNT:"/api/v1/system-admin/oea-results/count",OEA_RESULTS_LIST:"/api/v1/system-admin/oea-results/list"},STUDENT:{PROFILE:"/api/v1/student/profile",EXAMS:"/api/v1/student/exams",EXAM_START:a=>`/api/v1/student/exams/${a}/start`,EXAM_SUBMIT:a=>`/api/v1/student/exams/${a}/submit`,ROOMS:"/api/v1/student/rooms",ROOMS_JOINED:"/api/v1/student/rooms/joined",ROOM_DETAIL:a=>`/api/v1/student/rooms/${a}`,ROOM_JOIN:"/api/v1/student/rooms/join",ROOM_STATUS:a=>`/api/v1/student/rooms/${a}/status`,ROOM_JOIN_INVITE:(a,s)=>`/api/v1/student/rooms/${a}/invite/${s}`,ATTEMPTS_START:"/api/v1/student/attempts/start",ATTEMPTS_ACTIVE:"/api/v1/student/attempts/active",ATTEMPTS_ACTIVE_BY_ROOM:a=>`/api/v1/student/attempts/active-by-room/${a}`,ATTEMPT_DETAIL:a=>`/api/v1/student/attempts/${a}`,ATTEMPT_DELETE:a=>`/api/v1/student/attempts/${a}`,ATTEMPT_QUESTIONS:a=>`/api/v1/student/attempts/${a}/questions`,ATTEMPT_ANSWERS:a=>`/api/v1/student/attempts/${a}/answers`,ATTEMPT_SUBMIT:a=>`/api/v1/student/attempts/${a}/submit`,ATTEMPT_AUDIO_ANSWER:a=>`/api/v1/student/attempts/${a}/audio-answer`,ATTEMPT_PROCTORING_SNAPSHOT:a=>`/api/v1/student/attempts/${a}/proctoring-snapshot`,ATTEMPT_GRADING_SUMMARY:a=>`/api/v1/student/attempts/${a}/grading-summary`,ATTEMPT_ANSWERS_GRADING_STATUS:a=>`/api/v1/student/attempts/${a}/answers/grading-status`,ATTEMPT_ANSWER_DETAIL:(a,s)=>`/api/v1/student/attempts/${a}/answers/${s}`,SCHEDULES:"/api/v1/student/schedules",SCHEDULES_PAST:"/api/v1/student/schedules/past",RESULTS:"/api/v1/student/results",RESULT_DETAIL:a=>`/api/v1/student/results/${a}`,RESULT_RANKING:a=>`/api/v1/student/results/${a}/ranking`,EXPORT_NATIVE_PDF:"/api/v1/export/exam-report-pdf",STATS:"/api/v1/student/stats",PROGRESS:"/api/v1/student/progress",CONTESTS:"/api/v1/student/contests",CONTESTS_PUBLIC:"/api/v1/student/contests/public",CONTESTS_MY:"/api/v1/student/contests/my",CONTEST_DETAIL:a=>`/api/v1/student/contests/${a}`,CONTEST_REGISTER:a=>`/api/v1/student/contests/${a}/register`,CONTEST_ROOMS:a=>`/api/v1/student/contests/${a}/rooms`,CONTEST_RESULTS:a=>`/api/v1/student/contests/${a}/results`,CONTEST_HISTORY:a=>`/api/v1/student/contests/${a}/history`,CONTEST_LEADERBOARD:a=>`/api/v1/student/contests/${a}/leaderboard`,CONTEST_ROUNDS:a=>`/api/v1/student/contests/${a}/rounds`,CONTEST_GALLERY:a=>`/api/v1/student/contests/${a}/gallery`,CONTEST_ROOM_REGISTER:(a,s)=>`/api/v1/student/contests/${a}/rooms/${s}/register`},SHARED:{EXAM_TEMPLATES:"/api/v1/exam-templates",EXAM_TEMPLATE_DETAIL:a=>`/api/v1/exam-templates/${a}`,EXAM_TEMPLATE_EXPORT:a=>`/api/v1/exam-templates/${a}/export`,EXAM_TEMPLATE_IMPORT:"/api/v1/exam-templates/import",EXAM_TEMPLATE_UPDATE:a=>`/api/v1/exam-templates/${a}`,EXAM_TEMPLATE_DELETE:a=>`/api/v1/exam-templates/${a}`,EXAM_TEMPLATE_EXAMS:a=>`/api/v1/exam-templates/${a}/exams`,EXAM_TEMPLATE_APPLY_CONFIG:a=>`/api/v1/exam-templates/${a}/apply-config`,SUBJECTS:"/api/v1/subjects",CONTESTS:"/api/v1/contests",SPEAKING_REALTIME_GRADE:"/api/v1/speaking-assessment/realtime/grade-single"},STORAGE:{UPLOAD:"/api/v1/storage/upload",UPLOAD_AUDIO:"/api/v1/storage/upload-audio",FILE:a=>`/api/v1/storage/${encodeURIComponent(a)}`},PUBLIC:{EXTERNAL_SHEET_RESULT:a=>`/api/v1/public/external-sheets/result/${a}`,EXTERNAL_SHEET_UPLOAD:a=>`/api/v1/public/external-sheets/upload/${a}`,EXTERNAL_SHEET_TOKEN_INFO:a=>`/api/v1/public/external-sheets/token-info/${a}`,OEA_RESULTS_LOOKUP:"/api/v1/public/oea-results/lookup"},TEST:{COOKIE_SET:"/api/v1/test/cookie/set",COOKIE_SET_AUTH:"/api/v1/test/cookie/set-auth-test",COOKIE_CLEAR:"/api/v1/test/cookie/clear"}};
|
|
1
|
+
export const API_VERSION="v1";export const API_BASE_URL="undefined"==typeof process?void 0:process.env.NEXT_PUBLIC_API_URL;export const API_ENDPOINTS={AUTH:{LOGIN:"/api/v1/auth/login",LOGOUT:"/api/v1/auth/logout",REFRESH:"/api/v1/auth/refresh",CHANGE_PASSWORD:"/api/v1/auth/change-password",ME:"/api/v1/auth/me",UPGRADE_ACCOUNT:"/api/v1/auth/upgrade-account",STUDENT_REGISTER:"/api/v1/auth/student/register",REGISTER_SIMPLE:"/api/v1/auth/register-simple",PERMISSIONS:"/api/v1/auth/permissions"},MANAGE:{USERS:"/api/v1/manage/users",USER_DETAIL:a=>`/api/v1/manage/users/${a}`,SYNC_EBM:"/api/v1/manage/users/sync-ebm",BRANCHES:"/api/v1/manage/branches",BRANCH_DETAIL:a=>`/api/v1/manage/branches/${a}`,BRANCHES_STATISTICS:"/api/v1/manage/branches/statistics",BRANCHES_MANAGERS:"/api/v1/manage/branches/managers",BRANCHES_TEACHERS:"/api/v1/manage/branches/teachers",QUESTIONS:"/api/v1/manage/questions",QUESTION_DETAIL:a=>`/api/v1/manage/questions/${a}`,QUESTIONS_BATCH:"/api/v1/manage/questions/batch",QUESTIONS_GENERATE_AUDIO:"/api/v1/manage/questions/generate-audio",QUESTIONS_BY_EXAM:a=>`/api/v1/manage/questions/by-exam/${a}`,EXAMS:"/api/v1/manage/exams",EXAM_DETAIL:a=>`/api/v1/manage/exams/${a}`,EXAM_QUESTIONS:a=>`/api/v1/manage/exams/${a}/questions`,EXAM_SHUFFLE:a=>`/api/v1/manage/exams/${a}/shuffle`,EXAM_COPY:a=>`/api/v1/manage/exams/${a}/copy`,EXAM_CLASSES:"/api/v1/manage/exam-classes",EXAM_CLASS_DETAIL:a=>`/api/v1/manage/exam-classes/${a}`,EXAM_SESSIONS:"/api/v1/manage/exam-sessions",EXAM_SESSION_DETAIL:a=>`/api/v1/manage/exam-sessions/${a}`,EXAM_ROOMS:"/api/v1/manage/rooms",EXAM_ROOM_DETAIL:a=>`/api/v1/manage/rooms/${a}`,ROOM_TEACHERS:"/api/v1/manage/rooms/teachers",ROOM_STUDENTS:"/api/v1/manage/rooms/students",ROOM_EXAMS:"/api/v1/manage/rooms/exams",ROOM_CONTESTS:"/api/v1/manage/rooms/contests",ROOM_STATISTICS:"/api/v1/manage/rooms/statistics",ROOM_CLASSES:"/api/v1/manage/rooms/classes",ROOM_BRANCHES:"/api/v1/manage/rooms/branches",ROOM_TAGS:"/api/v1/manage/rooms/tags",ROOM_REGISTRATIONS:a=>`/api/v1/manage/rooms/${a}/registrations`,ROOM_REGISTRATION_DETAIL:(a,s)=>`/api/v1/manage/rooms/${a}/registrations/${s}`,ROOM_REGISTRATIONS_BULK_REVIEW:a=>`/api/v1/manage/rooms/${a}/registrations/bulk-review`,ROOM_INVITE_LINK:a=>`/api/v1/manage/rooms/${a}/invite-link`,ROOM_MANUAL_GRADING:a=>`/api/v1/manage/rooms/${a}/manual-grading`,ROOM_UPLOAD_ANSWER_SHEETS:a=>`/api/v1/manage/rooms/${a}/upload-answer-sheets`,ROOM_EXTERNAL_ANSWER_SHEETS:a=>`/api/v1/manage/rooms/${a}/external-answer-sheets`,ROOM_EXTERNAL_ANSWER_SHEET_DETAIL:(a,s)=>`/api/v1/manage/rooms/${a}/external-answer-sheets/${s}`,ROOM_EXTERNAL_UPLOAD_TOKEN:a=>`/api/v1/manage/rooms/${a}/external-answer-sheets/upload-token`,ROOM_EXTERNAL_ANSWER_SHEET_REGRADE:(a,s)=>`/api/v1/manage/rooms/${a}/external-answer-sheets/${s}/re-grade`,ROOM_EXTERNAL_ANSWER_SHEETS_REGRADE_ALL:a=>`/api/v1/manage/rooms/${a}/external-answer-sheets/re-grade-all`,ROOM_EXTERNAL_ANSWER_SHEET_REPROCESS:(a,s)=>`/api/v1/manage/rooms/${a}/external-answer-sheets/${s}/re-process`,ROOM_EXTERNAL_ANSWER_SHEETS_REPROCESS_ALL:a=>`/api/v1/manage/rooms/${a}/external-answer-sheets/re-process-all`,CONTESTS:"/api/v1/manage/contests",CONTEST_DETAIL:a=>`/api/v1/manage/contests/${a}`,CONTEST_SUMMARY:"/api/v1/manage/contests/summary",CONTEST_TOP_STUDENTS_LATEST:"/api/v1/manage/contests/top-students-latest",CONTEST_TOP_STUDENTS_ALL_TIME:"/api/v1/manage/contests/top-students-all-time",CONTEST_STATISTICS_LIST:"/api/v1/manage/contests/statistics-list",CONTEST_STUDENT_HISTORY:a=>`/api/v1/manage/contests/student-contest-history/${a}`,CONTEST_STUDENT_STATISTICS:a=>`/api/v1/manage/contests/student-statistics/${a}`,CONTEST_STATISTICS:a=>`/api/v1/manage/contests/${a}/statistics`,CONTEST_STAFF:a=>`/api/v1/manage/contests/${a}/staff`,CONTEST_STAFF_BY_GROUP:a=>`/api/v1/manage/contests/${a}/staff/by-group`,CONTEST_STAFF_DETAIL:(a,s)=>`/api/v1/manage/contests/${a}/staff/${s}`,CONTEST_GALLERY:a=>`/api/v1/manage/contests/${a}/gallery`,CONTEST_GALLERY_DETAIL:(a,s)=>`/api/v1/manage/contests/${a}/gallery/${s}`,CONTEST_CONVERT_MULTI_ROUND:a=>`/api/v1/manage/contests/${a}/convert-to-multi-round`,CONTEST_ROUNDS:a=>`/api/v1/manage/contests/${a}/rounds`,CONTEST_ROUND_DETAIL:(a,s)=>`/api/v1/manage/contests/${a}/rounds/${s}`,CONTEST_REGISTRATIONS:a=>`/api/v1/manage/contests/${a}/registrations`,CONTEST_REGISTRATION_DETAIL:(a,s)=>`/api/v1/manage/contests/${a}/registrations/${s}`,CONTEST_REGISTRATIONS_BULK_REVIEW:a=>`/api/v1/manage/contests/${a}/registrations/bulk-review`,CONTEST_RESULTS:a=>`/api/v1/manage/contests/${a}/results`,CONTEST_OVERVIEW_STATS:a=>`/api/v1/manage/contests/${a}/overview-stats`,QUESTION_BANKS:"/api/v1/manage/question-banks",QUESTION_BANK_DETAIL:a=>`/api/v1/manage/question-banks/${a}`,QUESTION_BANKS_STATISTICS:"/api/v1/manage/question-banks/statistics",SCHEDULES_SUMMARY:"/api/v1/manage/schedules/summary",SCHEDULES_CALENDAR:"/api/v1/manage/schedules/calendar",SCHEDULES:"/api/v1/manage/schedules",STUDENT_TEST_PARTICIPANTS:"/api/v1/manage/students/test-participants",REPORTS:"/api/v1/manage/reports",REPORT_OVERVIEW:"/api/v1/manage/reports/overview",REPORT_CLASSES:"/api/v1/manage/reports/classes",REPORT_BRANCHES:"/api/v1/manage/reports/branches",REPORT_SKILLS:"/api/v1/manage/reports/skills",REPORT_TRENDS:"/api/v1/manage/reports/trends",REPORT_CUSTOM:"/api/v1/manage/reports/custom",REPORT_CUSTOM_DETAIL:a=>`/api/v1/manage/reports/custom/${a}`,REPORT_CUSTOM_DOWNLOAD:a=>`/api/v1/manage/reports/custom/${a}/download`,REPORT_ROOMS:"/api/v1/manage/reports/rooms",REPORT_CONTESTS:"/api/v1/manage/reports/contests",REPORT_COMPETENCY:"/api/v1/manage/reports/competency",REPORT_COMPETENCY_EXAM_ROOMS:"/api/v1/manage/reports/competency/exam-rooms",DASHBOARD_SUMMARY:"/api/v1/manage/dashboard/summary",DASHBOARD_USER_GROWTH:"/api/v1/manage/dashboard/user-growth",DASHBOARD_EXAM_STATS:"/api/v1/manage/dashboard/exam-statistics",DASHBOARD_ACTIVITIES:"/api/v1/manage/dashboard/recent-activities",DASHBOARD_ROOMS:"/api/v1/manage/dashboard/rooms",DASHBOARD_CHARTS:"/api/v1/manage/dashboard/charts",DASHBOARD_UPCOMING_ROOMS:"/api/v1/manage/dashboard/upcoming-rooms",DASHBOARD_PENDING_GRADING:"/api/v1/manage/dashboard/pending-grading",ROLES:"/api/v1/manage/roles",ROLE_DETAIL:a=>`/api/v1/manage/roles/${a}`,ROLE_PERMISSIONS:a=>`/api/v1/manage/roles/${a}/permissions`,PERMISSIONS:"/api/v1/manage/permissions",PERMISSIONS_GROUPED:"/api/v1/manage/permissions/grouped",USER_ROLES:a=>`/api/v1/manage/users/${a}/roles`,USER_ROLE_DETAIL:(a,s)=>`/api/v1/manage/users/${a}/roles/${s}`,ROOM_OPEN:a=>`/api/v1/manage/rooms/${a}/open`,ROOM_CLOSE:a=>`/api/v1/manage/rooms/${a}/close`,ROOM_TOGGLE_LOCK:a=>`/api/v1/manage/rooms/${a}/toggle-lock`,GRADING_ATTEMPT:a=>`/api/v1/manage/grading/${a}`,GRADING_ANSWER:(a,s)=>`/api/v1/manage/grading/${a}/answers/${s}`,EXAM_VARIANTS:a=>`/api/v1/manage/exams/${a}/variants`,EXAM_TEMPLATE:a=>`/api/v1/manage/exams/${a}/template`},get ADMIN(){return this.MANAGE},SYSTEM_ADMIN:{BRANCHES:"/api/v1/system-admin/branches",BRANCH_DETAIL:a=>`/api/v1/system-admin/branches/${a}`,BRANCHES_STATISTICS:"/api/v1/system-admin/branches/statistics",USERS:"/api/v1/system-admin/users",USER_DETAIL:a=>`/api/v1/system-admin/users/${a}`,USERS_IMPORT:"/api/v1/system-admin/users/import",USERS_IMPORT_TEMPLATE:"/api/v1/system-admin/users/import/template",USERS_BULK_UPDATE_PASSWORD:"/api/v1/system-admin/users/bulk-update-password",USER_GROUPS:"/api/v1/system-admin/user-groups",USER_GROUP_DETAIL:a=>`/api/v1/system-admin/user-groups/${a}`,USER_GROUP_MEMBERS:a=>`/api/v1/system-admin/user-groups/${a}/members`,USER_GROUP_MEMBERS_BY_EMAIL:a=>`/api/v1/system-admin/user-groups/${a}/members/by-email`,TAGS:"/api/v1/system-admin/tags",TAG_DETAIL:a=>`/api/v1/system-admin/tags/${a}`,TAG_CATEGORIES:"/api/v1/system-admin/tags/categories",BULK_ROOMS_PREVIEW:"/api/v1/system-admin/bulk-rooms/preview",BULK_ROOMS_COMMIT:"/api/v1/system-admin/bulk-rooms/commit",BULK_ROOMS_EBM_BRANCHES:"/api/v1/system-admin/bulk-rooms/ebm-branches",BULK_ASSIGN_EXAMS_MATCH:"/api/v1/system-admin/bulk-assign-exams/match",BULK_ASSIGN_EXAMS_APPLY:"/api/v1/system-admin/bulk-assign-exams/apply",ASSIGN_STUDENTS_TO_ROOMS_IMPORT:"/api/v1/system-admin/rooms/assign-students/import",OEA_RESULTS_IMPORT:"/api/v1/system-admin/oea-results/import",OEA_RESULTS_CLEAR:"/api/v1/system-admin/oea-results/clear",OEA_RESULTS_COUNT:"/api/v1/system-admin/oea-results/count",OEA_RESULTS_LIST:"/api/v1/system-admin/oea-results/list"},STUDENT:{PROFILE:"/api/v1/student/profile",EXAMS:"/api/v1/student/exams",EXAM_START:a=>`/api/v1/student/exams/${a}/start`,EXAM_SUBMIT:a=>`/api/v1/student/exams/${a}/submit`,ROOMS:"/api/v1/student/rooms",ROOMS_JOINED:"/api/v1/student/rooms/joined",ROOM_DETAIL:a=>`/api/v1/student/rooms/${a}`,ROOM_JOIN:"/api/v1/student/rooms/join",ROOM_STATUS:a=>`/api/v1/student/rooms/${a}/status`,ROOM_JOIN_INVITE:(a,s)=>`/api/v1/student/rooms/${a}/invite/${s}`,ATTEMPTS_START:"/api/v1/student/attempts/start",ATTEMPTS_ACTIVE:"/api/v1/student/attempts/active",ATTEMPTS_ACTIVE_BY_ROOM:a=>`/api/v1/student/attempts/active-by-room/${a}`,ATTEMPT_DETAIL:a=>`/api/v1/student/attempts/${a}`,ATTEMPT_DELETE:a=>`/api/v1/student/attempts/${a}`,ATTEMPT_QUESTIONS:a=>`/api/v1/student/attempts/${a}/questions`,ATTEMPT_ANSWERS:a=>`/api/v1/student/attempts/${a}/answers`,ATTEMPT_SUBMIT:a=>`/api/v1/student/attempts/${a}/submit`,ATTEMPT_CANCEL:a=>`/api/v1/student/attempts/${a}/cancel`,ATTEMPT_AUDIO_ANSWER:a=>`/api/v1/student/attempts/${a}/audio-answer`,ATTEMPT_PROCTORING_SNAPSHOT:a=>`/api/v1/student/attempts/${a}/proctoring-snapshot`,ATTEMPT_GRADING_SUMMARY:a=>`/api/v1/student/attempts/${a}/grading-summary`,ATTEMPT_ANSWERS_GRADING_STATUS:a=>`/api/v1/student/attempts/${a}/answers/grading-status`,ATTEMPT_ANSWER_DETAIL:(a,s)=>`/api/v1/student/attempts/${a}/answers/${s}`,SCHEDULES:"/api/v1/student/schedules",SCHEDULES_PAST:"/api/v1/student/schedules/past",RESULTS:"/api/v1/student/results",RESULT_DETAIL:a=>`/api/v1/student/results/${a}`,RESULT_RANKING:a=>`/api/v1/student/results/${a}/ranking`,EXPORT_NATIVE_PDF:"/api/v1/export/exam-report-pdf",STATS:"/api/v1/student/stats",PROGRESS:"/api/v1/student/progress",CONTESTS:"/api/v1/student/contests",CONTESTS_PUBLIC:"/api/v1/student/contests/public",CONTESTS_MY:"/api/v1/student/contests/my",CONTEST_DETAIL:a=>`/api/v1/student/contests/${a}`,CONTEST_REGISTER:a=>`/api/v1/student/contests/${a}/register`,CONTEST_ROOMS:a=>`/api/v1/student/contests/${a}/rooms`,CONTEST_RESULTS:a=>`/api/v1/student/contests/${a}/results`,CONTEST_HISTORY:a=>`/api/v1/student/contests/${a}/history`,CONTEST_LEADERBOARD:a=>`/api/v1/student/contests/${a}/leaderboard`,CONTEST_ROUNDS:a=>`/api/v1/student/contests/${a}/rounds`,CONTEST_GALLERY:a=>`/api/v1/student/contests/${a}/gallery`,CONTEST_ROOM_REGISTER:(a,s)=>`/api/v1/student/contests/${a}/rooms/${s}/register`},SHARED:{EXAM_TEMPLATES:"/api/v1/exam-templates",EXAM_TEMPLATE_DETAIL:a=>`/api/v1/exam-templates/${a}`,EXAM_TEMPLATE_EXPORT:a=>`/api/v1/exam-templates/${a}/export`,EXAM_TEMPLATE_IMPORT:"/api/v1/exam-templates/import",EXAM_TEMPLATE_UPDATE:a=>`/api/v1/exam-templates/${a}`,EXAM_TEMPLATE_DELETE:a=>`/api/v1/exam-templates/${a}`,EXAM_TEMPLATE_EXAMS:a=>`/api/v1/exam-templates/${a}/exams`,EXAM_TEMPLATE_APPLY_CONFIG:a=>`/api/v1/exam-templates/${a}/apply-config`,SUBJECTS:"/api/v1/subjects",CONTESTS:"/api/v1/contests",SPEAKING_REALTIME_GRADE:"/api/v1/speaking-assessment/realtime/grade-single"},STORAGE:{UPLOAD:"/api/v1/storage/upload",UPLOAD_AUDIO:"/api/v1/storage/upload-audio",FILE:a=>`/api/v1/storage/${encodeURIComponent(a)}`},PUBLIC:{EXTERNAL_SHEET_RESULT:a=>`/api/v1/public/external-sheets/result/${a}`,EXTERNAL_SHEET_UPLOAD:a=>`/api/v1/public/external-sheets/upload/${a}`,EXTERNAL_SHEET_TOKEN_INFO:a=>`/api/v1/public/external-sheets/token-info/${a}`,OEA_RESULTS_LOOKUP:"/api/v1/public/oea-results/lookup"},TEST:{COOKIE_SET:"/api/v1/test/cookie/set",COOKIE_SET_AUTH:"/api/v1/test/cookie/set-auth-test",COOKIE_CLEAR:"/api/v1/test/cookie/clear"}};
|