academe-kit 0.10.1 → 0.10.3

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.
@@ -26,9 +26,19 @@ export interface FrameRenderArgs {
26
26
  scale: number;
27
27
  layout: FrameLayout;
28
28
  progress?: number;
29
+ /** Frames que renderizam o próprio ícone (3D) recebem-no aqui. */
30
+ icon?: ReactNode;
31
+ /** Permite ao frame estilizar o ícone no estado bloqueado. */
32
+ isLocked?: boolean;
29
33
  }
30
34
  export interface FrameRenderer {
31
35
  kind: FrameKind;
36
+ /**
37
+ * Frames 3D (ex.: sphere) desenham profundidade (base/skirt + lift + squash)
38
+ * e renderizam o próprio ícone. Quando true, o JourneyStep adiciona a classe
39
+ * `is-3d`, repassa o ícone ao frame e não desenha o ícone padrão.
40
+ */
41
+ is3d?: boolean;
32
42
  layout: (scale: number) => FrameLayout;
33
43
  render: (args: FrameRenderArgs) => ReactNode;
34
44
  }
@@ -17,6 +17,7 @@ export type { AcademeKeycloakContextProps, SecurityProviderProps, KeycloakUser,
17
17
  export { createAcademeApiClient } from "./services";
18
18
  export type { AcademeApiClient, AcademeServices } from "./services";
19
19
  export type { ChallengeUserQuizAttempt, ChallengeUserQuizAttemptsResponse, } from "./services/ChallengeService";
20
+ export type { JourneyStepView, JourneyChallengeView, JourneyView, } from "./services/UserProgressService";
20
21
  export { cn } from "./lib/utils";
21
22
  import "./index.css";
22
23
  import "./styles/globals.css";
@@ -645,6 +645,73 @@ export declare function createReportService(apiClient: AcademeApiClient): {
645
645
  } | undefined;
646
646
  };
647
647
  }, `${string}/${string}`>>;
648
+ /**
649
+ * Status de jornada dos alunos para os summary cards da rota /students.
650
+ *
651
+ * @param id UUID da instituição.
652
+ * @param params.periodId UUID do bimestre, ou `"all"` para todos os bimestres
653
+ * do ano letivo. Omitido = bimestre corrente.
654
+ * @param params.challengeId UUID de UM challenge específico para restringir o
655
+ * cálculo dentro do recorte temporal.
656
+ */
657
+ getStudentsJourneyStatusByInstitution(id: string, params?: {
658
+ periodId?: string;
659
+ challengeId?: string;
660
+ }): Promise<import("openapi-fetch").FetchResponse<{
661
+ parameters: {
662
+ query?: {
663
+ periodId?: string;
664
+ challengeId?: string;
665
+ };
666
+ header?: never;
667
+ path: {
668
+ id: string;
669
+ };
670
+ cookie?: never;
671
+ };
672
+ requestBody?: never;
673
+ responses: {
674
+ 200: {
675
+ headers: {
676
+ [name: string]: unknown;
677
+ };
678
+ content: {
679
+ "application/json": {
680
+ status?: string;
681
+ data?: import("../types/academe-api").components["schemas"]["StudentsJourneyStatusResponse"];
682
+ };
683
+ };
684
+ };
685
+ 400: {
686
+ headers: {
687
+ [name: string]: unknown;
688
+ };
689
+ content?: never;
690
+ };
691
+ 401: {
692
+ headers: {
693
+ [name: string]: unknown;
694
+ };
695
+ content?: never;
696
+ };
697
+ 500: {
698
+ headers: {
699
+ [name: string]: unknown;
700
+ };
701
+ content?: never;
702
+ };
703
+ };
704
+ }, {
705
+ params: {
706
+ path: {
707
+ id: string;
708
+ };
709
+ query: {
710
+ periodId?: string;
711
+ challengeId?: string;
712
+ } | undefined;
713
+ };
714
+ }, `${string}/${string}`>>;
648
715
  };
649
716
  export type ReportService = ReturnType<typeof createReportService>;
650
717
  export {};
