@ethora/chat-component-rn 26.4.1
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/LICENSE +661 -0
- package/README.md +148 -0
- package/empty-shim.js +15 -0
- package/index.js +13 -0
- package/metro.js +72 -0
- package/package.json +99 -0
- package/src/api.config.ts +34 -0
- package/src/assets/BG.png +0 -0
- package/src/assets/BG.tsx +56 -0
- package/src/assets/File.svg +4 -0
- package/src/assets/ForzaCare.png +0 -0
- package/src/assets/ForzaCare.tsx +27 -0
- package/src/assets/icons.tsx +685 -0
- package/src/assets/images.tsx +41 -0
- package/src/assets/test.xml +243 -0
- package/src/components/AuthForms/Login.tsx +295 -0
- package/src/components/AuthForms/LoginAnonym.tsx +68 -0
- package/src/components/AuthForms/Register.tsx +8 -0
- package/src/components/ContextMenu/ContextMenuComponents.tsx +87 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +244 -0
- package/src/components/ExampleComponents/CustomMessage.tsx +92 -0
- package/src/components/ExampleComponents/CustomTypingIndicatorExamples.tsx +239 -0
- package/src/components/Header/HeaderRoomList.tsx +104 -0
- package/src/components/InputComponents/AudioInput.tsx +24 -0
- package/src/components/InputComponents/AudioRecorder.tsx +100 -0
- package/src/components/InputComponents/MediaInput.tsx +114 -0
- package/src/components/InputComponents/RecordingIndicator.tsx +77 -0
- package/src/components/InputComponents/Search.tsx +135 -0
- package/src/components/InputComponents/TextInput.tsx +66 -0
- package/src/components/MainComponents/ChatHeader.tsx +163 -0
- package/src/components/MainComponents/ChatRoom.tsx +392 -0
- package/src/components/MainComponents/ChatWrapper.tsx +318 -0
- package/src/components/MainComponents/ChooseChatMessage.tsx +44 -0
- package/src/components/MainComponents/ConnectionBanner.tsx +33 -0
- package/src/components/MainComponents/EditWrapper.tsx +72 -0
- package/src/components/MainComponents/LoginWrapper.tsx +134 -0
- package/src/components/MainComponents/MediaMessage.tsx +55 -0
- package/src/components/MainComponents/MessageContainer.tsx +122 -0
- package/src/components/MainComponents/MessageList.tsx +429 -0
- package/src/components/MainComponents/NoMessagesPlaceholder.tsx +49 -0
- package/src/components/MainComponents/ProfileImagePlaceholder.tsx +143 -0
- package/src/components/MainComponents/RNStyled.tsx +34 -0
- package/src/components/MainComponents/ReduxWrapper.tsx +40 -0
- package/src/components/MainComponents/RoomList.tsx +246 -0
- package/src/components/MainComponents/Select.tsx +165 -0
- package/src/components/MainComponents/Switch.tsx +73 -0
- package/src/components/MainComponents/SystemMessage.tsx +42 -0
- package/src/components/Menu/HeaderRoomListMenu.tsx +169 -0
- package/src/components/MenuRoom/MenuRoom.tsx +46 -0
- package/src/components/MessageBubble/Avatar.tsx +84 -0
- package/src/components/MessageBubble/BottomReplyContainer.tsx +117 -0
- package/src/components/MessageBubble/CustomDivider.tsx +10 -0
- package/src/components/MessageBubble/DeletedMessage.tsx +36 -0
- package/src/components/MessageBubble/Message.tsx +400 -0
- package/src/components/MessageBubble/MessageInteractions.tsx +247 -0
- package/src/components/MessageBubble/MessageReaction.tsx +149 -0
- package/src/components/MessageBubble/MessageReply.tsx +50 -0
- package/src/components/MessageBubble/MessageTranslations.tsx +30 -0
- package/src/components/Modals/AddMembersModal/AddMembersModal.tsx +142 -0
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +471 -0
- package/src/components/Modals/ChatProfileModal/DeleteChatModal.tsx +91 -0
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +298 -0
- package/src/components/Modals/Modal/Modal.tsx +52 -0
- package/src/components/Modals/ModalHeaderComponent.tsx +41 -0
- package/src/components/Modals/ModalSelectMedia/ModalSelectMedia.tsx +285 -0
- package/src/components/Modals/ModalWrapper/ModalWrapper.tsx +103 -0
- package/src/components/Modals/NewChatModal/ModalContent.tsx +151 -0
- package/src/components/Modals/NewChatModal/NewChatModal.tsx +391 -0
- package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +136 -0
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +134 -0
- package/src/components/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.tsx +63 -0
- package/src/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.tsx +115 -0
- package/src/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.tsx +121 -0
- package/src/components/Modals/SettingsModals/ManageDataModal/StyledComponents.ts +0 -0
- package/src/components/Modals/SettingsModals/ProfileShares/ProfileShares.tsx +65 -0
- package/src/components/Modals/SettingsModals/Referrals/Referrals.tsx +90 -0
- package/src/components/Modals/SettingsModals/SharedStyledComponents.ts +74 -0
- package/src/components/Modals/SettingsModals/Visibility/RadioInput.tsx +59 -0
- package/src/components/Modals/SettingsModals/Visibility/StyledComponents.ts +32 -0
- package/src/components/Modals/SettingsModals/Visibility/VisibilityModal.tsx +146 -0
- package/src/components/Modals/UserProfileModal/EditUserModal.tsx +163 -0
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +410 -0
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +85 -0
- package/src/components/Modals/styledModalComponents.tsx +181 -0
- package/src/components/OperationalModal/OperationalModal.tsx +78 -0
- package/src/components/RoomComponents/ChatRoomItem.tsx +219 -0
- package/src/components/RoomComponents/LastMessageItem.tsx +47 -0
- package/src/components/RoomComponents/styled/LastAudioMessage.tsx +62 -0
- package/src/components/RoomComponents/styled/LastMessageEmoji.tsx +26 -0
- package/src/components/RoomComponents/styled/LastMessageFile.tsx +54 -0
- package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +54 -0
- package/src/components/RoomComponents/styled/LastMessageVideo.tsx +70 -0
- package/src/components/RoomComponents/styled/LastTextMessage.tsx +65 -0
- package/src/components/RoomComponents/styled/StyledRoomComponents.ts +53 -0
- package/src/components/SortDropDown/index.tsx +76 -0
- package/src/components/Thread/ThreadHeader.tsx +41 -0
- package/src/components/Thread/ThreadWrapper.tsx +270 -0
- package/src/components/Toast/Toast.tsx +128 -0
- package/src/components/Toast/index.ts +13 -0
- package/src/components/UsersList/StyledComponents.ts +30 -0
- package/src/components/UsersList/UsersList.tsx +112 -0
- package/src/components/styled/ActionButton.tsx +40 -0
- package/src/components/styled/AudioMessage.tsx +82 -0
- package/src/components/styled/Button.tsx +107 -0
- package/src/components/styled/ChatWrapperBox.tsx +9 -0
- package/src/components/styled/DateLabel.tsx +77 -0
- package/src/components/styled/Loader.tsx +65 -0
- package/src/components/styled/MediaFilePreview.tsx +42 -0
- package/src/components/styled/MediaModal.tsx +54 -0
- package/src/components/styled/MessageImage.tsx +54 -0
- package/src/components/styled/NewMessageLabel.tsx +50 -0
- package/src/components/styled/RoomListComponents/index.tsx +164 -0
- package/src/components/styled/SendInput.tsx +297 -0
- package/src/components/styled/StyledComponents.ts +320 -0
- package/src/components/styled/StyledInput.tsx +101 -0
- package/src/components/styled/StyledInputComponents/AudioComponents.tsx +1 -0
- package/src/components/styled/StyledInputComponents/Composing.tsx +97 -0
- package/src/components/styled/StyledInputComponents/CustomTypingIndicator.tsx +261 -0
- package/src/components/styled/StyledInputComponents/MediaComponents.tsx +90 -0
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +131 -0
- package/src/components/styled/StyledInputComponents/VideoComponents.tsx +49 -0
- package/src/components/styled/TreadLabel.tsx +50 -0
- package/src/components/styled/UnsupportedType.tsx +95 -0
- package/src/components/styled/VideoMessage.tsx +68 -0
- package/src/context/MessageNotificationContext.tsx +335 -0
- package/src/context/PushNotificationProvider.tsx +78 -0
- package/src/context/ToastContext.tsx +63 -0
- package/src/context/toastProvider.tsx +0 -0
- package/src/context/xmppProvider.tsx +364 -0
- package/src/helpers/block_scroll.ts +95 -0
- package/src/helpers/chatAutoEnterer.ts +46 -0
- package/src/helpers/checkUniqueUsers.tsx +31 -0
- package/src/helpers/constants/CHAT_TYPES.ts +6 -0
- package/src/helpers/constants/LANGUAGE_OPTIONS.ts +14 -0
- package/src/helpers/constants/LOCAL_STORAGE.ts +3 -0
- package/src/helpers/constants/MESSAGE_INTERACTIONS.ts +29 -0
- package/src/helpers/constants/MODAL_TYPES.ts +57 -0
- package/src/helpers/constants/PLATFORM_CONSTANTS.ts +3 -0
- package/src/helpers/createMainMessageForThread.ts +23 -0
- package/src/helpers/createMessageFromXml.ts +118 -0
- package/src/helpers/createRoomFromApi.tsx +27 -0
- package/src/helpers/createUserNameFromSetUser.ts +15 -0
- package/src/helpers/dateComparison.ts +12 -0
- package/src/helpers/debounce.ts +10 -0
- package/src/helpers/ensureScopedChatCache.ts +61 -0
- package/src/helpers/extractUniqueMembersFromRooms.ts +45 -0
- package/src/helpers/formatNumberWithCommas.ts +3 -0
- package/src/helpers/getBooleanFromString.ts +7 -0
- package/src/helpers/getDataFromXml.ts +80 -0
- package/src/helpers/getNumberFromString.ts +5 -0
- package/src/helpers/getRoomsWithRetry.ts +45 -0
- package/src/helpers/getTintedColor.ts +28 -0
- package/src/helpers/getUnnamedUsers.ts +39 -0
- package/src/helpers/handleCopyClick.ts +3 -0
- package/src/helpers/handleXmppError.ts +14 -0
- package/src/helpers/hashcolor.ts +34 -0
- package/src/helpers/historyPreloadScheduler.ts +264 -0
- package/src/helpers/initRoomsPresence.ts +32 -0
- package/src/helpers/initXmppRooms.tsx +71 -0
- package/src/helpers/insertMessageWithDelimiter.ts +96 -0
- package/src/helpers/isChatIdPresentInArray.ts +54 -0
- package/src/helpers/localStorageUser.ts +9 -0
- package/src/helpers/markdownParser.tsx +295 -0
- package/src/helpers/nanoToMs.ts +3 -0
- package/src/helpers/parseMessageBody.tsx +516 -0
- package/src/helpers/parseUrls.tsx +42 -0
- package/src/helpers/resolveInitBeforeLoadUser.ts +240 -0
- package/src/helpers/storeConsole.ts +26 -0
- package/src/helpers/transformTranslatations.ts +16 -0
- package/src/helpers/updateMessagesTillLast.tsx +104 -0
- package/src/helpers/updatedChatLastTimestamps.ts +29 -0
- package/src/helpers/validator.ts +20 -0
- package/src/helpers/walletUsername.ts +12 -0
- package/src/hooks/hooks.ts +6 -0
- package/src/hooks/useChatSettingState.tsx +38 -0
- package/src/hooks/useChatWrapperInit.ts +266 -0
- package/src/hooks/useComposing.tsx +59 -0
- package/src/hooks/useCustomTypingIndicator.tsx +193 -0
- package/src/hooks/useEventHandlers.tsx +81 -0
- package/src/hooks/useGetNewArchRoom.tsx +57 -0
- package/src/hooks/useHeapSender.tsx +88 -0
- package/src/hooks/useLocalStorage.tsx +53 -0
- package/src/hooks/useLogout.tsx +31 -0
- package/src/hooks/useMessageHeapState.tsx +11 -0
- package/src/hooks/useMessageLoaderQueue.tsx +90 -0
- package/src/hooks/useMessageQueue.ts +146 -0
- package/src/hooks/usePendingNotification.ts +49 -0
- package/src/hooks/usePrevious.tsx +15 -0
- package/src/hooks/usePushNotifications.ts +106 -0
- package/src/hooks/useQRCodeChatHandler.ts +58 -0
- package/src/hooks/useRoomInitialization.tsx +160 -0
- package/src/hooks/useRoomState.tsx +47 -0
- package/src/hooks/useRoomUrl.tsx +41 -0
- package/src/hooks/useSendMessage.tsx +306 -0
- package/src/hooks/useUnreadMessagesCounter.ts +55 -0
- package/src/hooks/useXmppInitialization.ts +148 -0
- package/src/main.ts +45 -0
- package/src/networking/api-requests/auth.api.ts +140 -0
- package/src/networking/api-requests/push.api.ts +55 -0
- package/src/networking/api-requests/roomMembers.api.ts +20 -0
- package/src/networking/api-requests/rooms.api.ts +142 -0
- package/src/networking/api-requests/user.api.ts +65 -0
- package/src/networking/apiClient.ts +149 -0
- package/src/networking/helpers/refreshChecker.ts +13 -0
- package/src/networking/stanzaHandlers.ts +418 -0
- package/src/networking/xmpp/actionSetTimestampToPrivateStore.xmpp.ts +37 -0
- package/src/networking/xmpp/allRoomPresences.xmpp.ts +10 -0
- package/src/networking/xmpp/createPrivateRoom.xmpp.ts +26 -0
- package/src/networking/xmpp/createRoom.xmpp.ts +35 -0
- package/src/networking/xmpp/createRoomPresence.xmpp.ts +74 -0
- package/src/networking/xmpp/createTimeoutPromise.xmpp.ts +15 -0
- package/src/networking/xmpp/deleteMessage.xmpp.ts +19 -0
- package/src/networking/xmpp/editMessage.xmpp.ts +46 -0
- package/src/networking/xmpp/getChatsPrivateStoreRequest.xmpp.ts +57 -0
- package/src/networking/xmpp/getHistory.xmpp.ts +140 -0
- package/src/networking/xmpp/getLastMessageArchive.xmpp.ts +24 -0
- package/src/networking/xmpp/getRoomInfo.xmpp.ts +15 -0
- package/src/networking/xmpp/getRoomMembers.xmpp.ts +13 -0
- package/src/networking/xmpp/getRooms.xmpp.ts +43 -0
- package/src/networking/xmpp/getRoomsPaged.xmpp.ts +59 -0
- package/src/networking/xmpp/handlePong.xmpp.ts +7 -0
- package/src/networking/xmpp/handleStanzas.xmpp.ts +55 -0
- package/src/networking/xmpp/inviteRoomRequest.xmpp.ts +25 -0
- package/src/networking/xmpp/leaveTheRoom.xmpp.ts +15 -0
- package/src/networking/xmpp/listenerManager.ts +116 -0
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +57 -0
- package/src/networking/xmpp/roomConfig.xmpp.ts +71 -0
- package/src/networking/xmpp/sendMediaMessage.xmpp.ts +97 -0
- package/src/networking/xmpp/sendMessageReaction.xmpp.ts +41 -0
- package/src/networking/xmpp/sendPing.xmpp.ts +21 -0
- package/src/networking/xmpp/sendTextMessage.xmpp.ts +99 -0
- package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +44 -0
- package/src/networking/xmpp/sendTypingRequest.xmpp.ts +26 -0
- package/src/networking/xmpp/setChatsPrivateStoreRequest.xmpp.ts +48 -0
- package/src/networking/xmpp/setMeAsOwner.xmpp.ts +52 -0
- package/src/networking/xmpp/setRoomImage.xmpp.ts +26 -0
- package/src/networking/xmpp/setVCard.xmpp.ts +19 -0
- package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +75 -0
- package/src/networking/xmppClient.ts +603 -0
- package/src/roomStore/Middleware/logoutMiddleware.tsx +24 -0
- package/src/roomStore/Middleware/newMessageMidlleware.tsx +87 -0
- package/src/roomStore/Middleware/reactionsMiddleware.tsx +77 -0
- package/src/roomStore/Middleware/testMiddleware.tsx +20 -0
- package/src/roomStore/Middleware/unreadMidlleware.tsx +58 -0
- package/src/roomStore/chatSettingsSlice.ts +178 -0
- package/src/roomStore/index.ts +68 -0
- package/src/roomStore/persistence.ts +152 -0
- package/src/roomStore/roomHeapSlice.ts +37 -0
- package/src/roomStore/roomsSlice.ts +353 -0
- package/src/services/pushNotifications.ts +170 -0
- package/src/services/pushSubscriptionService.ts +145 -0
- package/src/types/messages.ts +61 -0
- package/src/types/models/action.model.ts +30 -0
- package/src/types/models/config.model.ts +16 -0
- package/src/types/models/customComponents.model.ts +53 -0
- package/src/types/models/language.model.ts +11 -0
- package/src/types/models/media.model.ts +5 -0
- package/src/types/models/message.model.ts +69 -0
- package/src/types/models/modal.model.ts +9 -0
- package/src/types/models/room.model.ts +120 -0
- package/src/types/models/user.model.ts +90 -0
- package/src/types/models/xmpp.model.ts +155 -0
- package/src/types/types.ts +505 -0
- package/src/utils/PriorityQueue.ts +47 -0
- package/src/utils/actionHelpers.ts +40 -0
- package/src/utils/actionLogger.ts +64 -0
- package/src/utils/clientRegistry.ts +80 -0
- package/src/utils/devLogger.ts +197 -0
- package/src/utils/messageNotificationManager.ts +108 -0
- package/src/utils/resendMessage.ts +87 -0
- package/src/utils/toastEmitter.ts +27 -0
- package/src/utils/xmppMemoryMonitor.ts +63 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import type { ViewStyle, ImageSourcePropType } from 'react-native';
|
|
2
|
+
import type { Iso639_1Codes } from './models/language.model';
|
|
3
|
+
import { MODAL_TYPES } from '../helpers/constants/MODAL_TYPES';
|
|
4
|
+
|
|
5
|
+
export interface IUser extends Partial<User> {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string | null;
|
|
8
|
+
userJID?: string | null;
|
|
9
|
+
token: string;
|
|
10
|
+
refreshToken: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IMessage {
|
|
14
|
+
id: string; // message ID (aka timestamp in microseconds)
|
|
15
|
+
user: IUser;
|
|
16
|
+
date: Date | string; // date converted from id / timestamp (e.g. "2024-02-18T03:24:33.102Z")
|
|
17
|
+
body: string; // message body
|
|
18
|
+
roomJid: string; // room id
|
|
19
|
+
key?: string; // workaround to solve a problem of messages uniqueness - additional, local timestamp to solve when XMPP server sends duplicate timestamps (TO DO: depricate / review)
|
|
20
|
+
coinsInMessage?: string | number; // store only - message coins counter
|
|
21
|
+
numberOfReplies?: number[] | number; // store only - array of replies in a thread (if applicable) - includes messages IDs so that client app can display relevant message previews for the thread
|
|
22
|
+
isSystemMessage?: string;
|
|
23
|
+
isMediafile?: string;
|
|
24
|
+
locationPreview?: string;
|
|
25
|
+
mimetype?: string;
|
|
26
|
+
location?: string;
|
|
27
|
+
pending?: boolean;
|
|
28
|
+
timestamp?: number;
|
|
29
|
+
showInChannel?: string;
|
|
30
|
+
activeMessage?: boolean;
|
|
31
|
+
isReply?: boolean | string;
|
|
32
|
+
isDeleted?: boolean;
|
|
33
|
+
mainMessage?: string;
|
|
34
|
+
reply?: IReply[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface IReply extends IMessage {}
|
|
38
|
+
|
|
39
|
+
export type HistoryPreloadState = 'idle' | 'loading' | 'done' | 'error';
|
|
40
|
+
|
|
41
|
+
export interface IRoom {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
jid: string;
|
|
45
|
+
title: string;
|
|
46
|
+
usersCnt: number;
|
|
47
|
+
messages: IMessage[];
|
|
48
|
+
isLoading: boolean;
|
|
49
|
+
roomBg: string;
|
|
50
|
+
|
|
51
|
+
lastMessage?: string;
|
|
52
|
+
lastRoomMessage?: RoomLastMessage;
|
|
53
|
+
icon?: string;
|
|
54
|
+
composing?: boolean;
|
|
55
|
+
composingList?: string[];
|
|
56
|
+
lastViewedTimestamp?: number;
|
|
57
|
+
unreadMessages?: number;
|
|
58
|
+
noMessages?: boolean;
|
|
59
|
+
role?: string;
|
|
60
|
+
createdAt?: string | number | Date;
|
|
61
|
+
updatedAt?: string | number | Date;
|
|
62
|
+
|
|
63
|
+
roomMembers?: RoomMember[];
|
|
64
|
+
|
|
65
|
+
// QoS / preload state
|
|
66
|
+
historyPreloadState?: HistoryPreloadState;
|
|
67
|
+
historyComplete?: boolean;
|
|
68
|
+
unreadCapped?: boolean;
|
|
69
|
+
|
|
70
|
+
// Last-message tracking (driven by newMessageMidlleware).
|
|
71
|
+
lastMessageTimestamp?: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface RoomMember {
|
|
75
|
+
ban_status: string;
|
|
76
|
+
jid: string;
|
|
77
|
+
last_active: number;
|
|
78
|
+
name: string;
|
|
79
|
+
role: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface RoomLastMessage {
|
|
83
|
+
name: string;
|
|
84
|
+
body: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface UserType extends IMessage {
|
|
88
|
+
id: any;
|
|
89
|
+
user: any;
|
|
90
|
+
timestamp: any;
|
|
91
|
+
text: any;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface ConfigUser {
|
|
95
|
+
email: string;
|
|
96
|
+
password: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface User {
|
|
100
|
+
walletAddress: string;
|
|
101
|
+
|
|
102
|
+
description?: string;
|
|
103
|
+
token: string;
|
|
104
|
+
refreshToken: string;
|
|
105
|
+
|
|
106
|
+
defaultWallet: {
|
|
107
|
+
walletAddress: string;
|
|
108
|
+
};
|
|
109
|
+
_id: string;
|
|
110
|
+
firstName: string;
|
|
111
|
+
lastName: string;
|
|
112
|
+
email?: string;
|
|
113
|
+
username?: string;
|
|
114
|
+
profileImage?: string;
|
|
115
|
+
emails?: [
|
|
116
|
+
{
|
|
117
|
+
loginType: string;
|
|
118
|
+
email: string;
|
|
119
|
+
verified: boolean;
|
|
120
|
+
_id: string;
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
appId: string;
|
|
124
|
+
xmppPassword: string;
|
|
125
|
+
|
|
126
|
+
homeScreen?: string;
|
|
127
|
+
registrationChannelType?: string;
|
|
128
|
+
updatedAt?: string;
|
|
129
|
+
authMethod?: string;
|
|
130
|
+
resetPasswordExpires?: string;
|
|
131
|
+
resetPasswordToken?: string;
|
|
132
|
+
xmppUsername?: string;
|
|
133
|
+
roles?: string[];
|
|
134
|
+
tags?: string[];
|
|
135
|
+
__v?: number;
|
|
136
|
+
|
|
137
|
+
isProfileOpen?: boolean;
|
|
138
|
+
isAssetsOpen?: boolean;
|
|
139
|
+
isAgreeWithTerms?: boolean;
|
|
140
|
+
isSuperAdmin?: any;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface XmppState {
|
|
144
|
+
client: any;
|
|
145
|
+
loading: boolean;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface HistoryQoSConfig {
|
|
149
|
+
maxInFlightHistory?: number;
|
|
150
|
+
softPauseAfterSendMs?: number;
|
|
151
|
+
activeRoomBoostTtlMs?: number;
|
|
152
|
+
activeSendBoostMs?: number;
|
|
153
|
+
alwaysPrioritizeActiveRoom?: boolean;
|
|
154
|
+
backgroundWhileCriticalSend?: boolean;
|
|
155
|
+
preloadTopKRooms?: number;
|
|
156
|
+
presenceFailureBackoffMs?: number;
|
|
157
|
+
stagedPreloadEnabled?: boolean;
|
|
158
|
+
stagedPreloadFirstPassSize?: number;
|
|
159
|
+
stagedPreloadSecondPassSize?: number;
|
|
160
|
+
stagedPreloadConcurrency?: number;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface xmppSettingsInterface {
|
|
164
|
+
devServer?: string;
|
|
165
|
+
host?: string;
|
|
166
|
+
conference?: string;
|
|
167
|
+
disableLastRead?: boolean;
|
|
168
|
+
xmppPingOnSendEnabled?: boolean;
|
|
169
|
+
historyQoS?: HistoryQoSConfig;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface InAppNotificationConfig {
|
|
173
|
+
enabled?: boolean;
|
|
174
|
+
showInContext?: boolean;
|
|
175
|
+
maxNotifications?: number;
|
|
176
|
+
duration?: number;
|
|
177
|
+
position?: {
|
|
178
|
+
horizontal?: 'left' | 'right' | 'center';
|
|
179
|
+
vertical?: 'top' | 'bottom';
|
|
180
|
+
offset?: {
|
|
181
|
+
top?: number;
|
|
182
|
+
bottom?: number;
|
|
183
|
+
left?: number;
|
|
184
|
+
right?: number;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
onClick?: (params: {
|
|
188
|
+
roomJID: string;
|
|
189
|
+
messageId: string;
|
|
190
|
+
message: IMessage;
|
|
191
|
+
roomName: string;
|
|
192
|
+
senderName: string;
|
|
193
|
+
}) => void | Promise<void>;
|
|
194
|
+
customComponent?: React.ComponentType<{
|
|
195
|
+
id: string;
|
|
196
|
+
message: IMessage;
|
|
197
|
+
roomName: string;
|
|
198
|
+
senderName: string;
|
|
199
|
+
roomJID: string;
|
|
200
|
+
timestamp: number;
|
|
201
|
+
onClose: () => void;
|
|
202
|
+
onNavigateToMessage: (
|
|
203
|
+
roomJID: string,
|
|
204
|
+
messageId: string,
|
|
205
|
+
message: IMessage,
|
|
206
|
+
roomName: string,
|
|
207
|
+
senderName: string
|
|
208
|
+
) => void;
|
|
209
|
+
duration: number;
|
|
210
|
+
}>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export type ProviderBootstrapStatus =
|
|
214
|
+
| 'idle'
|
|
215
|
+
| 'running'
|
|
216
|
+
| 'ready'
|
|
217
|
+
| 'failed';
|
|
218
|
+
|
|
219
|
+
export interface FBConfig {
|
|
220
|
+
apiKey: string;
|
|
221
|
+
authDomain: string;
|
|
222
|
+
projectId: string;
|
|
223
|
+
storageBucket: string;
|
|
224
|
+
messagingSenderId: string;
|
|
225
|
+
appId: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface MessageBubble {
|
|
229
|
+
backgroundMessage?: string;
|
|
230
|
+
backgroundMessageUser?: string;
|
|
231
|
+
colorUser?: string;
|
|
232
|
+
color?: string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface PartialRoomWithMandatoryKeys {
|
|
236
|
+
jid: string;
|
|
237
|
+
name?: string;
|
|
238
|
+
title?: string;
|
|
239
|
+
icon?: string;
|
|
240
|
+
pinned?: boolean;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export interface IConfig {
|
|
244
|
+
// ----- identity / network -----
|
|
245
|
+
appId?: string;
|
|
246
|
+
baseUrl?: string;
|
|
247
|
+
customAppToken?: string;
|
|
248
|
+
projectName?: string;
|
|
249
|
+
|
|
250
|
+
// ----- theming -----
|
|
251
|
+
colors?: { primary: string; secondary: string };
|
|
252
|
+
messageColor?: {
|
|
253
|
+
backgroundMessage: string;
|
|
254
|
+
backgroundMessageUser: string;
|
|
255
|
+
colorUser: string;
|
|
256
|
+
color: string;
|
|
257
|
+
};
|
|
258
|
+
backgroundChat?: {
|
|
259
|
+
color?: string;
|
|
260
|
+
image?: string | ImageSourcePropType;
|
|
261
|
+
};
|
|
262
|
+
bubleMessage?: MessageBubble;
|
|
263
|
+
headerLogo?: string | React.ReactElement;
|
|
264
|
+
|
|
265
|
+
// ----- header / nav -----
|
|
266
|
+
disableHeader?: boolean;
|
|
267
|
+
disableMedia?: boolean;
|
|
268
|
+
chatHeaderBurgerMenu?: boolean;
|
|
269
|
+
chatHeaderAdditional?: { enabled: boolean; element: any };
|
|
270
|
+
headerMenu?: () => void;
|
|
271
|
+
headerChatMenu?: () => void;
|
|
272
|
+
chatHeaderSettings?: {
|
|
273
|
+
hide?: boolean;
|
|
274
|
+
disableCreate?: boolean;
|
|
275
|
+
disableMenu?: boolean;
|
|
276
|
+
hideSearch?: boolean;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// ----- auth -----
|
|
280
|
+
googleLogin?: {
|
|
281
|
+
enabled: boolean;
|
|
282
|
+
firebaseConfig: FBConfig;
|
|
283
|
+
};
|
|
284
|
+
// Legacy: exchanges a client JWT via /v1/users/client. Prefer userLogin
|
|
285
|
+
// or customLogin for new integrations.
|
|
286
|
+
jwtLogin?: {
|
|
287
|
+
token: string;
|
|
288
|
+
enabled: boolean;
|
|
289
|
+
handleBadlogin?: React.ReactElement;
|
|
290
|
+
};
|
|
291
|
+
userLogin?: {
|
|
292
|
+
enabled: boolean;
|
|
293
|
+
user: User | null;
|
|
294
|
+
};
|
|
295
|
+
// Preferred embedded integration: provide the final Ethora user/session
|
|
296
|
+
// from your own backend or app auth flow.
|
|
297
|
+
customLogin?: {
|
|
298
|
+
enabled: boolean;
|
|
299
|
+
loginFunction: () => Promise<User | null>;
|
|
300
|
+
};
|
|
301
|
+
defaultLogin?: boolean;
|
|
302
|
+
refreshTokens?: {
|
|
303
|
+
enabled: boolean;
|
|
304
|
+
refreshFunction?: () => Promise<{
|
|
305
|
+
accessToken: string;
|
|
306
|
+
refreshToken?: string;
|
|
307
|
+
} | null>;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
// ----- bootstrap -----
|
|
311
|
+
initBeforeLoad?: boolean;
|
|
312
|
+
initBeforeLoadAuth?: {
|
|
313
|
+
myEndpoint?: string;
|
|
314
|
+
};
|
|
315
|
+
clearStoreBeforeInit?: boolean;
|
|
316
|
+
newArch?: boolean;
|
|
317
|
+
useStoreConsoleEnabled?: boolean;
|
|
318
|
+
|
|
319
|
+
// ----- xmpp / QoS -----
|
|
320
|
+
xmppSettings?: xmppSettingsInterface;
|
|
321
|
+
disableLastRead?: boolean;
|
|
322
|
+
historyQoS?: HistoryQoSConfig;
|
|
323
|
+
|
|
324
|
+
// ----- room list -----
|
|
325
|
+
disableRooms?: boolean;
|
|
326
|
+
disableRoomMenu?: boolean;
|
|
327
|
+
forceSetRoom?: boolean;
|
|
328
|
+
defaultRooms?: string[] | ConfigRoom[];
|
|
329
|
+
setRoomJidInPath?: boolean; // web-only semantics; no-op on RN
|
|
330
|
+
customRooms?: {
|
|
331
|
+
rooms: PartialRoomWithMandatoryKeys[];
|
|
332
|
+
disableGetRooms?: boolean;
|
|
333
|
+
singleRoom: boolean;
|
|
334
|
+
};
|
|
335
|
+
enableRoomsRetry?: { enabled: boolean; helperText: string };
|
|
336
|
+
disableNewChatButton?: boolean;
|
|
337
|
+
disableRoomConfig?: boolean;
|
|
338
|
+
disableChatInfo?: {
|
|
339
|
+
disableHeader?: boolean;
|
|
340
|
+
disableDescription?: boolean;
|
|
341
|
+
disableType?: boolean;
|
|
342
|
+
disableMembers?: boolean;
|
|
343
|
+
hideMembers?: boolean;
|
|
344
|
+
disableChatHeaderMenu?: boolean;
|
|
345
|
+
};
|
|
346
|
+
qrUrl?: string;
|
|
347
|
+
|
|
348
|
+
// ----- styling -----
|
|
349
|
+
roomListStyles?: ViewStyle;
|
|
350
|
+
chatRoomStyles?: ViewStyle;
|
|
351
|
+
|
|
352
|
+
// ----- interactions / messages -----
|
|
353
|
+
disableInteractions?: boolean;
|
|
354
|
+
disableReactions?: boolean;
|
|
355
|
+
disableProfilesInteractions?: boolean;
|
|
356
|
+
disableUserCount?: boolean;
|
|
357
|
+
disableSentLogic?: boolean;
|
|
358
|
+
disableTypingIndicator?: boolean;
|
|
359
|
+
// Chat-profile modal granular gates (matches web's
|
|
360
|
+
// `disableChatInfo`).
|
|
361
|
+
disableChatInfo?: {
|
|
362
|
+
disableHeader?: boolean;
|
|
363
|
+
disableDescription?: boolean;
|
|
364
|
+
disableType?: boolean;
|
|
365
|
+
hideMembers?: boolean;
|
|
366
|
+
disableMembers?: boolean;
|
|
367
|
+
};
|
|
368
|
+
botMessageAutoScroll?: boolean;
|
|
369
|
+
blockMessageSendingWhenProcessing?:
|
|
370
|
+
| boolean
|
|
371
|
+
| {
|
|
372
|
+
enabled: boolean;
|
|
373
|
+
timeout?: number;
|
|
374
|
+
onTimeout?: (roomJID: string) => void;
|
|
375
|
+
};
|
|
376
|
+
messageTextFilter?: {
|
|
377
|
+
enabled: boolean;
|
|
378
|
+
filterFunction: (text: string) => string;
|
|
379
|
+
};
|
|
380
|
+
secondarySendButton?: {
|
|
381
|
+
enabled: boolean;
|
|
382
|
+
messageEdit: string;
|
|
383
|
+
buttonText?: string;
|
|
384
|
+
label?: React.ReactNode;
|
|
385
|
+
buttonStyles?: ViewStyle;
|
|
386
|
+
hideInputSendButton?: boolean;
|
|
387
|
+
overwriteEnterClick?: true;
|
|
388
|
+
};
|
|
389
|
+
customTypingIndicator?: {
|
|
390
|
+
enabled: boolean;
|
|
391
|
+
text?: string | ((usersTyping: string[]) => string);
|
|
392
|
+
position?: 'bottom' | 'top' | 'overlay' | 'floating';
|
|
393
|
+
styles?: ViewStyle;
|
|
394
|
+
customComponent?: React.ComponentType<{
|
|
395
|
+
usersTyping: string[];
|
|
396
|
+
text: string;
|
|
397
|
+
isVisible: boolean;
|
|
398
|
+
}>;
|
|
399
|
+
};
|
|
400
|
+
whitelistSystemMessage?: string[];
|
|
401
|
+
customSystemMessage?: React.ComponentType<MessageProps>;
|
|
402
|
+
|
|
403
|
+
// ----- translations -----
|
|
404
|
+
translates?: { enabled: boolean; translations?: Iso639_1Codes };
|
|
405
|
+
enableTranslates?: boolean;
|
|
406
|
+
|
|
407
|
+
// ----- notifications -----
|
|
408
|
+
inAppNotifications?: InAppNotificationConfig;
|
|
409
|
+
pushNotifications?: {
|
|
410
|
+
enabled?: boolean;
|
|
411
|
+
iconPath?: string;
|
|
412
|
+
badgePath?: string;
|
|
413
|
+
onClick?: (params: {
|
|
414
|
+
roomJID?: string;
|
|
415
|
+
messageId?: string;
|
|
416
|
+
data?: Record<string, any>;
|
|
417
|
+
notification?: { title?: string; body?: string };
|
|
418
|
+
}) => void | Promise<void>;
|
|
419
|
+
onNotificationPress?: (data: any) => void;
|
|
420
|
+
firebaseConfig?: FBConfig;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
// ----- event hooks -----
|
|
424
|
+
eventHandlers?: {
|
|
425
|
+
onMessageSent?: (event: {
|
|
426
|
+
message: string;
|
|
427
|
+
roomJID: string;
|
|
428
|
+
user: any;
|
|
429
|
+
messageType: 'text' | 'media';
|
|
430
|
+
metadata?: any;
|
|
431
|
+
}) => void | Promise<void>;
|
|
432
|
+
onMessageFailed?: (event: {
|
|
433
|
+
message: string;
|
|
434
|
+
roomJID: string;
|
|
435
|
+
error: Error;
|
|
436
|
+
messageType: 'text' | 'media';
|
|
437
|
+
}) => void;
|
|
438
|
+
onMessageEdited?: (event: {
|
|
439
|
+
messageId: string;
|
|
440
|
+
newMessage: string;
|
|
441
|
+
roomJID: string;
|
|
442
|
+
user: any;
|
|
443
|
+
}) => void;
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
interface ConfigRoom {
|
|
448
|
+
jid: string;
|
|
449
|
+
pinned: boolean;
|
|
450
|
+
_id?: string;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export interface StorageUser {
|
|
454
|
+
appId: string;
|
|
455
|
+
company: any[];
|
|
456
|
+
firstName: string;
|
|
457
|
+
homeScreen: string;
|
|
458
|
+
|
|
459
|
+
lastName: string;
|
|
460
|
+
referrerId: string;
|
|
461
|
+
refreshToken: string;
|
|
462
|
+
token: string;
|
|
463
|
+
walletAddress: string;
|
|
464
|
+
xmppPassword: string;
|
|
465
|
+
_id: string;
|
|
466
|
+
|
|
467
|
+
isAgreeWithTerms?: boolean;
|
|
468
|
+
isAllowedNewAppCreate?: boolean;
|
|
469
|
+
isAssetsOpen?: boolean;
|
|
470
|
+
isProfileOpen?: boolean;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export interface MessageProps {
|
|
474
|
+
message: IMessage;
|
|
475
|
+
isUser: boolean;
|
|
476
|
+
isReply: boolean;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export interface MediaMessageType {}
|
|
480
|
+
|
|
481
|
+
export interface DeleteModal {
|
|
482
|
+
isDeleteModal: boolean;
|
|
483
|
+
roomJid?: string;
|
|
484
|
+
messageId?: string;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
export interface EditAction {
|
|
488
|
+
isEdit: boolean;
|
|
489
|
+
roomJid?: string;
|
|
490
|
+
messageId?: string;
|
|
491
|
+
text?: string;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export type ModalType = (typeof MODAL_TYPES)[keyof typeof MODAL_TYPES];
|
|
495
|
+
|
|
496
|
+
export interface ModalFile {
|
|
497
|
+
fileName: string;
|
|
498
|
+
fileURL: string;
|
|
499
|
+
mimetype: string;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// Re-export so middleware/hooks that historically import from `types`
|
|
503
|
+
// keep working without reaching into `types/models/...`.
|
|
504
|
+
export type { ReactionAction } from './models/action.model';
|
|
505
|
+
export type { Iso639_1Codes } from './models/language.model';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export class PriorityQueue<T> {
|
|
2
|
+
private items: T[] = [];
|
|
3
|
+
private compare: (a: T, b: T) => number;
|
|
4
|
+
|
|
5
|
+
constructor(compareFunction: (a: T, b: T) => number) {
|
|
6
|
+
this.compare = compareFunction;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
push(item: T): void {
|
|
10
|
+
this.items.push(item);
|
|
11
|
+
this.items.sort(this.compare);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//should take variable size, so it could pop more than 1 item
|
|
15
|
+
pop(size: number = 1): T[] {
|
|
16
|
+
const poppedItems = this.items.splice(0, size);
|
|
17
|
+
return poppedItems;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
peek(): T | undefined {
|
|
21
|
+
return this.items[0];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
clear(): void {
|
|
25
|
+
this.items = [];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
isEmpty(): boolean {
|
|
29
|
+
return this.items.length === 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
size(): number {
|
|
33
|
+
return this.items.length;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
find(predicate: (item: T) => boolean): T | undefined {
|
|
37
|
+
return this.items.find(predicate);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
toArray(): T[] {
|
|
41
|
+
return [...this.items];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
contains(predicate: (item: T) => boolean): boolean {
|
|
45
|
+
return this.items.some(predicate);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AnyAction } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
export const isValidAction = (action: any): action is AnyAction => {
|
|
4
|
+
if (typeof action !== 'object' || action === null) {
|
|
5
|
+
console.error('Action is not a plain object:', action);
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (!action.type) {
|
|
10
|
+
console.error('Action missing type property:', action);
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return true;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const createSafeDispatch = (dispatch: any) => {
|
|
18
|
+
return (action: any) => {
|
|
19
|
+
if (!isValidAction(action)) {
|
|
20
|
+
console.error('Invalid action being dispatched:', action);
|
|
21
|
+
throw new Error('Invalid action: ' + JSON.stringify(action));
|
|
22
|
+
}
|
|
23
|
+
return dispatch(action);
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const createAsyncAction = (
|
|
28
|
+
asyncFunction: (...args: any[]) => Promise<any>
|
|
29
|
+
) => {
|
|
30
|
+
return (...args: any[]) =>
|
|
31
|
+
async (dispatch: any, getState: any) => {
|
|
32
|
+
try {
|
|
33
|
+
const result = await asyncFunction(...args);
|
|
34
|
+
return result;
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error('Async action error:', error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
interface ActionLogEntry {
|
|
2
|
+
timestamp: number;
|
|
3
|
+
action: any;
|
|
4
|
+
state: any;
|
|
5
|
+
stackTrace: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
class ActionLogger {
|
|
9
|
+
private logs: ActionLogEntry[] = [];
|
|
10
|
+
private maxLogs = 100;
|
|
11
|
+
|
|
12
|
+
logAction(action: any, state: any) {
|
|
13
|
+
if (process.env.NODE_ENV !== 'development') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const entry: ActionLogEntry = {
|
|
18
|
+
timestamp: Date.now(),
|
|
19
|
+
action,
|
|
20
|
+
state,
|
|
21
|
+
stackTrace: new Error().stack || '',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
this.logs.push(entry);
|
|
25
|
+
|
|
26
|
+
if (this.logs.length > this.maxLogs) {
|
|
27
|
+
this.logs = this.logs.slice(-this.maxLogs);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (typeof action !== 'object' || action === null) {
|
|
31
|
+
console.error('🚨 Non-plain object action detected:', action);
|
|
32
|
+
console.error('📋 Action type:', typeof action);
|
|
33
|
+
console.error('🔍 Constructor:', action?.constructor?.name);
|
|
34
|
+
console.error('📍 Stack trace:', entry.stackTrace);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!action.type) {
|
|
38
|
+
console.error('🚨 Action missing type property:', action);
|
|
39
|
+
console.error('📍 Stack trace:', entry.stackTrace);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getLogs() {
|
|
44
|
+
return [...this.logs];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
clearLogs() {
|
|
48
|
+
this.logs = [];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getRecentLogs(count: number = 10) {
|
|
52
|
+
return this.logs.slice(-count);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const actionLogger = new ActionLogger();
|
|
57
|
+
|
|
58
|
+
export const actionLoggerMiddleware =
|
|
59
|
+
(storeAPI: any) => (next: any) => (action: any) => {
|
|
60
|
+
if (process.env.NODE_ENV === 'development') {
|
|
61
|
+
actionLogger.logAction(action, storeAPI.getState());
|
|
62
|
+
}
|
|
63
|
+
return next(action);
|
|
64
|
+
};
|