@webinex/chatify 1.0.0-alpha07 → 1.0.0-rc1
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 +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/core/action.d.ts +4 -1
- package/dist/cjs/types/core/models.d.ts +2 -2
- package/dist/cjs/types/ui/Chatify.d.ts +6 -4
- package/dist/cjs/types/ui/Icon.d.ts +7 -0
- package/dist/cjs/types/ui/Message.d.ts +1 -1
- package/dist/cjs/types/ui/SendingMessage.d.ts +1 -1
- package/dist/cjs/types/ui/index.d.ts +1 -0
- package/dist/cjs/types/ui/localizer.d.ts +4 -0
- package/dist/css/chatify.css +56 -60
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/core/action.d.ts +4 -1
- package/dist/esm/types/core/models.d.ts +2 -2
- package/dist/esm/types/ui/Chatify.d.ts +6 -4
- package/dist/esm/types/ui/Icon.d.ts +7 -0
- package/dist/esm/types/ui/Message.d.ts +1 -1
- package/dist/esm/types/ui/SendingMessage.d.ts +1 -1
- package/dist/esm/types/ui/index.d.ts +1 -0
- package/dist/esm/types/ui/localizer.d.ts +4 -0
- package/dist/index.d.ts +23 -8
- package/package.json +90 -90
- package/src/ChatifyContext.tsx +41 -41
- package/src/core/action.tsx +319 -282
- package/src/core/client.ts +137 -137
- package/src/core/index.ts +14 -14
- package/src/core/models.tsx +75 -75
- package/src/core/reducer.tsx +86 -86
- package/src/core/state.ts +38 -38
- package/src/core/useAccounts.tsx +11 -11
- package/src/core/useAddChat.tsx +12 -12
- package/src/core/useAddMember.tsx +12 -12
- package/src/core/useAddMessage.tsx +40 -40
- package/src/core/useChat.tsx +12 -12
- package/src/core/useChatList.tsx +10 -10
- package/src/core/useLoadMore.tsx +42 -42
- package/src/core/useMessages.tsx +23 -23
- package/src/core/useMutation.tsx +48 -48
- package/src/core/useQuery.tsx +45 -45
- package/src/core/useReadMonitor.tsx +31 -31
- package/src/core/useRemoveMember.tsx +12 -12
- package/src/core/useSignalRMonitor.tsx +52 -49
- package/src/index.ts +3 -3
- package/src/ui/AddChat.tsx +55 -55
- package/src/ui/AddChatButton.tsx +19 -19
- package/src/ui/Aside.tsx +41 -41
- package/src/ui/Avatar.tsx +18 -18
- package/src/ui/Chat.tsx +26 -26
- package/src/ui/ChatBody.tsx +43 -43
- package/src/ui/ChatHeader.tsx +33 -33
- package/src/ui/ChatHeaderMembers.tsx +30 -30
- package/src/ui/ChatHeaderSettingsButton.tsx +26 -26
- package/src/ui/ChatListItem.tsx +101 -101
- package/src/ui/ChatName.tsx +15 -15
- package/src/ui/ChatSettings.tsx +59 -59
- package/src/ui/Chatify.tsx +104 -102
- package/src/ui/Footer.tsx +7 -7
- package/src/ui/Header.tsx +14 -14
- package/src/ui/Icon.tsx +21 -0
- package/src/ui/InputForm.tsx +51 -48
- package/src/ui/LoadMore.tsx +40 -40
- package/src/ui/Main.tsx +16 -16
- package/src/ui/Message.tsx +118 -118
- package/src/ui/MessageSkeleton.tsx +19 -19
- package/src/ui/SendingMessage.tsx +50 -50
- package/src/ui/SystemMessage.tsx +30 -26
- package/src/ui/index.ts +11 -10
- package/src/ui/localizer.tsx +68 -58
- package/src/ui/styles/aside.scss +94 -94
- package/src/ui/styles/index.scss +248 -252
- package/src/ui/styles/keyframes.scss +14 -14
- package/src/ui/styles/mixins.scss +20 -20
- package/src/ui/styles/variables.scss +10 -10
- package/src/util/customize.tsx +45 -45
- package/src/util/index.ts +3 -3
- package/src/util/uniqBy.tsx +17 -17
- package/src/util/uniqId.tsx +3 -3
|
@@ -35,14 +35,14 @@ export interface SendMessageRequest {
|
|
|
35
35
|
files: File[];
|
|
36
36
|
requestId: string;
|
|
37
37
|
}
|
|
38
|
-
export interface
|
|
38
|
+
export interface MessageBody {
|
|
39
39
|
text: string;
|
|
40
40
|
files: File[];
|
|
41
41
|
}
|
|
42
42
|
export interface AddChatRequest {
|
|
43
43
|
requestId: string;
|
|
44
44
|
name: string;
|
|
45
|
-
message?:
|
|
45
|
+
message?: MessageBody;
|
|
46
46
|
members: string[];
|
|
47
47
|
}
|
|
48
48
|
export interface ReadRequest {
|
|
@@ -8,8 +8,9 @@ import { AddChatButton } from './AddChatButton';
|
|
|
8
8
|
import { Footer } from './Footer';
|
|
9
9
|
import { ChatName } from './ChatName';
|
|
10
10
|
import { ChatListItemBox, ChatListItemLastMessage, ChatListItemLastMessageAuthor, ChatListItemLastMessageContent, ChatListItemName, ChatListItemUnreadCount } from './ChatListItem';
|
|
11
|
-
import { SendingMessage,
|
|
12
|
-
import { MessageAuthor,
|
|
11
|
+
import { SendingMessage, SendingMessageContent, SendingMessageInfoBox, SendingMessageText } from './SendingMessage';
|
|
12
|
+
import { MessageAuthor, MessageContent, MessageBox, MessageInfoBox, MessageReadObserver, MessageRow, MessageText } from './Message';
|
|
13
|
+
import { Icon } from './Icon';
|
|
13
14
|
export interface ChatifyCustomizeValue {
|
|
14
15
|
Avatar?: typeof Avatar.Component | null;
|
|
15
16
|
Header?: typeof Header.Component | null;
|
|
@@ -25,16 +26,17 @@ export interface ChatifyCustomizeValue {
|
|
|
25
26
|
ChatListItemLastMessageAuthor?: typeof ChatListItemLastMessageAuthor.Component | null;
|
|
26
27
|
ChatListItemLastMessageContent?: typeof ChatListItemLastMessageContent.Component | null;
|
|
27
28
|
SendingMessage?: typeof SendingMessage.Component | null;
|
|
28
|
-
SendingMessageBody?: typeof
|
|
29
|
+
SendingMessageBody?: typeof SendingMessageContent.Component | null;
|
|
29
30
|
SendingMessageInfoBox?: typeof SendingMessageInfoBox.Component | null;
|
|
30
31
|
SendingMessageText?: typeof SendingMessageText.Component | null;
|
|
31
32
|
MessageBox?: typeof MessageBox.Component | null;
|
|
32
33
|
MessageReadObserver?: typeof MessageReadObserver.Component | null;
|
|
33
34
|
MessageRow?: typeof MessageRow.Component | null;
|
|
34
|
-
MessageBody?: typeof
|
|
35
|
+
MessageBody?: typeof MessageContent.Component | null;
|
|
35
36
|
MessageInfoBox?: typeof MessageInfoBox.Component | null;
|
|
36
37
|
MessageText?: typeof MessageText.Component | null;
|
|
37
38
|
MessageAuthor?: typeof MessageAuthor.Component | null;
|
|
39
|
+
Icon?: typeof Icon.Component | null;
|
|
38
40
|
}
|
|
39
41
|
export interface ChatifyProps {
|
|
40
42
|
className?: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export type IconType = 'attach' | 'send';
|
|
3
|
+
export interface IconProps {
|
|
4
|
+
type: IconType;
|
|
5
|
+
}
|
|
6
|
+
export declare const ICONS: Record<IconType, React.ComponentType>;
|
|
7
|
+
export declare const Icon: import("../util").Customizable<FC<IconProps>, string>;
|
|
@@ -9,7 +9,7 @@ export interface MessageRowProps extends MessageBoxProps {
|
|
|
9
9
|
export declare const MessageAuthor: import("../util").Customizable<FC<MessageBoxProps>, string>;
|
|
10
10
|
export declare const MessageText: import("../util").Customizable<FC<MessageBoxProps>, string>;
|
|
11
11
|
export declare const MessageInfoBox: import("../util").Customizable<FC<MessageBoxProps>, string>;
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const MessageContent: import("../util").Customizable<FC<MessageBoxProps>, string>;
|
|
13
13
|
export declare const MessageRow: import("../util").Customizable<FC<MessageRowProps>, string>;
|
|
14
14
|
export declare const MessageBox: import("../util").Customizable<FC<MessageBoxProps>, string>;
|
|
15
15
|
export interface MessageReadObserverProps extends MessageBoxProps {
|
|
@@ -6,5 +6,5 @@ export interface SendingMessageProps {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const SendingMessageText: import("../util").Customizable<FC<SendingMessageProps>, string>;
|
|
8
8
|
export declare const SendingMessageInfoBox: import("../util").Customizable<FC<SendingMessageProps>, string>;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const SendingMessageContent: import("../util").Customizable<FC<SendingMessageProps>, string>;
|
|
10
10
|
export declare const SendingMessage: import("../util").Customizable<FC<SendingMessageProps>, string>;
|
|
@@ -3,6 +3,7 @@ export interface Localizer {
|
|
|
3
3
|
timestamp: (value: string) => string;
|
|
4
4
|
system: {
|
|
5
5
|
chatCreated: () => string;
|
|
6
|
+
memberAdded: () => string;
|
|
6
7
|
};
|
|
7
8
|
message: {
|
|
8
9
|
read: () => React.ReactNode;
|
|
@@ -22,6 +23,9 @@ export interface Localizer {
|
|
|
22
23
|
};
|
|
23
24
|
submitBtn: () => React.ReactNode;
|
|
24
25
|
};
|
|
26
|
+
input: {
|
|
27
|
+
placeholder: () => string;
|
|
28
|
+
};
|
|
25
29
|
}
|
|
26
30
|
export declare const LocalizerContext: React.Context<Localizer>;
|
|
27
31
|
export declare function useLocalizer(): Localizer;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ interface Localizer {
|
|
|
7
7
|
timestamp: (value: string) => string;
|
|
8
8
|
system: {
|
|
9
9
|
chatCreated: () => string;
|
|
10
|
+
memberAdded: () => string;
|
|
10
11
|
};
|
|
11
12
|
message: {
|
|
12
13
|
read: () => React$1.ReactNode;
|
|
@@ -26,6 +27,9 @@ interface Localizer {
|
|
|
26
27
|
};
|
|
27
28
|
submitBtn: () => React$1.ReactNode;
|
|
28
29
|
};
|
|
30
|
+
input: {
|
|
31
|
+
placeholder: () => string;
|
|
32
|
+
};
|
|
29
33
|
}
|
|
30
34
|
declare const LocalizerContext: React$1.Context<Localizer>;
|
|
31
35
|
declare function useLocalizer(): Localizer;
|
|
@@ -73,14 +77,14 @@ interface SendMessageRequest {
|
|
|
73
77
|
files: File[];
|
|
74
78
|
requestId: string;
|
|
75
79
|
}
|
|
76
|
-
interface
|
|
80
|
+
interface MessageBody {
|
|
77
81
|
text: string;
|
|
78
82
|
files: File[];
|
|
79
83
|
}
|
|
80
84
|
interface AddChatRequest {
|
|
81
85
|
requestId: string;
|
|
82
86
|
name: string;
|
|
83
|
-
message?:
|
|
87
|
+
message?: MessageBody;
|
|
84
88
|
members: string[];
|
|
85
89
|
}
|
|
86
90
|
interface ReadRequest {
|
|
@@ -214,9 +218,12 @@ declare const ACTIONS: {
|
|
|
214
218
|
read_received: (state: State, { events }: {
|
|
215
219
|
events: ReadEvent[];
|
|
216
220
|
}) => State;
|
|
217
|
-
member_added: (state: State, { chatId, account }: {
|
|
221
|
+
member_added: (state: State, { chatId, chatName, account, me, message, }: {
|
|
218
222
|
chatId: string;
|
|
223
|
+
chatName: string;
|
|
219
224
|
account: Account;
|
|
225
|
+
me: string;
|
|
226
|
+
message: Message;
|
|
220
227
|
}) => State;
|
|
221
228
|
member_removed: (state: State, { chatId, accountId, deleteHistory, me, }: {
|
|
222
229
|
chatId: string;
|
|
@@ -318,7 +325,7 @@ interface SendingMessageProps {
|
|
|
318
325
|
}
|
|
319
326
|
declare const SendingMessageText: Customizable<FC<SendingMessageProps>, string>;
|
|
320
327
|
declare const SendingMessageInfoBox: Customizable<FC<SendingMessageProps>, string>;
|
|
321
|
-
declare const
|
|
328
|
+
declare const SendingMessageContent: Customizable<FC<SendingMessageProps>, string>;
|
|
322
329
|
declare const SendingMessage: Customizable<FC<SendingMessageProps>, string>;
|
|
323
330
|
|
|
324
331
|
interface MessageBoxProps {
|
|
@@ -330,7 +337,7 @@ interface MessageRowProps extends MessageBoxProps {
|
|
|
330
337
|
declare const MessageAuthor: Customizable<FC<MessageBoxProps>, string>;
|
|
331
338
|
declare const MessageText: Customizable<FC<MessageBoxProps>, string>;
|
|
332
339
|
declare const MessageInfoBox: Customizable<FC<MessageBoxProps>, string>;
|
|
333
|
-
declare const
|
|
340
|
+
declare const MessageContent: Customizable<FC<MessageBoxProps>, string>;
|
|
334
341
|
declare const MessageRow: Customizable<FC<MessageRowProps>, string>;
|
|
335
342
|
declare const MessageBox: Customizable<FC<MessageBoxProps>, string>;
|
|
336
343
|
interface MessageReadObserverProps extends MessageBoxProps {
|
|
@@ -338,6 +345,13 @@ interface MessageReadObserverProps extends MessageBoxProps {
|
|
|
338
345
|
}
|
|
339
346
|
declare const MessageReadObserver: Customizable<FC<MessageReadObserverProps>, string>;
|
|
340
347
|
|
|
348
|
+
type IconType = 'attach' | 'send';
|
|
349
|
+
interface IconProps {
|
|
350
|
+
type: IconType;
|
|
351
|
+
}
|
|
352
|
+
declare const ICONS: Record<IconType, React.ComponentType>;
|
|
353
|
+
declare const Icon: Customizable<FC<IconProps>, string>;
|
|
354
|
+
|
|
341
355
|
interface ChatifyCustomizeValue {
|
|
342
356
|
Avatar?: typeof Avatar.Component | null;
|
|
343
357
|
Header?: typeof Header.Component | null;
|
|
@@ -353,16 +367,17 @@ interface ChatifyCustomizeValue {
|
|
|
353
367
|
ChatListItemLastMessageAuthor?: typeof ChatListItemLastMessageAuthor.Component | null;
|
|
354
368
|
ChatListItemLastMessageContent?: typeof ChatListItemLastMessageContent.Component | null;
|
|
355
369
|
SendingMessage?: typeof SendingMessage.Component | null;
|
|
356
|
-
SendingMessageBody?: typeof
|
|
370
|
+
SendingMessageBody?: typeof SendingMessageContent.Component | null;
|
|
357
371
|
SendingMessageInfoBox?: typeof SendingMessageInfoBox.Component | null;
|
|
358
372
|
SendingMessageText?: typeof SendingMessageText.Component | null;
|
|
359
373
|
MessageBox?: typeof MessageBox.Component | null;
|
|
360
374
|
MessageReadObserver?: typeof MessageReadObserver.Component | null;
|
|
361
375
|
MessageRow?: typeof MessageRow.Component | null;
|
|
362
|
-
MessageBody?: typeof
|
|
376
|
+
MessageBody?: typeof MessageContent.Component | null;
|
|
363
377
|
MessageInfoBox?: typeof MessageInfoBox.Component | null;
|
|
364
378
|
MessageText?: typeof MessageText.Component | null;
|
|
365
379
|
MessageAuthor?: typeof MessageAuthor.Component | null;
|
|
380
|
+
Icon?: typeof Icon.Component | null;
|
|
366
381
|
}
|
|
367
382
|
interface ChatifyProps {
|
|
368
383
|
className?: string;
|
|
@@ -394,4 +409,4 @@ declare function ChatifyContext({ value, children }: PropsWithChildren<{
|
|
|
394
409
|
value: ChatifyContextValue;
|
|
395
410
|
}>): react_jsx_runtime.JSX.Element;
|
|
396
411
|
|
|
397
|
-
export { ACTIONS, Account, Action, AddChatButton, AddChatRequest, AddMemberRequest, Avatar, AvatarProps, Chat, ChatHeader, ChatHeaderMembers, ChatHeaderMembersProps, ChatHeaderProps, ChatListItem, ChatListItemBox, ChatListItemBoxProps, ChatListItemLastMessage, ChatListItemLastMessageAuthor, ChatListItemLastMessageContent, ChatListItemName, ChatListItemUnreadCount, Chatify, ChatifyClient, ChatifyClientConfig, ChatifyContext, ChatifyContextValue, ChatifyCustomizeValue, ChatifyProps, ChatifySignalRConfig, File, Header, Localizer, LocalizerContext, Message, MessageAuthor, MessageBody, MessageBox, MessageBoxProps, MessageContent, MessageInfoBox, MessageReadObserver, MessageReadObserverProps, MessageRow, MessageRowProps, MessageState, MessageText, ReadEvent, ReadRequest, Reducer, ReducerProvider, RemoveMemberRequest, SendMessageRequest, SystemMessage, SystemMessageProps, defaultLocalizer, formatSystemMessage, useAccounts, useAddChat, useAddMember, useChat, useChatList, useClient, useDispatch, useLoadMore, useLocalizer, useMe, useMessages, useReadMonitor, useReducer, useRemoveMember, useSelect, useSignalRMonitor, useStateRef };
|
|
412
|
+
export { ACTIONS, Account, Action, AddChatButton, AddChatRequest, AddMemberRequest, Avatar, AvatarProps, Chat, ChatHeader, ChatHeaderMembers, ChatHeaderMembersProps, ChatHeaderProps, ChatListItem, ChatListItemBox, ChatListItemBoxProps, ChatListItemLastMessage, ChatListItemLastMessageAuthor, ChatListItemLastMessageContent, ChatListItemName, ChatListItemUnreadCount, Chatify, ChatifyClient, ChatifyClientConfig, ChatifyContext, ChatifyContextValue, ChatifyCustomizeValue, ChatifyProps, ChatifySignalRConfig, File, Header, ICONS, Icon, IconProps, IconType, Localizer, LocalizerContext, Message, MessageAuthor, MessageBody, MessageBox, MessageBoxProps, MessageContent, MessageInfoBox, MessageReadObserver, MessageReadObserverProps, MessageRow, MessageRowProps, MessageState, MessageText, ReadEvent, ReadRequest, Reducer, ReducerProvider, RemoveMemberRequest, SendMessageRequest, SystemMessage, SystemMessageProps, defaultLocalizer, formatSystemMessage, useAccounts, useAddChat, useAddMember, useChat, useChatList, useClient, useDispatch, useLoadMore, useLocalizer, useMe, useMessages, useReadMonitor, useReducer, useRemoveMember, useSelect, useSignalRMonitor, useStateRef };
|
package/package.json
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@webinex/chatify",
|
|
3
|
-
"description": "Webinex Wispo",
|
|
4
|
-
"private": false,
|
|
5
|
-
"version": "1.0.0-
|
|
6
|
-
"author": "Webinex Dev",
|
|
7
|
-
"license": "Apache-2.0",
|
|
8
|
-
"main": "dist/cjs/index.js",
|
|
9
|
-
"module": "dist/esm/index.js",
|
|
10
|
-
"types": "dist/index.d.ts",
|
|
11
|
-
"type": "module",
|
|
12
|
-
"targets": {
|
|
13
|
-
"demo": {
|
|
14
|
-
"source": "./example/index.html",
|
|
15
|
-
"isLibrary": false
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"dist",
|
|
20
|
-
"src"
|
|
21
|
-
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "rimraf dist && rimraf add && rollup -c --environment ENV:production --failAfterWarnings",
|
|
24
|
-
"start": "rollup -c -w",
|
|
25
|
-
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
26
|
-
"prettier:write": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
27
|
-
"prettier:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
28
|
-
"parcel": "parcel --target demo --dist-dir ./dist/demo",
|
|
29
|
-
"parcel:build": "rimraf ../Webinex.Chatify.Example/wwwroot && cross-env NODE_ENV=production parcel build --target demo --dist-dir ../Webinex.Chatify.Example/wwwroot"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@microsoft/signalr": "^8.0.0",
|
|
33
|
-
"@parcel/transformer-sass": "2.9.2",
|
|
34
|
-
"@rollup/plugin-commonjs": "^24.0.1",
|
|
35
|
-
"@rollup/plugin-eslint": "^9.0.3",
|
|
36
|
-
"@rollup/plugin-image": "^3.0.2",
|
|
37
|
-
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
38
|
-
"@rollup/plugin-typescript": "^11.1.0",
|
|
39
|
-
"@types/react": "^18.0.33",
|
|
40
|
-
"@types/react-dom": "^18.0.11",
|
|
41
|
-
"antd": "^5.11.5",
|
|
42
|
-
"axios": "^1.6.2",
|
|
43
|
-
"buffer": "^5.5.0||^6.0.0",
|
|
44
|
-
"classnames": "^2.3.2",
|
|
45
|
-
"cross-env": "^7.0.3",
|
|
46
|
-
"dayjs": "^1.11.7",
|
|
47
|
-
"eslint": "^8.38.0",
|
|
48
|
-
"eslint-config-react-app": "^7.0.1",
|
|
49
|
-
"is-hotkey": "^0.2.0",
|
|
50
|
-
"parcel": "^2.10.3",
|
|
51
|
-
"postcss": "^8.4.21",
|
|
52
|
-
"prettier": "^2.8.7",
|
|
53
|
-
"process": "^0.11.10",
|
|
54
|
-
"react": "^18.2.0",
|
|
55
|
-
"react-dom": "^18.2.0",
|
|
56
|
-
"rimraf": "^5.0.5",
|
|
57
|
-
"rollup": "^3.20.2",
|
|
58
|
-
"rollup-plugin-copy": "^3.4.0",
|
|
59
|
-
"rollup-plugin-dts": "^5.3.0",
|
|
60
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
61
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
62
|
-
"rollup-plugin-scss": "^4.0.0",
|
|
63
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
64
|
-
"rollup-plugin-visualizer": "^5.11.0",
|
|
65
|
-
"sass": "^1.66.1",
|
|
66
|
-
"shallow-equal": "^3.1.0",
|
|
67
|
-
"slate": "^0.94.1",
|
|
68
|
-
"slate-history": "^0.93.0",
|
|
69
|
-
"slate-react": "^0.98.3",
|
|
70
|
-
"tslib": "^2.6.2",
|
|
71
|
-
"typescript": "^5.2.2"
|
|
72
|
-
},
|
|
73
|
-
"peerDependencies": {
|
|
74
|
-
"@ant-design/icons": "^5.2.6",
|
|
75
|
-
"@ctrl/tinycolor": "^4.0.2",
|
|
76
|
-
"@microsoft/signalr": "^8.0.0",
|
|
77
|
-
"antd": ">=5",
|
|
78
|
-
"axios": ">=1",
|
|
79
|
-
"classnames": ">=2",
|
|
80
|
-
"dayjs": ">=1.8",
|
|
81
|
-
"is-hotkey": ">=0",
|
|
82
|
-
"react": ">=16",
|
|
83
|
-
"react-dom": ">=16",
|
|
84
|
-
"shallow-equal": ">=3",
|
|
85
|
-
"slate": "^0.94.1",
|
|
86
|
-
"slate-history": "^0.93.0",
|
|
87
|
-
"slate-react": "^0.98.3"
|
|
88
|
-
},
|
|
89
|
-
"dependencies": {}
|
|
90
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@webinex/chatify",
|
|
3
|
+
"description": "Webinex Wispo",
|
|
4
|
+
"private": false,
|
|
5
|
+
"version": "1.0.0-rc1",
|
|
6
|
+
"author": "Webinex Dev",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"main": "dist/cjs/index.js",
|
|
9
|
+
"module": "dist/esm/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"targets": {
|
|
13
|
+
"demo": {
|
|
14
|
+
"source": "./example/index.html",
|
|
15
|
+
"isLibrary": false
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "rimraf dist && rimraf add && rollup -c --environment ENV:production --failAfterWarnings",
|
|
24
|
+
"start": "rollup -c -w",
|
|
25
|
+
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
26
|
+
"prettier:write": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
27
|
+
"prettier:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
28
|
+
"parcel": "parcel --target demo --dist-dir ./dist/demo",
|
|
29
|
+
"parcel:build": "rimraf ../Webinex.Chatify.Example/wwwroot && cross-env NODE_ENV=production parcel build --target demo --dist-dir ../Webinex.Chatify.Example/wwwroot"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@microsoft/signalr": "^8.0.0",
|
|
33
|
+
"@parcel/transformer-sass": "2.9.2",
|
|
34
|
+
"@rollup/plugin-commonjs": "^24.0.1",
|
|
35
|
+
"@rollup/plugin-eslint": "^9.0.3",
|
|
36
|
+
"@rollup/plugin-image": "^3.0.2",
|
|
37
|
+
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
38
|
+
"@rollup/plugin-typescript": "^11.1.0",
|
|
39
|
+
"@types/react": "^18.0.33",
|
|
40
|
+
"@types/react-dom": "^18.0.11",
|
|
41
|
+
"antd": "^5.11.5",
|
|
42
|
+
"axios": "^1.6.2",
|
|
43
|
+
"buffer": "^5.5.0||^6.0.0",
|
|
44
|
+
"classnames": "^2.3.2",
|
|
45
|
+
"cross-env": "^7.0.3",
|
|
46
|
+
"dayjs": "^1.11.7",
|
|
47
|
+
"eslint": "^8.38.0",
|
|
48
|
+
"eslint-config-react-app": "^7.0.1",
|
|
49
|
+
"is-hotkey": "^0.2.0",
|
|
50
|
+
"parcel": "^2.10.3",
|
|
51
|
+
"postcss": "^8.4.21",
|
|
52
|
+
"prettier": "^2.8.7",
|
|
53
|
+
"process": "^0.11.10",
|
|
54
|
+
"react": "^18.2.0",
|
|
55
|
+
"react-dom": "^18.2.0",
|
|
56
|
+
"rimraf": "^5.0.5",
|
|
57
|
+
"rollup": "^3.20.2",
|
|
58
|
+
"rollup-plugin-copy": "^3.4.0",
|
|
59
|
+
"rollup-plugin-dts": "^5.3.0",
|
|
60
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
61
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
62
|
+
"rollup-plugin-scss": "^4.0.0",
|
|
63
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
64
|
+
"rollup-plugin-visualizer": "^5.11.0",
|
|
65
|
+
"sass": "^1.66.1",
|
|
66
|
+
"shallow-equal": "^3.1.0",
|
|
67
|
+
"slate": "^0.94.1",
|
|
68
|
+
"slate-history": "^0.93.0",
|
|
69
|
+
"slate-react": "^0.98.3",
|
|
70
|
+
"tslib": "^2.6.2",
|
|
71
|
+
"typescript": "^5.2.2"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"@ant-design/icons": "^5.2.6",
|
|
75
|
+
"@ctrl/tinycolor": "^4.0.2",
|
|
76
|
+
"@microsoft/signalr": "^8.0.0",
|
|
77
|
+
"antd": ">=5",
|
|
78
|
+
"axios": ">=1",
|
|
79
|
+
"classnames": ">=2",
|
|
80
|
+
"dayjs": ">=1.8",
|
|
81
|
+
"is-hotkey": ">=0",
|
|
82
|
+
"react": ">=16",
|
|
83
|
+
"react-dom": ">=16",
|
|
84
|
+
"shallow-equal": ">=3",
|
|
85
|
+
"slate": "^0.94.1",
|
|
86
|
+
"slate-history": "^0.93.0",
|
|
87
|
+
"slate-react": "^0.98.3"
|
|
88
|
+
},
|
|
89
|
+
"dependencies": {}
|
|
90
|
+
}
|
package/src/ChatifyContext.tsx
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import React, { PropsWithChildren, useContext } from 'react';
|
|
2
|
-
import { ReducerProvider } from './core/reducer';
|
|
3
|
-
import { ChatifyClient } from './core/client';
|
|
4
|
-
import { useSignalRMonitor } from './core/useSignalRMonitor';
|
|
5
|
-
|
|
6
|
-
const MeContext = React.createContext<string>(null!);
|
|
7
|
-
const ClientContext = React.createContext<ChatifyClient>(null!);
|
|
8
|
-
|
|
9
|
-
export function useClient() {
|
|
10
|
-
return useContext(ClientContext);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function useMe() {
|
|
14
|
-
return useContext(MeContext);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ChatifyContextValue {
|
|
18
|
-
me: string;
|
|
19
|
-
client: ChatifyClient;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function ChatifyContextWrapper(props: PropsWithChildren<{}>) {
|
|
23
|
-
const { children } = props;
|
|
24
|
-
const me = useMe();
|
|
25
|
-
const client = useClient();
|
|
26
|
-
useSignalRMonitor(me, client);
|
|
27
|
-
|
|
28
|
-
return <>{children}</>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function ChatifyContext({ value, children }: PropsWithChildren<{ value: ChatifyContextValue }>) {
|
|
32
|
-
return (
|
|
33
|
-
<ClientContext.Provider value={value.client}>
|
|
34
|
-
<MeContext.Provider value={value.me}>
|
|
35
|
-
<ReducerProvider>
|
|
36
|
-
<ChatifyContextWrapper>{children}</ChatifyContextWrapper>
|
|
37
|
-
</ReducerProvider>
|
|
38
|
-
</MeContext.Provider>
|
|
39
|
-
</ClientContext.Provider>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
1
|
+
import React, { PropsWithChildren, useContext } from 'react';
|
|
2
|
+
import { ReducerProvider } from './core/reducer';
|
|
3
|
+
import { ChatifyClient } from './core/client';
|
|
4
|
+
import { useSignalRMonitor } from './core/useSignalRMonitor';
|
|
5
|
+
|
|
6
|
+
const MeContext = React.createContext<string>(null!);
|
|
7
|
+
const ClientContext = React.createContext<ChatifyClient>(null!);
|
|
8
|
+
|
|
9
|
+
export function useClient() {
|
|
10
|
+
return useContext(ClientContext);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function useMe() {
|
|
14
|
+
return useContext(MeContext);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ChatifyContextValue {
|
|
18
|
+
me: string;
|
|
19
|
+
client: ChatifyClient;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ChatifyContextWrapper(props: PropsWithChildren<{}>) {
|
|
23
|
+
const { children } = props;
|
|
24
|
+
const me = useMe();
|
|
25
|
+
const client = useClient();
|
|
26
|
+
useSignalRMonitor(me, client);
|
|
27
|
+
|
|
28
|
+
return <>{children}</>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function ChatifyContext({ value, children }: PropsWithChildren<{ value: ChatifyContextValue }>) {
|
|
32
|
+
return (
|
|
33
|
+
<ClientContext.Provider value={value.client}>
|
|
34
|
+
<MeContext.Provider value={value.me}>
|
|
35
|
+
<ReducerProvider>
|
|
36
|
+
<ChatifyContextWrapper>{children}</ChatifyContextWrapper>
|
|
37
|
+
</ReducerProvider>
|
|
38
|
+
</MeContext.Provider>
|
|
39
|
+
</ClientContext.Provider>
|
|
40
|
+
);
|
|
41
|
+
}
|