@mui-toolpad-extended-tuni/users 3.0.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.
@@ -0,0 +1,59 @@
1
+ import { navigationTypes } from '../store/useUserStore';
2
+ export declare const departmentVariants: string[];
3
+ export declare const preferencesVariants: navigationTypes[];
4
+ export declare const randomPerson: {
5
+ gender: string;
6
+ name: {
7
+ title: string;
8
+ first: string;
9
+ last: string;
10
+ };
11
+ location: {
12
+ street: {
13
+ number: number;
14
+ name: string;
15
+ };
16
+ city: string;
17
+ state: string;
18
+ country: string;
19
+ postcode: number;
20
+ coordinates: {
21
+ latitude: string;
22
+ longitude: string;
23
+ };
24
+ timezone: {
25
+ offset: string;
26
+ description: string;
27
+ };
28
+ };
29
+ email: string;
30
+ login: {
31
+ uuid: string;
32
+ username: string;
33
+ password: string;
34
+ salt: string;
35
+ md5: string;
36
+ sha1: string;
37
+ sha256: string;
38
+ };
39
+ dob: {
40
+ date: string;
41
+ age: number;
42
+ };
43
+ registered: {
44
+ date: string;
45
+ age: number;
46
+ };
47
+ phone: string;
48
+ cell: string;
49
+ id: {
50
+ name: string;
51
+ value: string;
52
+ };
53
+ picture: {
54
+ large: string;
55
+ medium: string;
56
+ thumbnail: string;
57
+ };
58
+ nat: string;
59
+ };
@@ -0,0 +1,3 @@
1
+ import { HttpResponse } from 'msw';
2
+ export declare const userHandlers: import('msw').HttpHandler[];
3
+ export declare const getUserDataResponse: (userId?: string) => HttpResponse;
@@ -0,0 +1,6 @@
1
+ import { UserBackendData } from './types';
2
+ export declare function generateUsers(config: {
3
+ teacherCount: number;
4
+ studentCount: number;
5
+ adminCount: number;
6
+ }): Promise<UserBackendData[]>;
@@ -0,0 +1,52 @@
1
+ import { PlatformRole } from 'mui-toolpad-extended-tuni';
2
+ import { navigationTypes } from '../store/useUserStore';
3
+ import { randomPerson } from './constants';
4
+ export interface UserRawBackendData {
5
+ name: string;
6
+ email: string;
7
+ image?: {
8
+ large: string;
9
+ medium: string;
10
+ thumbnail: string;
11
+ };
12
+ department?: string;
13
+ platform_roles: PlatformRole[];
14
+ privacy_settings: {
15
+ allow_analytics: boolean;
16
+ allow_personalization: boolean;
17
+ allow_communications: boolean;
18
+ allow_third_party_sharing: boolean;
19
+ };
20
+ gdpr_consent: {
21
+ accepted: boolean;
22
+ accepted_date?: string;
23
+ last_updated: string;
24
+ };
25
+ data_retention: {
26
+ delete_account_after_inactivity?: number;
27
+ delete_data_after_account_deletion?: number;
28
+ };
29
+ preferences: {
30
+ navigation_type: navigationTypes;
31
+ visible_course_lists: {
32
+ is_student: boolean;
33
+ is_student_old: boolean;
34
+ is_teacher: boolean;
35
+ is_teacher_old: boolean;
36
+ available: boolean;
37
+ };
38
+ visible_navigation: string[];
39
+ last_visited_courses: string[];
40
+ };
41
+ }
42
+ export interface UserBackendData extends UserRawBackendData {
43
+ id: string;
44
+ created_at: string;
45
+ updated_at: string;
46
+ }
47
+ export type UserCourseConnection = {
48
+ userId: string;
49
+ courseId: string;
50
+ role: "teacher" | "student";
51
+ };
52
+ export type randomPersonFromApi = typeof randomPerson;
@@ -0,0 +1,7 @@
1
+ import { UserData } from 'mui-toolpad-extended-tuni';
2
+ export declare const getCurrentUser: () => Promise<UserData>;
3
+ export declare const getUsers: (courseId?: string) => Promise<UserData[]>;
4
+ export declare const createUser: (userData: Partial<UserData>) => Promise<UserData>;
5
+ export declare const updateUser: (userData: UserData) => Promise<UserData>;
6
+ export declare const deleteUser: (userId: string) => Promise<void>;
7
+ export declare const logoutUser: () => Promise<void>;
@@ -0,0 +1,20 @@
1
+ import { fetchState, UserData } from 'mui-toolpad-extended-tuni';
2
+ export type { UserData, PlatformRole, userId, navigationTypes, gender } from 'mui-toolpad-extended-tuni';
3
+ export interface UserState {
4
+ fetchState: fetchState;
5
+ user: UserData | null;
6
+ userToUpdate: UserData | null;
7
+ testUsers: UserData[];
8
+ users: UserData[];
9
+ courseUsers?: UserData[];
10
+ setUserToUpdate: (user: UserData | null) => void;
11
+ setUser: (user: UserData) => void;
12
+ setTestUsers: (users: UserData[]) => void;
13
+ getUser: () => void;
14
+ clearUser: () => void;
15
+ getUsers: () => void;
16
+ fetchCourseUsers: (courseId: string) => Promise<void>;
17
+ logout: () => Promise<void>;
18
+ updateUser: (userData: UserData) => Promise<UserData>;
19
+ }
20
+ export declare const useUserStore: import('zustand/traditional').UseBoundStoreWithEqualityFn<import('zustand').StoreApi<UserState>>;
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@mui-toolpad-extended-tuni/users",
3
+ "version": "3.0.0",
4
+ "description": "Users microservice for MUI Toolpad Extended TUNI",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.es.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "README.md"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.es.js",
17
+ "require": "./dist/index.cjs",
18
+ "default": "./dist/index.es.js"
19
+ }
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "keywords": [
25
+ "react",
26
+ "mui",
27
+ "toolpad",
28
+ "education",
29
+ "tuni",
30
+ "users"
31
+ ],
32
+ "license": "MIT",
33
+ "sideEffects": false,
34
+ "scripts": {
35
+ "build": "tsc --skipLibCheck && vite build",
36
+ "dev": "vite build --watch"
37
+ },
38
+ "peerDependencies": {
39
+ "mui-toolpad-extended-tuni": "^3.0.0",
40
+ "@emotion/react": "^11.0.0",
41
+ "@emotion/styled": "^11.0.0",
42
+ "@mui/icons-material": "^7.0.0",
43
+ "@mui/material": "^7.0.0",
44
+ "react": "^19.0.0",
45
+ "react-dom": "^19.0.0",
46
+ "react-router-dom": "^7.0.0",
47
+ "axios": "^1.7.0",
48
+ "zustand": "^4.5.0"
49
+ }
50
+ }
51
+