@@ -19,7 +19,10 @@ export declare function createSubmissionService(apiClient: AcademeApiClient): {
19
19
  userId?: string;
20
20
  groupId?: string;
21
21
  institutionId?: string;
22
+ institutionClassroomId?: string;
23
+ serieId?: string;
22
24
  status?: "submitted" | "ai_evaluated" | "approved" | "rejected";
25
+ search?: string;
23
26
  page?: import("../types/academe-api").components["parameters"]["page"];
24
27
  limit?: import("../types/academe-api").components["parameters"]["limit"];
25
28
  };
@@ -57,7 +60,10 @@ export declare function createSubmissionService(apiClient: AcademeApiClient): {
57
60
  userId?: string;
58
61
  groupId?: string;
59
62
  institutionId?: string;
63
+ institutionClassroomId?: string;
64
+ serieId?: string;
60
65
  status?: "submitted" | "ai_evaluated" | "approved" | "rejected";
66
+ search?: string;
61
67
  page?: import("../types/academe-api").components["parameters"]["page"];
62
68
  limit?: import("../types/academe-api").components["parameters"]["limit"];
63
69
  } | undefined;
@@ -0,0 +1,304 @@
1
+ import type { AcademeApiClient } from "./index";
2
+ import type { components } from "../types/academe-api";
3
+ export type JourneyStepView = components["schemas"]["JourneyStepView"];
4
+ export type JourneyChallengeView = components["schemas"]["JourneyChallengeView"];
5
+ export type JourneyView = components["schemas"]["JourneyView"];
6
+ /**
7
+ * Service do agregado `user-challenge-progress` — o caminho oficial para os
8
+ * clientes (web/mobile) montarem a jornada e o progresso do usuário. Espelha
9
+ * app-academe-v2/src/services/academe/user-progress.service.ts.
10
+ */
11
+ export declare function createUserProgressService(apiClient: AcademeApiClient): {
12
+ /**
13
+ * Jornada pré-computada do usuário (status, progress, color, icon,
14
+ * isUpcoming, série) — base de renderização direta da tela de jornada.
15
+ *
16
+ * `userId` é [Admin]: quando informado, retorna a jornada do usuário-alvo
17
+ * (ex.: backoffice visualizando a jornada de um aluno); omitido = jornada
18
+ * do próprio usuário autenticado.
19
+ */
20
+ getJourney(serieId?: string, userId?: string): Promise<JourneyView>;
21
+ /**
22
+ * Visão step-by-step do progresso do usuário em um desafio. Cada step traz
23
+ * `myStartedAt`, `myCompletedAt` e (em desafios em grupo) os agregados do
24
+ * grupo.
25
+ */
26
+ getChallengeProgress(challengeId: string): Promise<import("openapi-fetch").FetchResponse<{
27
+ parameters: {
28
+ query?: never;
29
+ header?: never;
30
+ path: {
31
+ id: components["parameters"]["id"];
32
+ };
33
+ cookie?: never;
34
+ };
35
+ requestBody?: never;
36
+ responses: {
37
+ 200: {
38
+ headers: {
39
+ [name: string]: unknown;
40
+ };
41
+ content: {
42
+ "application/json": {
43
+ status?: string;
44
+ data?: {
45
+ challengeStepId?: string;
46
+ stepName?: string;
47
+ index?: number;
48
+ totalMembers?: number;
49
+ completedMembers?: number;
50
+ groupCompleted?: boolean;
51
+ myStartedAt?: string | null;
52
+ myCompletedAt?: string | null;
53
+ }[];
54
+ };
55
+ };
56
+ };
57
+ 401: components["responses"]["Unauthorized"];
58
+ 404: components["responses"]["NotFound"];
59
+ };
60
+ }, {
61
+ params: {
62
+ path: {
63
+ id: string;
64
+ };
65
+ };
66
+ }, `${string}/${string}`>>;
67
+ /**
68
+ * Avança um tick na jornada do usuário no desafio, agnóstico do tipo da
69
+ * etapa. Cada chamada executa UMA ação:
70
+ * - Sem progresso na etapa atual → action='started'
71
+ * - Etapa iniciada (sem completedAt) → action='completed'
72
+ * - Todas as etapas concluídas → action='finished' (no-op)
73
+ *
74
+ * Caminho oficial para clientes (web/mobile). Não usar os endpoints
75
+ * internos `/steps/{stepId}/start` ou `/steps/{stepId}/complete`.
76
+ */
77
+ advance(challengeId: string): Promise<import("openapi-fetch").FetchResponse<{
78
+ parameters: {
79
+ query?: never;
80
+ header?: never;
81
+ path: {
82
+ id: components["parameters"]["id"];
83
+ };
84
+ cookie?: never;
85
+ };
86
+ requestBody?: never;
87
+ responses: {
88
+ 200: {
89
+ headers: {
90
+ [name: string]: unknown;
91
+ };
92
+ content: {
93
+ "application/json": {
94
+ status?: string;
95
+ data?: {
96
+ action?: "started" | "completed" | "finished";
97
+ challengeId?: string;
98
+ currentStep?: {
99
+ id?: string;
100
+ index?: number;
101
+ name?: string;
102
+ startedAt?: string | null;
103
+ completedAt?: string | null;
104
+ } | null;
105
+ nextStep?: {
106
+ id?: string;
107
+ index?: number;
108
+ name?: string;
109
+ startedAt?: string | null;
110
+ } | null;
111
+ };
112
+ };
113
+ };
114
+ };
115
+ 401: components["responses"]["Unauthorized"];
116
+ 404: components["responses"]["NotFound"];
117
+ };
118
+ }, {
119
+ params: {
120
+ path: {
121
+ id: string;
122
+ };
123
+ };
124
+ }, `${string}/${string}`>>;
125
+ /**
126
+ * Status de conclusão do grupo numa etapa. Em desafios em grupo: retorna a
127
+ * agregação (`canAdvance=true` quando todos concluíram). Em desafios
128
+ * individuais: retorna o status do próprio usuário.
129
+ */
130
+ getStepGroupStatus(stepId: string): Promise<import("openapi-fetch").FetchResponse<{
131
+ parameters: {
132
+ query?: never;
133
+ header?: never;
134
+ path: {
135
+ stepId: string;
136
+ };
137
+ cookie?: never;
138
+ };
139
+ requestBody?: never;
140
+ responses: {
141
+ 200: {
142
+ headers: {
143
+ [name: string]: unknown;
144
+ };
145
+ content: {
146
+ "application/json": {
147
+ status?: string;
148
+ data?: {
149
+ isGroupChallenge?: boolean;
150
+ totalMembers?: number;
151
+ completedMembers?: number;
152
+ canAdvance?: boolean;
153
+ };
154
+ };
155
+ };
156
+ };
157
+ 401: components["responses"]["Unauthorized"];
158
+ 404: components["responses"]["NotFound"];
159
+ };
160
+ }, {
161
+ params: {
162
+ path: {
163
+ stepId: string;
164
+ };
165
+ };
166
+ }, `${string}/${string}`>>;
167
+ /**
168
+ * Progresso agregado do usuário em um módulo (ou no curso inteiro quando
169
+ * `moduleId` é omitido). Usado pelos steps do tipo `course` da jornada.
170
+ */
171
+ getCourseProgress(courseId: string, moduleId?: string | null): Promise<import("openapi-fetch").FetchResponse<{
172
+ parameters: {
173
+ query?: never;
174
+ header?: never;
175
+ path: {
176
+ courseId: string;
177
+ moduleId: string;
178
+ };
179
+ cookie?: never;
180
+ };
181
+ requestBody?: never;
182
+ responses: {
183
+ 200: {
184
+ headers: {
185
+ [name: string]: unknown;
186
+ };
187
+ content: {
188
+ "application/json": {
189
+ status?: string;
190
+ data?: components["schemas"]["UsersCourseLogProgress"];
191
+ };
192
+ };
193
+ };
194
+ 401: components["responses"]["Unauthorized"];
195
+ 404: components["responses"]["NotFound"];
196
+ };
197
+ }, {
198
+ params: {
199
+ path: {
200
+ courseId: string;
201
+ moduleId: string;
202
+ };
203
+ };
204
+ }, `${string}/${string}`>>;
205
+ /**
206
+ * [Interno] Força o início de uma etapa específica (idempotente). Clientes
207
+ * devem preferir `advance`; mantido para casos pontuais (ex.: iniciar a
208
+ * próxima etapa após concluir um curso aberto a partir da jornada).
209
+ */
210
+ start(stepId: string): Promise<import("openapi-fetch").FetchResponse<{
211
+ parameters: {
212
+ query?: never;
213
+ header?: never;
214
+ path: {
215
+ stepId: string;
216
+ };
217
+ cookie?: never;
218
+ };
219
+ requestBody?: never;
220
+ responses: {
221
+ 201: {
222
+ headers: {
223
+ [name: string]: unknown;
224
+ };
225
+ content: {
226
+ "application/json": {
227
+ status?: string;
228
+ data?: components["schemas"]["UserChallengeProgress"];
229
+ };
230
+ };
231
+ };
232
+ 401: components["responses"]["Unauthorized"];
233
+ 404: components["responses"]["NotFound"];
234
+ };
235
+ }, {
236
+ params: {
237
+ path: {
238
+ stepId: string;
239
+ };
240
+ };
241
+ }, `${string}/${string}`>>;
242
+ /**
243
+ * [Admin] Conclui de uma vez TODAS as etapas ativas de um desafio para um
244
+ * usuário-alvo, criando a linha de progresso quando não existir. Idempotente
245
+ * — etapas já concluídas não são alteradas.
246
+ *
247
+ * Diferente de `advance` (que avança um tick por vez para o usuário
248
+ * autenticado), aqui o desafio inteiro é concluído de uma vez para o usuário
249
+ * identificado no path. Em desafios em grupo, apenas o progresso do
250
+ * usuário-alvo é concluído; os demais membros não são afetados.
251
+ */
252
+ completeAllForUser(challengeId: string, userId: string): Promise<import("openapi-fetch").FetchResponse<{
253
+ parameters: {
254
+ query?: never;
255
+ header?: never;
256
+ path: {
257
+ id: string;
258
+ userId: string;
259
+ };
260
+ cookie?: never;
261
+ };
262
+ requestBody?: never;
263
+ responses: {
264
+ 200: {
265
+ headers: {
266
+ [name: string]: unknown;
267
+ };
268
+ content: {
269
+ "application/json": {
270
+ status?: string;
271
+ data?: {
272
+ challengeId?: string;
273
+ userId?: string;
274
+ total?: number;
275
+ completedSteps?: {
276
+ id?: string;
277
+ index?: number;
278
+ name?: string;
279
+ completedAt?: string | null;
280
+ }[];
281
+ };
282
+ };
283
+ };
284
+ };
285
+ 401: components["responses"]["Unauthorized"];
286
+ 404: {
287
+ headers: {
288
+ [name: string]: unknown;
289
+ };
290
+ content: {
291
+ "application/json": components["schemas"]["Error"];
292
+ };
293
+ };
294
+ };
295
+ }, {
296
+ params: {
297
+ path: {
298
+ id: string;
299
+ userId: string;
300
+ };
301
+ };
302
+ }, `${string}/${string}`>>;
303
+ };
304
+ export type UserProgressService = ReturnType<typeof createUserProgressService>;
@@ -21,6 +21,7 @@ import { type StorageFileService } from './StorageFileService';
21
21
  import { type ChallengeService } from './ChallengeService';
22
22
  import { type StepService } from './StepService';
23
23
  import { type SubmissionService } from './SubmissionService';
24
+ import { type UserProgressService } from './UserProgressService';
24
25
  export type AcademeApiClient = ReturnType<typeof createClient<paths>>;
25
26
  export declare function createAcademeApiClient(baseUrl: string): AcademeApiClient;
26
27
  export interface AcademeServices {
@@ -45,6 +46,7 @@ export interface AcademeServices {
45
46
  challenge: ChallengeService;
46
47
  step: StepService;
47
48
  submission: SubmissionService;
49
+ userProgress: UserProgressService;
48
50
  }
49
51
  export declare function createAcademeServices(apiClient: AcademeApiClient): AcademeServices;
50
52
  export { createUserService, type UserService } from "./userService";
@@ -67,3 +69,4 @@ export { createStorageFileService, type StorageFileService } from './StorageFile
67
69
  export { createChallengeService, type ChallengeService } from './ChallengeService';
68
70
  export { createStepService, type StepService } from './StepService';
69
71
  export { createSubmissionService, type SubmissionService } from './SubmissionService';
72
+ export { createUserProgressService, type UserProgressService } from './UserProgressService';