1 |
- {"version":3,"sources":["components/reusableComponents/Routes/PrivateRoute/index.tsx","components/reusableComponents/Routes/PublicRoute/index.tsx","components/reusableComponents/Load/index.jsx","App.tsx","redux/messages/reducer/index.ts","redux/pinnedMessages/reducer/index.ts","redux/allMessages/reducer/index.ts","redux/contacts/reducer/index.ts","redux/chat/reducer/index.ts","redux/chats/reducer/index.ts","redux/control/reducer/index.ts","redux/authorization/reducer/index.ts","redux/rootReducer/index.ts","redux/store/index.ts","index.tsx","redux/authorization/action/index.ts","api-data/index.ts","redux/authorization/selector/index.ts","redux/control/action/index.ts","redux/chat/action/index.ts","redux/authorization/operations/index.ts","redux/messages/action/index.ts","redux/pinnedMessages/action/index.ts","redux/allMessages/action/index.ts","redux/contacts/action/index.ts","redux/chats/action/index.ts","helpers/index.ts","redux/chat/selector/index.ts","App.module.css","components/reusableComponents/Load/index.module.css"],"names":["PrivateRoute","children","routeProps","token","useSelector","getToken","to","PublicRoute","restricted","shouldRedirect","Load","className","s","loader","type","color","height","width","timeout","HomePage","lazy","AuthPage","App","companionId","getChat","dispatch","useDispatch","handleTypingClose","a","typingChat","useEffect","localStorage","isChecked","setToken","set","asyncCurrentUser","handleKeepIn","asyncLogout","onlineUser","window","addEventListener","removeEventListener","handleTypingChat","onMouseLeave","appWrapper","utils","DateFnsUtils","fallback","exact","path","position","autoClose","hideProgressBar","newestOnTop","closeOnClick","rtl","pauseOnFocusLoss","draggable","pauseOnHover","reducerMessages","createReducer","total","limit","page","messages","actionGetMessagesSuccess","state","payload","isEqual","actionGetMessagesReject","_payload_","reducerPinnedMessages","actionGetPinnedMessagesSuccess","actionGetPinnedMessagesReject","_payload","reducerAllMessages","actionGetAllMessagesSuccess","actionGetAllMessagesReject","reducerContacts","contacts","actionGetContactsSuccess","actionGetContactsReject","initialState","name","lastName","originalName","originalLastName","avatarUrl","avatarsArr","online","lastMessage","lastMessageCreatedAt","mute","sort","seen","seenCompanion","watched","typing","number","country","pinned","socketId","_id","owner","createdAt","updatedAt","__v","reducerChat","actionSelectChat","actionGetChatById","actionRemoveChat","_state","reducerChats","chats","actionGetChatsSuccess","actionGetChatsReject","reducerControl","leftIsOpen","rightIsOpen","scrollChat","openPinned","actionLeftIsOpen","actionRightIsOpen","actionScrollChat","actionOpenPinned","code","nightMode","silentMode","reducerAuthorization","actionLogInSuccess","actionLogInReject","actionLogOutSuccess","actionLogOutReject","actionCurrentSuccess","actionCurrentReject","authorizationPersistConfig","key","storage","rootReducer","combineReducers","pinnedMessages","allMessages","chat","control","authorization","persistReducer","composeEnhancers","composeWithDevTools","store","createStore","applyMiddleware","thunk","persistor","persistStore","queryClient","QueryClient","ReactDOM","render","StrictMode","loading","QueryClientProvider","client","document","getElementById","createAction","value","axios","require","defaults","baseURL","prodBaseURL","headers","common","Authorization","unset","forbidden","message","slice","removeItem","location","reload","authorizeUser","post","data","closeTime","toast","success","progress","undefined","loginUser","patch","logoutUser","updateCredentials","body","updateUser","removeUserAvatar","index","delete","updateUserAvatar","formData","currentUser","get","addContact","removeContact","id","updateContact","pinContact","getContacts","getChatById","_doc","startChat","removeChatForBoth","muteChat","sortChat","socketIdChat","seenChat","pinChat","getChats","removeMessageById","removeSelectedMessagesById","selectedArr","updateMessageById","emoji","pinMessageById","unpinAllMessagesById","sentMessageById","caption","sentMessageEditById","sentMessageReplyById","sentMessageForwardById","companionIdForwardToAndFrom","sentImgMessageById","sentAudioMessageById","sentVideoMessageById","sentFileMessageById","getMessagesById","getAllMessages","getNumber","getSort","getNightMode","getSilentMode","getAuthorizationState","asyncCreateUser","file","FormData","append","asyncLogin","cb","registered","Error","format","split","join","trim","firstLetter","word","toUpperCase","slicedWord","max","from","length","timeStampEU","Date","toLocaleString","year","month","day","hour","minute","timeStampEUFilter","second","timeStampMessage","timeStampFilter","playNotification","url","Audio","play","notification","onClick","copied","text","playNotificationWithoutPermission","w","audioContext","AudioContext","webkitAudioContext","navigator","mediaDevices","getUserMedia","audio","then","source","createBufferSource","stop","close","request","XMLHttpRequest","open","responseType","onload","decodeAudioData","response","buffer","connect","destination","start","e","console","log","send","catch","reason","error","handleDownload","FileSaver","saveAs","handleSort","sortBy","b","sortByRecent","aCreatedAt","bCreatedAt","aTime","bTime","filteredMessages","arr","date","filter","el","fullType","toLowerCase","includes","filterBy","emojisArr","prodSocketURL","prodAwsS3","refreshAppTime","getChatMemo","createSelector","module","exports"],"mappings":"sVAiBeA,MAXf,YAAmE,IAA3CC,EAA0C,EAA1CA,SAAaC,EAA6B,4BAC1DC,EAAQC,YAAYC,KAC1B,OACE,cAAC,IAAD,2BAAWH,GAAX,aACGC,EAAQF,EAAW,cAAC,IAAD,CAAUK,GAAG,YCYxBC,MAhBf,YAIkB,IAHhBN,EAGe,EAHfA,SAGe,IAFfO,kBAEe,SADZN,EACY,yCAETO,EADQL,YAAYC,MACMG,EAEhC,OACE,cAAC,IAAD,2BAAWN,GAAX,aACGO,EAAiB,cAAC,IAAD,CAAUH,GAAG,MAASL,M,2CCE/BS,EAbF,WACX,OACE,cAAC,IAAD,CACEC,UAAWC,IAAEC,OACbC,KAAK,OACLC,MAAM,UACNC,OAAQ,IACRC,MAAO,IACPC,QAAS,OCGTC,EAAWC,gBACf,kBACE,8DAKEC,EAAWD,gBACf,kBACE,uDAsEWE,I,gBAAAA,EAjEf,WACE,IAAMnB,EAAQC,YAAYC,KAClBkB,EAAgBnB,YAAYoB,KAA5BD,YACFE,EAAWC,cACXC,EAAiB,uCAAG,sBAAAC,EAAA,8DAAYL,GAAZ,qCAAgCM,YAAWN,GAAa,GAAxD,oGAAH,qDA8BvB,OA5BAO,qBAAU,WACJ3B,GAAoC,SAA3B4B,aAAaC,YACxBC,IAASC,IAAI/B,GACbsB,EAASU,kBAET,CAACV,EAAUtB,IAEf2B,qBAAU,WACR,IAAMM,EAAY,uCAAG,4BAAAR,EAAA,2DACbI,EAAYD,aAAaC,YACF,UAAdA,EAFI,gBAGjBP,EAASY,eAHQ,0BAIRL,GAAyB,SAAdA,EAJH,gCAKTM,cALS,2CAAH,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119.chunk.js","sourcesContent":["import { Route, Redirect } from 'react-router-dom';\nimport { useSelector } from 'react-redux';\n\nimport { IPrivateProps} from '../../../../typescript/components/Routes/interfaces';\nimport { getToken } from '../../../../redux/authorization/selector'\n\nfunction PrivateRoute({ children, ...routeProps }: IPrivateProps) {\n const token = useSelector(getToken)\n return (\n <Route {...routeProps}>\n {token ? children : <Redirect to=\"/w/\" />}\n </Route>\n );\n}\n\n\n\nexport default PrivateRoute\n","import { Route, Redirect } from 'react-router-dom';\nimport { useSelector } from 'react-redux';\n\nimport { IPublicProps } from '../../../../typescript/components/Routes/interfaces';\nimport { getToken } from '../../../../redux/authorization/selector'\n\nfunction PublicRoute({\n children,\n restricted = false,\n ...routeProps\n}: IPublicProps) {\n const token = useSelector(getToken)\n const shouldRedirect = token && restricted;\n\n return (\n <Route {...routeProps}>\n {shouldRedirect ? <Redirect to=\"/\" /> : children}\n </Route>\n );\n}\n\n\nexport default PublicRoute;\n","import 'react-loader-spinner/dist/loader/css/react-spinner-loader.css';\nimport Loader from 'react-loader-spinner';\n\nimport s from './index.module.css';\n\nconst Load = () => {\n return (\n <Loader\n className={s.loader}\n type=\"Puff\"\n color=\"#0ca0f5\"\n height={100}\n width={100}\n timeout={300000}\n />\n )\n};\n\nexport default Load\n\n\n\n","import { lazy, Suspense , useEffect } from 'react';\nimport { BrowserRouter, Switch } from 'react-router-dom';\nimport { ToastContainer } from 'react-toastify';\nimport { useSelector, useDispatch } from 'react-redux';\nimport { MuiPickersUtilsProvider } from '@material-ui/pickers';\nimport DateFnsUtils from '@date-io/date-fns';\n\nimport s from './App.module.css';\nimport { getToken } from './redux/authorization/selector'\nimport { getChat } from './redux/chat/selector'\nimport { asyncLogout, asyncCurrentUser } from './redux/authorization/operations'\nimport { setToken, onlineUser,typingChat } from './api-data'\nimport PrivateRoute from './components/reusableComponents/Routes/PrivateRoute';\nimport PublicRoute from './components/reusableComponents/Routes/PublicRoute';\nimport Load from './components/reusableComponents/Load';\n\nconst HomePage = lazy(\n () =>\n import(\n './components/HomePage' /* webpackChunkName: \"HomePage\" */\n ),\n);\n\nconst AuthPage = lazy(\n () =>\n import(\n './components/AuthPage' /* webpackChunkName: \"AuthPage\" */\n ),\n);\n\nfunction App() {\n const token = useSelector(getToken)\n const { companionId } = useSelector(getChat)\n const dispatch = useDispatch()\n const handleTypingClose = async () => companionId&& await typingChat(companionId, false)\n \n useEffect(() => {\n if (token && localStorage.isChecked === 'true') {\n setToken.set(token)\n dispatch(asyncCurrentUser())\n }\n }, [dispatch, token])\n\n useEffect(() => {\n const handleKeepIn = async () => {\n const isChecked = localStorage.isChecked\n if (isChecked&&isChecked === 'false') {\n dispatch(asyncLogout())\n } else if (isChecked&&isChecked === 'true') {\n await onlineUser()\n }\n }\n window.addEventListener(\"beforeunload\",handleKeepIn)\n return () => window.removeEventListener(\"beforeunload\", handleKeepIn)\n\n }, [dispatch])\n\n useEffect(() => {\n const handleTypingChat = async () => await typingChat(companionId,false)\n window.addEventListener(\"beforeunload\",handleTypingChat)\n return () => window.removeEventListener(\"beforeunload\", handleTypingChat)\n\n }, [companionId])\n\n return (\n <div onMouseLeave={handleTypingClose} className={s.appWrapper}>\n <MuiPickersUtilsProvider utils={DateFnsUtils}>\n <Suspense fallback={<Load/>}>\n <BrowserRouter>\n <Switch>\n <PrivateRoute exact path=\"/\">\n <HomePage/>\n </PrivateRoute>\n <PublicRoute path={'/w/'} restricted>\n <AuthPage />\n </PublicRoute>\n </Switch>\n </BrowserRouter>\n </Suspense>\n <ToastContainer\n position=\"top-right\"\n autoClose={5000}\n hideProgressBar={false}\n newestOnTop={false}\n closeOnClick\n rtl={false}\n pauseOnFocusLoss\n draggable\n pauseOnHover\n /> \n </MuiPickersUtilsProvider>\n </div>\n)}\n\n\nexport default App;\n","import isEqual from 'lodash.isequal';\r\nimport { createReducer } from '@reduxjs/toolkit';\r\nimport { IMessagesState, IMessagesPayload} from '../../../typescript/redux/messages/interfaces';\r\nimport {\r\n actionGetMessagesSuccess,\r\n actionGetMessagesReject\r\n} from '../action';\r\n\r\nconst initialState: IMessagesState = {\r\n total: \"0\",\r\n limit: \"0\",\r\n page: \"0\",\r\n messages: [],\r\n}\r\n\r\nconst reducerMessages = createReducer(initialState, {\r\n [actionGetMessagesSuccess.type]: (state, { payload }: IMessagesPayload) => {\r\n if (isEqual(state, payload) === false) return payload\r\n return state;\r\n },\r\n [actionGetMessagesReject.type]: (state, _payload_) => {\r\n return state;\r\n },\r\n});\r\n\r\nexport default reducerMessages;\r\n","import isEqual from 'lodash.isequal';\r\nimport { createReducer } from '@reduxjs/toolkit';\r\nimport { IPinnedMessagesPayload} from '../../../typescript/redux/pinnedMessages/interfaces';\r\nimport { TPinnedMessages} from '../../../typescript/redux/pinnedMessages/types';\r\nimport {\r\n actionGetPinnedMessagesSuccess,\r\n actionGetPinnedMessagesReject,\r\n} from '../action';\r\n\r\nconst initialState: TPinnedMessages = []\r\n\r\nconst reducerPinnedMessages = createReducer(initialState, {\r\n [actionGetPinnedMessagesSuccess.type]: (state, { payload }: IPinnedMessagesPayload) => {\r\n if (isEqual(state, payload) === false) return payload\r\n return state;\r\n },\r\n [actionGetPinnedMessagesReject.type]: (state, _payload) => {\r\n return state;\r\n },\r\n});\r\n\r\nexport default reducerPinnedMessages;\r\n","import isEqual from 'lodash.isequal';\r\nimport { createReducer } from '@reduxjs/toolkit';\r\nimport { IAllMessagesState, IAllMessagesPayload} from '../../../typescript/redux/allMessages/interfaces';\r\nimport {\r\n actionGetAllMessagesSuccess,\r\n actionGetAllMessagesReject,\r\n} from '../action';\r\n\r\nconst initialState: IAllMessagesState = {\r\n total: \"0\",\r\n limit: \"0\",\r\n page: \"0\",\r\n messages: [],\r\n}\r\n\r\nconst reducerAllMessages = createReducer(initialState, {\r\n [actionGetAllMessagesSuccess.type]: (state, { payload }: IAllMessagesPayload) => {\r\n if (isEqual(state, payload) === false) return payload\r\n return state;\r\n },\r\n [actionGetAllMessagesReject.type]: (state, _payload) => {\r\n return state;\r\n },\r\n});\r\n\r\nexport default reducerAllMessages;\r\n","import isEqual from 'lodash.isequal';\r\nimport { createReducer } from '@reduxjs/toolkit';\r\nimport { IContactsState,IContactsPayload} from '../../../typescript/redux/contacts/interfaces';\r\nimport {\r\n actionGetContactsSuccess,\r\n actionGetContactsReject\r\n} from '../action';\r\n\r\nconst initialState:IContactsState = {\r\n total: \"0\",\r\n limit: \"0\",\r\n page: \"0\",\r\n contacts: []\r\n}\r\n\r\nconst reducerContacts = createReducer(initialState, {\r\n [actionGetContactsSuccess.type]: (state, { payload }: IContactsPayload) => {\r\n if (isEqual(state, payload) === false) return payload\r\n return state;\r\n },\r\n [actionGetContactsReject.type]: (state, _payload) => {\r\n return state;\r\n },\r\n});\r\n\r\nexport default reducerContacts;\r\n","import isEqual from 'lodash.isequal';\r\nimport { createReducer } from '@reduxjs/toolkit';\r\nimport { IChatPayload } from '../../../typescript/redux/chat/interfaces';\r\nimport { TChat} from '../../../typescript/redux/chat/types';\r\n\r\nimport {\r\n actionSelectChat,\r\n actionGetChatById,\r\n actionRemoveChat\r\n} from '../action';\r\n\r\nconst initialState: TChat = {\r\n name: '',\r\n lastName: '',\r\n originalName: '',\r\n originalLastName: '',\r\n avatarUrl: '',\r\n avatarsArr: [],\r\n color: '',\r\n online: '',\r\n lastMessage: '',\r\n lastMessageCreatedAt:'',\r\n mute: false,\r\n sort:false,\r\n seen: 0,\r\n seenCompanion: 0,\r\n total: 0,\r\n watched: false,\r\n typing: false,\r\n number: '',\r\n country: '',\r\n pinned: false,\r\n socketId:\"\",\r\n _id: '',\r\n companionId: '',\r\n owner: '',\r\n createdAt: '',\r\n updatedAt: '',\r\n __v: 0,\r\n}\r\n\r\nconst reducerChat = createReducer(initialState, {\r\n [actionSelectChat.type]: (state, { payload }: IChatPayload) => {\r\n if (isEqual(state, payload) === false) return payload\r\n return state;\r\n },\r\n [actionGetChatById.type]: (state, { payload }: IChatPayload) => {\r\n if (isEqual(state, payload) === false) return payload\r\n return state;\r\n },\r\n [actionRemoveChat.type]: (_state,_payload) => {\r\n return initialState\r\n }, \r\n});\r\n\r\nexport default reducerChat;\r\n","import isEqual from 'lodash.isequal';\r\nimport { createReducer } from '@reduxjs/toolkit';\r\nimport { IChatsState, IChatsPayload } from '../../../typescript/redux/chats/interfaces';\r\n\r\nimport {\r\n actionGetChatsSuccess,\r\n actionGetChatsReject,\r\n} from '../action';\r\n\r\nconst initialState: IChatsState = {\r\n total: \"0\",\r\n limit: \"0\",\r\n page: \"0\",\r\n chats: [],\r\n}\r\n\r\n\r\n\r\nconst reducerChats = createReducer(initialState, {\r\n [actionGetChatsSuccess.type]: (state, { payload }: IChatsPayload) => {\r\n if (isEqual(state, payload) === false) return payload\r\n return state;\r\n },\r\n [actionGetChatsReject.type]: (state, _payload) => {\r\n return state;\r\n },\r\n});\r\n\r\nexport default reducerChats;\r\n","import isEqual from 'lodash.isequal';\nimport { createReducer } from '@reduxjs/toolkit';\nimport { actionLeftIsOpen,actionRightIsOpen,actionScrollChat,actionOpenPinned } from '../action';\nimport { IControlState,IPayloadLeftIsOpen,IPayloadRightIsOpen,IPayloadScrollChat,IPayloadOpenPinned } from '../../../typescript/redux/control/interfaces'\n\nconst initialState: IControlState = {\n leftIsOpen: '',\n rightIsOpen: '',\n scrollChat: false,\n openPinned: false,\n}\n\nconst reducerControl = createReducer(initialState, {\n [actionLeftIsOpen.type]: (state, { payload: leftIsOpen }: IPayloadLeftIsOpen) => {\n if (isEqual(state.leftIsOpen, leftIsOpen) === false) return {...state,leftIsOpen}\n return state; \n }, \n [actionRightIsOpen.type]: (state, { payload: rightIsOpen }: IPayloadRightIsOpen) => {\n if (isEqual(state.rightIsOpen, rightIsOpen) === false) return {...state,rightIsOpen}\n return state; \n },\n [actionScrollChat.type]: (state, { payload: scrollChat }: IPayloadScrollChat) => {\n if (isEqual(state.scrollChat, scrollChat) === false) return {...state,scrollChat}\n return state; \n },\n [actionOpenPinned.type]: (state, { payload: openPinned }: IPayloadOpenPinned) => {\n if (isEqual(state.openPinned, openPinned) === false) return {...state,openPinned}\n return state; \n }, \n});\n\nexport default reducerControl;\n","import isEqual from 'lodash.isequal';\r\nimport { createReducer } from '@reduxjs/toolkit';\r\nimport { IAuthorizationState , IAuthorizationPayload} from '../../../typescript/redux/authorization/interfaces';\r\nimport {\r\n actionLogInSuccess,\r\n actionLogInReject,\r\n actionLogOutSuccess,\r\n actionLogOutReject,\r\n actionCurrentSuccess,\r\n actionCurrentReject\r\n} from '../action';\r\n\r\nconst initialState:IAuthorizationState = {\r\n name: \"\",\r\n lastName: \"\",\r\n originalName: \"\",\r\n originalLastName: \"\",\r\n avatarUrl: \"\",\r\n avatarsArr: [],\r\n color: \"\",\r\n code: \"\",\r\n _id: \"\",\r\n token: \"\",\r\n online: \"\",\r\n number: \"\" ,\r\n country: \"\",\r\n sort: false,\r\n nightMode: false,\r\n silentMode: false,\r\n createdAt: \"\",\r\n updatedAt: \"\",\r\n __v: 0,\r\n}\r\n\r\nconst reducerAuthorization = createReducer(initialState, {\r\n [actionLogInSuccess.type]: (state, { payload:token }: { payload: string }) => {\r\n return {...state,token};\r\n },\r\n [actionLogInReject.type]: (state, _payload) => {\r\n return state;\r\n },\r\n [actionLogOutSuccess.type]: (_state, _payload) => {\r\n return initialState;\r\n },\r\n [actionLogOutReject.type]: (state, _payload) => {\r\n return state;\r\n },\r\n [actionCurrentSuccess.type]: (state, { payload }: IAuthorizationPayload) => {\r\n if (isEqual(state, payload) === false) return payload\r\n return state;\r\n },\r\n [actionCurrentReject.type]: (_state, _payload) => {\r\n return initialState;\r\n },\r\n});\r\n\r\nexport default reducerAuthorization;\r\n","import { combineReducers } from '@reduxjs/toolkit';\r\nimport { persistReducer } from 'redux-persist';\r\nimport storage from 'redux-persist/lib/storage';\r\n\r\nimport reducerMessages from '../messages/reducer'\r\nimport reducerPinnedMessages from '../pinnedMessages/reducer';\r\nimport reducerAllMessages from '../allMessages/reducer'\r\nimport reducerContacts from '../contacts/reducer'\r\nimport reducerChat from '../chat/reducer'\r\nimport reducerChats from '../chats/reducer'\r\nimport reducerControl from '../control/reducer'\r\nimport reducerAuthorization from '../authorization/reducer';\r\n\r\nconst authorizationPersistConfig = {\r\n key: 'auth',\r\n storage: storage,\r\n};\r\n\r\nexport const rootReducer = combineReducers({\r\n messages: reducerMessages,\r\n pinnedMessages: reducerPinnedMessages,\r\n allMessages: reducerAllMessages,\r\n chat:reducerChat,\r\n chats: reducerChats,\r\n contacts:reducerContacts,\r\n control: reducerControl,\r\n authorization: persistReducer(\r\n authorizationPersistConfig,\r\n reducerAuthorization,\r\n ),\r\n});\r\n","import { createStore, applyMiddleware } from 'redux';\r\nimport thunk from 'redux-thunk';\r\nimport { persistStore } from 'redux-persist';\r\nimport { composeWithDevTools } from 'redux-devtools-extension';\r\n\r\nimport { rootReducer } from '../rootReducer';\r\n\r\nconst composeEnhancers = composeWithDevTools({});\r\nconst store = createStore(\r\n rootReducer,\r\n composeEnhancers(applyMiddleware(thunk)),\r\n);\r\nconst persistor = persistStore(store);\r\nexport { store, persistor };\r\n","import React from 'react';\nimport { Provider } from 'react-redux';\nimport { PersistGate } from 'redux-persist/integration/react';\nimport ReactDOM from 'react-dom';\nimport 'video-react/dist/video-react.css';\nimport 'react-toastify/dist/ReactToastify.css';\nimport 'modern-normalize/modern-normalize.css';\nimport \"react-responsive-carousel/lib/styles/carousel.min.css\"\nimport './index.css';\nimport App from './App';\nimport Load from './components/reusableComponents/Load'\nimport { store, persistor } from './redux/store';\nimport { QueryClient, QueryClientProvider } from 'react-query';\n\nconst queryClient = new QueryClient();\n\n\nReactDOM.render(\n <React.StrictMode>\n <PersistGate loading={<Load/>} persistor={persistor}>\n <Provider store={store}>\n <QueryClientProvider client={queryClient}>\n <App />\n </QueryClientProvider>\n </Provider>\n </PersistGate>\n </React.StrictMode>,\n document.getElementById('root'),\n);\n","import { createAction } from '@reduxjs/toolkit';\r\nimport {IAuthorizationState} from '../../../typescript/redux/authorization/interfaces'\r\n\r\nconst actionLogInSuccess = createAction('login/success', (value:string) => ({\r\n payload: value,\r\n}));\r\n\r\nconst actionLogInReject = createAction('login/reject', () => ({\r\n payload: null,\r\n}));\r\n\r\nconst actionLogOutSuccess = createAction('logout/success', () => ({\r\n payload: null,\r\n}));\r\n\r\nconst actionLogOutReject = createAction('logout/reject', () => ({\r\n payload: null,\r\n}));\r\n\r\nconst actionCurrentSuccess = createAction('current/success', (value:IAuthorizationState) => ({\r\n payload: value,\r\n}));\r\n\r\nconst actionCurrentReject = createAction('current/reject', () => ({\r\n payload: null,\r\n}));\r\n\r\nexport {\r\n actionLogInSuccess,\r\n actionLogInReject,\r\n actionLogOutSuccess,\r\n actionLogOutReject,\r\n actionCurrentSuccess,\r\n actionCurrentReject\r\n};\r\n","import { toast } from 'react-toastify';\nimport { prodBaseURL } from '../helpers';\nconst axios = require('axios');\naxios.defaults.baseURL = `${prodBaseURL}/api`;\n\nconst error = (message:string,closeTime: false| number) =>\n toast.error(`🔥 ${message}!`, {\n position: 'bottom-left',\n autoClose: closeTime,\n hideProgressBar: false,\n closeOnClick: true,\n pauseOnHover: true,\n draggable: true,\n progress: undefined,\n });\n\nconst success = (message:string,closeTime: false| number) =>\n toast.success(`⚡ ${message}`, {\n position: 'bottom-left',\n autoClose: closeTime,\n hideProgressBar: false,\n closeOnClick: true,\n pauseOnHover: true,\n draggable: true,\n progress: undefined,\n });\n\nconst setToken = {\n set(token:string) {\n axios.defaults.headers.common.Authorization = `Bearer ${token}`;\n },\n unset() {\n axios.defaults.headers.common.Authorization = '';\n },\n};\n\nconst forbidden = ({ message }: any) => {\n if (message.slice(-3) === '403') {\n localStorage.removeItem('persist:auth')\n window.location.reload(true);\n }\n}\n\nconst authorizeUser = async (number:string,country:string):Promise<string | undefined> => {\n try {\n const { data : {data} } = await axios.post('/auth/register', { number,country });\n success(`Use this code ${data} to sign in to the app \"w-telegram\". The real code cannot be sent via SMS to your phone because the Twilio account is not paid.`,20000);\n return data\n } catch (e) {\n return undefined\n }\n};\n\nconst loginUser = async <T>(number:string,code:string):Promise<T | undefined> => {\n try {\n const { data : {data} } = await axios.patch('/auth/login', { number,code });\n return data\n } catch (e) {\n return undefined\n }\n};\n\nconst logoutUser = async <T>():Promise<T | undefined> => {\n try {\n const { data } = await axios.patch('/auth/logout');\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst onlineUser = async <T>():Promise<T | undefined> => {\n try {\n const { data } = await axios.patch('/auth/online');\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst updateCredentials = async <T>(body:object):Promise<T | undefined> => {\n try {\n const { data : {data} } = await axios.patch('/users/current/credentials', body);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst updateUser = async <T>(body:object):Promise<T | undefined> => {\n try {\n const { data : {data} } = await axios.patch('/users/current/update', body);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst removeUserAvatar = async <T>(index:number):Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.delete(`/users/current/${index}`);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst updateUserAvatar = async <T>(formData: object): Promise<T | undefined> => {\n try {\n const { data : {data} } = await axios.patch('/users/avatars', formData);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n } \n};\n\nconst currentUser = async <T>(): Promise<T | undefined> => {\n try {\n const { data : {data} } = await axios.get('/users/current');\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n } \n};\n\nconst addContact = async <T>(number:string): Promise<T | undefined> => {\n try {\n const { data : {data} } = await axios.post('/contacts', { number });\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst removeContact = async <T>(id:string): Promise<T | undefined> => {\n try {\n const { data : {data} } = await axios.delete(`/contacts/${id}`);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst updateContact = async <T>(id:string,_id:string,name:string,lastName:string,companionId:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch('/contacts', { id, _id, name, lastName,companionId });\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst pinContact = async <T>(id:string,pinned:boolean): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch('/contacts/pin', { id, pinned });\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst getContacts = async <T>(): Promise<T | undefined> => {\n try {\n const { data : {data} } = await axios.get('/contacts');\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst getChatById = async <T>(id:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.get(`/chats/${id}`);\n return data._doc\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst startChat = async <T>(id:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post('/chats', { id });\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst removeChatForBoth = async <T>(id:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.delete(`/chats/both/${id}`);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst muteChat = async <T>(id:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch('/chats/mute', {id});\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sortChat = async <T>(id:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch('/chats/sort', {id});\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst socketIdChat = async <T>(socketId:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch('/chats/socketId', {socketId});\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst seenChat = async <T>(id:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch('/chats/seen', { id });\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst typingChat = async <T>(id:string,typing:boolean): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch('/chats/typing', { id,typing});\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst pinChat = async <T>(id:string,pinned:boolean): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch('/chats/pin', { id,pinned});\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst getChats = async <T>(): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.get('/chats');\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst removeMessageById = async <T>(id:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.delete(`/messages/${id}`);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst removeSelectedMessagesById = async <T>(companionId:string,selectedArr:string[]): Promise<T | undefined> => {\n try {\n const { data } = await axios.patch('/messages/selected',{companionId,selectedArr});\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst updateMessageById = async <T>(id:string,emoji:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch(`/messages/${id}`,{emoji});\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst pinMessageById = async <T>(id:string,pinned:boolean): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch(`/messages/pin/${id}`,{pinned});\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst unpinAllMessagesById = async <T>(pinnedMessages:string[]): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.patch('/messages/unpin/all/',{pinnedMessages});\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentMessageById = async <T>(id:string,message:string,caption:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post('/messages', { id, message,caption });\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentMessageEditById = async <T>(id:string,message:string,caption:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post('/messages/edit', { id, message,caption });\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentMessageReplyById = async <T>(id:string,message:string,caption:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post('/messages/reply', { id, message,caption });\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentMessageForwardById = async <T>(id:string,companionIdForwardToAndFrom:string,message:string,caption:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post('/messages/forward', { id,companionIdForwardToAndFrom,message,caption });\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentImgMessageById = async <T>(id:string,formData: object,caption:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post(`/messages/image/${id} ${caption}}`, formData);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentAudioMessageById = async <T>(id:string,formData: object,caption:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post(`/messages/audio/${id} ${caption}`, formData);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentVideoMessageById = async <T>(id:string,formData: object,caption:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post(`/messages/video/${id} ${caption}`, formData);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentFileMessageById = async <T>(id:string,formData: object,caption:string): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post(`/messages/file/${id} ${caption}`, formData);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst getMessagesById = async <T>(id:string): Promise<T | undefined> => {\n try {\n const { data : {data} } = await axios.get(`/messages/${id}`);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst getAllMessages = async <T>(): Promise<T | undefined> => {\n try {\n const { data : {data} } = await axios.get('/messages');\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nexport {\n setToken,\n error,\n success,\n authorizeUser,\n loginUser,\n logoutUser,\n onlineUser,\n updateCredentials,\n updateUser,\n removeUserAvatar,\n updateUserAvatar,\n currentUser,\n addContact,\n removeContact,\n updateContact,\n pinContact,\n getContacts,\n startChat,\n removeChatForBoth,\n getChatById,\n muteChat,\n sortChat,\n socketIdChat,\n seenChat,\n typingChat,\n pinChat,\n getChats,\n removeMessageById,\n removeSelectedMessagesById,\n updateMessageById,\n pinMessageById,\n unpinAllMessagesById,\n sentMessageById,\n sentMessageEditById,\n sentMessageReplyById,\n sentMessageForwardById,\n sentImgMessageById,\n sentAudioMessageById,\n sentVideoMessageById,\n sentFileMessageById,\n getMessagesById,\n getAllMessages,\n};\n","import {IState} from '../../../typescript/redux/interfaces'\r\n\r\nconst getToken = (state: IState) => state.authorization.token;\r\nconst getNumber = (state:IState) => state.authorization.number;\r\nconst getName = (state: IState) => state.authorization.name;\r\nconst getLastName = (state: IState) => state.authorization.lastName;\r\nconst getCountry = (state: IState) => state.authorization.country;\r\nconst getAvatarUrl = (state: IState) => state.authorization.avatarUrl;\r\nconst getId = (state: IState) => state.authorization._id;\r\nconst getSort = (state: IState) => state.authorization.sort;\r\nconst getNightMode = (state: IState) => state.authorization.nightMode;\r\nconst getSilentMode = (state: IState) => state.authorization.silentMode;\r\nconst getAuthorizationState= (state:IState) => state.authorization;\r\n\r\nexport { getToken,getNumber,getName,getLastName,getCountry,getAvatarUrl,getId,getSort,getNightMode,getSilentMode,getAuthorizationState };\r\n","import { createAction } from '@reduxjs/toolkit';\nimport { TLeftIsOpen,TRightIsOpen,TScrollChat } from '../../../typescript/redux/control/types'\n\nconst actionLeftIsOpen= createAction('control/LeftIsOpen', (value:TLeftIsOpen) => ({\n payload: value,\n}));\n\nconst actionRightIsOpen= createAction('control/RightIsOpen', (value:TRightIsOpen) => ({\n payload: value,\n}));\n\nconst actionScrollChat = createAction('control/scrollChat', (value:TScrollChat) => ({\n payload: value,\n}));\n\nconst actionOpenPinned = createAction('control/openPinned', (value:boolean) => ({\n payload: value,\n}));\n\n\n\nexport { actionLeftIsOpen,actionRightIsOpen,actionScrollChat,actionOpenPinned };\n","import { createAction } from '@reduxjs/toolkit';\r\nimport { TChat } from '../../../typescript/redux/chat/types'\r\n\r\nconst actionSelectChat = createAction('selectChat/success', (value:TChat) => ({\r\n payload: value,\r\n}));\r\nconst actionGetChatById = createAction('getChatById/success', (value:TChat) => ({\r\n payload: value,\r\n}));\r\n\r\nconst actionRemoveChat = createAction('deleteChat/success', () => ({\r\n payload:{}\r\n}));\r\n\r\n\r\nexport {\r\n actionSelectChat,\r\n actionGetChatById,\r\n actionRemoveChat\r\n};\r\n","import {\r\n actionLogInSuccess,\r\n actionLogInReject,\r\n actionLogOutSuccess,\r\n actionLogOutReject,\r\n actionCurrentSuccess,\r\n actionCurrentReject\r\n} from '../action';\r\nimport { setToken, loginUser, logoutUser, updateCredentials, updateUserAvatar, currentUser } from '../../../api-data';\r\nimport { IAuthorizationState } from '../../../typescript/redux/authorization/interfaces'\r\n\r\nconst asyncCreateUser = (name:string, lastName: string,file:object | null) => async (dispatch:any) => {\r\n try {\r\n const data = await updateCredentials<{token:string}>({ name, lastName, originalName:name, originalLastName:lastName})\r\n if(data&&data.token) dispatch(actionLogInSuccess(data.token)) \r\n if (file) {\r\n const formData: any = new FormData()\r\n formData.append(\"avatar\", file);\r\n await updateUserAvatar(formData)\r\n }\r\n } catch (e) {\r\n dispatch(actionLogInReject())\r\n } \r\n};\r\n\r\nconst asyncLogin = (number:string, code: string,cb:() => void ) => async (dispatch:any) => {\r\n try {\r\n const data = await loginUser<{ token: string, registered: boolean }>(number, code);\r\n const token = data?.token\r\n const registered = data?.registered\r\n if (!token) return\r\n setToken.set(token)\r\n if (!registered) return cb()\r\n dispatch(actionLogInSuccess(token))\r\n } catch (e) {\r\n dispatch(actionLogInReject());\r\n cb()\r\n } \r\n};\r\n\r\nconst asyncLogout = () => async (dispatch:any) => {\r\n try {\r\n await logoutUser<object>();\r\n dispatch(actionLogOutSuccess());\r\n setToken.unset()\r\n } catch (e) {\r\n dispatch(actionLogOutReject());\r\n } \r\n};\r\n\r\nconst asyncCurrentUser = () => async (dispatch:any) => {\r\n try {\r\n const data = await currentUser<IAuthorizationState>()\r\n data && dispatch(actionCurrentSuccess(data));\r\n if(!data?.token) throw new Error('old token')\r\n } catch (e) {\r\n dispatch(actionCurrentReject());\r\n } \r\n};\r\n\r\nexport { asyncCreateUser, asyncLogin, asyncLogout, asyncCurrentUser };\r\n","import { createAction } from '@reduxjs/toolkit';\r\nimport { IMessagesState } from '../../../typescript/redux/messages/interfaces'\r\n\r\nconst actionGetMessagesSuccess = createAction('getMessages/success', (value:IMessagesState) => ({\r\n payload: value,\r\n}));\r\n\r\nconst actionGetMessagesReject = createAction('getMessages/reject', () => ({\r\n payload: null,\r\n}));\r\n\r\n\r\nexport {\r\n actionGetMessagesSuccess,\r\n actionGetMessagesReject,\r\n};\r\n","import { createAction } from '@reduxjs/toolkit';\r\nimport { TPinnedMessages } from '../../../typescript/redux/pinnedMessages/types'\r\n\r\nconst actionGetPinnedMessagesSuccess = createAction('getPinnedMessages/success', (value:TPinnedMessages) => ({\r\n payload: value,\r\n}));\r\n\r\nconst actionGetPinnedMessagesReject = createAction('getPinnedMessages/reject', () => ({\r\n payload: null,\r\n}));\r\n\r\n\r\nexport {\r\n actionGetPinnedMessagesSuccess,\r\n actionGetPinnedMessagesReject,\r\n};\r\n","import { createAction } from '@reduxjs/toolkit';\r\nimport { IAllMessagesState } from '../../../typescript/redux/allMessages/interfaces'\r\n\r\nconst actionGetAllMessagesSuccess = createAction('getAllMessages/success', (value:IAllMessagesState) => ({\r\n payload: value,\r\n}));\r\n\r\nconst actionGetAllMessagesReject = createAction('getAllMessages/reject', () => ({\r\n payload: null,\r\n}));\r\n\r\n\r\nexport {\r\n actionGetAllMessagesSuccess,\r\n actionGetAllMessagesReject,\r\n};\r\n","import { createAction } from '@reduxjs/toolkit';\r\nimport { IContactsState } from '../../../typescript/redux/contacts/interfaces'\r\n\r\nconst actionGetContactsSuccess = createAction('getContacts/success', (value:IContactsState) => ({\r\n payload: value,\r\n}));\r\n\r\nconst actionGetContactsReject = createAction('getContacts/reject', () => ({\r\n payload: null,\r\n}));\r\n\r\n\r\nexport {\r\n actionGetContactsSuccess,\r\n actionGetContactsReject\r\n};\r\n","import { createAction } from '@reduxjs/toolkit';\r\nimport { IChatsRes } from '../../../typescript/redux/chats/interfaces'\r\nimport { TChat } from '../../../typescript/redux/chats/types'\r\n\r\nconst actionGetChatsSuccess = createAction('getChats/success', (value:IChatsRes) => ({\r\n payload: value,\r\n}));\r\n\r\nconst actionGetChatsReject = createAction('getChats/reject', () => ({\r\n payload: null,\r\n}));\r\n\r\n\r\nexport {\r\n actionGetChatsSuccess,\r\n actionGetChatsReject,\r\n};\r\n","import { toast } from 'react-toastify';\r\nimport FileSaver from 'file-saver';\r\nimport { TChats } from '../typescript/redux/chats/types';\r\nimport { TAllMessages } from '../typescript/redux/allMessages/types';\r\n\r\nconst format = (a: string) => a.split(' ').join('').trim()\r\n\r\nconst firstLetter = (word: string) => word.slice(0, 1).toUpperCase()\r\n\r\nconst slicedWord = (word: string, max: number, from: number = 0) =>\r\n word.length < max ? word.slice(from) : word.slice(from, max)\r\n \r\nconst timeStamp = (updatedAt: string) => new Date(updatedAt).toLocaleString(\"en-US\", {\r\n year:'numeric',\r\n month: 'short',\r\n day: 'numeric',\r\n hour: 'numeric',\r\n minute: '2-digit',\r\n})\r\n\r\nconst timeStampEU = (updatedAt: string) => new Date(updatedAt).toLocaleString('en-GB', {\r\n year:'numeric',\r\n month: 'short',\r\n day: 'numeric',\r\n hour: 'numeric',\r\n minute: '2-digit',\r\n})\r\n\r\nconst timeStampEUFilter = (updatedAt: string) => new Date(updatedAt).toLocaleString('en-GB', {\r\n year:'numeric',\r\n month: 'short',\r\n day: 'numeric',\r\n hour: 'numeric',\r\n minute: '2-digit',\r\n second: '2-digit',\r\n})\r\n\r\nconst timeStampMessage = (updatedAt: string) => new Date(updatedAt).toLocaleString('en-GB',{\r\n hour: 'numeric',\r\n minute: '2-digit',\r\n})\r\n\r\n\r\nconst timeStampFilter = (updatedAt: string) => new Date(updatedAt).toLocaleString(\"en-US\", {\r\n year:'numeric',\r\n month: 'short',\r\n day: 'numeric',\r\n})\r\n\r\n\r\nconst playNotification = (url:string) => {\r\n const audio = new Audio(url);\r\n audio.play();\r\n}\r\n\r\nconst notification = (name: string, onClick: () => void) => {\r\n toast(`🦄new message from ${name}`, {\r\n position: \"bottom-right\",\r\n autoClose: 5000,\r\n hideProgressBar: false,\r\n closeOnClick: true,\r\n pauseOnHover: true,\r\n draggable: true,\r\n progress: undefined,\r\n onClick\r\n });\r\n}\r\n\r\nconst copied = (text:string) => {\r\n toast(`${text} Copied`, {\r\n position: \"bottom-right\",\r\n autoClose: 2000,\r\n hideProgressBar: false,\r\n closeOnClick: true,\r\n pauseOnHover: true,\r\n draggable: true,\r\n progress: undefined,\r\n });\r\n}\r\n\r\nconst playNotificationWithoutPermission = (url: string) => {\r\n const w:any = window\r\n const audioContext: any = new (w.AudioContext || w.webkitAudioContext)();\r\n navigator.mediaDevices\r\n .getUserMedia({ audio: true })\r\n .then(() => {\r\n const source = audioContext.createBufferSource();\r\n source.addEventListener('ended', () => {\r\n source.stop();\r\n audioContext.close();\r\n });\r\n const request = new XMLHttpRequest();\r\n request.open('GET', url, true);\r\n request.responseType = 'arraybuffer';\r\n request.onload = () => {\r\n audioContext.decodeAudioData(\r\n request.response,\r\n (buffer:any) => {\r\n source.buffer = buffer;\r\n source.connect(audioContext.destination);\r\n source.start();\r\n },\r\n (e:any) => {\r\n console.log('Error with decoding audio data' + e.message);\r\n });\r\n }\r\n request.send();\r\n })\r\n .catch(reason => console.error(`Audio permissions denied: ${reason}`));\r\n}\r\n\r\nconst handleDownload = async (url: string, type: string) => await FileSaver.saveAs(url, type);\r\n\r\nconst handleSort = (sortBy: string, data: any,sort:boolean): any => {\r\n return [...data].sort(function (a: any, b: any) {\r\n if (sort?a[sortBy] > b[sortBy]:a[sortBy] < b[sortBy]) {\r\n return -1;\r\n } else if (sort?a[sortBy] < b[sortBy]:a[sortBy] > b[sortBy]) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n}\r\n\r\nconst sortByRecent = (chats:TChats,sort:boolean) => [...chats].sort((a, b) => {\r\n const aCreatedAt = a.lastMessageCreatedAt ? a.lastMessageCreatedAt : a.createdAt\r\n const bCreatedAt = b.lastMessageCreatedAt ? b.lastMessageCreatedAt : b.createdAt\r\n const aTime = timeStampEUFilter(aCreatedAt)\r\n const bTime = timeStampEUFilter(bCreatedAt)\r\n const direction = sort ? aTime < bTime: aTime > bTime\r\n return direction ? 1 : -1\r\n})\r\n\r\nconst filteredMessages = (arr: TAllMessages,date:any,value:string) => arr.filter((el) => {\r\n if (!date) {\r\n if (!el.fullType && el.message.toLowerCase().includes(value.toLowerCase())) {\r\n return el\r\n }\r\n if (el.fullType && el.fullType.toLowerCase().includes(value.toLowerCase())) {\r\n return el\r\n }\r\n } else {\r\n if (!el.fullType && el.message.toLowerCase().includes(value.toLowerCase())\r\n && timeStampFilter(date) === timeStampFilter(el.createdAt)) {\r\n return el\r\n }\r\n if (el.fullType && el.fullType.toLowerCase().includes(value.toLowerCase())\r\n && timeStampFilter(date) === timeStampFilter(el.createdAt)) {\r\n return el\r\n }\r\n }\r\n})\r\n\r\nconst filterBy = ['pdf/docx', 'image', 'text', 'audio', 'video']\r\n\r\nconst emojisArr = ['💘','😀','😍','😲','😡'] \r\n\r\nlet prodBaseURL = 'https://w-telegram.herokuapp.com'\r\nlet prodSocketURL = 'https://w-telegram-socket.herokuapp.com'\r\n// prodSocketURL = 'http://localhost:3001'\r\n// prodBaseURL = 'http://localhost:3000'\r\n\r\nconst prodAwsS3 = 'https://my-telegram-bucket.s3.eu-west-1.amazonaws.com'\r\n\r\nconst refreshAppTime = 3000\r\n\r\nexport {\r\n format,\r\n firstLetter,\r\n slicedWord,\r\n timeStamp,\r\n timeStampEU,\r\n timeStampEUFilter,\r\n timeStampMessage,\r\n timeStampFilter,\r\n playNotification,\r\n notification,\r\n copied,\r\n playNotificationWithoutPermission,\r\n handleDownload,\r\n handleSort,\r\n sortByRecent,\r\n filteredMessages,\r\n filterBy,\r\n emojisArr,\r\n prodSocketURL,\r\n prodBaseURL,\r\n prodAwsS3,\r\n refreshAppTime,\r\n}","import { createSelector } from 'reselect';\r\nimport { IState } from '../../../typescript/redux/interfaces'\r\n\r\nconst getState = (state: IState) => state;\r\nconst getChat = (state: IState) => state.chat;\r\nconst getChatMemo = createSelector([getChat], chat => chat);\r\n\r\nexport { getChat,getState,getChatMemo };\r\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"appWrapper\":\"App_appWrapper__2lsaD\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"loader\":\"Load_loader__5RgFk\"};"],"sourceRoot":""}
|