@webinex/chatify 1.0.0-alpha00
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/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/ChatifyContext.d.ts +11 -0
- package/dist/cjs/types/core/action.d.ts +73 -0
- package/dist/cjs/types/core/client.d.ts +35 -0
- package/dist/cjs/types/core/index.d.ts +14 -0
- package/dist/cjs/types/core/models.d.ts +64 -0
- package/dist/cjs/types/core/reducer.d.ts +11 -0
- package/dist/cjs/types/core/state.d.ts +25 -0
- package/dist/cjs/types/core/useAccounts.d.ts +1 -0
- package/dist/cjs/types/core/useAddChat.d.ts +2 -0
- package/dist/cjs/types/core/useAddMember.d.ts +2 -0
- package/dist/cjs/types/core/useAddMessage.d.ts +5 -0
- package/dist/cjs/types/core/useChat.d.ts +3 -0
- package/dist/cjs/types/core/useChatList.d.ts +1 -0
- package/dist/cjs/types/core/useLoadMore.d.ts +3 -0
- package/dist/cjs/types/core/useMessages.d.ts +15 -0
- package/dist/cjs/types/core/useMutation.d.ts +12 -0
- package/dist/cjs/types/core/useQuery.d.ts +7 -0
- package/dist/cjs/types/core/useReadMonitor.d.ts +1 -0
- package/dist/cjs/types/core/useRemoveMember.d.ts +2 -0
- package/dist/cjs/types/core/useSignalR.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +3 -0
- package/dist/cjs/types/ui/AddChat.d.ts +1 -0
- package/dist/cjs/types/ui/Aside.d.ts +1 -0
- package/dist/cjs/types/ui/Chat.d.ts +4 -0
- package/dist/cjs/types/ui/ChatBody.d.ts +4 -0
- package/dist/cjs/types/ui/ChatHeader.d.ts +4 -0
- package/dist/cjs/types/ui/ChatSettings.d.ts +1 -0
- package/dist/cjs/types/ui/Chatify.d.ts +8 -0
- package/dist/cjs/types/ui/InputForm.d.ts +1 -0
- package/dist/cjs/types/ui/LoadMore.d.ts +4 -0
- package/dist/cjs/types/ui/Main.d.ts +1 -0
- package/dist/cjs/types/ui/Message.d.ts +5 -0
- package/dist/cjs/types/ui/MessageMd.d.ts +13 -0
- package/dist/cjs/types/ui/MessageSkeleton.d.ts +4 -0
- package/dist/cjs/types/ui/SendingMessage.d.ts +6 -0
- package/dist/cjs/types/ui/SystemMessage.d.ts +8 -0
- package/dist/cjs/types/ui/index.d.ts +2 -0
- package/dist/cjs/types/ui/localizer.d.ts +28 -0
- package/dist/cjs/types/util/index.d.ts +2 -0
- package/dist/cjs/types/util/uniqBy.d.ts +1 -0
- package/dist/cjs/types/util/uniqId.d.ts +1 -0
- package/dist/css/chatify.css +328 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/ChatifyContext.d.ts +11 -0
- package/dist/esm/types/core/action.d.ts +73 -0
- package/dist/esm/types/core/client.d.ts +35 -0
- package/dist/esm/types/core/index.d.ts +14 -0
- package/dist/esm/types/core/models.d.ts +64 -0
- package/dist/esm/types/core/reducer.d.ts +11 -0
- package/dist/esm/types/core/state.d.ts +25 -0
- package/dist/esm/types/core/useAccounts.d.ts +1 -0
- package/dist/esm/types/core/useAddChat.d.ts +2 -0
- package/dist/esm/types/core/useAddMember.d.ts +2 -0
- package/dist/esm/types/core/useAddMessage.d.ts +5 -0
- package/dist/esm/types/core/useChat.d.ts +3 -0
- package/dist/esm/types/core/useChatList.d.ts +1 -0
- package/dist/esm/types/core/useLoadMore.d.ts +3 -0
- package/dist/esm/types/core/useMessages.d.ts +15 -0
- package/dist/esm/types/core/useMutation.d.ts +12 -0
- package/dist/esm/types/core/useQuery.d.ts +7 -0
- package/dist/esm/types/core/useReadMonitor.d.ts +1 -0
- package/dist/esm/types/core/useRemoveMember.d.ts +2 -0
- package/dist/esm/types/core/useSignalR.d.ts +1 -0
- package/dist/esm/types/index.d.ts +3 -0
- package/dist/esm/types/ui/AddChat.d.ts +1 -0
- package/dist/esm/types/ui/Aside.d.ts +1 -0
- package/dist/esm/types/ui/Chat.d.ts +4 -0
- package/dist/esm/types/ui/ChatBody.d.ts +4 -0
- package/dist/esm/types/ui/ChatHeader.d.ts +4 -0
- package/dist/esm/types/ui/ChatSettings.d.ts +1 -0
- package/dist/esm/types/ui/Chatify.d.ts +8 -0
- package/dist/esm/types/ui/InputForm.d.ts +1 -0
- package/dist/esm/types/ui/LoadMore.d.ts +4 -0
- package/dist/esm/types/ui/Main.d.ts +1 -0
- package/dist/esm/types/ui/Message.d.ts +5 -0
- package/dist/esm/types/ui/MessageMd.d.ts +13 -0
- package/dist/esm/types/ui/MessageSkeleton.d.ts +4 -0
- package/dist/esm/types/ui/SendingMessage.d.ts +6 -0
- package/dist/esm/types/ui/SystemMessage.d.ts +8 -0
- package/dist/esm/types/ui/index.d.ts +2 -0
- package/dist/esm/types/ui/localizer.d.ts +28 -0
- package/dist/esm/types/util/index.d.ts +2 -0
- package/dist/esm/types/util/uniqBy.d.ts +1 -0
- package/dist/esm/types/util/uniqId.d.ts +1 -0
- package/dist/index.d.ts +290 -0
- package/package.json +90 -0
- package/src/ChatifyContext.tsx +26 -0
- package/src/core/action.tsx +282 -0
- package/src/core/client.ts +137 -0
- package/src/core/index.ts +14 -0
- package/src/core/models.tsx +75 -0
- package/src/core/reducer.tsx +80 -0
- package/src/core/state.ts +38 -0
- package/src/core/useAccounts.tsx +11 -0
- package/src/core/useAddChat.tsx +12 -0
- package/src/core/useAddMember.tsx +12 -0
- package/src/core/useAddMessage.tsx +40 -0
- package/src/core/useChat.tsx +12 -0
- package/src/core/useChatList.tsx +10 -0
- package/src/core/useLoadMore.tsx +42 -0
- package/src/core/useMessages.tsx +23 -0
- package/src/core/useMutation.tsx +48 -0
- package/src/core/useQuery.tsx +45 -0
- package/src/core/useReadMonitor.tsx +31 -0
- package/src/core/useRemoveMember.tsx +12 -0
- package/src/core/useSignalR.tsx +51 -0
- package/src/index.ts +3 -0
- package/src/ui/AddChat.tsx +55 -0
- package/src/ui/Aside.tsx +67 -0
- package/src/ui/Chat.tsx +26 -0
- package/src/ui/ChatBody.tsx +43 -0
- package/src/ui/ChatHeader.tsx +47 -0
- package/src/ui/ChatSettings.tsx +59 -0
- package/src/ui/Chatify.tsx +47 -0
- package/src/ui/InputForm.tsx +48 -0
- package/src/ui/LoadMore.tsx +40 -0
- package/src/ui/Main.tsx +16 -0
- package/src/ui/Message.tsx +50 -0
- package/src/ui/MessageMd.tsx +47 -0
- package/src/ui/MessageSkeleton.tsx +19 -0
- package/src/ui/SendingMessage.tsx +14 -0
- package/src/ui/SystemMessage.tsx +26 -0
- package/src/ui/index.ts +2 -0
- package/src/ui/localizer.tsx +58 -0
- package/src/ui/styles/aside.scss +94 -0
- package/src/ui/styles/index.scss +247 -0
- package/src/ui/styles/keyframes.scss +14 -0
- package/src/ui/styles/mixins.scss +20 -0
- package/src/ui/styles/variables.scss +10 -0
- package/src/util/index.ts +2 -0
- package/src/util/uniqBy.tsx +17 -0
- package/src/util/uniqId.tsx +3 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface Localizer {
|
|
3
|
+
timestamp: (value: string) => string;
|
|
4
|
+
system: {
|
|
5
|
+
chatCreated: () => string;
|
|
6
|
+
};
|
|
7
|
+
message: {
|
|
8
|
+
read: () => React.ReactNode;
|
|
9
|
+
reading: () => React.ReactNode;
|
|
10
|
+
sending: () => React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
addChat: {
|
|
13
|
+
title: () => React.ReactNode;
|
|
14
|
+
name: {
|
|
15
|
+
label: () => React.ReactNode;
|
|
16
|
+
required: () => string;
|
|
17
|
+
max250: () => string;
|
|
18
|
+
};
|
|
19
|
+
members: {
|
|
20
|
+
label: () => React.ReactNode;
|
|
21
|
+
required: () => string;
|
|
22
|
+
};
|
|
23
|
+
submitBtn: () => React.ReactNode;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare const LocalizerContext: React.Context<Localizer>;
|
|
27
|
+
export declare function useLocalizer(): Localizer;
|
|
28
|
+
export declare const defaultLocalizer: Localizer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function uniqBy<T, TKey extends string | number | symbol>(items: T[], selector: (x: T) => TKey): T[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function uniqId(): string;
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
@keyframes fadeInFromNone {
|
|
2
|
+
0% {
|
|
3
|
+
display: none;
|
|
4
|
+
opacity: 0;
|
|
5
|
+
}
|
|
6
|
+
1% {
|
|
7
|
+
opacity: 0;
|
|
8
|
+
}
|
|
9
|
+
100% {
|
|
10
|
+
opacity: 1;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
.wxchtf-aside {
|
|
14
|
+
flex: none;
|
|
15
|
+
width: 300px;
|
|
16
|
+
border-right: 1px solid #ddd;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-flow: column nowrap;
|
|
19
|
+
}
|
|
20
|
+
.wxchtf-aside .wxchtf-chats.ant-menu {
|
|
21
|
+
flex: 1 1 auto;
|
|
22
|
+
height: 100px;
|
|
23
|
+
overflow-y: auto;
|
|
24
|
+
}
|
|
25
|
+
.wxchtf-aside .wxchtf-chats.ant-menu::-webkit-scrollbar {
|
|
26
|
+
width: 8px;
|
|
27
|
+
height: 8px;
|
|
28
|
+
}
|
|
29
|
+
.wxchtf-aside .wxchtf-chats.ant-menu::-webkit-scrollbar-track {
|
|
30
|
+
background-color: #f1f1f1;
|
|
31
|
+
}
|
|
32
|
+
.wxchtf-aside .wxchtf-chats.ant-menu::-webkit-scrollbar-thumb {
|
|
33
|
+
background-color: #dfdfdf;
|
|
34
|
+
}
|
|
35
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item {
|
|
36
|
+
padding: 0;
|
|
37
|
+
height: unset;
|
|
38
|
+
margin: 0;
|
|
39
|
+
width: 100%;
|
|
40
|
+
border-radius: 0;
|
|
41
|
+
line-height: 1.5;
|
|
42
|
+
border-top: 1px solid #ddd;
|
|
43
|
+
}
|
|
44
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item:first-child {
|
|
45
|
+
border-top: none;
|
|
46
|
+
}
|
|
47
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item.ant-menu-item-selected .wxchtf-chat-name {
|
|
48
|
+
font-weight: 600;
|
|
49
|
+
}
|
|
50
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item .wxchtf-chat {
|
|
51
|
+
padding: 0.5rem 1rem;
|
|
52
|
+
position: relative;
|
|
53
|
+
}
|
|
54
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item .wxchtf-chat.--unread .wxchtf-chat-last {
|
|
55
|
+
font-weight: bold;
|
|
56
|
+
}
|
|
57
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item .wxchtf-chat .wxchtf-chat-name {
|
|
58
|
+
font-weight: bold;
|
|
59
|
+
display: inline-block;
|
|
60
|
+
}
|
|
61
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item .wxchtf-chat .wxchtf-unread-count {
|
|
62
|
+
display: inline-block;
|
|
63
|
+
padding: 0.2rem;
|
|
64
|
+
min-width: 1rem;
|
|
65
|
+
height: 1.2rem;
|
|
66
|
+
line-height: 0.7rem;
|
|
67
|
+
margin-left: 0.5rem;
|
|
68
|
+
border-radius: 50%;
|
|
69
|
+
text-align: center;
|
|
70
|
+
font-size: 0.7rem;
|
|
71
|
+
background: #ffa726;
|
|
72
|
+
}
|
|
73
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item .wxchtf-chat .wxchtf-chat-last {
|
|
74
|
+
font-style: italic;
|
|
75
|
+
opacity: 0.75;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
text-overflow: ellipsis;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
line-height: 25px;
|
|
80
|
+
}
|
|
81
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item .wxchtf-chat .wxchtf-chat-last .wxchtf-chat-last-author {
|
|
82
|
+
display: inline-block;
|
|
83
|
+
margin-right: 0.5rem;
|
|
84
|
+
}
|
|
85
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item .wxchtf-chat .wxchtf-chat-last .wxchtf-chat-last-author .ant-avatar {
|
|
86
|
+
display: inline-block;
|
|
87
|
+
border: none;
|
|
88
|
+
margin-right: 5px;
|
|
89
|
+
width: 25px;
|
|
90
|
+
height: 25px;
|
|
91
|
+
line-height: 23px;
|
|
92
|
+
}
|
|
93
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item .wxchtf-chat .wxchtf-chat-last .wxchtf-chat-last-author::after {
|
|
94
|
+
content: ":";
|
|
95
|
+
}
|
|
96
|
+
.wxchtf-aside .wxchtf-chats.ant-menu .ant-menu-item .wxchtf-chat .wxchtf-chat-last .wxchtf-chat-last-message {
|
|
97
|
+
display: inline;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.wxchtf-chatify {
|
|
101
|
+
border: 1px solid #ddd;
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-flow: column nowrap;
|
|
104
|
+
background: white;
|
|
105
|
+
border-radius: 4px;
|
|
106
|
+
}
|
|
107
|
+
.wxchtf-chatify .wxchtf-header {
|
|
108
|
+
min-height: 2rem;
|
|
109
|
+
border-bottom: 1px solid #ddd;
|
|
110
|
+
}
|
|
111
|
+
.wxchtf-chatify .wxchtf-body {
|
|
112
|
+
flex: 1 0;
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-flow: row nowrap;
|
|
115
|
+
}
|
|
116
|
+
.wxchtf-chatify .wxchtf-footer {
|
|
117
|
+
min-height: 2rem;
|
|
118
|
+
border-top: 1px solid #ddd;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.wxchtf-main {
|
|
122
|
+
flex: auto;
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-flow: column nowrap;
|
|
125
|
+
}
|
|
126
|
+
.wxchtf-main .wxchtf-chat {
|
|
127
|
+
flex: auto;
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-flow: column nowrap;
|
|
130
|
+
}
|
|
131
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-header {
|
|
132
|
+
border-bottom: 1px solid #ddd;
|
|
133
|
+
padding: 0.5rem 1rem;
|
|
134
|
+
}
|
|
135
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-header .wxchtf-chat-name {
|
|
136
|
+
font-weight: 600;
|
|
137
|
+
flex: none;
|
|
138
|
+
}
|
|
139
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body {
|
|
140
|
+
flex: 1 1 auto;
|
|
141
|
+
height: 100px;
|
|
142
|
+
overflow-y: auto;
|
|
143
|
+
background: #f5f5f5;
|
|
144
|
+
padding: 2rem 1rem;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-flow: column-reverse nowrap;
|
|
147
|
+
}
|
|
148
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body::-webkit-scrollbar {
|
|
149
|
+
width: 8px;
|
|
150
|
+
height: 8px;
|
|
151
|
+
}
|
|
152
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body::-webkit-scrollbar-track {
|
|
153
|
+
background-color: #f1f1f1;
|
|
154
|
+
}
|
|
155
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body::-webkit-scrollbar-thumb {
|
|
156
|
+
background-color: #dfdfdf;
|
|
157
|
+
}
|
|
158
|
+
@media only screen and (min-width: 1120px) {
|
|
159
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body {
|
|
160
|
+
padding-right: 30%;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message {
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-flow: row nowrap;
|
|
166
|
+
width: 100%;
|
|
167
|
+
align-items: flex-end;
|
|
168
|
+
}
|
|
169
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message.--sending {
|
|
170
|
+
animation: fadeInFromNone 0.5s ease-out;
|
|
171
|
+
}
|
|
172
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message.--my {
|
|
173
|
+
direction: rtl;
|
|
174
|
+
justify-content: flex-start;
|
|
175
|
+
}
|
|
176
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message.--my .wxchtf-message-author {
|
|
177
|
+
margin-right: 0;
|
|
178
|
+
margin-left: 15px;
|
|
179
|
+
}
|
|
180
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message.--my .wxchtf-message-body {
|
|
181
|
+
direction: ltr;
|
|
182
|
+
border-bottom-left-radius: 10px;
|
|
183
|
+
border-bottom-right-radius: 0;
|
|
184
|
+
background-color: #b9f6ca;
|
|
185
|
+
}
|
|
186
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message .wxchtf-message-author {
|
|
187
|
+
margin-right: 15px;
|
|
188
|
+
}
|
|
189
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message .wxchtf-message-author .ant-avatar {
|
|
190
|
+
width: 40px;
|
|
191
|
+
height: 40px;
|
|
192
|
+
line-height: 38px;
|
|
193
|
+
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
|
|
194
|
+
}
|
|
195
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message .wxchtf-message-body {
|
|
196
|
+
min-width: 300px;
|
|
197
|
+
max-width: 70%;
|
|
198
|
+
border-radius: 10px;
|
|
199
|
+
padding: 0.75rem 1rem;
|
|
200
|
+
background: white;
|
|
201
|
+
border-bottom-left-radius: 0;
|
|
202
|
+
background-color: #e1f5fe;
|
|
203
|
+
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
|
|
204
|
+
display: block;
|
|
205
|
+
white-space: pre-wrap;
|
|
206
|
+
overflow-wrap: break-word;
|
|
207
|
+
}
|
|
208
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message .wxchtf-message-body .wxchtf-message-info-box {
|
|
209
|
+
text-align: right;
|
|
210
|
+
}
|
|
211
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message .wxchtf-message-body .wxchtf-message-info-box .wxchtf-message-sent-at,
|
|
212
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message .wxchtf-message-body .wxchtf-message-info-box .wxchtf-message-read-box,
|
|
213
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message .wxchtf-message-body .wxchtf-message-info-box .wxchtf-message-sending-box {
|
|
214
|
+
display: inline-block;
|
|
215
|
+
font-style: italic;
|
|
216
|
+
font-size: 0.75em;
|
|
217
|
+
margin-top: 0.5rem;
|
|
218
|
+
opacity: 0.5;
|
|
219
|
+
}
|
|
220
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message .wxchtf-message-body .wxchtf-message-info-box .wxchtf-message-read-box,
|
|
221
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message .wxchtf-message-body .wxchtf-message-info-box .wxchtf-message-sending-box {
|
|
222
|
+
margin-left: 5px;
|
|
223
|
+
}
|
|
224
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-system-message {
|
|
225
|
+
font-style: italic;
|
|
226
|
+
position: relative;
|
|
227
|
+
text-align: center;
|
|
228
|
+
}
|
|
229
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-system-message .wxchtf-text,
|
|
230
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-system-message .wxchtf-timestamp {
|
|
231
|
+
display: inline-block;
|
|
232
|
+
opacity: 0.9;
|
|
233
|
+
font-size: 0.85em;
|
|
234
|
+
}
|
|
235
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-system-message .wxchtf-timestamp {
|
|
236
|
+
margin-left: 1rem;
|
|
237
|
+
}
|
|
238
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message,
|
|
239
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-system-message,
|
|
240
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message-skeleton {
|
|
241
|
+
margin-bottom: 2rem;
|
|
242
|
+
}
|
|
243
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message:first-child,
|
|
244
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-system-message:first-child,
|
|
245
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message-skeleton:first-child {
|
|
246
|
+
margin-bottom: 0;
|
|
247
|
+
}
|
|
248
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message-skeleton {
|
|
249
|
+
display: flex;
|
|
250
|
+
flex-flow: row nowrap;
|
|
251
|
+
align-items: end;
|
|
252
|
+
}
|
|
253
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message-skeleton .wxchtf-avatar {
|
|
254
|
+
margin-right: 15px;
|
|
255
|
+
}
|
|
256
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message-skeleton .wxchtf-avatar .ant-skeleton-avatar {
|
|
257
|
+
width: 40px;
|
|
258
|
+
height: 40px;
|
|
259
|
+
line-height: 40px;
|
|
260
|
+
}
|
|
261
|
+
.wxchtf-main .wxchtf-chat .wxchtf-chat-body .wxchtf-message-skeleton .wxchtf-content {
|
|
262
|
+
width: 300px;
|
|
263
|
+
height: 100px;
|
|
264
|
+
border-radius: 10px;
|
|
265
|
+
border-bottom-left-radius: 0;
|
|
266
|
+
}
|
|
267
|
+
.wxchtf-main .wxchtf-input-form {
|
|
268
|
+
flex: none;
|
|
269
|
+
max-height: 300px;
|
|
270
|
+
display: flex;
|
|
271
|
+
flex-flow: column nowrap;
|
|
272
|
+
}
|
|
273
|
+
.wxchtf-main .wxchtf-input-form .wxchtf-input-box {
|
|
274
|
+
flex: none;
|
|
275
|
+
display: flex;
|
|
276
|
+
flex-flow: row nowrap;
|
|
277
|
+
padding: 1rem 0;
|
|
278
|
+
border-top: 1px solid #ddd;
|
|
279
|
+
}
|
|
280
|
+
.wxchtf-main .wxchtf-input-form .wxchtf-input-box .wxchtf-add-files-box {
|
|
281
|
+
flex: none;
|
|
282
|
+
display: flex;
|
|
283
|
+
padding: 0 1rem;
|
|
284
|
+
align-items: end;
|
|
285
|
+
}
|
|
286
|
+
.wxchtf-main .wxchtf-input-form .wxchtf-input-box .wxchtf-add-files-box .ant-btn.ant-btn-icon-only .anticon {
|
|
287
|
+
font-size: 1.5rem;
|
|
288
|
+
}
|
|
289
|
+
.wxchtf-main .wxchtf-input-form .wxchtf-input-box .wxchtf-text-input-box {
|
|
290
|
+
flex: auto;
|
|
291
|
+
}
|
|
292
|
+
.wxchtf-main .wxchtf-input-form .wxchtf-input-box .wxchtf-text-input-box textarea {
|
|
293
|
+
resize: none;
|
|
294
|
+
border: none;
|
|
295
|
+
outline: none;
|
|
296
|
+
box-shadow: none;
|
|
297
|
+
}
|
|
298
|
+
.wxchtf-main .wxchtf-input-form .wxchtf-input-box .wxchtf-text-input-box textarea::-webkit-scrollbar {
|
|
299
|
+
width: 8px;
|
|
300
|
+
height: 8px;
|
|
301
|
+
}
|
|
302
|
+
.wxchtf-main .wxchtf-input-form .wxchtf-input-box .wxchtf-text-input-box textarea::-webkit-scrollbar-track {
|
|
303
|
+
background-color: #f1f1f1;
|
|
304
|
+
}
|
|
305
|
+
.wxchtf-main .wxchtf-input-form .wxchtf-input-box .wxchtf-text-input-box textarea::-webkit-scrollbar-thumb {
|
|
306
|
+
background-color: #dfdfdf;
|
|
307
|
+
}
|
|
308
|
+
.wxchtf-main .wxchtf-input-form .wxchtf-input-box .wxchtf-submit-btn-box {
|
|
309
|
+
flex: none;
|
|
310
|
+
display: flex;
|
|
311
|
+
padding: 0 1rem;
|
|
312
|
+
align-items: end;
|
|
313
|
+
}
|
|
314
|
+
.wxchtf-main .wxchtf-input-form .wxchtf-input-box .wxchtf-submit-btn-box .ant-btn.ant-btn-icon-only .anticon {
|
|
315
|
+
font-size: 1.5rem;
|
|
316
|
+
}
|
|
317
|
+
.wxchtf-main .wxchtf-add-chat {
|
|
318
|
+
display: flex;
|
|
319
|
+
flex-flow: column nowrap;
|
|
320
|
+
justify-content: center;
|
|
321
|
+
align-items: center;
|
|
322
|
+
height: 100%;
|
|
323
|
+
}
|
|
324
|
+
.wxchtf-main .wxchtf-add-chat form {
|
|
325
|
+
padding: 2rem;
|
|
326
|
+
max-width: 700px;
|
|
327
|
+
width: 100%;
|
|
328
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import s,{useRef as n,useCallback as i,useContext as c,useState as r,useEffect as d,useMemo as o}from"react";import*as u from"@microsoft/signalr";import{shallowEqual as h}from"shallow-equal";import{Menu as l,Avatar as m,Form as g,Input as y,Select as b,Button as f,Row as v,Col as p,Space as j,Tooltip as O,Skeleton as q,List as x}from"antd";import w from"dayjs";import{SettingOutlined as I,CloseOutlined as _}from"@ant-design/icons";import k from"@ant-design/icons/SendOutlined";import N from"@ant-design/icons/FileAddOutlined";import C from"is-hotkey";function F(e,t,a,s){return new(a||(a=Promise))((function(n,i){function c(e){try{d(s.next(e))}catch(e){i(e)}}function r(e){try{d(s.throw(e))}catch(e){i(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(c,r)}d((s=s.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const S={hubUri:"/api/chatify/hub",headersFactory:()=>Promise.resolve({})},R=["chatify://new-message","chatify://chat-created","chatify://read","chatify://member-added","chatify://member-removed"];class A{constructor(e){this._connection=null,this._subscribers={},this._reconnectSubscribers=[],this.connect=()=>F(this,void 0,void 0,(function*(){const e=yield this._config.signalR.headersFactory();this._connection=(new u.HubConnectionBuilder).withUrl(this._config.signalR.hubUri,{accessTokenFactory:this._config.signalR.accessTokenFactory?this._config.signalR.accessTokenFactory:void 0,headers:e}).withAutomaticReconnect().build(),R.forEach((e=>{this._connection.on(e,((...t)=>{var a;null===(a=this._subscribers[e])||void 0===a||a.forEach((e=>e(t)))}))})),this._connection.onreconnected((()=>this._reconnectSubscribers.forEach((e=>e())))),yield this._connection.start()})),this.subscribe=(e,t)=>{var a;return this._subscribers[e]=null!==(a=this._subscribers[e])&&void 0!==a?a:[],this._subscribers[e].push(t),()=>this._subscribers[e].filter((e=>e!==t))},this.subscribeReconnect=e=>(this._reconnectSubscribers.push(e),()=>this._reconnectSubscribers.filter((t=>t!==e))),this.accounts=()=>F(this,void 0,void 0,(function*(){const{data:e}=yield this.axios.get("account");return e})),this.chats=()=>F(this,void 0,void 0,(function*(){const{data:e}=yield this.axios.get("chat");return e})),this.chat=e=>F(this,void 0,void 0,(function*(){const{data:t}=yield this.axios.get(`chat/${e}`);return t})),this.addChat=e=>F(this,void 0,void 0,(function*(){const{data:t}=yield this.axios.post("chat",e);return t})),this.messages=e=>F(this,void 0,void 0,(function*(){const{chatId:t,skip:a=0,take:s=20}=e,n=encodeURIComponent(JSON.stringify({skip:a,take:s})),{data:i}=yield this.axios.get(`chat/${t}/message?pagingRule=${n}`);return i})),this.send=e=>F(this,void 0,void 0,(function*(){const{chatId:t}=e,a=function(e,t){var a={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(a[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(e);n<s.length;n++)t.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(a[s[n]]=e[s[n]])}return a}(e,["chatId"]);yield this.axios.post(`chat/${t}/message`,a)})),this.read=e=>F(this,void 0,void 0,(function*(){yield this.axios.put("chat/message/read",e)})),this.removeMember=e=>F(this,void 0,void 0,(function*(){yield this.axios.delete(`chat/${e.chatId}/member`,{data:e})})),this.addMember=e=>F(this,void 0,void 0,(function*(){yield this.axios.post(`chat/${e.chatId}/member`,e)})),this._config=Object.assign(Object.assign({},e),{signalR:Object.assign(Object.assign({},S),e.signalR)})}get axios(){return this._config.axios}}function B(e,t,a){const s=a((e=Object.assign(Object.assign({},e),{query:Object.assign({},e.query)})).query[t]);return s&&(e.query[t]=s),e}function E(e,t,a){const s=a((e=Object.assign(Object.assign({},e),{mutation:Object.assign({},e.mutation)})).mutation[t]);return s&&(e.mutation[t]=s),e}const T={query_fetch:(e,{key:t})=>B(e,t,(e=>Object.assign(Object.assign({},e),{isFetching:!0,uninitialized:!1}))),query_resolve:(e,{key:t,data:a})=>B(e,t,(e=>Object.assign(Object.assign({},e),{isFetching:!1,error:void 0,data:a}))),query_reject:(e,{key:t,error:a})=>B(e,t,(e=>Object.assign(Object.assign({},e),{isFetching:!1,error:a}))),mutation_fetch:(e,{key:t})=>E(e,t,(e=>Object.assign(Object.assign({},e),{isFetching:!0}))),mutation_resolve:(e,{key:t})=>E(e,t,(e=>Object.assign(Object.assign({},e),{isFetching:!1,error:void 0}))),mutation_reject:(e,{key:t,error:a})=>E(e,t,(e=>Object.assign(Object.assign({},e),{isFetching:!1,error:a}))),update:(e,{mutation:t})=>t(e),chat_open:(e,{chatId:t})=>Object.assign(Object.assign({},e),{ui:Object.assign(Object.assign({},e.ui),{view:"chat",chatId:t})}),new_chat_open:e=>Object.assign(Object.assign({},e),{ui:Object.assign(Object.assign({},e.ui),{view:"new-chat",chatId:void 0})}),chat_settings_open:(e,{chatId:t})=>Object.assign(Object.assign({},e),{ui:Object.assign(Object.assign({},e.ui),{view:"chat-settings",chatId:t})}),message_received:(e,{message:t,requestId:a})=>{var s;return void 0!==(null===(s=e.query["messages."+t.chatId])||void 0===s?void 0:s.data)&&(e=Object.assign(Object.assign({},e),{query:Object.assign(Object.assign({},e.query),{["messages."+t.chatId]:Object.assign(Object.assign({},e.query["messages."+t.chatId]),{data:[Object.assign({type:"message"},t),...e.query["messages."+t.chatId].data].filter((e=>"sending"!==e.type||e.requestId!==a))})})})),void 0!==e.query["chat-list"].data&&(e=Object.assign(Object.assign({},e),{query:Object.assign(Object.assign({},e.query),{"chat-list":Object.assign(Object.assign({},e.query["chat-list"]),{data:e.query["chat-list"].data.map((e=>e.id===t.chatId?Object.assign(Object.assign({},e),{message:t,unreadCount:t.read?e.unreadCount:e.unreadCount+1}):e))})})})),e},chat_created:(e,{chat:t})=>{var a;return void 0===(null===(a=e.query["chat-list"])||void 0===a?void 0:a.data)?e:Object.assign(Object.assign({},e),{query:Object.assign(Object.assign({},e.query),{"chat-list":Object.assign(Object.assign({},e.query["chat-list"]),{data:[t,...e.query["chat-list"].data]})})})},read:(e,{id:t,timestamp:a})=>Object.assign(Object.assign({},e),{read:Object.assign(Object.assign({},e.read),{queued:[...e.read.queued,t],timestamp:a})}),read_send:(e,{ids:t})=>Object.assign(Object.assign({},e),{read:Object.assign(Object.assign({},e.read),{queued:e.read.queued.filter((e=>!t.includes(e))),sent:[...e.read.sent,...t]})}),read_reject:(e,{ids:t,timestamp:a})=>Object.assign(Object.assign({},e),{read:Object.assign(Object.assign({},e.read),{queued:[...e.read.queued,...t],sent:e.read.sent.filter((e=>!t.includes(e))),timestamp:a})}),read_received:(e,{events:t})=>{var a,s;const n=t.map((e=>e.messageId));e=Object.assign(Object.assign({},e),{query:Object.assign({},e.query),read:Object.assign(Object.assign({},e.read),{sent:e.read.sent.filter((e=>!n.includes(e)))})}),Object.keys(e.query).filter((e=>e.startsWith("messages."))).forEach((t=>{var a;e.query[t]=Object.assign({},e.query[t]);const s=e.query[t];s.data=null===(a=s.data)||void 0===a?void 0:a.map((e=>"message"===e.type&&n.includes(e.id)?Object.assign(Object.assign({},e),{read:!0}):e))})),e.query["chat-list"]=Object.assign({},e.query["chat-list"]);const i=e.query["chat-list"];return i.data=null===(a=i.data)||void 0===a?void 0:a.map((e=>n.includes(e.message.id)?Object.assign(Object.assign({},e),{message:Object.assign(Object.assign({},e.message),{read:!0})}):e)),i.data=null===(s=i.data)||void 0===s?void 0:s.map((e=>Object.assign(Object.assign({},e),{unreadCount:e.unreadCount-t.filter((t=>t.chatId===e.id)).length}))),e},member_added:(e,{chatId:t,account:a})=>{var s;return void 0!==(null===(s=(e=Object.assign(Object.assign({},e),{query:Object.assign({},e.query)})).query["chat."+t])||void 0===s?void 0:s.data)&&(e.query["chat."+t]=Object.assign(Object.assign({},e.query["chat."+t]),{data:Object.assign({},e.query["chat."+t].data)}),e.query["chat."+t].data.members=[...e.query["chat."+t].data.members,a]),e},member_removed:(e,{chatId:t,accountId:a,deleteHistory:s,me:n})=>{var i,c,r,d,o;return void 0!==(null===(i=(e=Object.assign(Object.assign({},e),{query:Object.assign({},e.query)})).query["chat."+t])||void 0===i?void 0:i.data)&&(e.query["chat."+t]=Object.assign(Object.assign({},e.query["chat."+t]),{data:Object.assign({},e.query["chat."+t].data)}),e.query["chat."+t].data.members=e.query["chat."+t].data.members.filter((e=>e.id!==a))),a===n&&s&&(null===(c=e.query["chat-list"])||void 0===c?void 0:c.data)&&(e.query["chat-list"]=Object.assign({},e.query["chat-list"]),e.query["chat-list"].data=e.query["chat-list"].data.filter((e=>e.id!==t))),a===n&&s&&(null===(r=e.query["chat-list"])||void 0===r?void 0:r.data)&&e.ui.chatId===t&&(e.ui=Object.assign(Object.assign({},e.ui),{chatId:null===(o=null===(d=e.query["chat-list"])||void 0===d?void 0:d.data.at(0))||void 0===o?void 0:o.id})),e}},M={ui:{},query:{},mutation:{},read:{queued:[],sent:[],timestamp:0}};function P(){const e=n(M),t=n([]),a=i((a=>{const s=function(e,t){const a=T[t.type](e,t.data);return console.debug("[Chatify]: ",t,a),a}(e.current,a);h(e.current,s)||(e.current=s,t.current.forEach((e=>e(s))))}),[]),s=i((e=>(t.current.push(e),()=>{t.current=t.current.filter((t=>t!==e))})),[]);return[e,a,s]}const H=s.createContext(null);function $({children:t}){const a=P();return e(H.Provider,{value:a,children:t})}function U(){return c(H)[1]}function D(){const[e]=c(H);return e}function z(e,t){const[a,,s]=c(H),i=n(e(a.current)),[o,u]=r(i.current);return d((()=>s((t=>{const a=e(t);h(a,i.current)||(i.current=a,u(a))}))),[]),o}const K=s.createContext(null),Q=s.createContext(null);function G(){return c(Q)}function J(){return c(K)}function W({value:t,children:a}){return e(Q.Provider,{value:t.client,children:e(K.Provider,{value:t.me,children:a})})}const L={uninitialized:!1,isFetching:!0,data:void 0,error:void 0};function V(e,t){return e.query[t]}function X(e){const{key:t,queryFn:a}=e,s=D(),n=U(),i=function(e){return z((t=>V(t,e)))}(e.key);return d((()=>{V(s.current,t)||(n({type:"query_fetch",data:{key:t}}),a().then((e=>n({type:"query_resolve",data:{key:t,data:e}}))).catch((e=>n({type:"query_reject",data:{key:t,error:e}}))))}),[]),null!=i?i:L}function Y(e){const{chatId:t}=e,a=G();return X({key:"chat."+t,queryFn:()=>a.chat(t)})}function Z(){const e=G();return X({key:"chat-list",queryFn:()=>e.chats()})}const ee={isFetching:!1,error:void 0};function te(e){const{key:t,queryFn:a,onQueryStarted:s}=e,n=U(),c=D(),r=z((t=>t.mutation[e.key])),d=i((e=>{n({type:"mutation_fetch",data:{key:t}});const i=a(e);i.then((()=>{n({type:"mutation_resolve",data:{key:t}})})).catch((e=>n({type:"mutation_reject",data:{key:t,error:e}}))),s&&s(e,{promise:i,state:c.current,updateState:e=>{n({type:"update",data:{mutation:e}})}})}),[]);return[d,null!=r?r:ee]}function ae({chatId:e}){const t=D(),a=G();return te({key:"more."+e,queryFn:()=>a.messages({chatId:e,skip:t.current.query["messages."+e].data.filter((e=>"message"===e.type)).length,take:15}),onQueryStarted:(t,{promise:a,updateState:s})=>F(this,void 0,void 0,(function*(){const t=yield a;s((a=>{var s;(a=Object.assign({},a)).query=Object.assign({},a.query),a.query["messages."+e]=Object.assign({},a.query["messages."+e]);const n=a.query["messages."+e];return n.data=null===(s=n.data)||void 0===s?void 0:s.filter((e=>"more"!==e.type)),n.data=[...n.data,...t.map((e=>Object.assign(Object.assign({type:"message"},e),{proceed:!0})))],15===t.length&&(n.data=[...n.data,{type:"more"}]),a}))}))})}function se(e){const{chatId:t}=e,a=G();return X({key:"messages."+t,queryFn:()=>a.messages({chatId:t,skip:0,take:15}).then((e=>{const t=e.map((e=>Object.assign(Object.assign({type:"message"},e),{proceed:!0})));return 15===e.length?[...t,{type:"more"}]:t}))})}function ne(){const e=G(),t=U(),a=J();d((()=>{let s=[];return e.connect().then((()=>{s.push(e.subscribe("chatify://new-message",(([e,a])=>{t({type:"message_received",data:{message:e,requestId:a}})}))),s.push(e.subscribe("chatify://chat-created",(([e,a])=>{t({type:"chat_created",data:{chat:e,requestId:a}})}))),s.push(e.subscribe("chatify://read",(([e])=>{t({type:"read_received",data:{events:e}})}))),s.push(e.subscribe("chatify://member-added",(([e,a])=>{t({type:"member_added",data:{chatId:e,account:a}})}))),s.push(e.subscribe("chatify://member-removed",(([e,s,n])=>{t({type:"member_removed",data:{chatId:e,accountId:s,deleteHistory:n,me:a}})})))})),()=>{s.forEach((e=>e()))}}),[])}function ie(){const e=G();return X({key:"accounts",queryFn:()=>e.accounts()})}function ce(){const e=G();return te({key:"add-chat",queryFn:t=>e.addChat(t)})}function re(){const e=G(),[t,a]=z((e=>[e.read.queued,e.read.timestamp])),s=U(),i=n(null);d((()=>{0!==t.length&&(i.current&&clearTimeout(i.current),i.current=setTimeout((()=>{s({type:"read_send",data:{ids:t}}),e.read({ids:t}).catch((()=>s({type:"read_reject",data:{ids:t,timestamp:(new Date).getTime()}})))}),100))}),[a])}function de(){const e=G();return te({key:"add-member",queryFn:t=>e.addMember(t)})}function oe(){const e=G();return te({key:"remove-member",queryFn:t=>e.removeMember(t)})}const ue=s.createContext(null);function he(){return c(ue)}const le={timestamp:e=>w(e).format("HH:mm"),message:{read:()=>"Read",reading:()=>"Reading...",sending:()=>"Sending..."},addChat:{title:()=>"Add chat",name:{label:()=>"Name",required:()=>"Name is required",max250:()=>"Max 250 characters allowed"},members:{label:()=>"Members",required:()=>"Members is required"},submitBtn:()=>"Submit"},system:{chatCreated:()=>"Chat created"}};function me(e,t){if("chatify://chat-created"===t)return e.system.chatCreated();throw new Error(`Unknown system message ${t}`)}function ge(a){const{text:s,sentAt:n}=a,i=he();return t("div",{className:"wxchtf-system-message",children:[e("div",{className:"wxchtf-text",children:me(i,s)}),e("div",{className:"wxchtf-timestamp",children:i.timestamp(n)})]})}function ye(a){const{chat:s}=a,{name:n,message:i,unreadCount:c}=s,r=he();return t("div",{className:"wxchtf-chat"+(i.read?"":" --unread"),children:[e("div",{className:"wxchtf-chat-name",children:n}),c>0&&e("div",{className:"wxchtf-unread-count",children:c}),t("div",{className:"wxchtf-chat-last",children:["chatify::system"!==i.sentBy.id&&t("div",{className:"wxchtf-chat-last-author",children:[e(m,{src:i.sentBy.avatar})," ",i.sentBy.name]}),e("div",{className:"wxchtf-chat-last-message",children:"chatify::system"===i.sentBy.id?me(r,i.text):i.text})]})]})}function be(){const t=z((e=>e.ui.chatId)),a=U(),s=o((()=>t?[t]:[]),[t]),n=i((e=>a({type:"chat_open",data:{chatId:e.selectedKeys[0]}})),[a]),{data:c}=Z(),r=o((()=>c?c.map((t=>({key:t.id,label:e(ye,{chat:t})}))):[]),[c]);return d((()=>{!t&&c&&c.length>0&&a({type:"chat_open",data:{chatId:c[0].id}})}),[c,a]),e("div",{className:"wxchtf-aside",children:c&&e(l,{className:"wxchtf-chats",selectedKeys:s,onSelect:n,items:r})})}function fe(){return Date.now().toString(36)+Math.random().toString(36).substring(2)}function ve(){const[a,{isFetching:s}]=ce(),{data:n,isFetching:c}=ie(),r=he(),d=o((()=>null==n?void 0:n.map((e=>({value:e.id,label:e.name})))),[n]),u=i((e=>a({name:e.name,members:e.members,requestId:fe()})),[a]);return t("div",{className:"wxchtf-add-chat",children:[e("h3",{children:r.addChat.title()}),t(g,{onFinish:u,layout:"vertical",disabled:s,children:[e(g.Item,{name:"name",label:r.addChat.name.label(),rules:[{required:!0,message:r.addChat.name.required()},{max:250,message:r.addChat.name.max250()}],children:e(y,{})}),e(g.Item,{name:"members",label:r.addChat.members.label(),rules:[{required:!0,message:r.addChat.members.required()}],children:e(b,{mode:"multiple",loading:c,options:d})}),e(f,{loading:s,type:"primary",block:!0,htmlType:"submit",children:r.addChat.submitBtn()})]})]})}function pe(a){var s;const{id:n}=a,{data:c}=Y({chatId:n}),r=z((e=>{var t;return null===(t=e.query["chat-list"].data)||void 0===t?void 0:t.find((e=>e.id===n))})),d=U(),o=i((()=>d({type:"chat_settings_open",data:{chatId:n}})),[d]);return e("div",{className:"wxchtf-chat-header",children:t(v,{justify:"space-between",align:"middle",children:[e(p,{className:"wxchtf-chat-name",children:null!==(s=null==c?void 0:c.name)&&void 0!==s?s:null==r?void 0:r.name}),e(p,{className:"wxchtf-chat-members",children:t(j,{align:"center",children:[(null==c?void 0:c.members)&&e(m.Group,{maxCount:5,children:c.members.map((t=>e(O,{title:t.name,children:e(m,{src:t.avatar,children:t.name})},t.id)))}),e(f,{onClick:o,type:"link",icon:e(I,{})})]})})]})})}const je=s.forwardRef(((a,s)=>{const{author:n,text:i,my:c,read:r,reading:d,sending:o,timestamp:u}=a,h=he();return t("div",{ref:s,className:"wxchtf-message"+(c?" --my":"")+(o?" --sending":""),children:[n&&e("div",{className:"wxchtf-message-author",children:e(m,{src:n.avatar})}),t("div",{className:"wxchtf-message-body",children:[e("div",{className:"wxchtf-message-text",children:i}),t("div",{className:"wxchtf-message-info-box",children:[e("div",{className:"wxchtf-message-sent-at",children:h.timestamp(u)}),void 0!==r&&!c&&e("div",{className:"wxchtf-message-read-box",children:d?h.message.reading():h.message.read()}),o&&e("div",{className:"wxchtf-message-sending-box",children:h.message.sending()})]})]})]})}));function Oe(t){const{message:a}=t,s=J(),i=a.sentBy.id===s,c=U(),r=n(null),u=n(!1),h=z((e=>e.read.queued.includes(a.id))),l=o((()=>new IntersectionObserver((([e])=>{!e.isIntersecting||u.current||a.read||(u.current=!0,c({type:"read",data:{id:a.id,timestamp:(new Date).getTime()}}))}))),[]);return d((()=>(l.observe(r.current),()=>l.disconnect())),[l]),e(je,{ref:r,my:i,text:a.text,files:a.files,author:a.sentBy,timestamp:a.sentAt,read:a.read,sending:!1,reading:h})}function qe(s){const{count:n=1}=s;return e(a,{children:Array.from(Array(n)).map(((a,s)=>t("div",{className:"wxchtf-message-skeleton",children:[e(q.Avatar,{className:"wxchtf-avatar",active:!0}),e(q.Button,{active:!0,className:"wxchtf-content"})]},s)))})}function xe(t){const{chatId:a}=t,[s,{isFetching:i}]=ae({chatId:a}),[c,u]=r(!1),h=n(null),l=o((()=>new IntersectionObserver((([e])=>u((t=>t||e.isIntersecting))))),[]);return d((()=>(l.observe(h.current),()=>l.disconnect())),[l]),d((()=>{c&&s()}),[c]),i?e(qe,{count:4}):e("div",{ref:h})}function we(t){const{text:a,files:s}=t;return e(je,{text:a,files:s,my:!0,sending:!0,timestamp:(new Date).toUTCString()})}function Ie(a){const{id:s}=a,{data:n}=se({chatId:s});return t("div",{className:"wxchtf-chat-body",children:[!n&&e(qe,{count:5}),null==n?void 0:n.map(((t,a)=>{if("message"===t.type&&"chatify::system"===t.sentBy.id)return e(ge,{text:t.text,sentAt:t.sentAt});switch(t.type){case"message":return e(Oe,{message:t},t.id);case"sending":return e(we,{text:t.text,files:t.files},t.requestId);case"more":return e(xe,{chatId:s},a);default:return null}}))]})}function _e(){const a=z((e=>e.ui.chatId)),[s]=function(e){const{chatId:t}=e,a=G();return te({key:"add."+t,queryFn:e=>a.send(Object.assign({chatId:t},e)),onQueryStarted:(e,{updateState:a})=>F(this,void 0,void 0,(function*(){a((a=>{const s=(a=Object.assign(Object.assign({},a),{query:Object.assign(Object.assign({},a.query),{["messages."+t]:Object.assign({},a.query["messages."+t])})})).query["messages."+t];return s.data=[{type:"sending",text:e.text,requestId:e.requestId,files:e.files},...s.data],a}))}))})}({chatId:a}),[n,c]=r(""),d=i((()=>{c(""),s({text:n,files:[],requestId:fe()})}),[a,n]);return e("div",{className:"wxchtf-input-form",children:t("div",{className:"wxchtf-input-box",children:[e("div",{className:"wxchtf-add-files-box",children:e(f,{type:"link",icon:e(N,{}),className:"wxchtf-add-files-btn"})}),e("div",{className:"wxchtf-text-input-box",children:e(y.TextArea,{value:n,onChange:e=>c(e.target.value),autoSize:{maxRows:5},className:"wxchtf-text-input-textarea",placeholder:"Start typing (Ctrl/⌘Cmd + Enter to send) ...",onKeyDown:e=>{C("ctrl+enter")(e)&&d()}})}),e("div",{className:"wxchtf-submit-btn-box",children:e(f,{onClick:d,type:"link",icon:e(k,{}),className:"wxchtf-submit-btn"})})]})})}function ke(s){const{id:n}=s,i=J(),{data:c}=Y({chatId:n}),r=!0===(null==c?void 0:c.members.map((e=>e.id)).includes(i));return t(a,{children:[t("div",{className:"wxchtf-chat",children:[e(pe,{id:n}),e(Ie,{id:n})]}),r&&e(_e,{})]})}function Ne(a){const{account:s,chatId:n}=a,[c]=oe(),r=i((()=>c({chatId:n,accountId:s.id,deleteHistory:!0})),[c,n,s.id]);return t(x.Item,{children:[s.name," ",e(f,{onClick:r,type:"link",icon:e(_,{})})]})}function Ce(){const[a]=z((e=>[e.ui.chatId])),{data:s}=Y({chatId:a}),[n]=de(),{data:c}=ie(),r=o((()=>null==c?void 0:c.map((e=>({value:e.id,label:e.name})))),[c]),d=i((e=>n({chatId:a,accountId:e,withHistory:!0})),[n,a]);return s?t("div",{className:"wxchtf-chat-settings",children:[t(v,{justify:"space-between",children:[e(p,{children:e("h3",{className:"wxchtf-title",children:s.name})}),e(p,{children:e(f,{type:"link",icon:e(_,{})})})]}),e("h4",{children:"Members"}),e(x,{dataSource:s.members,rowKey:"id",renderItem:t=>e(Ne,{account:t,chatId:a})}),e(b,{style:{width:"350px"},options:r,value:null,onSelect:d})]}):null}function Fe(){const{view:a,chatId:s}=z((e=>({view:e.ui.view,chatId:e.ui.chatId})));return t("div",{className:"wxchtf-main",children:["chat"===a&&s&&e(ke,{id:s},s),"new-chat"===a&&e(ve,{}),"chat-settings"===a&&e(Ce,{})]})}function Se(a){const{className:s="",style:n}=a;ne(),re();const c=U(),r=i((()=>c({type:"new_chat_open",data:void 0})),[c]);return t("div",{className:s+" wxchtf-chatify",style:n,children:[e("div",{className:"wxchtf-header",children:e(f,{onClick:r,icon:"+",type:"link",children:"Add chat"})}),t("div",{className:"wxchtf-body",children:[e(be,{}),e(Fe,{})]}),e("div",{className:"wxchtf-footer"})]})}function Re(t){const{localizer:a=le}=t;return e(ue.Provider,{value:a,children:e($,{children:e(Se,Object.assign({},t))})})}export{T as ACTIONS,Re as Chatify,A as ChatifyClient,W as ChatifyContext,ue as LocalizerContext,$ as ReducerProvider,le as defaultLocalizer,ie as useAccounts,ce as useAddChat,de as useAddMember,Y as useChat,Z as useChatList,G as useClient,U as useDispatch,ae as useLoadMore,he as useLocalizer,J as useMe,se as useMessages,re as useReadMonitor,P as useReducer,oe as useRemoveMember,z as useSelect,ne as useSignalR,D as useStateRef};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../node_modules/tslib/tslib.es6.js","../../src/core/client.ts","../../src/core/action.tsx","../../src/core/state.ts","../../src/core/reducer.tsx","../../src/ChatifyContext.tsx","../../src/core/useQuery.tsx","../../src/core/useChat.tsx","../../src/core/useChatList.tsx","../../src/core/useMutation.tsx","../../src/core/useLoadMore.tsx","../../src/core/useMessages.tsx","../../src/core/useSignalR.tsx","../../src/core/useAccounts.tsx","../../src/core/useAddChat.tsx","../../src/core/useReadMonitor.tsx","../../src/core/useAddMember.tsx","../../src/core/useRemoveMember.tsx","../../src/ui/localizer.tsx","../../src/ui/SystemMessage.tsx","../../src/ui/Aside.tsx","../../src/util/uniqId.tsx","../../src/ui/AddChat.tsx","../../src/ui/ChatHeader.tsx","../../src/ui/MessageMd.tsx","../../src/ui/Message.tsx","../../src/ui/MessageSkeleton.tsx","../../src/ui/LoadMore.tsx","../../src/ui/SendingMessage.tsx","../../src/ui/ChatBody.tsx","../../src/ui/InputForm.tsx","../../src/core/useAddMessage.tsx","../../src/ui/Chat.tsx","../../src/ui/ChatSettings.tsx","../../src/ui/Main.tsx","../../src/ui/Chatify.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","SuppressedError","DEFAULT_SIGNALR_CONFIG","hubUri","headersFactory","METHODS","ChatifyClient","constructor","config","this","_connection","_subscribers","_reconnectSubscribers","connect","headers","_config","signalR","SignalR","HubConnectionBuilder","withUrl","accessTokenFactory","undefined","withAutomaticReconnect","build","forEach","x","on","args","_a","s","onreconnected","subscriber","start","subscribe","method","push","filter","subscribeReconnect","accounts","data","axios","get","chats","chat","id","addChat","post","messages","chatId","skip","take","pagingRule","encodeURIComponent","JSON","stringify","send","request","rest","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","__rest","read","put","removeMember","delete","addMember","assign","updateQuery","state","key","mutation","query","updateMutation","ACTIONS","query_fetch","isFetching","uninitialized","query_resolve","error","query_reject","mutation_fetch","mutation_resolve","mutation_reject","update","chat_open","ui","view","new_chat_open","chat_settings_open","message_received","message","requestId","type","map","unreadCount","chat_created","timestamp","queued","read_send","ids","includes","sent","read_reject","read_received","events","messageId","keys","startsWith","queryState","chatListState","_b","member_added","account","members","member_removed","accountId","deleteHistory","me","_c","_e","_d","at","INITIAL_STATE","useReducer","useRef","subscribers","dispatch","useCallback","action","newState","console","debug","reducer","current","shallowEqual","ReducerContext","React","createContext","ReducerProvider","children","_jsx","Provider","useDispatch","useContext","useStateRef","reducerState","useSelect","select","deps","prev","setState","useState","useEffect","newValue","MeContext","ClientContext","useClient","useMe","ChatifyContext","client","INITIAL_QUERY_STATE","useQuery","queryFn","useQueryState","catch","useChat","useChatList","INITIAL_MUTATION_STATE","useMutation","onQueryStarted","mutationState","invoke","promise","updateState","useLoadMore","_","proceed","useMessages","useSignalR","unsubscribes","useAccounts","useAddChat","useReadMonitor","timer","clearTimeout","setTimeout","Date","getTime","useAddMember","useRemoveMember","LocalizerContext","useLocalizer","defaultLocalizer","dayjs","format","reading","sending","title","name","label","required","max250","submitBtn","system","chatCreated","formatSystemMessage","localizer","text","Error","SystemMessage","props","sentAt","_jsxs","className","Chat","sentBy","Avatar","src","avatar","Aside","activeChatId","selected","useMemo","onSelect","info","selectedKeys","items","Menu","uniqId","now","toString","Math","random","substring","AddChat","add","adding","options","onSubmit","Form","onFinish","layout","disabled","Item","rules","max","Input","Select","mode","loading","Button","block","htmlType","ChatHeader","chatListItem","find","onSettingsClick","Row","justify","align","Col","Space","Group","maxCount","Tooltip","onClick","icon","SettingOutlined","MessageMd","forwardRef","author","my","ref","Message","readRef","observer","IntersectionObserver","entry","isIntersecting","observe","disconnect","files","MessageSkeleton","count","_Fragment","Array","from","index","Skeleton","active","LoadMore","loadMore","intersecting","setIntersecting","SendingMessage","toUTCString","ChatBody","InputForm","useAddMessage","setText","onSend","FileAddOutlined","TextArea","onChange","target","autoSize","maxRows","placeholder","onKeyDown","event","isHotkey","SendOutlined","isMember","Member","remove","onRemoveClick","List","CloseOutlined","ChatSettings","accountOptions","onAdd","withHistory","dataSource","rowKey","renderItem","style","width","Main","Content","onAddChat","Chatify"],"mappings":"0mBAkHO,SAASA,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKN,EAAUO,KAAKF,GAAQ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,CAAAC,UAAU,cACb1E,SAAA,CAAAC,EAAC+E,GAAK,CAAA,GACN/E,EAAC2L,GAAO,CAAA,MAEV3L,EAAA,MAAA,CAAKyE,UAAU,oBAGrB,CAEM,SAAUqH,GAAQxH,GACtB,MAAMJ,UAAEA,EAAYd,IAAqBkB,EAEzC,OACEtE,EAACkD,GAAiBjD,SAAS,CAAA9J,MAAO+N,EAASnE,SACzCC,EAACF,EAAe,CAAAC,SACdC,EAAC4L,GAAOrR,OAAAe,OAAA,CAAA,EAAKgJ,OAIrB","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ChatifyClient } from './core';
|
|
3
|
+
export declare function useClient(): ChatifyClient;
|
|
4
|
+
export declare function useMe(): string;
|
|
5
|
+
export interface ChatifyContextValue {
|
|
6
|
+
me: string;
|
|
7
|
+
client: ChatifyClient;
|
|
8
|
+
}
|
|
9
|
+
export declare function ChatifyContext({ value, children }: PropsWithChildren<{
|
|
10
|
+
value: ChatifyContextValue;
|
|
11
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { State } from './state';
|
|
2
|
+
import { Account, ChatListItem, Message, ReadEvent } from './models';
|
|
3
|
+
export declare const ACTIONS: {
|
|
4
|
+
query_fetch: (state: State, { key }: {
|
|
5
|
+
key: string;
|
|
6
|
+
}) => State;
|
|
7
|
+
query_resolve: (state: State, { key, data }: {
|
|
8
|
+
key: string;
|
|
9
|
+
data: any[];
|
|
10
|
+
}) => State;
|
|
11
|
+
query_reject: (state: State, { key, error }: {
|
|
12
|
+
key: string;
|
|
13
|
+
error: any;
|
|
14
|
+
}) => State;
|
|
15
|
+
mutation_fetch: (state: State, { key }: {
|
|
16
|
+
key: string;
|
|
17
|
+
}) => State;
|
|
18
|
+
mutation_resolve: (state: State, { key }: {
|
|
19
|
+
key: string;
|
|
20
|
+
}) => State;
|
|
21
|
+
mutation_reject: (state: State, { key, error }: {
|
|
22
|
+
key: string;
|
|
23
|
+
error: any;
|
|
24
|
+
}) => State;
|
|
25
|
+
update: (state: State, { mutation }: {
|
|
26
|
+
mutation: (state: State) => State;
|
|
27
|
+
}) => State;
|
|
28
|
+
chat_open: (state: State, { chatId }: {
|
|
29
|
+
chatId: string;
|
|
30
|
+
}) => State;
|
|
31
|
+
new_chat_open: (state: State) => State;
|
|
32
|
+
chat_settings_open: (state: State, { chatId }: {
|
|
33
|
+
chatId: string;
|
|
34
|
+
}) => State;
|
|
35
|
+
message_received: (state: State, { message, requestId }: {
|
|
36
|
+
message: Message;
|
|
37
|
+
requestId: string;
|
|
38
|
+
}) => State;
|
|
39
|
+
chat_created: (state: State, { chat }: {
|
|
40
|
+
chat: ChatListItem;
|
|
41
|
+
requestId?: string | undefined;
|
|
42
|
+
}) => State;
|
|
43
|
+
read: (state: State, { id, timestamp }: {
|
|
44
|
+
id: string;
|
|
45
|
+
timestamp: number;
|
|
46
|
+
}) => State;
|
|
47
|
+
read_send: (state: State, { ids }: {
|
|
48
|
+
ids: string[];
|
|
49
|
+
}) => State;
|
|
50
|
+
read_reject: (state: State, { ids, timestamp }: {
|
|
51
|
+
ids: string[];
|
|
52
|
+
timestamp: number;
|
|
53
|
+
}) => State;
|
|
54
|
+
read_received: (state: State, { events }: {
|
|
55
|
+
events: ReadEvent[];
|
|
56
|
+
}) => State;
|
|
57
|
+
member_added: (state: State, { chatId, account }: {
|
|
58
|
+
chatId: string;
|
|
59
|
+
account: Account;
|
|
60
|
+
}) => State;
|
|
61
|
+
member_removed: (state: State, { chatId, accountId, deleteHistory, me, }: {
|
|
62
|
+
chatId: string;
|
|
63
|
+
accountId: string;
|
|
64
|
+
deleteHistory: boolean;
|
|
65
|
+
me: string;
|
|
66
|
+
}) => State;
|
|
67
|
+
};
|
|
68
|
+
export type Action = {
|
|
69
|
+
[K in keyof typeof ACTIONS]: {
|
|
70
|
+
type: K;
|
|
71
|
+
data: Parameters<(typeof ACTIONS)[K]>[1];
|
|
72
|
+
};
|
|
73
|
+
}[keyof typeof ACTIONS];
|