@webinex/chatify 1.0.0-alpha08 → 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.
Files changed (74) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/core/action.d.ts +4 -1
  4. package/dist/cjs/types/core/models.d.ts +2 -2
  5. package/dist/cjs/types/ui/Chatify.d.ts +4 -4
  6. package/dist/cjs/types/ui/Message.d.ts +1 -1
  7. package/dist/cjs/types/ui/SendingMessage.d.ts +1 -1
  8. package/dist/cjs/types/ui/localizer.d.ts +1 -0
  9. package/dist/css/chatify.css +56 -56
  10. package/dist/esm/index.js +1 -1
  11. package/dist/esm/index.js.map +1 -1
  12. package/dist/esm/types/core/action.d.ts +4 -1
  13. package/dist/esm/types/core/models.d.ts +2 -2
  14. package/dist/esm/types/ui/Chatify.d.ts +4 -4
  15. package/dist/esm/types/ui/Message.d.ts +1 -1
  16. package/dist/esm/types/ui/SendingMessage.d.ts +1 -1
  17. package/dist/esm/types/ui/localizer.d.ts +1 -0
  18. package/dist/index.d.ts +11 -7
  19. package/package.json +90 -90
  20. package/src/ChatifyContext.tsx +41 -41
  21. package/src/core/action.tsx +319 -282
  22. package/src/core/client.ts +137 -137
  23. package/src/core/index.ts +14 -14
  24. package/src/core/models.tsx +75 -75
  25. package/src/core/reducer.tsx +86 -86
  26. package/src/core/state.ts +38 -38
  27. package/src/core/useAccounts.tsx +11 -11
  28. package/src/core/useAddChat.tsx +12 -12
  29. package/src/core/useAddMember.tsx +12 -12
  30. package/src/core/useAddMessage.tsx +40 -40
  31. package/src/core/useChat.tsx +12 -12
  32. package/src/core/useChatList.tsx +10 -10
  33. package/src/core/useLoadMore.tsx +42 -42
  34. package/src/core/useMessages.tsx +23 -23
  35. package/src/core/useMutation.tsx +48 -48
  36. package/src/core/useQuery.tsx +45 -45
  37. package/src/core/useReadMonitor.tsx +31 -31
  38. package/src/core/useRemoveMember.tsx +12 -12
  39. package/src/core/useSignalRMonitor.tsx +52 -49
  40. package/src/index.ts +3 -3
  41. package/src/ui/AddChat.tsx +55 -55
  42. package/src/ui/AddChatButton.tsx +19 -19
  43. package/src/ui/Aside.tsx +41 -41
  44. package/src/ui/Avatar.tsx +18 -18
  45. package/src/ui/Chat.tsx +26 -26
  46. package/src/ui/ChatBody.tsx +43 -43
  47. package/src/ui/ChatHeader.tsx +33 -33
  48. package/src/ui/ChatHeaderMembers.tsx +30 -30
  49. package/src/ui/ChatHeaderSettingsButton.tsx +26 -26
  50. package/src/ui/ChatListItem.tsx +101 -101
  51. package/src/ui/ChatName.tsx +15 -15
  52. package/src/ui/ChatSettings.tsx +59 -59
  53. package/src/ui/Chatify.tsx +104 -104
  54. package/src/ui/Footer.tsx +7 -7
  55. package/src/ui/Header.tsx +14 -14
  56. package/src/ui/Icon.tsx +21 -21
  57. package/src/ui/InputForm.tsx +51 -51
  58. package/src/ui/LoadMore.tsx +40 -40
  59. package/src/ui/Main.tsx +16 -16
  60. package/src/ui/Message.tsx +118 -118
  61. package/src/ui/MessageSkeleton.tsx +19 -19
  62. package/src/ui/SendingMessage.tsx +50 -50
  63. package/src/ui/SystemMessage.tsx +30 -26
  64. package/src/ui/index.ts +11 -11
  65. package/src/ui/localizer.tsx +68 -66
  66. package/src/ui/styles/aside.scss +94 -94
  67. package/src/ui/styles/index.scss +248 -248
  68. package/src/ui/styles/keyframes.scss +14 -14
  69. package/src/ui/styles/mixins.scss +20 -20
  70. package/src/ui/styles/variables.scss +10 -10
  71. package/src/util/customize.tsx +45 -45
  72. package/src/util/index.ts +3 -3
  73. package/src/util/uniqBy.tsx +17 -17
  74. 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 MessageContent {
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?: MessageContent;
45
+ message?: MessageBody;
46
46
  members: string[];
47
47
  }
48
48
  export interface ReadRequest {
@@ -8,8 +8,8 @@ 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, SendingMessageBody, SendingMessageInfoBox, SendingMessageText } from './SendingMessage';
12
- import { MessageAuthor, MessageBody, MessageBox, MessageInfoBox, MessageReadObserver, MessageRow, MessageText } from './Message';
11
+ import { SendingMessage, SendingMessageContent, SendingMessageInfoBox, SendingMessageText } from './SendingMessage';
12
+ import { MessageAuthor, MessageContent, MessageBox, MessageInfoBox, MessageReadObserver, MessageRow, MessageText } from './Message';
13
13
  import { Icon } from './Icon';
