analytica-frontend-lib 1.2.52 → 1.2.53
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/ActivitiesHistory/index.css +33 -0
- package/dist/ActivitiesHistory/index.css.map +1 -1
- package/dist/ActivityCardQuestionBanks/index.css +33 -0
- package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
- package/dist/ActivityCardQuestionPreview/index.css +33 -0
- package/dist/ActivityCardQuestionPreview/index.css.map +1 -1
- package/dist/ActivityDetails/index.css +33 -0
- package/dist/ActivityDetails/index.css.map +1 -1
- package/dist/ActivityFilters/index.css +33 -0
- package/dist/ActivityFilters/index.css.map +1 -1
- package/dist/ActivityPreview/index.css +33 -0
- package/dist/ActivityPreview/index.css.map +1 -1
- package/dist/AlertManager/index.css +33 -0
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/RecommendedLessonsHistory/index.css +33 -0
- package/dist/RecommendedLessonsHistory/index.css.map +1 -1
- package/dist/SendActivityModal/SendActivityModal.css +33 -0
- package/dist/SendActivityModal/SendActivityModal.css.map +1 -1
- package/dist/SendActivityModal/index.css +33 -0
- package/dist/SendActivityModal/index.css.map +1 -1
- package/dist/TableProvider/index.css +33 -0
- package/dist/TableProvider/index.css.map +1 -1
- package/dist/hooks/useChat.d.ts +112 -0
- package/dist/hooks/useChat.d.ts.map +1 -0
- package/dist/hooks/useChatRooms.d.ts +76 -0
- package/dist/hooks/useChatRooms.d.ts.map +1 -0
- package/dist/index.css +33 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +709 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +706 -0
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +33 -0
- package/dist/styles.css.map +1 -1
- package/dist/types/chat.d.ts +164 -0
- package/dist/types/chat.d.ts.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { ChatMessage, ChatParticipant } from '../types/chat';
|
|
2
|
+
/**
|
|
3
|
+
* WebSocket connection states
|
|
4
|
+
*/
|
|
5
|
+
export declare const WS_STATES: {
|
|
6
|
+
readonly CONNECTING: 0;
|
|
7
|
+
readonly OPEN: 1;
|
|
8
|
+
readonly CLOSING: 2;
|
|
9
|
+
readonly CLOSED: 3;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Options for the useChat hook
|
|
13
|
+
*/
|
|
14
|
+
export interface UseChatOptions {
|
|
15
|
+
/** WebSocket URL (e.g., wss://api.example.com/chat/ws) */
|
|
16
|
+
wsUrl: string;
|
|
17
|
+
/** JWT authentication token */
|
|
18
|
+
token: string;
|
|
19
|
+
/** Chat room ID */
|
|
20
|
+
roomId: string;
|
|
21
|
+
/** Current user's userInstitutionId */
|
|
22
|
+
userId: string;
|
|
23
|
+
/** Callback when connection is established */
|
|
24
|
+
onConnect?: () => void;
|
|
25
|
+
/** Callback when connection is closed */
|
|
26
|
+
onDisconnect?: () => void;
|
|
27
|
+
/** Callback when an error occurs */
|
|
28
|
+
onError?: (error: Error) => void;
|
|
29
|
+
/** Auto-reconnect on disconnect (default: true) */
|
|
30
|
+
autoReconnect?: boolean;
|
|
31
|
+
/** Reconnect interval in ms (default: 3000) */
|
|
32
|
+
reconnectInterval?: number;
|
|
33
|
+
/** Max reconnect attempts (default: 5) */
|
|
34
|
+
maxReconnectAttempts?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Return type for the useChat hook
|
|
38
|
+
*/
|
|
39
|
+
export interface UseChatReturn {
|
|
40
|
+
/** Whether WebSocket is connected */
|
|
41
|
+
isConnected: boolean;
|
|
42
|
+
/** List of chat messages */
|
|
43
|
+
messages: ChatMessage[];
|
|
44
|
+
/** List of room participants */
|
|
45
|
+
participants: ChatParticipant[];
|
|
46
|
+
/** Send a text message */
|
|
47
|
+
sendMessage: (content: string) => void;
|
|
48
|
+
/** Leave the chat room */
|
|
49
|
+
leave: () => void;
|
|
50
|
+
/** Current error state */
|
|
51
|
+
error: Error | null;
|
|
52
|
+
/** Reconnect to the WebSocket */
|
|
53
|
+
reconnect: () => void;
|
|
54
|
+
/** Current user ID for identifying own messages */
|
|
55
|
+
currentUserId: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Hook for managing WebSocket connection to a chat room
|
|
59
|
+
*
|
|
60
|
+
* Handles:
|
|
61
|
+
* - WebSocket connection lifecycle
|
|
62
|
+
* - Message sending/receiving
|
|
63
|
+
* - Participant tracking
|
|
64
|
+
* - Auto-reconnection
|
|
65
|
+
*
|
|
66
|
+
* @param options - Hook configuration options
|
|
67
|
+
* @returns Chat state and actions
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```tsx
|
|
71
|
+
* const {
|
|
72
|
+
* isConnected,
|
|
73
|
+
* messages,
|
|
74
|
+
* participants,
|
|
75
|
+
* sendMessage,
|
|
76
|
+
* error
|
|
77
|
+
* } = useChat({
|
|
78
|
+
* wsUrl: 'wss://api.example.com/chat/ws',
|
|
79
|
+
* token: authToken,
|
|
80
|
+
* roomId: 'room-123',
|
|
81
|
+
* userId: 'user-456',
|
|
82
|
+
* onConnect: () => console.log('Connected!'),
|
|
83
|
+
* onError: (err) => console.error('Error:', err),
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* const handleSend = () => {
|
|
87
|
+
* sendMessage('Hello, world!');
|
|
88
|
+
* };
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare function useChat({ wsUrl, token, roomId, userId, onConnect, onDisconnect, onError, autoReconnect, reconnectInterval, maxReconnectAttempts, }: UseChatOptions): UseChatReturn;
|
|
92
|
+
/**
|
|
93
|
+
* Factory function to create a pre-configured useChat hook
|
|
94
|
+
*
|
|
95
|
+
* @param baseWsUrl - Base WebSocket URL
|
|
96
|
+
* @returns Factory function that creates the hook with room-specific options
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```tsx
|
|
100
|
+
* // In your app setup
|
|
101
|
+
* const createChatHook = createUseChat('wss://api.example.com/chat/ws');
|
|
102
|
+
*
|
|
103
|
+
* // In component
|
|
104
|
+
* const { messages, sendMessage } = createChatHook({
|
|
105
|
+
* token: authToken,
|
|
106
|
+
* roomId: 'room-123',
|
|
107
|
+
* userId: 'user-456',
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function createUseChat(baseWsUrl: string): (options: Omit<UseChatOptions, "wsUrl">) => UseChatReturn;
|
|
112
|
+
//# sourceMappingURL=useChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChat.d.ts","sourceRoot":"","sources":["../../src/hooks/useChat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EAGhB,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;CAKZ,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,oCAAoC;IACpC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,mDAAmD;IACnD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0CAA0C;IAC1C,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,WAAW,EAAE,OAAO,CAAC;IACrB,4BAA4B;IAC5B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,gCAAgC;IAChC,YAAY,EAAE,eAAe,EAAE,CAAC;IAChC,0BAA0B;IAC1B,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,0BAA0B;IAC1B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,iCAAiC;IACjC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,SAAS,EACT,YAAY,EACZ,OAAO,EACP,aAAoB,EACpB,iBAAwB,EACxB,oBAAwB,GACzB,EAAE,cAAc,GAAG,aAAa,CAuOhC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,IACrC,SAAS,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,mBAE/C"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ChatApiClient, ChatRoom, ChatRoomWithDetails, ChatUser } from '../types/chat';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the useChatRooms hook
|
|
4
|
+
*/
|
|
5
|
+
export interface UseChatRoomsOptions {
|
|
6
|
+
apiClient: ChatApiClient;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Return type for the useChatRooms hook
|
|
10
|
+
*/
|
|
11
|
+
export interface UseChatRoomsReturn {
|
|
12
|
+
/** List of user's chat rooms */
|
|
13
|
+
rooms: ChatRoomWithDetails[];
|
|
14
|
+
/** Available users for creating new chat rooms */
|
|
15
|
+
availableUsers: ChatUser[];
|
|
16
|
+
/** Loading state */
|
|
17
|
+
loading: boolean;
|
|
18
|
+
/** Error state */
|
|
19
|
+
error: Error | null;
|
|
20
|
+
/** Fetch user's chat rooms */
|
|
21
|
+
fetchRooms: () => Promise<void>;
|
|
22
|
+
/** Fetch available users for chat */
|
|
23
|
+
fetchAvailableUsers: () => Promise<void>;
|
|
24
|
+
/** Create a new chat room */
|
|
25
|
+
createRoom: (participantIds: string[]) => Promise<ChatRoom | null>;
|
|
26
|
+
/** Clear error state */
|
|
27
|
+
clearError: () => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Hook for managing chat rooms via REST API
|
|
31
|
+
*
|
|
32
|
+
* Provides functionality to:
|
|
33
|
+
* - List user's chat rooms
|
|
34
|
+
* - Fetch available users for new chats
|
|
35
|
+
* - Create new chat rooms
|
|
36
|
+
*
|
|
37
|
+
* @param options - Hook configuration options
|
|
38
|
+
* @returns Chat rooms state and actions
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* const { rooms, fetchRooms, createRoom } = useChatRooms({ apiClient: api });
|
|
43
|
+
*
|
|
44
|
+
* useEffect(() => {
|
|
45
|
+
* fetchRooms();
|
|
46
|
+
* }, []);
|
|
47
|
+
*
|
|
48
|
+
* const handleCreateRoom = async (userIds: string[]) => {
|
|
49
|
+
* const room = await createRoom(userIds);
|
|
50
|
+
* if (room) {
|
|
51
|
+
* // Navigate to the new room
|
|
52
|
+
* }
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function useChatRooms({ apiClient, }: UseChatRoomsOptions): UseChatRoomsReturn;
|
|
57
|
+
/**
|
|
58
|
+
* Factory function to create a pre-configured useChatRooms hook
|
|
59
|
+
*
|
|
60
|
+
* @param apiClient - API client instance
|
|
61
|
+
* @returns Pre-configured hook function
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* // In your app setup
|
|
66
|
+
* import { createUseChatRooms } from 'analytica-frontend-lib';
|
|
67
|
+
* import api from './services/api';
|
|
68
|
+
*
|
|
69
|
+
* export const useChatRooms = createUseChatRooms(api);
|
|
70
|
+
*
|
|
71
|
+
* // Then use directly in components
|
|
72
|
+
* const { rooms, fetchRooms } = useChatRooms();
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function createUseChatRooms(apiClient: ChatApiClient): () => UseChatRoomsReturn;
|
|
76
|
+
//# sourceMappingURL=useChatRooms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChatRooms.d.ts","sourceRoot":"","sources":["../../src/hooks/useChatRooms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,mBAAmB,EACnB,QAAQ,EAIT,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,kDAAkD;IAClD,cAAc,EAAE,QAAQ,EAAE,CAAC;IAC3B,oBAAoB;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,8BAA8B;IAC9B,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,qCAAqC;IACrC,mBAAmB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,6BAA6B;IAC7B,UAAU,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACnE,wBAAwB;IACxB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,GACV,EAAE,mBAAmB,GAAG,kBAAkB,CAkG1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,aAAa,4BAE1D"}
|
package/dist/index.css
CHANGED
|
@@ -1012,6 +1012,9 @@
|
|
|
1012
1012
|
.max-h-32 {
|
|
1013
1013
|
max-height: calc(var(--spacing) * 32);
|
|
1014
1014
|
}
|
|
1015
|
+
.max-h-64 {
|
|
1016
|
+
max-height: calc(var(--spacing) * 64);
|
|
1017
|
+
}
|
|
1015
1018
|
.max-h-\[70vh\] {
|
|
1016
1019
|
max-height: 70vh;
|
|
1017
1020
|
}
|
|
@@ -1114,6 +1117,9 @@
|
|
|
1114
1117
|
.w-1 {
|
|
1115
1118
|
width: calc(var(--spacing) * 1);
|
|
1116
1119
|
}
|
|
1120
|
+
.w-1\/2 {
|
|
1121
|
+
width: calc(1/2 * 100%);
|
|
1122
|
+
}
|
|
1117
1123
|
.w-2 {
|
|
1118
1124
|
width: calc(var(--spacing) * 2);
|
|
1119
1125
|
}
|
|
@@ -1126,6 +1132,9 @@
|
|
|
1126
1132
|
.w-3\.5 {
|
|
1127
1133
|
width: calc(var(--spacing) * 3.5);
|
|
1128
1134
|
}
|
|
1135
|
+
.w-3\/4 {
|
|
1136
|
+
width: calc(3/4 * 100%);
|
|
1137
|
+
}
|
|
1129
1138
|
.w-4 {
|
|
1130
1139
|
width: calc(var(--spacing) * 4);
|
|
1131
1140
|
}
|
|
@@ -1165,6 +1174,9 @@
|
|
|
1165
1174
|
.w-48 {
|
|
1166
1175
|
width: calc(var(--spacing) * 48);
|
|
1167
1176
|
}
|
|
1177
|
+
.w-64 {
|
|
1178
|
+
width: calc(var(--spacing) * 64);
|
|
1179
|
+
}
|
|
1168
1180
|
.w-72 {
|
|
1169
1181
|
width: calc(var(--spacing) * 72);
|
|
1170
1182
|
}
|
|
@@ -1289,6 +1301,9 @@
|
|
|
1289
1301
|
.max-w-20 {
|
|
1290
1302
|
max-width: calc(var(--spacing) * 20);
|
|
1291
1303
|
}
|
|
1304
|
+
.max-w-\[70\%\] {
|
|
1305
|
+
max-width: 70%;
|
|
1306
|
+
}
|
|
1292
1307
|
.max-w-\[85px\] {
|
|
1293
1308
|
max-width: 85px;
|
|
1294
1309
|
}
|
|
@@ -1594,6 +1609,9 @@
|
|
|
1594
1609
|
.flex-row {
|
|
1595
1610
|
flex-direction: row;
|
|
1596
1611
|
}
|
|
1612
|
+
.flex-row-reverse {
|
|
1613
|
+
flex-direction: row-reverse;
|
|
1614
|
+
}
|
|
1597
1615
|
.flex-wrap {
|
|
1598
1616
|
flex-wrap: wrap;
|
|
1599
1617
|
}
|
|
@@ -1850,6 +1868,12 @@
|
|
|
1850
1868
|
border-bottom-right-radius: var(--radius-xl);
|
|
1851
1869
|
border-bottom-left-radius: var(--radius-xl);
|
|
1852
1870
|
}
|
|
1871
|
+
.rounded-br-md {
|
|
1872
|
+
border-bottom-right-radius: var(--radius-md);
|
|
1873
|
+
}
|
|
1874
|
+
.rounded-bl-md {
|
|
1875
|
+
border-bottom-left-radius: var(--radius-md);
|
|
1876
|
+
}
|
|
1853
1877
|
.border {
|
|
1854
1878
|
border-style: var(--tw-border-style);
|
|
1855
1879
|
border-width: 1px;
|
|
@@ -1886,6 +1910,10 @@
|
|
|
1886
1910
|
border-bottom-style: var(--tw-border-style);
|
|
1887
1911
|
border-bottom-width: 2px;
|
|
1888
1912
|
}
|
|
1913
|
+
.border-l {
|
|
1914
|
+
border-left-style: var(--tw-border-style);
|
|
1915
|
+
border-left-width: 1px;
|
|
1916
|
+
}
|
|
1889
1917
|
.border-l-4 {
|
|
1890
1918
|
border-left-style: var(--tw-border-style);
|
|
1891
1919
|
border-left-width: 4px;
|
|
@@ -16609,6 +16637,11 @@
|
|
|
16609
16637
|
margin-left: calc(var(--spacing) * 96);
|
|
16610
16638
|
}
|
|
16611
16639
|
}
|
|
16640
|
+
.lg\:block {
|
|
16641
|
+
@media (width >= 64rem) {
|
|
16642
|
+
display: block;
|
|
16643
|
+
}
|
|
16644
|
+
}
|
|
16612
16645
|
.lg\:flex {
|
|
16613
16646
|
@media (width >= 64rem) {
|
|
16614
16647
|
display: flex;
|