touchstudy-core 0.1.14 → 0.1.16

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 (42) hide show
  1. package/dist/assets/iconChatBubble.d.ts +3 -0
  2. package/dist/assets/iconChecked.d.ts +3 -0
  3. package/dist/assets/iconPersonActive.d.ts +3 -0
  4. package/dist/assets/iconPersonNoActive.d.ts +3 -0
  5. package/dist/assets/iconSendMessenger.d.ts +4 -0
  6. package/dist/components/Chats/ChatContainer.d.ts +0 -1
  7. package/dist/components/Chats/ChatHeader.d.ts +9 -6
  8. package/dist/components/Chats/ChatItem.d.ts +6 -21
  9. package/dist/components/Chats/ChatList.d.ts +1 -2
  10. package/dist/components/Chats/ChatRightItem.d.ts +1 -5
  11. package/dist/components/Chats/InputChat.d.ts +6 -3
  12. package/dist/components/Chats/apiClient/conversationService.d.ts +2 -0
  13. package/dist/components/Chats/configs/constants.d.ts +5 -0
  14. package/dist/components/Chats/configs/types.d.ts +79 -15
  15. package/dist/components/Chats/hooks/useChatContainer.d.ts +20 -25
  16. package/dist/components/Chats/hooks/useDialog.d.ts +6 -0
  17. package/dist/components/Chats/hooks/useMessageList.d.ts +3 -5
  18. package/dist/containers/Login/apiClient/index.d.ts +0 -1
  19. package/dist/containers/Login/views/Login.d.ts +3 -0
  20. package/dist/containers/Login/views/block/BlockLogin.d.ts +3 -0
  21. package/dist/index.css +349 -0
  22. package/dist/index.d.ts +12 -8
  23. package/dist/index.js +1614 -1225
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.modern.js +1593 -1214
  26. package/dist/index.modern.js.map +1 -1
  27. package/dist/layouts/TheAcademyDropdown.d.ts +10 -0
  28. package/dist/redux/commons/action.d.ts +1 -0
  29. package/dist/services/academyService.d.ts +3 -0
  30. package/dist/services/accountService.d.ts +5 -0
  31. package/dist/utils/constants.d.ts +11 -7
  32. package/dist/utils/hooks/index.d.ts +3 -0
  33. package/dist/utils/hooks/useAutoAcademyDomain.d.ts +2 -0
  34. package/dist/utils/{useGoogleSignOut.d.ts → hooks/useGoogleSignOut.d.ts} +1 -1
  35. package/dist/utils/{useLanguage.d.ts → hooks/useLanguage.d.ts} +1 -1
  36. package/dist/utils/hooks/useLogin.d.ts +7 -0
  37. package/dist/utils/hooks/useSwitchAcademy.d.ts +10 -0
  38. package/dist/utils/types/academy.d.ts +6 -0
  39. package/dist/utils/types/login.d.ts +33 -0
  40. package/package.json +2 -1
  41. package/dist/components/Chats/hooks/useConversationList.d.ts +0 -20
  42. package/dist/components/Chats/hooks/useExamList.d.ts +0 -6
