academe-kit 0.1.9 → 0.2.2
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.d.ts +9999 -62
- package/dist/index.esm.js +1082 -159
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1083 -158
- package/dist/index.js.map +1 -1
- package/dist/types/context/SecurityProvider/types.d.ts +7 -4
- package/dist/types/index.d.ts +7 -2
- package/dist/types/roles/backoffice.d.ts +2 -0
- package/dist/types/roles/dashboard.d.ts +2 -0
- package/dist/types/roles/global.d.ts +7 -0
- package/dist/types/services/ClassroomService.d.ts +270 -0
- package/dist/types/services/GuardianService.d.ts +309 -0
- package/dist/types/services/InstitutionService.d.ts +792 -0
- package/dist/types/services/OrganizationService.d.ts +216 -0
- package/dist/types/services/ReportService.d.ts +575 -0
- package/dist/types/services/SerieService.d.ts +214 -0
- package/dist/types/services/ShiftService.d.ts +214 -0
- package/dist/types/services/UserService.d.ts +438 -0
- package/dist/types/services/index.d.ts +30 -0
- package/dist/types/types/academe-api.d.ts +6941 -0
- package/dist/types/types/index.d.ts +9 -0
- package/package.json +5 -2
- package/dist/index.css +0 -5
- package/dist/types/hooks/useCurrentUser.d.ts +0 -82
- package/dist/types/services/userService.d.ts +0 -79
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { components } from './academe-api';
|
|
2
|
+
export type User = components['schemas']['User'];
|
|
3
|
+
export type Institution = components['schemas']['Institution'];
|
|
4
|
+
export type Classroom = components['schemas']['Classroom'];
|
|
5
|
+
export type InstitutionClassroom = components['schemas']['InstitutionClassroom'];
|
|
6
|
+
export type InstitutionUser = components['schemas']['InstitutionUser'];
|
|
7
|
+
export type Organization = components['schemas']['Organization'];
|
|
8
|
+
export type Serie = components['schemas']['Serie'];
|
|
9
|
+
export type Shift = components['schemas']['Shift'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "academe-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React component library with Tailwind CSS and Storybook",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"build": "rollup -c",
|
|
24
24
|
"build:watch": "rollup -c --watch",
|
|
25
25
|
"build-storybook": "storybook build",
|
|
26
|
-
"storybook": "storybook dev -p 6006"
|
|
26
|
+
"storybook": "storybook dev -p 6006",
|
|
27
|
+
"generate:api-types": "npx openapi-typescript http://localhost:3002/api/openapi.json -o ./src/types/academe-api.ts"
|
|
27
28
|
},
|
|
28
29
|
"keywords": [
|
|
29
30
|
"react",
|
|
@@ -79,6 +80,8 @@
|
|
|
79
80
|
"clsx": "^2.1.1",
|
|
80
81
|
"keycloak-js": "^26.2.0",
|
|
81
82
|
"lucide-react": "^0.545.0",
|
|
83
|
+
"openapi-fetch": "^0.15.0",
|
|
84
|
+
"openapi-typescript": "^7.10.1",
|
|
82
85
|
"tailwind-merge": "^3.3.1",
|
|
83
86
|
"tailwindcss-animate": "^1.0.7"
|
|
84
87
|
}
|
package/dist/index.css
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
! tailwindcss v3.4.18 | MIT License | https://tailwindcss.com
|
|
3
|
-
*/:root{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--secondary:210 40% 96.1%;--secondary-foreground:222.2 47.4% 11.2%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--radius:0.5rem}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*
|
|
4
|
-
! tailwindcss v3.4.18 | MIT License | https://tailwindcss.com
|
|
5
|
-
*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.flex{display:flex}.size-10{height:2.5rem;width:2.5rem}.size-4{height:1rem;width:1rem}.h-screen{height:100vh}.w-screen{width:100vw}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-lg{border-radius:var(--radius)}.border-2{border-width:2px}.border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.bg-transparent{background-color:transparent}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-1\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-semibold{font-weight:600}.text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.text-violet-500{--tw-text-opacity:1;color:rgb(139 92 246/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.outline{outline-style:solid}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.duration-200{animation-duration:.2s}.hover\:bg-blue-50:hover{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.hover\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.focus\:ring-gray-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(107 114 128/var(--tw-ring-opacity,1))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom hook for accessing current user data
|
|
3
|
-
* Provides easy access to MongoDB-enriched user information
|
|
4
|
-
*/
|
|
5
|
-
import { AcademeUser } from '../context/SecurityProvider/types';
|
|
6
|
-
export interface UseCurrentUserReturn {
|
|
7
|
-
user: AcademeUser | null;
|
|
8
|
-
isLoading: boolean;
|
|
9
|
-
error: Error | null;
|
|
10
|
-
userId: string | undefined;
|
|
11
|
-
email: string | undefined;
|
|
12
|
-
fullName: string | undefined;
|
|
13
|
-
schoolId: string | undefined;
|
|
14
|
-
roles: string[];
|
|
15
|
-
isStudent: boolean;
|
|
16
|
-
registrationNumber: string | undefined;
|
|
17
|
-
className: string | undefined;
|
|
18
|
-
completionRate: number;
|
|
19
|
-
engagementRate: number;
|
|
20
|
-
isAdmin: boolean;
|
|
21
|
-
isSchoolAdmin: boolean;
|
|
22
|
-
isTeacher: boolean;
|
|
23
|
-
hasCompletedOnboarding: boolean;
|
|
24
|
-
hasAccessEnabled: boolean;
|
|
25
|
-
refreshUser: () => Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
export declare const useCurrentUser: () => UseCurrentUserReturn;
|
|
28
|
-
/**
|
|
29
|
-
* Hook to check if user has a specific role
|
|
30
|
-
*/
|
|
31
|
-
export declare const useHasRole: (role: string) => boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Hook to check if user has any of the specified roles
|
|
34
|
-
*/
|
|
35
|
-
export declare const useHasAnyRole: (requiredRoles: string[]) => boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Hook to check if user has all of the specified roles
|
|
38
|
-
*/
|
|
39
|
-
export declare const useHasAllRoles: (requiredRoles: string[]) => boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Hook to check if user belongs to a specific school
|
|
42
|
-
*/
|
|
43
|
-
export declare const useHasSchoolAccess: (schoolId: string) => boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Hook for student-specific data and checks
|
|
46
|
-
*/
|
|
47
|
-
export declare const useStudentData: () => {
|
|
48
|
-
isStudent: boolean;
|
|
49
|
-
hasStudentData: boolean;
|
|
50
|
-
studentInfo: null;
|
|
51
|
-
academicInfo: null;
|
|
52
|
-
responsibleInfo: null;
|
|
53
|
-
metrics: null;
|
|
54
|
-
} | {
|
|
55
|
-
isStudent: boolean;
|
|
56
|
-
hasStudentData: boolean;
|
|
57
|
-
studentInfo: {
|
|
58
|
-
registrationNumber: string | undefined;
|
|
59
|
-
cpf: string | undefined;
|
|
60
|
-
birthDate: string | undefined;
|
|
61
|
-
gender: string | undefined;
|
|
62
|
-
phone: string | undefined;
|
|
63
|
-
};
|
|
64
|
-
academicInfo: {
|
|
65
|
-
schoolYear: string | undefined;
|
|
66
|
-
grade: string | undefined;
|
|
67
|
-
className: string | undefined;
|
|
68
|
-
shift: string | undefined;
|
|
69
|
-
classId: string | undefined;
|
|
70
|
-
};
|
|
71
|
-
responsibleInfo: {
|
|
72
|
-
name: string | undefined;
|
|
73
|
-
email: string | undefined;
|
|
74
|
-
phone: string | undefined;
|
|
75
|
-
};
|
|
76
|
-
metrics: {
|
|
77
|
-
completionRate: number;
|
|
78
|
-
engagementRate: number;
|
|
79
|
-
hasCompletedOnboarding: boolean;
|
|
80
|
-
hasAccessEnabled: boolean;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User Service - Fetches complete user data from MongoDB
|
|
3
|
-
* This service interacts with the new unified users collection
|
|
4
|
-
*/
|
|
5
|
-
export interface MongoDBUser {
|
|
6
|
-
id: string;
|
|
7
|
-
keycloak_user_id: string;
|
|
8
|
-
email: string;
|
|
9
|
-
full_name: string;
|
|
10
|
-
phone?: string;
|
|
11
|
-
school_id?: string;
|
|
12
|
-
active: boolean;
|
|
13
|
-
created_at: string;
|
|
14
|
-
updated_at: string;
|
|
15
|
-
last_login?: string;
|
|
16
|
-
registration_number?: string;
|
|
17
|
-
school_year?: string;
|
|
18
|
-
serie_ano?: string;
|
|
19
|
-
turma?: string;
|
|
20
|
-
turno?: string;
|
|
21
|
-
class_id?: string;
|
|
22
|
-
nome_responsavel?: string;
|
|
23
|
-
email_responsavel?: string;
|
|
24
|
-
telefone_responsavel?: string;
|
|
25
|
-
data_nascimento?: string;
|
|
26
|
-
cpf?: string;
|
|
27
|
-
sexo?: string;
|
|
28
|
-
completion_rate: number;
|
|
29
|
-
engagement_rate: number;
|
|
30
|
-
onboarding_completo: boolean;
|
|
31
|
-
acesso_liberado: boolean;
|
|
32
|
-
roles?: string[];
|
|
33
|
-
}
|
|
34
|
-
export interface UserServiceConfig {
|
|
35
|
-
apiBaseUrl: string;
|
|
36
|
-
getAccessToken: () => string | null;
|
|
37
|
-
}
|
|
38
|
-
declare class UserService {
|
|
39
|
-
private client;
|
|
40
|
-
private getAccessToken;
|
|
41
|
-
private cachedUser;
|
|
42
|
-
private cacheExpiry;
|
|
43
|
-
constructor(config: UserServiceConfig);
|
|
44
|
-
/**
|
|
45
|
-
* Get current user data from MongoDB
|
|
46
|
-
* Includes caching to reduce API calls
|
|
47
|
-
*/
|
|
48
|
-
getCurrentUser(forceRefresh?: boolean): Promise<MongoDBUser | null>;
|
|
49
|
-
/**
|
|
50
|
-
* Update current user data
|
|
51
|
-
*/
|
|
52
|
-
updateCurrentUser(data: Partial<MongoDBUser>): Promise<MongoDBUser | null>;
|
|
53
|
-
/**
|
|
54
|
-
* Clear cached user data
|
|
55
|
-
*/
|
|
56
|
-
clearCache(): void;
|
|
57
|
-
/**
|
|
58
|
-
* Check if user has a specific role
|
|
59
|
-
*/
|
|
60
|
-
hasRole(user: MongoDBUser | null, role: string): boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Check if user has access to a specific school
|
|
63
|
-
*/
|
|
64
|
-
hasSchoolAccess(user: MongoDBUser | null, schoolId: string): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Check if user is a student (has student-specific data)
|
|
67
|
-
*/
|
|
68
|
-
isStudent(user: MongoDBUser | null): boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Check if user has completed onboarding
|
|
71
|
-
*/
|
|
72
|
-
hasCompletedOnboarding(user: MongoDBUser | null): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Check if user has access enabled
|
|
75
|
-
*/
|
|
76
|
-
hasAccessEnabled(user: MongoDBUser | null): boolean;
|
|
77
|
-
}
|
|
78
|
-
export declare const createUserService: (config: UserServiceConfig) => UserService;
|
|
79
|
-
export default UserService;
|