main.8802c01f.chunk.js.map 55 KB

1
  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/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/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_","reducerAllMessages","actionGetAllMessagesSuccess","actionGetAllMessagesReject","_payload","reducerContacts","contacts","actionGetContactsSuccess","actionGetContactsReject","initialState","name","lastName","originalName","originalLastName","avatarUrl","avatarsArr","online","lastMessage","lastMessageCreatedAt","mute","sort","seen","watched","typing","number","_id","owner","createdAt","updatedAt","__v","reducerChat","actionSelectChat","actionGetChatById","actionRemoveChat","_state","reducerChats","chats","actionGetChatsSuccess","actionGetChatsReject","reducerControl","leftIsOpen","rightIsOpen","scrollChat","actionLeftIsOpen","actionRightIsOpen","actionScrollChat","code","country","nightMode","reducerAuthorization","actionLogInSuccess","actionLogInReject","actionLogOutSuccess","actionLogOutReject","actionCurrentSuccess","actionCurrentReject","authorizationPersistConfig","key","storage","rootReducer","combineReducers","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","toast","success","progress","undefined","loginUser","patch","logoutUser","updateCredentials","body","updateUser","removeUserAvatar","index","delete","updateUserAvatar","formData","currentUser","get","addContact","removeContact","id","updateContact","getContacts","getChatById","_doc","startChat","removeChatForBoth","muteChat","sortChat","seenChat","getChats","removeMessageById","sentMessageById","sentImgMessageById","sentAudioMessageById","sentVideoMessageById","sentFileMessageById","getMessagesById","getAllMessages","getNumber","getAuthorizationState","asyncCreateUser","file","FormData","append","Promise","all","find","el","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","fullType","toLowerCase","includes","refreshAppTime","getChatMemo","createSelector","module","exports"],"mappings":"sVAiBeA,MAXf,YAAmE,IAA3CC,EAA0C,EAA1CA,SAAaC,EAA6B,4BAC1DC,EA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,IAAU,SAAA4G,GAAI,OAAIA,M,mBCJtDkL,EAAOC,QAAU,CAAC,WAAa,0B,mBCA/BD,EAAOC,QAAU,CAAC,OAAS,uB","file":"static/js/main.8802c01f.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 { 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 total: 0,\r\n watched: false,\r\n typing: false,\r\n number:'',\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 } from '../action';\nimport { IControlState,IPayloadLeftIsOpen,IPayloadRightIsOpen,IPayloadScrollChat } from '../../../typescript/redux/control/interfaces'\n\nconst initialState: IControlState = {\n leftIsOpen: '',\n rightIsOpen: '',\n scrollChat: 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});\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 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 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 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) =>\n toast.error(`🔥 ${message}!`, {\n position: 'bottom-left',\n autoClose: 3000,\n hideProgressBar: false,\n closeOnClick: true,\n pauseOnHover: true,\n draggable: true,\n progress: undefined,\n });\n\nconst success = (message:string) =>\n toast.success(`⚡ ${message}`, {\n position: 'bottom-left',\n autoClose: 3000,\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(`code ${data}`);\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 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 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 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 sentMessageById = async <T>(id:string,message:any): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post('/messages', { id, message });\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentImgMessageById = async <T>(id:string,formData: object): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post(`/messages/image/${id}`, formData);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentAudioMessageById = async <T>(id:string,formData: object): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post(`/messages/audio/${id}`, formData);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentVideoMessageById = async <T>(id:string,formData: object): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post(`/messages/video/${id}`, formData);\n return data\n } catch (e) {\n forbidden(e)\n return undefined\n }\n};\n\nconst sentFileMessageById = async <T>(id:string,formData: object): Promise<T | undefined> => {\n try {\n const { data: { data } } = await axios.post(`/messages/file/${id}`, 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 getContacts,\n startChat,\n removeChatForBoth,\n getChatById,\n muteChat,\n sortChat,\n seenChat,\n typingChat,\n getChats,\n removeMessageById,\n sentMessageById,\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 getAuthorizationState= (state:IState) => state.authorization;\r\n\r\nexport { getToken,getNumber,getName,getLastName,getCountry,getAvatarUrl,getId,getSort,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\n\nexport { actionLeftIsOpen,actionRightIsOpen,actionScrollChat };\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\nimport { TResPromiseAll } from '../../../typescript/redux/authorization/types'\r\n\r\nconst asyncCreateUser = (name:string, lastName: string,file:object) => async (dispatch:any) => {\r\n try {\r\n const formData: any = new FormData()\r\n formData.append(\"avatar\", file);\r\n const data = await Promise.all<TResPromiseAll>(\r\n [updateUserAvatar(formData), updateCredentials({ name, lastName, originalName:name, originalLastName:lastName})])\r\n const token = data.find(el => el?.token)?.token\r\n token&&dispatch(actionLogInSuccess(token))\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 { 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 prodBaseURL = 'http://localhost:3000'\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 prodBaseURL,\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":""}