analytica-frontend-lib 1.2.55 → 1.2.56

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.
Files changed (39) hide show
  1. package/dist/ActivitiesHistory/index.css +12 -0
  2. package/dist/ActivitiesHistory/index.css.map +1 -1
  3. package/dist/ActivityCardQuestionBanks/index.css +12 -0
  4. package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
  5. package/dist/ActivityCardQuestionPreview/index.css +12 -0
  6. package/dist/ActivityCardQuestionPreview/index.css.map +1 -1
  7. package/dist/ActivityDetails/index.css +12 -0
  8. package/dist/ActivityDetails/index.css.map +1 -1
  9. package/dist/ActivityFilters/index.css +12 -0
  10. package/dist/ActivityFilters/index.css.map +1 -1
  11. package/dist/ActivityPreview/index.css +12 -0
  12. package/dist/ActivityPreview/index.css.map +1 -1
  13. package/dist/AlertManager/index.css +12 -0
  14. package/dist/AlertManager/index.css.map +1 -1
  15. package/dist/RecommendedLessonsHistory/index.css +12 -0
  16. package/dist/RecommendedLessonsHistory/index.css.map +1 -1
  17. package/dist/SendActivityModal/SendActivityModal.css +12 -0
  18. package/dist/SendActivityModal/SendActivityModal.css.map +1 -1
  19. package/dist/SendActivityModal/index.css +12 -0
  20. package/dist/SendActivityModal/index.css.map +1 -1
  21. package/dist/TableProvider/index.css +12 -0
  22. package/dist/TableProvider/index.css.map +1 -1
  23. package/dist/hooks/useAppContent.d.ts +0 -1
  24. package/dist/hooks/useAppContent.d.ts.map +1 -1
  25. package/dist/hooks/useChat.d.ts.map +1 -1
  26. package/dist/hooks/useChatRooms.d.ts.map +1 -1
  27. package/dist/index.css +12 -0
  28. package/dist/index.css.map +1 -1
  29. package/dist/index.d.ts +3 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +137 -28
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +134 -29
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/styles.css +12 -0
  36. package/dist/styles.css.map +1 -1
  37. package/dist/utils/chatUtils.d.ts +74 -0
  38. package/dist/utils/chatUtils.d.ts.map +1 -0
  39. package/package.json +1 -1
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Chat utility functions
3
+ */
4
+ /**
5
+ * User info for chat from auth store
6
+ */
7
+ export interface ChatUserInfo {
8
+ userId: string;
9
+ userName: string;
10
+ userPhoto: string | null;
11
+ token: string;
12
+ }
13
+ /**
14
+ * Check if chat user info is valid (has userId and token)
15
+ *
16
+ * @param userInfo - Chat user info object
17
+ * @returns boolean indicating if user info is valid for chat
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const userInfo = getChatUserInfo(user, tokens, sessionInfo);
22
+ * if (!isChatUserInfoValid(userInfo)) {
23
+ * return <ChatLoading />;
24
+ * }
25
+ * ```
26
+ */
27
+ export declare const isChatUserInfoValid: (userInfo: ChatUserInfo) => boolean;
28
+ /**
29
+ * Get WebSocket URL from API URL
30
+ * Converts https:// to wss:// and http:// to ws://
31
+ *
32
+ * @param apiUrl - The API URL (defaults to VITE_API_URL or http://localhost:3000)
33
+ * @returns WebSocket URL for chat
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const wsUrl = getChatWsUrl('https://api.example.com');
38
+ * // Returns: 'wss://api.example.com/chat/ws'
39
+ * ```
40
+ */
41
+ export declare const getChatWsUrl: (apiUrl: string) => string;
42
+ /**
43
+ * Extract user info for chat from auth store data
44
+ *
45
+ * @param user - User object from auth store
46
+ * @param tokens - Tokens object from auth store
47
+ * @param sessionInfo - Session info object from auth store
48
+ * @param defaultUserName - Default user name if not found (e.g., 'Professor' or 'Aluno')
49
+ * @returns Chat user info
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const { user, tokens, sessionInfo } = useAuthStore();
54
+ * const userInfo = getChatUserInfo(user, tokens, sessionInfo, 'Aluno');
55
+ *
56
+ * if (!isChatUserInfoValid(userInfo)) {
57
+ * return <ChatLoading />;
58
+ * }
59
+ *
60
+ * const { userId, userName, userPhoto, token } = userInfo;
61
+ * ```
62
+ */
63
+ export declare const getChatUserInfo: (user: {
64
+ userInstitutionId?: string | number;
65
+ name?: string;
66
+ urlProfilePicture?: string;
67
+ } | null | undefined, tokens: {
68
+ token?: string;
69
+ } | null | undefined, sessionInfo: {
70
+ userId?: string | number;
71
+ userName?: string;
72
+ urlProfilePicture?: string;
73
+ } | null | undefined, defaultUserName?: string) => ChatUserInfo;
74
+ //# sourceMappingURL=chatUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatUtils.d.ts","sourceRoot":"","sources":["../../src/utils/chatUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,YAAY,KAAG,OAE5D,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAG7C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,eAAe,GAC1B,MACI;IACE,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACD,IAAI,GACJ,SAAS,EACb,QAAQ;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,EAC7C,aACI;IACE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACD,IAAI,GACJ,SAAS,EACb,kBAAiB,MAAkB,KAClC,YAiBF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "analytica-frontend-lib",
3
- "version": "1.2.55",
3
+ "version": "1.2.56",
4
4
  "description": "Repositório público dos componentes utilizados nas plataformas da Analytica Ensino",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "./dist/index.js",