academe-kit 0.12.0 → 0.13.0
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/index.cjs +64 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +92 -2
- package/dist/index.esm.js +64 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/services/UserProgressService.d.ts +8 -1
- package/dist/types/services/VitrineService.d.ts +51 -0
- package/dist/types/services/index.d.ts +3 -0
- package/dist/types/services/userService.d.ts +31 -0
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export { createAcademeApiClient } from "./services";
|
|
|
20
20
|
export type { AcademeApiClient, AcademeServices } from "./services";
|
|
21
21
|
export type { ChallengeUserQuizAttempt, ChallengeUserQuizAttemptsResponse, } from "./services/ChallengeService";
|
|
22
22
|
export type { JourneyStepView, JourneyChallengeView, JourneyView, } from "./services/UserProgressService";
|
|
23
|
+
export type { AccessibleSerie, ClassroomSummary, UserEnrollment, } from "./services/userService";
|
|
24
|
+
export type { VitrineHome, VitrinePlaylist, VitrineCard, VitrineCardKind, VitrinePlaylistSource, VitrineCardOrientation, } from "./services/VitrineService";
|
|
23
25
|
export { cn } from "./lib/utils";
|
|
24
26
|
import "./index.css";
|
|
25
27
|
import "./styles/globals.css";
|
|
@@ -16,8 +16,15 @@ export declare function createUserProgressService(apiClient: AcademeApiClient):
|
|
|
16
16
|
* `userId` é [Admin]: quando informado, retorna a jornada do usuário-alvo
|
|
17
17
|
* (ex.: backoffice visualizando a jornada de um aluno); omitido = jornada
|
|
18
18
|
* do próprio usuário autenticado.
|
|
19
|
+
*
|
|
20
|
+
* `institutionId` é a escola ATUAL: a jornada é POR ESCOLA (o usuário pode
|
|
21
|
+
* estar em várias). Omitido = 1ª matrícula resolvida no backend.
|
|
22
|
+
*
|
|
23
|
+
* ⚠️ Ordem dos parâmetros: `institutionId` foi adicionado como 3º parâmetro
|
|
24
|
+
* (após `userId`) para NÃO quebrar chamadas posicionais existentes — o
|
|
25
|
+
* backoffice chama `getJourney(undefined, userId)`.
|
|
19
26
|
*/
|
|
20
|
-
getJourney(serieId?: string, userId?: string): Promise<JourneyView>;
|
|
27
|
+
getJourney(serieId?: string, userId?: string, institutionId?: string): Promise<JourneyView>;
|
|
21
28
|
/**
|
|
22
29
|
* Visão step-by-step do progresso do usuário em um desafio. Cada step traz
|
|
23
30
|
* `myStartedAt`, `myCompletedAt` e (em desafios em grupo) os agregados do
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AcademeApiClient } from "./index";
|
|
2
|
+
/**
|
|
3
|
+
* Vitrine (Home) do aluno — rails/playlists estilo Netflix.
|
|
4
|
+
* Consome `GET /vitrine/home` do api-academe-v2.
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ O endpoint ainda NÃO está no OpenAPI gerado (`academe-api.ts`), então os
|
|
7
|
+
* tipos abaixo são MANTIDOS À MÃO e a chamada usa cast — mesmo padrão de
|
|
8
|
+
* `InstitutionService.setUserClassrooms`. Quando o backend expuser o schema,
|
|
9
|
+
* regenerar os tipos e apertar.
|
|
10
|
+
*/
|
|
11
|
+
export type VitrineCardKind = "course" | "module" | "lesson" | "playlist";
|
|
12
|
+
export type VitrinePlaylistSource = "curated" | "continue_watching" | "trending" | "watchlist" | "recent" | "continue_playlist";
|
|
13
|
+
export type VitrineCardOrientation = "horizontal" | "vertical" | "square" | "fullImage";
|
|
14
|
+
export interface VitrineCard {
|
|
15
|
+
kind: VitrineCardKind;
|
|
16
|
+
id: string;
|
|
17
|
+
courseId?: string | null;
|
|
18
|
+
title: string;
|
|
19
|
+
subtitle?: string | null;
|
|
20
|
+
coverUrl?: string | null;
|
|
21
|
+
durationSeconds?: number | null;
|
|
22
|
+
progressPct?: number | null;
|
|
23
|
+
courseTitle?: string | null;
|
|
24
|
+
lessonLabel?: string | null;
|
|
25
|
+
rank?: number | null;
|
|
26
|
+
}
|
|
27
|
+
export interface VitrinePlaylist {
|
|
28
|
+
id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
subtitle: string | null;
|
|
31
|
+
source: VitrinePlaylistSource;
|
|
32
|
+
variant: "common" | "featured";
|
|
33
|
+
cardOrientation: VitrineCardOrientation;
|
|
34
|
+
itemsPerViewDesktop: number;
|
|
35
|
+
itemsPerViewMobile: number;
|
|
36
|
+
autoplay: boolean;
|
|
37
|
+
style: Record<string, unknown>;
|
|
38
|
+
items: VitrineCard[];
|
|
39
|
+
}
|
|
40
|
+
export interface VitrineHome {
|
|
41
|
+
institutionId: string | null;
|
|
42
|
+
playlists: VitrinePlaylist[];
|
|
43
|
+
}
|
|
44
|
+
export declare function createVitrineService(apiClient: AcademeApiClient): {
|
|
45
|
+
/**
|
|
46
|
+
* Home do aluno para a escola atual. `institutionId` omitido = 1ª matrícula
|
|
47
|
+
* (o backend resolve). Recarregar ao trocar de escola no app.
|
|
48
|
+
*/
|
|
49
|
+
getHome(institutionId?: string): Promise<VitrineHome>;
|
|
50
|
+
};
|
|
51
|
+
export type VitrineService = ReturnType<typeof createVitrineService>;
|
|
@@ -22,6 +22,7 @@ import { type ChallengeService } from './ChallengeService';
|
|
|
22
22
|
import { type StepService } from './StepService';
|
|
23
23
|
import { type SubmissionService } from './SubmissionService';
|
|
24
24
|
import { type UserProgressService } from './UserProgressService';
|
|
25
|
+
import { type VitrineService } from './VitrineService';
|
|
25
26
|
export type AcademeApiClient = ReturnType<typeof createClient<paths>>;
|
|
26
27
|
export declare function createAcademeApiClient(baseUrl: string): AcademeApiClient;
|
|
27
28
|
export interface AcademeServices {
|
|
@@ -47,6 +48,7 @@ export interface AcademeServices {
|
|
|
47
48
|
step: StepService;
|
|
48
49
|
submission: SubmissionService;
|
|
49
50
|
userProgress: UserProgressService;
|
|
51
|
+
vitrine: VitrineService;
|
|
50
52
|
}
|
|
51
53
|
export declare function createAcademeServices(apiClient: AcademeApiClient): AcademeServices;
|
|
52
54
|
export { createUserService, type UserService } from "./userService";
|
|
@@ -70,3 +72,4 @@ export { createChallengeService, type ChallengeService } from './ChallengeServic
|
|
|
70
72
|
export { createStepService, type StepService } from './StepService';
|
|
71
73
|
export { createSubmissionService, type SubmissionService } from './SubmissionService';
|
|
72
74
|
export { createUserProgressService, type UserProgressService } from './UserProgressService';
|
|
75
|
+
export { createVitrineService, type VitrineService } from './VitrineService';
|
|
@@ -12,6 +12,30 @@ type GetUsersParams = {
|
|
|
12
12
|
page?: number;
|
|
13
13
|
limit?: number;
|
|
14
14
|
};
|
|
15
|
+
/** Série acessível ao aluno (item do seletor de séries da jornada). */
|
|
16
|
+
export type AccessibleSerie = {
|
|
17
|
+
serieId: string;
|
|
18
|
+
serieValue: number;
|
|
19
|
+
serieLabel: string;
|
|
20
|
+
level: "fundamental" | "medio";
|
|
21
|
+
};
|
|
22
|
+
/** Turma do aluno (resumo) — para a listagem de turmas no perfil. */
|
|
23
|
+
export type ClassroomSummary = {
|
|
24
|
+
institutionClassroomId: string;
|
|
25
|
+
classroomId: string;
|
|
26
|
+
classroomName: string;
|
|
27
|
+
shiftName: string | null;
|
|
28
|
+
serie: AccessibleSerie | null;
|
|
29
|
+
institutionId: string;
|
|
30
|
+
institutionName: string | null;
|
|
31
|
+
};
|
|
32
|
+
/** Contexto de matrícula do usuário: turmas + escola atual + séries distintas. */
|
|
33
|
+
export type UserEnrollment = {
|
|
34
|
+
classrooms: ClassroomSummary[];
|
|
35
|
+
/** Escola atual resolvida pelo backend (1ª matrícula) — tem turma. */
|
|
36
|
+
currentInstitutionId: string | null;
|
|
37
|
+
series: AccessibleSerie[];
|
|
38
|
+
};
|
|
15
39
|
export declare function createUserService(apiClient: AcademeApiClient): {
|
|
16
40
|
/**
|
|
17
41
|
* Get current authenticated user
|
|
@@ -63,6 +87,13 @@ export declare function createUserService(apiClient: AcademeApiClient): {
|
|
|
63
87
|
500: components["responses"]["ServerError"];
|
|
64
88
|
};
|
|
65
89
|
}> | undefined, `${string}/${string}`>>;
|
|
90
|
+
/**
|
|
91
|
+
* Contexto de matrícula do usuário: turmas (para o perfil) + séries
|
|
92
|
+
* distintas (para o seletor de séries da jornada) + escola atual. Fonte
|
|
93
|
+
* única, deduplicada e ordenada no backend. Normaliza os campos opcionais do
|
|
94
|
+
* OpenAPI. Espelha o app-academe (user.service.getMyEnrollment).
|
|
95
|
+
*/
|
|
96
|
+
getMyEnrollment(): Promise<UserEnrollment>;
|
|
66
97
|
/**
|
|
67
98
|
* List all users with optional filters
|
|
68
99
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "academe-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Official React SDK for Academe ecosystem - Authentication, protected routes, API services, and UI components for educational management applications",
|
|
6
6
|
"main": "dist/index.cjs",
|