14
14
  export interface ChatifyCustomizeValue {
15
15
  Avatar?: typeof Avatar.Component | null;
@@ -26,13 +26,13 @@ export interface ChatifyCustomizeValue {
26
26
  ChatListItemLastMessageAuthor?: typeof ChatListItemLastMessageAuthor.Component | null;
27
27
  ChatListItemLastMessageContent?: typeof ChatListItemLastMessageContent.Component | null;
28
28
  SendingMessage?: typeof SendingMessage.Component | null;
29
- SendingMessageBody?: typeof SendingMessageBody.Component | null;
29
+ SendingMessageBody?: typeof SendingMessageContent.Component | null;
30
30
  SendingMessageInfoBox?: typeof SendingMessageInfoBox.Component | null;
31
31
  SendingMessageText?: typeof SendingMessageText.Component | null;
32
32
  MessageBox?: typeof MessageBox.Component | null;
33
33
  MessageReadObserver?: typeof MessageReadObserver.Component | null;
34
34
  MessageRow?: typeof MessageRow.Component | null;
35
- MessageBody?: typeof MessageBody.Component | null;
35
+ MessageBody?: typeof MessageContent.Component | null;
36
36
  MessageInfoBox?: typeof MessageInfoBox.Component | null;
37
37
  MessageText?: typeof MessageText.Component | null;
38
38
  MessageAuthor?: typeof MessageAuthor.Component | null;
@@ -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 MessageBody: import("../util").Customizable<FC<MessageBoxProps>, string>;
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 SendingMessageBody: import("../util").Customizable<FC<SendingMessageProps>, string>;
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;
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;
@@ -76,14 +77,14 @@ interface SendMessageRequest {
76
77
  files: File[];
77
78
  requestId: string;
78
79
  }
79
- interface MessageContent {
80
+ interface MessageBody {
80
81
  text: string;
81
82
  files: File[];
82
83
  }
83
84
  interface AddChatRequest {
84
85
  requestId: string;
85
86
  name: string;
86
- message?: MessageContent;
87
+ message?: MessageBody;
87
88
  members: string[];
88
89
  }
89
90
  interface ReadRequest {
@@ -217,9 +218,12 @@ declare const ACTIONS: {
217
218
  read_received: (state: State, { events }: {
218
219
  events: ReadEvent[];
219
220
  }) => State;
220
- member_added: (state: State, { chatId, account }: {
221
+ member_added: (state: State, { chatId, chatName, account, me, message, }: {
221
222
  chatId: string;
223
+ chatName: string;
222
224
  account: Account;
225
+ me: string;
226
+ message: Message;
223
227
  }) => State;
224
228
  member_removed: (state: State, { chatId, accountId, deleteHistory, me, }: {
225
229
  chatId: string;
@@ -321,7 +325,7 @@ interface SendingMessageProps {
321
325
  }
322
326
  declare const SendingMessageText: Customizable<FC<SendingMessageProps>, string>;
323
327
  declare const SendingMessageInfoBox: Customizable<FC<SendingMessageProps>, string>;
324
- declare const SendingMessageBody: Customizable<FC<SendingMessageProps>, string>;
328
+ declare const SendingMessageContent: Customizable<FC<SendingMessageProps>, string>;
325
329
  declare const SendingMessage: Customizable<FC<SendingMessageProps>, string>;
326
330
 
327
331
  interface MessageBoxProps {
@@ -333,7 +337,7 @@ interface MessageRowProps extends MessageBoxProps {
333
337
  declare const MessageAuthor: Customizable<FC<MessageBoxProps>, string>;
334
338
  declare const MessageText: Customizable<FC<MessageBoxProps>, string>;
335
339
  declare const MessageInfoBox: Customizable<FC<MessageBoxProps>, string>;
336
- declare const MessageBody: Customizable<FC<MessageBoxProps>, string>;
340
+ declare const MessageContent: Customizable<FC<MessageBoxProps>, string>;
337
341
  declare const MessageRow: Customizable<FC<MessageRowProps>, string>;
338
342
  declare const MessageBox: Customizable<FC<MessageBoxProps>, string>;
339
343
  interface MessageReadObserverProps extends MessageBoxProps {
@@ -363,13 +367,13 @@ interface ChatifyCustomizeValue {
363
367
  ChatListItemLastMessageAuthor?: typeof ChatListItemLastMessageAuthor.Component | null;
364
368
  ChatListItemLastMessageContent?: typeof ChatListItemLastMessageContent.Component | null;
365
369
  SendingMessage?: typeof SendingMessage.Component | null;
366
- SendingMessageBody?: typeof SendingMessageBody.Component | null;
370
+ SendingMessageBody?: typeof SendingMessageContent.Component | null;
367
371
  SendingMessageInfoBox?: typeof SendingMessageInfoBox.Component | null;
368
372
  SendingMessageText?: typeof SendingMessageText.Component | null;
369
373
  MessageBox?: typeof MessageBox.Component | null;
370
374
  MessageReadObserver?: typeof MessageReadObserver.Component | null;
371
375
  MessageRow?: typeof MessageRow.Component | null;
372
- MessageBody?: typeof MessageBody.Component | null;
376
+ MessageBody?: typeof MessageContent.Component | null;
373
377
  MessageInfoBox?: typeof MessageInfoBox.Component | null;
374
378
  MessageText?: typeof MessageText.Component | null;
375
379
  MessageAuthor?: typeof MessageAuthor.Component | null;
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-alpha08",
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
+ }
@@ -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
+ }