corp-chat-library-antd-react-socket 1.2.22 → 1.2.24
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/README.md +49 -19
- package/dist/CHAT/context/ChatSocketContext.d.ts +2 -0
- package/dist/CHAT/types/types.d.ts +3 -0
- package/dist/index.css +1 -1
- package/dist/index.js +2898 -2829
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,12 +43,13 @@ export interface HttpParams {
|
|
|
43
43
|
BFF_PORT: number;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export interface FetchParams {
|
|
47
|
-
fetchChatsListPath: string;
|
|
48
|
-
fetchChatMessagesPath: string;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
export interface FetchParams {
|
|
47
|
+
fetchChatsListPath: string;
|
|
48
|
+
fetchChatMessagesPath: string;
|
|
49
|
+
fetchMessageContextPath?: string;
|
|
50
|
+
sendSmsPath: string;
|
|
51
|
+
markMessagesAsReadPath: string;
|
|
52
|
+
}
|
|
52
53
|
|
|
53
54
|
export interface SocketSubscribe {
|
|
54
55
|
subscribeToChat: string;
|
|
@@ -172,10 +173,11 @@ export interface fetchChatMessagesPathResponse {
|
|
|
172
173
|
"content": {
|
|
173
174
|
"messages": [
|
|
174
175
|
{
|
|
175
|
-
"id": 626,
|
|
176
|
-
"from_id": 584,
|
|
177
|
-
"answer": null,
|
|
178
|
-
"
|
|
176
|
+
"id": 626,
|
|
177
|
+
"from_id": 584,
|
|
178
|
+
"answer": null,
|
|
179
|
+
"answer_message": null,
|
|
180
|
+
"text": "text",
|
|
179
181
|
"files": [
|
|
180
182
|
{
|
|
181
183
|
"id": 23,
|
|
@@ -195,10 +197,37 @@ export interface fetchChatMessagesPathResponse {
|
|
|
195
197
|
},
|
|
196
198
|
"message": "OK!"
|
|
197
199
|
}
|
|
198
|
-
```
|
|
199
|
-
---
|
|
200
|
-
|
|
201
|
-
### "
|
|
200
|
+
```
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### "fetchMessageContextPath"
|
|
204
|
+
When a reply points to a message that is not loaded in the current chat, the chat will load a pack of messages around that target message and then scroll to it.\
|
|
205
|
+
Request URL:
|
|
206
|
+
```ts
|
|
207
|
+
`${fetchMessageContextPath}/${chatId}/${messageId}`
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
payload:
|
|
211
|
+
```ts
|
|
212
|
+
const payload = {
|
|
213
|
+
"_token": "006GmuwH1vmrE8OdOIax4ySEd3FDreDD1u78t5ll"
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
expected response format:
|
|
218
|
+
```ts
|
|
219
|
+
export interface fetchMessageContextPathResponse {
|
|
220
|
+
"content": {
|
|
221
|
+
"messages": ChatMessage[],
|
|
222
|
+
"who": "Name Surname",
|
|
223
|
+
"total": 19
|
|
224
|
+
},
|
|
225
|
+
"message": "OK!"
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### "sendSmsPath"
|
|
202
231
|
When you scroll up the chat, a pack of older messages will be loaded.\
|
|
203
232
|
formData payload:
|
|
204
233
|
```
|
|
@@ -346,11 +375,12 @@ export interface To {
|
|
|
346
375
|
```
|
|
347
376
|
Message format for the opened chat:
|
|
348
377
|
```ts
|
|
349
|
-
export interface ChatMessage {
|
|
350
|
-
id: number,
|
|
351
|
-
from_id: number,
|
|
352
|
-
answer: number | null,
|
|
353
|
-
|
|
378
|
+
export interface ChatMessage {
|
|
379
|
+
id: number,
|
|
380
|
+
from_id: number,
|
|
381
|
+
answer: number | null,
|
|
382
|
+
answer_message?: ChatMessage | null,
|
|
383
|
+
text: string,
|
|
354
384
|
files: File[],
|
|
355
385
|
status: boolean,
|
|
356
386
|
created_at: number,
|
|
@@ -14,6 +14,7 @@ interface ChatSocketContextType {
|
|
|
14
14
|
loadingSendSms: boolean;
|
|
15
15
|
fetchChatsList: (search: string | null) => void;
|
|
16
16
|
fetchChatMessages: (chatId: number, lastMsg: number | null) => void;
|
|
17
|
+
fetchMessageContext: (chatId: number, messageId: number) => Promise<boolean>;
|
|
17
18
|
sendSms: ({ to, text, files, answer, timestamp, from_id }: toSendSms) => void;
|
|
18
19
|
markMessagesAsRead: (messageIds: (number | undefined)[]) => void;
|
|
19
20
|
setSubscribeToChat: (search: string | null) => void;
|
|
@@ -31,6 +32,7 @@ interface ChatSocketContextType {
|
|
|
31
32
|
PROD_AXIOS_INSTANCE: AxiosInstance | null;
|
|
32
33
|
setFetchChatsListPath: (path: string | null) => void;
|
|
33
34
|
setFetchChatMessagesPath: (path: string | null) => void;
|
|
35
|
+
setFetchMessageContextPath: (path: string | null) => void;
|
|
34
36
|
setSendSmsPath: (path: string | null) => void;
|
|
35
37
|
setMarkMessagesAsReadPath: (path: string | null) => void;
|
|
36
38
|
init: boolean;
|
|
@@ -17,6 +17,7 @@ export interface HttpParams {
|
|
|
17
17
|
export interface FetchParams {
|
|
18
18
|
fetchChatsListPath: string;
|
|
19
19
|
fetchChatMessagesPath: string;
|
|
20
|
+
fetchMessageContextPath?: string;
|
|
20
21
|
sendSmsPath: string;
|
|
21
22
|
markMessagesAsReadPath: string;
|
|
22
23
|
}
|
|
@@ -126,6 +127,7 @@ export interface ChatMessage {
|
|
|
126
127
|
id: number;
|
|
127
128
|
from_id: number;
|
|
128
129
|
answer: number | null;
|
|
130
|
+
answer_message?: ChatMessage | null;
|
|
129
131
|
text: string;
|
|
130
132
|
files: File[];
|
|
131
133
|
status: boolean;
|
|
@@ -145,6 +147,7 @@ export interface Normalized {
|
|
|
145
147
|
fromId: number;
|
|
146
148
|
id: number;
|
|
147
149
|
answer: number | null;
|
|
150
|
+
answerMessage?: ChatMessage | null;
|
|
148
151
|
text: string;
|
|
149
152
|
files: File[];
|
|
150
153
|
timestamp: number;
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--app-top-menu: linear-gradient(178deg, rgba(79, 143, 207, 1) 0%, rgba(41, 92, 143, 1) 100%);--sa-primary-color: #2178fa}.ant-layout-sider-children{margin:0!important;padding:0!important}ol,ul{list-style:none;padding-left:0;margin:0}.
|
|
1
|
+
:root{--app-top-menu: linear-gradient(178deg, rgba(79, 143, 207, 1) 0%, rgba(41, 92, 143, 1) 100%);--sa-primary-color: #2178fa}.ant-layout-sider-children{margin:0!important;padding:0!important}ol,ul{list-style:none;padding-left:0;margin:0}._draggableWrapper_1uhlh_17 .ant-modal-content{padding:0;background-color:#fff;border:1px solid #787878a2;border-radius:15px;overflow:hidden}._chat-modal__title_1uhlh_33{cursor:grab;padding:20px 10px 10px 20px;background:var(--app-top-menu);color:#fff!important;font-weight:400!important}._chat-modal__title_1uhlh_33:active{cursor:grabbing}._chat-input__footer_1uhlh_57{border-top:1px solid #c1c1c1;background:#fff;padding:5px 0;display:flex;gap:5px;justify-content:space-around}._chat-input__footer_1uhlh_57>*{margin:0 auto!important}._sidebar-layout_1uhlh_83{display:flex;flex-direction:column;height:100%;border-right:1px solid #c1c1c1;padding:2px 0}._sidebar-layout_1uhlh_83>*:not(:last-child){border-bottom:1px solid #e6e6e6}._sidebar-layout_1uhlh_83:nth-child(1){border-bottom:none}._chat-list_1uhlh_113::-webkit-scrollbar{display:none}._chat-list_1uhlh_113>*{margin:0;border-bottom:1px solid #e6e6e6;height:86px}._chat-item_1uhlh_139{margin-bottom:12px}._last-message_1uhlh_147{min-height:20px;max-height:36px;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;white-space:normal;font-size:.9em;color:#555}._activeChatItem_1uhlh_165 ._last-message_1uhlh_147{color:#f3f1f1}._lastMessageLabel_1uhlh_169{font-style:italic}._lastMessageDateTime_1uhlh_173{margin-top:2px;display:flex;align-items:center;gap:6px}._lastMessageDate_1uhlh_173{font-size:11px;line-height:14px;color:#8a8a8a}._lastMessageTime_1uhlh_186{padding:1px 5px;border-radius:4px;background:#607d8b;color:#fff;font-size:11px;line-height:14px;font-weight:600}._lastMessageStatus_1uhlh_196{position:relative;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;color:#6f7b83}._lastMessageStatusRead_1uhlh_206{color:green}._activeChatItem_1uhlh_165 ._lastMessageDate_1uhlh_173{color:#e5e5e5}._activeChatItem_1uhlh_165 ._lastMessageTime_1uhlh_186{background:#fff3;color:#fff}._activeChatItem_1uhlh_165 ._lastMessageStatus_1uhlh_196{color:#fff}._activeChatItem_1uhlh_165 ._lastMessageStatusRead_1uhlh_206{color:#7ee787}._message_1uhlh_230{display:flex;margin-bottom:8px}._myMessage_1uhlh_240{justify-content:flex-end}._otherMessage_1uhlh_248{justify-content:flex-start}._bubble_1uhlh_258{max-width:70%;padding:8px 12px;position:relative}._myMessageBubble_1uhlh_272{border-radius:25px 25px 0;margin:0 7px 0 auto;background:#dcf8c6;color:#000;align-self:flex-end;border:1px solid #e6e6e6;-webkit-box-shadow:9px 10px 15px -5px rgba(34,60,80,.2);-moz-box-shadow:9px 10px 15px -5px rgba(34,60,80,.2);box-shadow:9px 10px 15px -5px #223c5033}._otherMessageBubble_1uhlh_298{border-radius:25px 25px 25px 0;margin-left:7px;background:#e1f8f2;color:#000;border:1px solid #e6e6e6;align-self:flex-start;-webkit-box-shadow:-13px 10px 15px -5px rgba(34,60,80,.2);-moz-box-shadow:-13px 10px 15px -5px rgba(34,60,80,.2);box-shadow:-13px 10px 15px -5px #223c5033}._senderName_1uhlh_324{display:block;font-size:12px;font-weight:700;color:#333;margin-bottom:4px}._time_1uhlh_342{font-size:11px;color:#666;text-align:right;margin-top:2px}._chat_header_1uhlh_358{height:40px;display:flex;justify-content:space-between;align-items:center;padding:8px 16px;border-bottom:1px solid #f0f0f0;background:#fafafa;flex-shrink:0}._chatHeaderUser_1uhlh_373{display:flex;align-items:center;gap:8px;min-width:0}._chatHeaderAvatar_1uhlh_380,._chatListAvatar_1uhlh_381{flex-shrink:0;background:#607d8b;color:#fff;font-weight:600}._chatHeaderAvatar_1uhlh_380 svg,._chatListAvatar_1uhlh_381 svg{display:block}._chatHeaderUserName_1uhlh_393{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._chatHeaderSkeletonAvatar_1uhlh_399{flex-shrink:0}._chatHeaderSkeletonName_1uhlh_403,._chatHeaderSkeletonId_1uhlh_404{display:flex!important}._chatHeaderSkeletonName_1uhlh_403{width:180px!important;height:18px!important}._chatHeaderSkeletonId_1uhlh_404{width:42px!important;height:18px!important}._lastUpdate_1uhlh_418{font-size:12px;color:#888}._localMessage_1uhlh_424{opacity:.7}._sending_1uhlh_432{color:#1890ff;font-size:11px;font-style:italic}._notification-badge_1uhlh_444{cursor:pointer;transition:background-color .2s}._notification-badge_1uhlh_444:hover{background-color:#1890ff}._chat-layout_1uhlh_464{height:760px;display:flex;overflow:hidden}._chat-layout_1uhlh_464 ._ant-layout-content_1uhlh_471{min-height:0!important}._chat-content_1uhlh_479{flex:1;overflow:hidden}._chatcontentLayout_1uhlh_489{height:100%;display:flex;flex-direction:column}._chat_content_1uhlh_501{display:grid;grid-template-columns:1fr;grid-template-rows:auto 1fr auto}._messagesList_1uhlh_523{flex:1;overflow-y:auto;padding:8px;min-height:0;display:flex;flex-direction:column}._messagesList_1uhlh_523::-webkit-scrollbar,._textArea_1uhlh_545::-webkit-scrollbar{display:none}._textArea_1uhlh_545{min-height:40px;max-height:120px;resize:none;padding:0 2px;width:200px;line-height:40px}._textArea_1uhlh_545::placeholder{color:#999;opacity:.5}._chatItem_1uhlh_581{height:86px;padding:5px;display:flex;align-items:center;justify-content:space-between;gap:8px}._chatItemContent_1uhlh_589{min-width:0;flex:1}._chatListSkeletonAvatar_1uhlh_593{flex-shrink:0}._chatListSkeletonName_1uhlh_597,._chatListSkeletonMessage_1uhlh_598,._chatListSkeletonDate_1uhlh_599,._chatListSkeletonTime_1uhlh_600{display:flex!important}._chatListSkeletonName_1uhlh_597{width:72%!important;height:16px!important;margin-bottom:8px}._chatListSkeletonMessage_1uhlh_598{width:92%!important;height:18px!important;margin-bottom:5px}._chatListSkeletonMeta_1uhlh_616{display:flex;align-items:center;gap:6px}._chatListSkeletonDate_1uhlh_599{width:54px!important;height:14px!important}._chatListSkeletonTime_1uhlh_600{width:42px!important;height:16px!important;border-radius:4px!important}._activeChatItem_1uhlh_165 ._chatListAvatar_1uhlh_381{background:#fff3;color:#fff}._activeChatItem_1uhlh_165{background:var(--app-top-menu);color:#fff;opacity:.8}._chat_body_1uhlh_651{flex:1;display:flex;flex-direction:column;overflow-y:scroll;scrollbar-color:#f5f5f5 #f5f5f5;scrollbar-width:thin;transition:.3s}._chat_body_1uhlh_651:hover{scrollbar-color:var(--sa-primary-color) #f5f5f5}._antd_empty_1uhlh_679{height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}._chatSkeleton_1uhlh_687{padding:12px;display:flex;flex-direction:column;gap:12px}._chatSkeletonDivider_1uhlh_694{width:80px!important;height:22px!important;align-self:center;border-radius:12px!important}._chatSkeletonRow_1uhlh_701{width:100%;display:flex;justify-content:flex-start}._chatSkeletonRowSelf_1uhlh_707{justify-content:flex-end}._chatSkeletonRowSelf_1uhlh_707 .ant-skeleton-button{margin-left:auto}._chatSkeletonBubble_1uhlh_715,._chatSkeletonBubbleSelf_1uhlh_716,._chatSkeletonBubbleWide_1uhlh_717{height:44px!important;border-radius:18px!important}._chatSkeletonBubble_1uhlh_715{width:68%!important;display:flex!important}._chatSkeletonBubbleSelf_1uhlh_716{width:58%!important;display:flex!important}._chatSkeletonBubbleWide_1uhlh_717{width:82%!important;display:flex!important}._chat_inputs_1uhlh_737{width:100%;display:grid;grid-template-columns:auto 1fr auto auto;align-items:center;grid-gap:10px;padding:0 10px}._chatInputWrapper_1uhlh_746{width:100%;display:flex;flex-direction:column;gap:4px}._replyComposer_1uhlh_753{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px;min-width:0;margin:0 10px;padding:5px 8px 5px 10px;border-left:3px solid #1890ff;border-radius:4px;background:#f5f8fb}._replyComposerContent_1uhlh_766{min-width:0}._replyComposerName_1uhlh_770{color:#1677ff;font-size:12px;font-weight:600;line-height:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._replyComposerText_1uhlh_780{color:#333;font-size:12px;line-height:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._replyComposerClose_1uhlh_789{flex-shrink:0}._replyLink_1uhlh_793{width:100%;display:block;margin:0 0 6px;padding:5px 8px;border:0;border-left:3px solid #1890ff;border-radius:4px;background:#ffffffa6;color:inherit;cursor:pointer;text-align:left}._replyLinkName_1uhlh_807,._replyLinkText_1uhlh_808{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._replyLinkName_1uhlh_807{color:#1677ff;font-size:12px;font-weight:600;line-height:16px}._replyLinkText_1uhlh_808{color:#333;font-size:12px;line-height:16px}._messageHighlighted_1uhlh_828 ._bubble_1uhlh_258{animation:_messageHighlight_1uhlh_828 4s ease}@keyframes _messageHighlight_1uhlh_828{0%{box-shadow:0 0 #1890ff73}15%{box-shadow:0 0 0 5px #1890ff47}65%{box-shadow:0 0 0 5px #1890ff47}to{box-shadow:0 0 #1890ff00}}._chat-list__container_1uhlh_847{height:100%;overflow-y:scroll;scrollbar-color:#f5f5f5 #f5f5f5;scrollbar-width:thin;transition:.3s}._chat-list__container_1uhlh_847:hover{scrollbar-color:var(--sa-primary-color) #f5f5f5}._files_container_1uhlh_865{display:flex;flex-direction:column;align-items:center;gap:10px}._file_1uhlh_865{width:100%;padding:0 5px;border-radius:5px;color:#333;display:flex;align-items:center;gap:10px}._file_circle_1uhlh_895{background-color:#99bad3;border-radius:50%;padding:10px;display:flex;align-items:center;justify-content:center}._file_circle_1uhlh_895._self_1uhlh_911{background-color:#9ed399}._href_label_1uhlh_917{margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|