analytica-frontend-lib 1.2.60 → 1.2.61
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 +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +173 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +166 -26
- package/dist/index.mjs.map +1 -1
- package/dist/utils/filterHelpers.d.ts +105 -0
- package/dist/utils/filterHelpers.d.ts.map +1 -0
- package/dist/utils/subjectMappers.d.ts +29 -0
- package/dist/utils/subjectMappers.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { ActivityFilterOption } from '../types/activitiesHistory';
|
|
2
|
+
/**
|
|
3
|
+
* Generic user institution data structure
|
|
4
|
+
* Matches the structure from GET /user/me endpoint
|
|
5
|
+
*/
|
|
6
|
+
export interface UserInstitutionData {
|
|
7
|
+
school?: {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
schoolYear?: {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
};
|
|
15
|
+
class?: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Generic subject teacher topic class structure
|
|
22
|
+
*/
|
|
23
|
+
export interface SubTeacherTopicClassData {
|
|
24
|
+
subject?: {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
};
|
|
28
|
+
class?: {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generic user data structure for filter extraction
|
|
35
|
+
* Can be extended by consuming projects
|
|
36
|
+
*/
|
|
37
|
+
export interface UserFilterSourceData {
|
|
38
|
+
userInstitutions?: UserInstitutionData[];
|
|
39
|
+
subTeacherTopicClasses?: SubTeacherTopicClassData[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Extract unique school options from user data
|
|
43
|
+
* Uses Map for deduplication to handle multiple institutions with same school
|
|
44
|
+
*
|
|
45
|
+
* @param userData - User data from /user/me endpoint
|
|
46
|
+
* @returns Array of unique schools sorted by name
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const userData = useUserStore(state => state.data);
|
|
51
|
+
* const schools = getSchoolOptionsFromUserData(userData);
|
|
52
|
+
* // Returns: [{ id: '1', name: 'Escola A' }, { id: '2', name: 'Escola B' }]
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare const getSchoolOptionsFromUserData: (userData: UserFilterSourceData | null | undefined) => ActivityFilterOption[];
|
|
56
|
+
/**
|
|
57
|
+
* Extract unique subject options from user data
|
|
58
|
+
* Uses Map for deduplication
|
|
59
|
+
*
|
|
60
|
+
* @param userData - User data from /user/me endpoint
|
|
61
|
+
* @returns Array of unique subjects sorted by name
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const userData = useUserStore(state => state.data);
|
|
66
|
+
* const subjects = getSubjectOptionsFromUserData(userData);
|
|
67
|
+
* // Returns: [{ id: '1', name: 'Matemática' }, { id: '2', name: 'Português' }]
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare const getSubjectOptionsFromUserData: (userData: UserFilterSourceData | null | undefined) => ActivityFilterOption[];
|
|
71
|
+
/**
|
|
72
|
+
* Extract unique school year (série) options from user data
|
|
73
|
+
*
|
|
74
|
+
* @param userData - User data from /user/me endpoint
|
|
75
|
+
* @returns Array of unique school years sorted by name
|
|
76
|
+
*/
|
|
77
|
+
export declare const getSchoolYearOptionsFromUserData: (userData: UserFilterSourceData | null | undefined) => ActivityFilterOption[];
|
|
78
|
+
/**
|
|
79
|
+
* Extract unique class (turma) options from user data
|
|
80
|
+
* Combines classes from userInstitutions and subTeacherTopicClasses
|
|
81
|
+
*
|
|
82
|
+
* @param userData - User data from /user/me endpoint
|
|
83
|
+
* @returns Array of unique classes sorted by name
|
|
84
|
+
*/
|
|
85
|
+
export declare const getClassOptionsFromUserData: (userData: UserFilterSourceData | null | undefined) => ActivityFilterOption[];
|
|
86
|
+
/**
|
|
87
|
+
* Build user filter data object from user data
|
|
88
|
+
* Convenience function to create ActivityUserFilterData
|
|
89
|
+
*
|
|
90
|
+
* @param userData - User data from /user/me endpoint
|
|
91
|
+
* @returns Object with schools and subjects arrays
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const userData = useUserStore(state => state.data);
|
|
96
|
+
* const userFilterData = buildUserFilterData(userData);
|
|
97
|
+
* // Use with ActivitiesHistory component:
|
|
98
|
+
* <ActivitiesHistory userFilterData={userFilterData} ... />
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare const buildUserFilterData: (userData: UserFilterSourceData | null | undefined) => {
|
|
102
|
+
schools: ActivityFilterOption[];
|
|
103
|
+
subjects: ActivityFilterOption[];
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=filterHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterHelpers.d.ts","sourceRoot":"","sources":["../../src/utils/filterHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,UAAU,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,KAAK,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,KAAK,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACzC,sBAAsB,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACrD;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,GACvC,UAAU,oBAAoB,GAAG,IAAI,GAAG,SAAS,KAChD,oBAAoB,EAmBtB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,oBAAoB,GAAG,IAAI,GAAG,SAAS,KAChD,oBAAoB,EAmBtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,GAC3C,UAAU,oBAAoB,GAAG,IAAI,GAAG,SAAS,KAChD,oBAAoB,EAmBtB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GACtC,UAAU,oBAAoB,GAAG,IAAI,GAAG,SAAS,KAChD,oBAAoB,EAgCtB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,oBAAoB,GAAG,IAAI,GAAG,SAAS,KAChD;IAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAA;CAGpE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SubjectEnum } from '../enums/SubjectEnum';
|
|
2
|
+
/**
|
|
3
|
+
* Maps backend subject names to SubjectEnum values
|
|
4
|
+
* @param subjectName - The subject name from the backend
|
|
5
|
+
* @returns The corresponding SubjectEnum value or null if no mapping exists
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const subjectEnum = mapSubjectNameToEnum('Matemática');
|
|
10
|
+
* // Returns: SubjectEnum.MATEMATICA
|
|
11
|
+
*
|
|
12
|
+
* const unknown = mapSubjectNameToEnum('Unknown Subject');
|
|
13
|
+
* // Returns: null
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const mapSubjectNameToEnum: (subjectName: string) => SubjectEnum | null;
|
|
17
|
+
/**
|
|
18
|
+
* Maps SubjectEnum values back to display names
|
|
19
|
+
* @param subjectEnum - The SubjectEnum value
|
|
20
|
+
* @returns The display name for the subject
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const name = mapSubjectEnumToName(SubjectEnum.MATEMATICA);
|
|
25
|
+
* // Returns: 'Matemática'
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const mapSubjectEnumToName: (subjectEnum: SubjectEnum) => string;
|
|
29
|
+
//# sourceMappingURL=subjectMappers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subjectMappers.d.ts","sourceRoot":"","sources":["../../src/utils/subjectMappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA2BnD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,GAC/B,aAAa,MAAM,KAClB,WAAW,GAAG,IAGhB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,aAAa,WAAW,KAAG,MAqB/D,CAAC"}
|
package/package.json
CHANGED