@@ -0,0 +1,3 @@
1
+ import React, { SVGProps } from "react";
2
+ declare const iconChatBubble: ({ width, height, color }: SVGProps<SVGSVGElement>) => React.JSX.Element;
3
+ export default iconChatBubble;
@@ -0,0 +1,3 @@
1
+ import React, { SVGProps } from "react";
2
+ declare const iconChecked: ({ width, height, color }: SVGProps<SVGSVGElement>) => React.JSX.Element;
3
+ export default iconChecked;
@@ -0,0 +1,3 @@
1
+ import React, { SVGProps } from "react";
2
+ declare const iconPersonActive: ({ width, height, color }: SVGProps<SVGSVGElement>) => React.JSX.Element;
3
+ export default iconPersonActive;
@@ -0,0 +1,3 @@
1
+ import React, { SVGProps } from "react";
2
+ declare const iconPersonNoActive: ({ width, height, color }: SVGProps<SVGSVGElement>) => React.JSX.Element;
3
+ export default iconPersonNoActive;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { SVGProps } from 'react';
3
+ declare const iconSendMessage: ({ width, height, color }: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
+ export default iconSendMessage;
@@ -10,7 +10,6 @@ export interface IChatContainerProps {
10
10
  scrollOffset?: number;
11
11
  isLoading?: boolean;
12
12
  isScrollToEnd?: boolean;
13
- onRead?: () => void;
14
13
  onReachTop?: () => void;
15
14
  onReachBottom?: () => void;
16
15
  onEndScrollToEnd?: () => void;
@@ -1,5 +1,4 @@
1
1
  import { FC } from "react";
2
- import { Option } from "./configs/types";
3
2
  export interface IExamOption {
4
3
  id: number;
5
4
  code: string;
@@ -8,11 +7,15 @@ export interface IExamOption {
8
7
  startTime: string;
9
8
  }
10
9
  export interface IChatHeaderProps {
11
- name: string;
12
- avatar?: string;
13
- selectedOption?: number;
14
- options?: IExamOption[];
15
- onChangeOption?: (value: Option) => void;
10
+ fullName?: string;
11
+ examTitle?: string;
12
+ createdAt?: string;
13
+ durationExam?: string;
14
+ questionOrder?: number;
15
+ conversationId?: number;
16
+ isCompleted?: boolean;
17
+ teacherName?: string;
18
+ roles?: Array<string>;
16
19
  }
17
20
  declare const ChatHeader: FC<IChatHeaderProps>;
18
21
  export default ChatHeader;
@@ -1,35 +1,20 @@
1
1
  import { FC } from "react";
2
- import React from "react";
3
- import { MessageStatus } from "./configs/types";
2
+ import { StudentsConversationResponse } from "./configs/types";
4
3
  export interface IChatItemProps {
5
4
  id?: number;
6
5
  isMe?: boolean;
7
- name: string;
8
6
  avatar?: string;
9
- isSystemLog?: boolean;
10
7
  content?: string;
11
8
  createdAt: string;
9
+ sender?: StudentsConversationResponse;
12
10
  isRead: boolean;
13
- type?: ChatItemType;
14
- examCode?: string;
15
- examId?: number;
16
- parentId?: number;
17
- parentContent?: string;
18
- showExamHeader?: boolean;
19
- isFirst?: boolean;
20
- isLast?: boolean;
21
- actionLink?: string;
22
- examTitle?: string;
23
- selectedReplyMessageId?: number;
24
- selectedReplyItemRef?: React.RefObject<HTMLLIElement>;
25
- status: MessageStatus;
26
- onToggleReply?: (id: number) => void;
11
+ contentType?: number;
27
12
  }
28
13
  export interface IChatItemWithActionProps extends IChatItemProps {
29
- onAddExamMessage?: (examId: number, title: string, examCode: string) => void;
30
- onReply?: (id: number, content: string, examId?: number) => void;
31
14
  onReTrySendMessage?: () => void;
32
- onGotoParentMessage?: (id: number) => void;
15
+ showTimestamp?: boolean;
16
+ showName?: boolean;
17
+ isStudent?: boolean;
33
18
  }
34
19
  export declare enum ChatItemType {
35
20
  Default = 0,
@@ -2,9 +2,8 @@ import React, { FC } from "react";
2
2
  import { IChatItemProps } from "./ChatItem";
3
3
  export interface IChatListProps {
4
4
  messages?: IChatItemProps[];
5
- onAddExamMessage: (examId: number, examTitle: string, examCode: string) => void;
6
5
  onReTrySendMessage?: () => void;
7
- onReply?: (id: number, content: string, examId?: number) => void;
6
+ roles: Array<String>;
8
7
  }
9
8
  interface Props extends IChatListProps {
10
9
  listItemRef: React.RefObject<HTMLUListElement>;
@@ -1,8 +1,4 @@
1
1
  import { FC } from "react";
2
2
  import { IChatItemWithActionProps } from "./ChatItem";
3
- import { MessageRequest } from "./configs/types";
4
- interface Props extends IChatItemWithActionProps {
5
- onReTrySendMessage?: (req?: MessageRequest) => void;
6
- }
7
- declare const ChatRightItem: FC<Props>;
3
+ declare const ChatRightItem: FC<IChatItemWithActionProps>;
8
4
  export default ChatRightItem;
@@ -1,11 +1,14 @@
1
1
  import React, { FC } from "react";
2
2
  export interface IInputChatProps {
3
3
  text: string;
4
- parentText?: string;
5
- examTitle?: string;
6
4
  onSubmit: () => void;
7
5
  onChangeInput: (text: string) => void;
8
- onClearReply?: () => void;
6
+ isCompleted?: boolean;
7
+ handleUploadImage: (file: File) => void;
8
+ selectedFile: {
9
+ content: string;
10
+ };
11
+ handleDeleteSelectedImage: () => void;
9
12
  }
10
13
  interface Props extends IInputChatProps {
11
14
  inputRef: React.RefObject<HTMLInputElement>;
@@ -3,5 +3,7 @@ export declare const getListConversation: (query: ConversationFilter) => Promise
3
3
  export declare const createConversation: (studentId: number) => Promise<import("axios").AxiosResponse<any, any>>;
4
4
  export declare const apiAddMessage: (conversationId: number, message: MessageRequest) => Promise<import("axios").AxiosResponse<any, any>>;
5
5
  export declare const getMessagesByConversation: (conversationId: number, filter: MessageFilter) => Promise<import("axios").AxiosResponse<any, any>>;
6
+ export declare const completeConversation: (conversationId: number) => Promise<import("axios").AxiosResponse<any, any>>;
6
7
  export declare const apiMarkReadMessage: (conversationId: number, messageId: number) => Promise<import("axios").AxiosResponse<any, any>>;
7
8
  export declare const apiGetConversationByUserId: (userId: number) => Promise<import("axios").AxiosResponse<any, any>>;
9
+ export declare const apiUploadFile: (file: FormData) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -5,5 +5,10 @@ export declare enum ExamStatus {
5
5
  Inprogress = "Inprogress",
6
6
  Completed = "Completed"
7
7
  }
8
+ export declare enum Roles {
9
+ Student = "Student",
10
+ Teacher = "Teacher",
11
+ Admin = "Admin"
12
+ }
8
13
  export declare const CONVERSATION_DEFAULT_FILTER: ConversationFilter;
9
14
  export declare const MESSAGE_DEFAULT_FILTER: MessageFilter;
@@ -6,15 +6,75 @@ export declare type ConversationResponse = {
6
6
  lastMessage: MessageResponse;
7
7
  totalUnReadMessage: number;
8
8
  };
9
+ export declare type ConversationsResponse = {
10
+ id: number;
11
+ studentExamSessionId: number;
12
+ studentId: number;
13
+ question: ConversationQuestion;
14
+ isCompleted: boolean;
15
+ completedAt: string;
16
+ totalUnReadMessage: number;
17
+ lastMessage: string | null;
18
+ examTitle: string;
19
+ examId: number;
20
+ examSessionId: number;
21
+ duration: string;
22
+ startTime: string;
23
+ examCreatedAt: string;
24
+ createdAt: string;
25
+ teacherName: string;
26
+ };
27
+ export declare type ConversationQuestion = {
28
+ id: number;
29
+ title: string;
30
+ articleNumber: number;
31
+ questionOrder: number;
32
+ };
9
33
  export declare type UserResponse = {
10
34
  id: number;
11
- displayName: string;
35
+ fullName: string;
12
36
  avatar: string;
13
37
  };
14
38
  export declare type ConversationFilter = {
15
39
  currentPage: number;
16
40
  pageSize: number;
17
41
  textSearch: string;
42
+ hasConversation?: boolean;
43
+ studentId?: number;
44
+ sortColumnName?: string;
45
+ sortColumnDirection?: string;
46
+ };
47
+ export declare type ExamResponse = {
48
+ id: number;
49
+ examId: number;
50
+ title: string;
51
+ code: string;
52
+ description: string;
53
+ type: string;
54
+ createdBy: {
55
+ id: number;
56
+ phoneNumber: string;
57
+ email: string;
58
+ avatar: string;
59
+ fullName: string;
60
+ schoolName: string;
61
+ };
62
+ teacher: {
63
+ id: number;
64
+ phoneNumber?: string;
65
+ email: string;
66
+ avatar: string;
67
+ fullName: string;
68
+ schoolName: string;
69
+ };
70
+ imageUrl: string;
71
+ questionCount: number;
72
+ duration: string;
73
+ createdAt: Date;
74
+ examCreatedAt: Date;
75
+ startTime: Date;
76
+ status: number;
77
+ totalStudentsJoined: number;
18
78
  };
19
79
  export declare type MessageFilter = {
20
80
  currentPage?: number;
@@ -24,6 +84,8 @@ export declare type MessageFilter = {
24
84
  sortColumnName?: MessageSortBy;
25
85
  examId?: number;
26
86
  beforeDate?: string;
87
+ totalItems?: number;
88
+ totalPages?: number;
27
89
  };
28
90
  export declare enum MessageSortBy {
29
91
  CreatedAt = "CreatedAt"
@@ -34,7 +96,7 @@ export declare enum OrderBy {
34
96
  }
35
97
  export declare enum StudentSortBy {
36
98
  CreatedAt = "CreatedAt",
37
- DisplayName = "DisplayName"
99
+ FullName = "FullName"
38
100
  }
39
101
  export declare enum StudentOrderBy {
40
102
  ASC = "ASC",
@@ -42,26 +104,27 @@ export declare enum StudentOrderBy {
42
104
  }
43
105
  export declare type MessageResponse = {
44
106
  id?: number;
45
- isStudent: boolean;
46
107
  conversationId?: number;
47
108
  content: string;
48
109
  isRead: boolean;
49
110
  readAt?: string;
50
- examId?: number;
51
111
  createdAt: string;
52
- exam?: ExamResponse;
53
- action?: MessageAction;
54
- isSystemLog?: boolean;
55
- type?: MessageSourceType;
56
- parentId?: number;
57
- parentContent?: string;
112
+ sender?: StudentsConversationResponse;
58
113
  };
59
- export declare type ExamResponse = {
114
+ export declare type UploadFileResponse = {
115
+ fileName?: any;
116
+ uploaded: number;
117
+ url: string;
118
+ };
119
+ export declare type StudentsConversationResponse = {
60
120
  id: number;
61
- title: string;
62
- code: string;
63
- startTime: string;
64
- createdAt: string;
121
+ avatar: string;
122
+ grade: string;
123
+ email?: string;
124
+ major?: string;
125
+ fullName: string;
126
+ parentName?: string;
127
+ schoolName?: string;
65
128
  };
66
129
  export declare type MessageRequest = {
67
130
  content: string;
@@ -70,6 +133,7 @@ export declare type MessageRequest = {
70
133
  parentContent?: string;
71
134
  examTitle?: string;
72
135
  examCode?: string;
136
+ contentType?: number;
73
137
  };
74
138
  export declare enum MessageAction {
75
139
  Default = 0,
@@ -1,51 +1,46 @@
1
1
  /// <reference types="react" />
2
+ import { ConversationsResponse, MessageRequest, StudentsConversationResponse } from "../configs/types";
2
3
  import { IChatItemProps } from "../ChatItem";
3
- import { ConversationResponse, MessageResponse, MessageRequest, MessageStatus } from "../configs/types";
4
4
  interface Props {
5
- conversation?: ConversationResponse;
6
- userId?: number;
7
- onUpdateLastMessage?: (message: MessageResponse) => void;
8
- onUpdateConversation?: (conversation: ConversationResponse) => void;
9
- onCreateConversationSuccess?: Function;
10
- onGetMessagesSuccess?: Function;
11
- examId?: number;
5
+ conversation?: ConversationsResponse;
6
+ student?: StudentsConversationResponse;
12
7
  }
13
8
  declare const useChatContainer: (props: Props) => {
14
9
  chatHeaderProps: {
15
- name: string;
16
- avatar: string;
17
- options: import("../configs/types").ExamResponse[] | undefined;
18
- selectedOption: number | undefined;
19
- onChangeOption: (val: any) => void;
10
+ fullName: string | undefined;
11
+ examTitle: string | undefined;
12
+ questionOrder: number | undefined;
13
+ conversationId: number | undefined;
14
+ isCompleted: boolean | undefined;
15
+ durationExam: string | undefined;
16
+ createdAt: string | undefined;
17
+ teacherName: string | undefined;
18
+ roles: any;
20
19
  };
21
20
  chatListProps: {
22
21
  messages: IChatItemProps[];
23
- onAddExamMessage: (examId: number, title: string, examCode: string) => void;
24
- onReply: (parentId: number, content: string, examId?: number | undefined) => void;
25
22
  onReTrySendMessage: () => Promise<void>;
23
+ roles: any;
26
24
  };
27
25
  inputProps: {
26
+ selectedFile: MessageRequest | null | undefined;
28
27
  text: string;
29
- parentText: string | undefined;
30
- examTitle: string | undefined;
31
28
  onChangeInput: (text: string) => void;
32
29
  onSubmit: () => Promise<void>;
33
- onClearReply: (() => void) | undefined;
30
+ handleDeleteSelectedImage: () => void;
31
+ handleUploadImage: (file: File) => Promise<void>;
32
+ isCompleted: boolean | undefined;
34
33
  };
35
34
  isScrollToEnd: boolean;
36
35
  isLoadingMessages: boolean;
37
- exams: import("../configs/types").ExamResponse[] | undefined;
38
36
  messageList: IChatItemProps[];
39
- selectedConversation: ConversationResponse | undefined;
40
- messageStatus: MessageStatus;
37
+ selectedConversation: ConversationsResponse | undefined;
41
38
  messageFilter: import("../configs/types").MessageFilter;
42
39
  handleToggleScrollToEnd: () => void;
43
- handleLoadMoreMessages: () => void;
44
- getMessageList: (conversationId: number, examId?: number | undefined) => Promise<void>;
45
- handleFilterExam: (val: any) => void;
40
+ handleLoadMoreMessages: () => Promise<true | undefined>;
41
+ getMessageList: (conversationId: number) => Promise<void>;
46
42
  setMessage: import("react").Dispatch<import("react").SetStateAction<MessageRequest | undefined>>;
47
43
  resetMessages: () => void;
48
44
  getMessageConversation: () => Promise<void>;
49
- handleMarkRead: () => Promise<void>;
50
45
  };
51
46
  export default useChatContainer;
@@ -0,0 +1,6 @@
1
+ declare const useDialog: () => {
2
+ openConfirmDialog: boolean;
3
+ toggleConfirmDialog: () => void;
4
+ handleConfirm: (conversationId: number) => Promise<void>;
5
+ };
6
+ export default useDialog;
@@ -1,14 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { MessageResponse, MessageFilter } from "../configs/types";
3
- declare const useMessageList: (userId?: number | undefined, getListExamOptions?: Function | undefined) => {
3
+ declare const useMessageList: () => {
4
4
  isLoading: boolean;
5
5
  messageFilter: MessageFilter;
6
6
  messages: MessageResponse[];
7
- getMessageList: (conversationId: number, examId?: number | undefined) => Promise<void>;
7
+ getMessageList: (conversationId: number) => Promise<void>;
8
8
  setMessages: import("react").Dispatch<import("react").SetStateAction<MessageResponse[]>>;
9
9
  resetMessages: () => void;
10
- handleChangeExamId: (value: any) => void;
11
- handleMarkReadMessage: (conversationId: number, messageId: number) => Promise<void>;
12
- handleLoadMore: () => boolean | undefined;
10
+ handleLoadMore: (conversationId: number) => Promise<true | undefined>;
13
11
  };
14
12
  export default useMessageList;
@@ -1,2 +1 @@
1
1
  export declare const getGoogleClientId: () => Promise<import("axios").AxiosResponse<any, any>>;
2
- export declare const apiLoginGoogle: (body: any, role: string) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -3,6 +3,9 @@ import { INavigateProps } from "../../../utils/types";
3
3
  import { Role } from "../configs/constants";
4
4
  interface Props {
5
5
  role?: Role;
6
+ homeAcademyUrl: string;
7
+ homeUrl: string;
8
+ registerUrl?: string;
6
9
  }
7
10
  declare const Login: FC<INavigateProps & Props>;
8
11
  export default Login;
@@ -4,6 +4,9 @@ import { Role } from "../../configs/constants";
4
4
  interface Props {
5
5
  defaultInfo?: any;
6
6
  role?: Role;
7
+ homeAcademyUrl: string;
8
+ homeUrl: string;
9
+ registerUrl?: string;
7
10
  }
8
11
  declare const BlockLogin: FC<Props & INavigateProps>;
9
12
  export default BlockLogin;