(history, reducers, initialState);\n\n\trenderApp(routes);\n};\n\nexport const getStore = () => store;\n\nexport const getHistory = () => history;\n\nexport const setStore = (newStore: any) => store = newStore;\n\nexport const renderApp = (routes) => {\n\t// This code starts up the React app when it runs in a browser. It sets up the routing configuration\n\t// and injects the app into a DOM element.\n\tif (getStore() === null) {\n\t\tthrow 'bootClient must be called first!';\n\t}\n\n\tloadableReady(() => {\n\t\tReactDOM.hydrate(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t{routes}\n\t\t\t\t\t \n\t\t\t\t \n\t\t\t ,\n\t\t\tdocument.getElementById('react-app'),\n\t\t);\n\t});\n};\n","import { Action, Reducer } from 'redux';\n\nimport { addTask } from 'domain-task';\n\nimport { request } from '@common/react/components/Api';\n\n/* eslint-disable-next-line */\nimport { AppThunkAction } from '@app/store/index';\n\nexport interface PageItemState {\n\tpage: P | null;\n\tpath: string | null;\n\tisLoading: boolean;\n}\n\nexport enum TypeKeys {\n\tREQUESTPAGE = 'REQUESTPAGE',\n\tRECIEVEPAGE = 'RECIEVEPAGE'\n}\n\nexport interface RequestPageAction {\n\ttype: TypeKeys.REQUESTPAGE;\n\tstorageName: string | null;\n\tpath: string;\n}\n\nexport interface ReceivePageAction {\n\ttype: TypeKeys.RECIEVEPAGE;\n\tstorageName: string | null;\n\tpage: any;\n}\n\ntype KnownPageAction = RequestPageAction | ReceivePageAction;\n\nexport const actionCreators = ({\n\tloadPage: (storageName: string, path: string): AppThunkAction => (dispatch, getState) => {\n\t\tconst storeState = (getState() as any)[storageName];\n\n\t\tif (storeState.path !== path) {\n\t\t\tconst fetchTask = request(\n\t\t\t\t'pageLoader',\n\t\t\t\t{ path },\n\t\t\t\tgetState(),\n\t\t\t).then((data) => dispatch({ type: TypeKeys.RECIEVEPAGE, storageName, page: data }));\n\n\t\t\taddTask(fetchTask);\n\t\t\tdispatch({ type: TypeKeys.REQUESTPAGE, storageName, path });\n\n\t\t\treturn fetchTask;\n\t\t}\n\t},\n});\n\nexport const reducer = (storageName: string):Reducer> => {\n\treturn (state: PageItemState = { isLoading: false, page: null, path: '' }, incomingAction: Action) => {\n\t\tconst action = incomingAction as KnownPageAction;\n\t\tif (!action.storageName || action.storageName === storageName) {\n\t\t\tswitch (action.type) {\n\t\t\t\tcase TypeKeys.REQUESTPAGE:\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisLoading: true,\n\t\t\t\t\t\tpage: state.page,\n\t\t\t\t\t\tpath: action.path,\n\t\t\t\t\t};\n\t\t\t\tcase TypeKeys.RECIEVEPAGE:\n\t\t\t\t\treturn { isLoading: false, page: action.page, path: action.page.path };\n\t\t\t\tdefault:\n\t\t\t\t\tconst exhaustiveCheck: never = action;\n\t\t\t}\n\t\t}\n\n\t\treturn state;\n\t};\n};\n","import { ReducersMapObject } from 'redux';\n\nimport * as Login from '@common/react/store/Login';\nimport * as Item from '@common/react/store/Item';\nimport { BaseUser } from '@common/react/objects/BaseUser';\nimport { BuildData } from '@common/react/objects/BuildData';\nimport BaseHostOptions from '@common/react/store/BaseHostOptions';\n\n// The top-level state object\nexport interface BaseApplicationState {\n\tlogin: Login.LoginState;\n\tbuildData: Item.ItemState;\n\thostOptions: Item.ItemState;\n}\n\n// Whenever an action is dispatched, Redux will update each top-level application state property using\n// the reducer with the matching name. It's important that the names match exactly, and that the reducer\n// acts on the corresponding ApplicationState property type.\nexport const baseReducers: ReducersMapObject = {\n\tlogin: Login.getReducer(),\n\tbuildData: Item.getReducer('buildData'),\n\thostOptions: Item.getReducer('hostOptions'),\n};\n\n// This type can be used as a hint on action creators so that its 'dispatch' and 'getState' params are\n// correctly typed to match your store.\nexport interface BaseAppThunkAction> {\n\t(dispatch: (action: TAction) => void, getState: () => TApplicationState): void;\n}\n","import { ReducersMapObject } from 'redux';\n\nimport * as Item from '@common/react/store/Item';\nimport { BaseAppThunkAction, baseReducers } from '@common/react/store';\nimport { ApplicationStateWithChats, getReducer as getChatsReducer } from '@common/react/components/Chat/Store/Chats';\nimport { PageItemState, reducer as PageStateReducer } from '@common/react/store/PageItem';\nimport { VideoChatState, getReducer as getVideoChatReducer } from '@common/react/store/VideoChat';\nimport { ItemsState as ItemsProviderStoreState, getReducer as getIPStoreReducer } from '@common/react/store/ItemsProviderStore';\n\nimport { BaseInvite } from '@commonTuna/react/objects/BaseInvite';\n\nimport { User } from '@app/objects/User';\nimport { HeaderState, reducer as HeaderReducer } from '@app/store/HeaderSearch';\nimport { CountersState, reducer as CountersReducer } from '@app/store/Counters';\nimport { RegistrationPage } from '@app/objects/Pages/RegistrationPage';\nimport { SearchFilterState, reducer as SearchFilterReducer } from '@app/store/SearchFilter';\nimport { UserRegistrationSteps } from '@app/components/Pages/Register/PatientMainForm';\nimport { BuildData } from '@app/objects/BuildData';\n\n// The top-level state object\nexport interface ApplicationState extends ApplicationStateWithChats {\n\tserverPage: PageItemState;\n\n\tbuildData: Item.ItemState;\n\n\tcompanyTemplateInvites: ItemsProviderStoreState;\n\n\tuserRegistrationSteps: Item.ItemState;\n\n\tcounters: CountersState;\n\n\theader: HeaderState;\n\n\tregistrationPage: PageItemState;\n\n\tsearchFilterData: SearchFilterState;\n\n\tvideoChat: VideoChatState;\n}\n\n// Whenever an action is dispatched, Redux will update each top-level application state property using\n// the reducer with the matching name. It's important that the names match exactly, and that the reducer\n// acts on the corresponding ApplicationState property type.\nexport const reducers: ReducersMapObject = {\n\t...baseReducers,\n\n\tbuildData: Item.getReducer('buildData'),\n\n\tserverPage: PageStateReducer('serverPage'),\n\n\tchats: getChatsReducer(),\n\n\tcompanyTemplateInvites: getIPStoreReducer('companyTemplateInvites'),\n\n\tuserRegistrationSteps: Item.getReducer('userRegistrationSteps'),\n\n\tcounters: CountersReducer,\n\n\theader: HeaderReducer,\n\n\tregistrationPage: PageStateReducer('registrationPage'),\n\n\tsearchFilterData: SearchFilterReducer,\n\n\tvideoChat: getVideoChatReducer(),\n};\n\n// This type can be used as a hint on action creators so that its 'dispatch' and 'getState' params are\n// correctly typed to match your store.\nexport type AppThunkAction = BaseAppThunkAction\n","import 'raf/polyfill';\n\nimport 'core-js/features/array/from';\nimport 'core-js/features/array/find';\nimport 'core-js/features/array/includes';\nimport 'core-js/features/set';\nimport 'core-js/features/map';\nimport 'core-js/features/weak-map';\nimport 'core-js/features/promise';\n\nimport * as Sentry from '@sentry/browser';\n\nimport { bootClient, renderApp } from '@common/react/loadable/boot-client';\nimport { updateReducers } from '@common/react/configureStore';\n\nimport { ApplicationState, reducers } from '@app/store';\nimport { User } from '@app/objects/User';\nimport { routes } from '@app/routes';\n\nbootClient(routes, reducers);\n\nconsole.log(`ENVIRONMENT: ${typeof ENVIRONMENT !== 'undefined' ? ENVIRONMENT : ''}`);\n\n// Allow Hot Module Replacement\nif (module.hot) {\n\tmodule.hot.accept('@app/routes', () => {\n\t\trenderApp((require('@app/routes') as any).routes);\n\t});\n}\n\n// Enable Webpack hot module replacement for reducers\nif (module.hot) {\n\tmodule.hot.accept('@app/store', () => {\n\t\tconst nextRootReducer = require('@app/store');\n\t\tupdateReducers((nextRootReducer as any).reducers);\n\t});\n}\n\nif (typeof ENVIRONMENT !== 'undefined' && ENVIRONMENT === 'production') {\n\tSentry.init({ dsn: 'https://c615bb76d98d45c4ba76c5d43dcd9685@o389532.ingest.sentry.io/5356380' });\n}\n","import { getCurrentHub } from '@sentry/hub';\nimport { logger } from '@sentry/utils';\n/**\n * Internal function to create a new SDK client instance. The client is\n * installed and then bound to the current scope.\n *\n * @param clientClass The client class to instanciate.\n * @param options Options to pass to the client.\n */\nexport function initAndBind(clientClass, options) {\n if (options.debug === true) {\n logger.enable();\n }\n var hub = getCurrentHub();\n var client = new clientClass(options);\n hub.bindClient(client);\n}\n//# sourceMappingURL=sdk.js.map","import { request as baseRequest } from '@common/react/components/Api';\n\nimport { ApplicationState } from '@app/store';\nimport { User } from '@app/objects/User';\n\nexport function request(type: string, data?: any, state?: ApplicationState) {\n\treturn baseRequest(type, data, state);\n}\n","import * as React from 'react';\n\nimport ConfigProvider from 'antd/es/config-provider';\nimport loadable from '@loadable/component';\nimport { shallowEqual, useSelector } from 'react-redux';\n\nimport { loadableDelay } from '@common/react/loadable/loadableSettings';\nimport Loader from '@common/react/components/Core/LoadingProvider/Loader';\nimport '@common/react/yupLocaleSettings';\nimport { LoadingProvider } from '@common/react/components/Core/LoadingProvider/LoadingProvider';\nimport ErrorBoundaryWithSentry from '@common/react/components/UI/ErrorBoundaryWithSentry/ErrorBoundaryWithSentry';\nimport { ChatSettingsProvider } from '@common/react/components/Chat/ChatSettingsProvider';\nimport { RequestProvider } from '@common/react/components/RequestProvider/RequestProvider';\n// import { ReactionsPlugin } from '@common/react/components/Chat/Reactions/ReactionsPlugin';\nimport { ChatPlugins } from '@common/react/components/Chat/Chat';\nimport Application from '@common/react/components/Core/Application/Application';\nimport NotificationGliderProvider from '@common/react/components/Chat/NotificationGliderProvider';\nimport Avatar from '@common/react/components/Forms/Avatar';\nimport MessageFlashingTime from '@common/react/components/Chat/MessageFlashingTime';\nimport { setLocalStorageValue } from '@common/react/utils/localStorage/localStorage';\nimport IdleTimer from '@common/react/components/Core/IdleTimer/IdleTimer';\n\nimport CartProviderWithUpdate from '@app/components/UI/CartProviderWithUpdate/CartProviderWithUpdate';\nimport HeaderSearch from '@app/components/UI/Header/HeaderSearch';\nimport PortalLoader from '@app/components/UI/PortalLoader';\nimport '@app/scss/components/chatMessageNotificationGlider.scss';\nimport { MenuStateProvider } from '@app/components/UI/Menu/MenuStateProvider';\nimport UserStateTracker from '@app/components/UI/UserStateTracker/UserStateTracker';\nimport { theme } from '@app/components/UI/ThemeConfig/ThemeConfig';\nimport RouteChangeTracker from '@app/components/Routes/RouteChangeTracker';\nimport PatientLocationsSetter from '@app/components/UI/PatientLocationsSetter/PatientLocationsSetter';\nimport { customReduxActions } from '@app/store/CustomReduxActions';\nimport { User, UserRole } from '@app/objects/User';\nimport { Init } from '@app/objects/Init';\n\nimport '@app/scss/style.scss';\nimport RouteWithFooter from '@app/components/Routes/RouteWithFooter';\nimport { ApplicationState } from '@app/store';\n\nconst params = { fallback: };\n\nconst ReactionNotificationHandler = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ReactionNotificationHandler\" */\n\t\t'@common/react/components/Chat/ReactionNotificationHandler'\n\t)), { fallback: <>> });\n\nconst SignalRChats = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"SignalRChats\" */\n\t\t'@common/react/components/Chat/SignalRChats'\n\t)), { fallback: <>> });\n\nconst VideoChatModal = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"VideoChatModal\" */\n\t\t'@common/react/components/UI/VideoChat/VideoChatModal'\n\t)), { fallback: <>> });\n\nconst VideoChatGlider = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"VideoChatGlider\" */\n\t\t'@common/react/components/Chat/VideoChatGlider'\n\t)), { fallback: <>> });\n\nconst NotFound = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"PageNotFound\" */\n\t\t'@common/react/components/UI/PageNotFound/PageNotFound'\n\t)), params);\n\nconst renderAvatar = (state) => ;\n\nconst Layout: React.FC = ({ children }) => {\n\tconst user = useSelector((state: ApplicationState) => state.login.user, shallowEqual);\n\n\tReact.useEffect(() => {\n\t\tif (!user) {\n\t\t\tsetLocalStorageValue('skipFillInvites', false);\n\t\t}\n\t}, [user]);\n\n\treturn (\n\t\t\n\t\t\t
\n\t\t\t\t \n\t\t\t\t }>\n\t\t\t\t\t ,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tinitCustomHandler={customReduxActions}\n\t\t\t\t\t\t\t\t\t\t\tcheckUserAccess={(user: User, roles: Array, props?: any) =>\n\t\t\t\t\t\t\t\t\t\t\t\tuser && roles.includes(user.role)}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t\t\t\t\t\t\t{user ? (<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t>) : null}\n\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t\t{user ? (<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t\t>) : null}\n\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t\n\t\t\t \n\t\t
\n\t);\n};\n\nexport default Layout;\n","export const getMinutesFromDuration = (duration: string): number => {\n\tconst [h, m] = duration.split(':');\n\n\treturn (+h * 60) + +m;\n};\n\nexport const timeFormat = (time: string) => {\n\tconst [h, m] = time.split(':');\n\tlet a = false;\n\tif (+h < 12) {\n\t\ta = true;\n\t}\n\treturn `${a ? h : +h - 12}:${m} ${a ? 'a' : 'p'}m`;\n};\n\nexport const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\n\nexport const fromNow = (date) => {\n\tconst seconds = Math.floor((+new Date() - date) / 1000);\n\tconst years = Math.floor(seconds / 31536000);\n\tconst months = Math.floor(seconds / 2592000);\n\tconst days = Math.floor(seconds / 86400);\n\n\tif (days > 548) {\n\t\treturn `${years} years ago`;\n\t}\n\tif (days >= 320 && days <= 547) {\n\t\treturn 'a year ago';\n\t}\n\tif (days >= 45 && days <= 319) {\n\t\treturn `${months} months ago`;\n\t}\n\tif (days >= 26 && days <= 45) {\n\t\treturn 'a month ago';\n\t}\n\n\tconst hours = Math.floor(seconds / 3600);\n\n\tif (hours >= 36 && days <= 25) {\n\t\treturn `${days} days ago`;\n\t}\n\tif (hours >= 22 && hours <= 35) {\n\t\treturn 'a day ago';\n\t}\n\n\tconst minutes = Math.floor(seconds / 60);\n\n\tif (minutes >= 90 && hours <= 21) {\n\t\treturn `${hours} hours ago`;\n\t}\n\tif (minutes >= 45 && minutes <= 89) {\n\t\treturn 'an hour ago';\n\t}\n\tif (seconds >= 90 && minutes <= 44) {\n\t\treturn `${minutes} minutes ago`;\n\t}\n\tif (seconds >= 45 && seconds <= 89) {\n\t\treturn 'a minute ago';\n\t}\n\tif (seconds >= 0 && seconds <= 45) {\n\t\treturn 'a few seconds ago';\n\t}\n};\n","import { getMinutesFromDuration } from '@common/react/utils/timeUtils';\n\nimport { WorkingHour } from '@commonTuna/react/objects/BaseLocation';\n\nexport const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\nconst daysEs = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'];\n\nexport const solveWorkingHours = (workingHours: Array) => {\n\tconst whs = workingHours.slice()\n\t\t.sort((a, b) => {\n\t\t\tif (a.dayOfWeek === 0) return 1;\n\t\t\tif (b.dayOfWeek === 0) return -1;\n\t\t\treturn a.dayOfWeek - b.dayOfWeek;\n\t\t});\n\tconst objByDayOfWeek: { [key: string]: WorkingHour } = {};\n\twhs.forEach((wh) => {\n\t\tif (!objByDayOfWeek[wh.dayOfWeek]) {\n\t\t\tobjByDayOfWeek[wh.dayOfWeek] = wh;\n\t\t} else {\n\t\t\tobjByDayOfWeek[wh.dayOfWeek] = {\n\t\t\t\t...wh,\n\t\t\t\tendTime: getMinutesFromDuration(objByDayOfWeek[wh.dayOfWeek].endTime) < getMinutesFromDuration(wh.endTime)\n\t\t\t\t\t? wh.endTime : objByDayOfWeek[wh.dayOfWeek].endTime,\n\t\t\t\tstartTime: getMinutesFromDuration(objByDayOfWeek[wh.dayOfWeek].startTime) < getMinutesFromDuration(wh.startTime)\n\t\t\t\t\t? objByDayOfWeek[wh.dayOfWeek].startTime : wh.startTime,\n\t\t\t};\n\t\t}\n\t});\n\tconst obj: any = {};\n\t(Object.values(objByDayOfWeek)).forEach((wh) => {\n\t\tconst key = `${wh.startTime}-${wh.endTime}`;\n\t\tif (!obj[key]) {\n\t\t\tobj[key] = [{ ...wh }];\n\t\t} else if (!obj[key].some((item) => item.dayOfWeek === wh.dayOfWeek)) {\n\t\t\tobj[key] = obj[key].concat(wh);\n\t\t}\n\t});\n\treturn Object.values(obj)\n\t\t.map((arr: any, i) => {\n\t\t\tlet title = days[arr[0].dayOfWeek];\n\t\t\tlet titleEs = daysEs[arr[0].dayOfWeek];\n\t\t\tfor (let i = 1; i < arr.length; i++) {\n\t\t\t\tconst isEnd = arr[i].dayOfWeek === 6 && arr[i + 1]?.dayOfWeek === 0;\n\t\t\t\tif (arr[i].dayOfWeek - 1 !== arr[i - 1]?.dayOfWeek && !isEnd && !(arr[i].dayOfWeek === 0 && arr[i - 1]?.dayOfWeek === 6)) {\n\t\t\t\t\ttitle = `${title}, ${days[arr[i].dayOfWeek]}`;\n\t\t\t\t\ttitleEs = `${titleEs}, ${daysEs[arr[i].dayOfWeek]}`;\n\t\t\t\t} else if (i + 1 === arr.length\n\t\t\t\t\t|| (arr[i].dayOfWeek + 1 !== arr[i + 1]?.dayOfWeek && !isEnd)) {\n\t\t\t\t\ttitle = `${title} - ${days[arr[i].dayOfWeek]}`;\n\t\t\t\t\ttitleEs = `${titleEs} - ${daysEs[arr[i].dayOfWeek]}`;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid: i,\n\t\t\t\ttitle,\n\t\t\t\ttitleEs,\n\t\t\t\tstartTime: arr[0].startTime,\n\t\t\t\tendTime: arr[0].endTime,\n\t\t\t};\n\t\t});\n};\n","import React from 'react';\n\nimport Tag from 'antd/lib/tag';\n\nimport LinkWithPrevLocation from '@common/react/components/UI/LinkWithPrevLocation/LinkWithPrevLocation';\n\nimport { solveWorkingHours } from '@commonTuna/react/utils/workingHours/workingHours';\nimport { numberWithComma } from '@commonTuna/react/utils/NumberWithComma/NumberWithComma';\n\nimport { getLocationAddress, showTime } from '@app/components/Utils';\nimport Stars from '@app/components/UI/Stars/Stars';\n\ninterface LocationNodeProps {\n\titem: any;\n\thideLink?: boolean;\n\taddressAsLink?: boolean;\n\tshowRate?: boolean;\n}\n\nconst LocationInfo: React.FC = ({\n\titem, hideLink, addressAsLink, showRate,\n}) => {\n\tconst address = React.useMemo(() => getLocationAddress(item), []);\n\tconst link = React.useMemo(() => {\n\t\tlet res = `https://maps.google.com/maps/search/?api=1&query=${address}`;\n\t\tif (typeof window !== 'undefined') {\n\t\t\tif (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {\n\t\t\t\tres = `maps://maps.google.com/maps/search/?api=1&query=${address}`;\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}, [item]);\n\n\tconst workingHours = React.useMemo(() => {\n\t\tif (!item.workingHours) return [];\n\t\treturn solveWorkingHours(item.workingHours);\n\t}, [item.workingHours]);\n\n\treturn \n\t\t{showRate ?
\n\t\t\t\n\t\t\t\t \n\t\t\t \n\t\t\t{numberWithComma(item.averageReviewRate)}\n\t\t\t{' '}\n\t\t\t(\n\t\t\t{item.totalReviewCount || 0}\n\t\t\t)\n\t\t
: null}\n\t\t{address ?
\n\t\t\t\n\t\t\t\tAddress: \n\t\t\t \n\t\t\t{addressAsLink ? {address} : address}\n\t\t : null}\n\t\t{workingHours.length ? <>\n\t\t\t
\n\t\t\t
\n\t\t\t\tWorking Hours: \n\t\t\t \n\t\t\t{workingHours.map((wh) =>
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t{wh.title}\n\t\t\t\t\t\t:\n\t\t\t\t\t \n\t\t\t\t\t{' '}\n\t\t\t\t\t{showTime(wh.startTime)}\n\t\t\t\t\t{' '}\n\t\t\t\t\t-\n\t\t\t\t\t{' '}\n\t\t\t\t\t{showTime(wh.endTime)}\n\t\t\t\t \n\t\t\t )}\n\t\t> : null}\n\t\t{hideLink ? null :
\n\t\t\t\n\t\t\t\tMore About\n\t\t\t\t{' '}\n\t\t\t\t{item.nameEn}\n\t\t\t\t{' '}\n\t\t\t\tClinic\n\t\t\t \n\t\t
}\n\t
;\n};\n\nexport default LocationInfo;\n","import * as React from 'react';\nimport { NavLink } from 'react-router-dom';\n\nimport Tag from 'antd/lib/tag';\n\nimport { Product } from '@app/objects/Product/Product';\n\nconst ProductTag: React.FC<{product: Product}> = (props) => {\n\tconst product = props.product;\n\treturn (<>\n\t\t{product.path\n\t\t\t? \n\t\t\t\t\n\t\t\t\t\t{product.name}\n\t\t\t\t \n\t\t\t \n\t\t\t: \n\t\t\t\t{product.name}\n\t\t\t \n\t\t}\n\t>);\n};\n\nexport default ProductTag;\n","import * as React from 'react';\nimport { useHistory } from 'react-router-dom';\n\nimport useShoppingCart from '@app/hooks/useShoppingCart';\n\nconst BuyNow: React.FC<{ specialForStore, className? }> = (props) => {\n\tconst history = useHistory();\n\tconst { getItem, addCartItem } = useShoppingCart();\n\tconst {\n\t\tspecialForStore,\n\t\tclassName = '',\n\t} = props;\n\tconst storedItem = getItem(specialForStore?.id);\n\n\treturn {\n\t\t\te.preventDefault();\n\t\t\tif (!storedItem) {\n\t\t\t\taddCartItem(specialForStore, 1);\n\t\t\t}\n\t\t\thistory.push('/ordering');\n\t\t}}\n\t\tclassName={`special-buy-now-button ${className}`}\n\t>\n\t\t\n\t\t\tBuy now\n\t\t \n\t ;\n};\n\nexport default BuyNow;\n","import * as React from 'react';\n\nimport Tooltip, { AbstractTooltipProps } from 'antd/lib/tooltip';\n\ninterface Props {\n\ttext?: string;\n\tcount: number;\n\ttooltipProps?: AbstractTooltipProps;\n\tclassName?: string;\n\twithTitle?: boolean;\n}\n\nconst TextWithTooltip: React.FC = ({\n\ttext, count, tooltipProps, className, withTitle,\n}) => {\n\treturn text ? \n\t\t{text.length > count\n\t\t\t? \n\t\t\t\t{text?.slice(0, count)}\n\t\t\t\t...\n\t\t\t \n\t\t\t: withTitle ? {text} : text\n\t\t}\n\t
: null;\n};\n\nexport default TextWithTooltip;\n","import React from 'react';\nimport ContentLoader from 'react-content-loader';\n\nconst CardImageLoader = (props) => (\n\t\n\t\t \n\t \n);\n\nexport default CardImageLoader;\n","import * as React from 'react';\n\nimport Modal from 'antd/lib/modal';\nimport Tag from 'antd/lib/tag';\n\nimport { ItemProvider } from '@common/react/components/Core/ItemProvider/ItemProvider';\nimport LinkWithPrevLocation from '@common/react/components/UI/LinkWithPrevLocation/LinkWithPrevLocation';\nimport { ItemEditorWrapper } from '@common/react/components/Core/ItemEditor/ItemEditorWrapper';\n\nimport ImageWithSkeleton from '@commonTuna/react/components/UI/ImageWithSkeleton/ImageWithSkeleton';\nimport { getMoneyString } from '@commonTuna/react/components/Utils';\n\nimport '@app/scss/components/specialModal.scss';\nimport '@app/scss/components/specialProductInfo.scss';\nimport PreviewImageLoader from '@app/components/UI/SpecialImageLoader/PreviewImageLoader';\nimport AddToCartButton from '@app/components/UI/AddToCartButton/AddToCartButton';\nimport WithPathLink from '@app/components/UI/WithPathLink/WithPathLink';\nimport { getLocationName } from '@app/components/Utils';\nimport ProductTag from '@app/components/Pages/Products/ProductTag';\nimport BuyNow from '@app/components/Pages/Specials/BuyNow';\nimport { Special } from '@app/objects/Special';\nimport { transformSpecialToCartItem } from '@app/objects/CartItem';\n\nimport noImage from '@images/no-image.jpg';\n\ninterface Props {\n\tid: number;\n\topen: boolean;\n\tsetOpen: (open) => void;\n}\n\nconst SpecialModal: React.FC = ({ id, open, setOpen }) => {\n\tconst [imgLoading, setImgLoading] = React.useState(true);\n\n\tconst handleClose = () => {\n\t\tsetOpen(false);\n\t};\n\n\treturn \n\t\t\n\t\t\tid={id}\n\t\t\ttype=\"special\"\n\t\t\tloadRequest=\"getSpecials\"\n\t\t>\n\t\t\t\n\t\t\t\tbackPath=\"\"\n\t\t\t\tclassName=\"special-container\"\n\t\t\t\trender={({ state: { item: special } }) => {\n\t\t\t\t\tconst specialForStore = transformSpecialToCartItem(special);\n\t\t\t\t\treturn \n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t{imgLoading\n\t\t\t\t\t\t\t\t\t\t?
\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t
setImgLoading(false)}\n\t\t\t\t\t\t\t\t\t\thidden={imgLoading}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t{special.name &&
{special.name} }\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t{special.location\n\t\t\t\t\t\t\t\t\t\t\t&&
\n\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t{getLocationName(special.location, false, true)}\n\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t{special?.procedures?.length > 0 && <>\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\tProcedures\n\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t{special.procedures.map((item) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{item.procedure.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t )}\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t>}\n\t\t\t\t\t\t\t\t\t\t{special?.products?.length > 0 && <>\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\tProducts\n\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t{special.products.map((item) => item.product\n\t\t\t\t\t\t\t\t\t\t\t\t\t&&
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t
)}\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t>}\n\t\t\t\t\t\t\t\t\t\t{special.description &&
{special.description}
}\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t{getMoneyString(special.price)} \n\t\t\t\t\t\t\t\t\t\t{getMoneyString(special.originalPrice)} \n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\tShow more details \n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
;\n\t\t\t\t}}\n\t\t\t/>\n\t\t \n\t ;\n};\n\nexport default SpecialModal;\n","import * as React from 'react';\nimport { NavLink } from 'react-router-dom';\n\nimport TextWithTooltip from '@common/react/components/UI/TextWithTooltip/TextWithTooltip';\n\nimport { getMoneyString } from '@commonTuna/react/components/Utils';\nimport ImageWithSkeleton from '@commonTuna/react/components/UI/ImageWithSkeleton/ImageWithSkeleton';\n\nimport AddToCartButton from '@app/components/UI/AddToCartButton/AddToCartButton';\nimport { Special } from '@app/objects/Special';\nimport { LocationPortal } from '@app/objects/CompanyPortal';\nimport CardImageLoader from '@app/components/UI/CardImageLoader/CardImageLoader';\nimport SpecialModal from '@app/components/UI/SpecialModal/SpecialModal';\nimport WithPathLink from '@app/components/UI/WithPathLink/WithPathLink';\nimport { getLocationName } from '@app/components/Utils';\n\nimport noImage from '@images/no-image.jpg';\n\ninterface SpecialCardProps {\n\titem: Special;\n\tlocation?: LocationPortal;\n\tlazyLoad?: boolean;\n}\n\nconst SpecialName: React.FC<{name: string, className?: string}> = ({ name, className }) => {\n\treturn ;\n};\n\nexport const SpecialLocation: React.FC<{text: string}> = ({ text }) => {\n\treturn ;\n};\n\nconst preventDefault = (e: React.MouseEvent): void => {\n\te.preventDefault();\n\te.stopPropagation();\n};\n\nconst SpecialCardContent: React.FC = (props) => {\n\tconst {\n\t\titem,\n\t\tlocation = undefined,\n\t\tlazyLoad,\n\t\tsetOpen,\n\t} = props;\n\tconst [loading, setLoading] = React.useState(true);\n\tconst handleOpen = (e) => {\n\t\tsetOpen(true);\n\t};\n\n\tReact.useEffect(() => {\n\t\tsetLoading(false);\n\t}, []);\n\n\t// set item location from props for clinic page(where specials are without location)\n\titem.location = item.location || location;\n\tconst locationName: string = getLocationName(item.location, false, true) as string;\n\n\treturn <>\n\t\t\n\t\t\t
\n\t\t\t\t
Fast Preview
\n\t\t\t
\n\t\t\t{loading &&
}\n\t\t\t
setLoading(false)}\n\t\t\t\thidden={loading}\n\t\t\t/>\n\t\t \n\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t \n\t\t\t\t
\n\t\t\t\t{item.location\n\t\t\t\t\t&&
\n\t\t\t\t\t\t \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t
\n\t\t\t\t}\n\t\t\t\t{item.description\n\t\t\t\t\t?
\n\t\t\t\t\t: null\n\t\t\t\t}\n\t\t\t\t
\n\t\t\t\t\t{getMoneyString(item.price)} \n\t\t\t\t\t{getMoneyString(item.originalPrice)} \n\t\t\t\t
\n\t\t\t\t
e.preventDefault()}>\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t>;\n};\n\nconst SpecialCard: React.FC = ({ item, location = undefined, lazyLoad = true }) => {\n\tconst [open, setOpen] = React.useState(false);\n\n\treturn \n\t\t
\n\t\t{item.path\n\t\t\t?
\n\t\t\t\t \n\t\t\t \n\t\t\t:
\n\t\t\t\t \n\t\t\t
\n\t\t}\n\t
;\n};\n\nexport default SpecialCard;\n","import * as React from 'react';\nimport { Route, RouteProps, Redirect } from 'react-router-dom';\nimport { shallowEqual, useSelector } from 'react-redux';\nimport { Helmet } from 'react-helmet';\n\nimport { loadable, loadableDelay } from '@common/react/loadable/loadableSettings';\nimport ErrorBoundaryWithSentry from '@common/react/components/UI/ErrorBoundaryWithSentry/ErrorBoundaryWithSentry';\nimport { RequestProvider } from '@common/react/components/RequestProvider/RequestProvider';\n\nimport { LogoLoaderPage } from '@commonTuna/react/components/UI/LogoLoader/LogoLoader';\n\nimport { ApplicationState } from '@app/store';\n\nconst params = {\n\tfallback: ,\n};\n\nconst DashboardLayout = loadable(() => loadableDelay(/* webpackChunkName: \"DashboardLayout\" */\n\timport('@app/components/Layouts/DashboardLayout/DashboardLayout'),\n), params);\n\ninterface Props extends RouteProps {\n\tcomponent: any;\n\tredirectPath?: string;\n\ttitle?: string;\n}\n\nconst DashboardRoute: React.FC = ({\n\tcomponent: Component, redirectPath = '/', title, ...rest\n}) => {\n\tconst user = useSelector((state: ApplicationState) => state.login.user, shallowEqual);\n\treturn (user ? \n\t\t\t{title && \n\t\t\t\t{title} \n\t\t\t }\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t \n\t\t\t \n\t\t : )}\n\t/>;\n};\n\nexport default DashboardRoute;\n","import React, { useState, useEffect } from 'react';\n\nvar GA4ReactGlobalIndex = '__ga4React__';\n/**\r\n * @desc class required to manage google analitycs 4\r\n * @class GA4React\r\n * */\n\nclass GA4React {\n constructor(gaCode, gaConfig, additionalGaCode, timeout, options) {\n this.gaCode = gaCode;\n this.gaConfig = gaConfig;\n this.additionalGaCode = additionalGaCode;\n this.timeout = timeout;\n this.options = options;\n this.scriptSyncId = 'ga4ReactScriptSync';\n this.scriptAsyncId = 'ga4ReactScriptAsync';\n this.nonceAsync = '';\n this.nonceSync = '';\n this.gaConfig = gaConfig ? gaConfig : {};\n this.gaCode = gaCode;\n this.timeout = timeout || 5000;\n this.additionalGaCode = additionalGaCode;\n this.options = options;\n\n if (this.options) {\n var {\n nonce\n } = this.options;\n this.nonceAsync = nonce && nonce[0] ? nonce[0] : '';\n this.nonceSync = nonce && nonce[1] ? nonce[1] : '';\n }\n }\n /**\r\n * @desc output on resolve initialization\r\n */\n\n\n outputOnResolve() {\n return {\n pageview: this.pageview,\n event: this.event,\n gtag: this.gtag\n };\n }\n /**\r\n * @desc Return main function for send ga4 events, pageview etc\r\n * @returns {Promise}\r\n */\n\n\n initialize() {\n return new Promise((resolve, reject) => {\n if (GA4React.isInitialized()) {\n reject(new Error('GA4React is being initialized'));\n } // in case of retry logics, remove previous scripts\n\n\n var previousScriptAsync = document.getElementById(this.scriptAsyncId);\n\n if (previousScriptAsync) {\n previousScriptAsync.remove();\n }\n\n var head = document.getElementsByTagName('head')[0];\n var scriptAsync = document.createElement('script');\n scriptAsync.setAttribute('id', this.scriptAsyncId);\n scriptAsync.setAttribute('async', '');\n\n if (this.nonceAsync && typeof this.nonceAsync === 'string' && this.nonceAsync.length > 0) {\n scriptAsync.setAttribute('nonce', this.nonceAsync);\n }\n\n scriptAsync.setAttribute('src', \"https://www.googletagmanager.com/gtag/js?id=\" + this.gaCode);\n\n scriptAsync.onload = () => {\n var target = document.getElementById(this.scriptSyncId);\n\n if (target) {\n target.remove();\n } // in case of retry logics, remove previous script sync\n\n\n var previousScriptSync = document.getElementById(this.scriptSyncId);\n\n if (previousScriptSync) {\n previousScriptSync.remove();\n }\n\n var scriptSync = document.createElement('script');\n scriptSync.setAttribute('id', this.scriptSyncId);\n\n if (this.nonceSync && typeof this.nonceSync === 'string' && this.nonceSync.length > 0) {\n scriptSync.setAttribute('nonce', this.nonceSync);\n }\n\n var scriptHTML = \"window.dataLayer = window.dataLayer || [];\\n function gtag(){dataLayer.push(arguments);};\\n gtag('js', new Date());\\n gtag('config', '\" + this.gaCode + \"', \" + JSON.stringify(this.gaConfig) + \");\";\n\n if (this.additionalGaCode) {\n this.additionalGaCode.forEach(code => {\n scriptHTML += \"\\ngtag('config', '\" + code + \"', \" + JSON.stringify(this.gaConfig) + \");\";\n });\n }\n\n scriptSync.innerHTML = scriptHTML;\n head.appendChild(scriptSync);\n var resolved = this.outputOnResolve();\n Object.assign(window, {\n [GA4ReactGlobalIndex]: resolved\n });\n resolve(resolved);\n };\n\n scriptAsync.onerror = event => {\n if (typeof event === 'string') {\n reject(\"GA4React intialization failed \" + event);\n } else {\n var error = new Error();\n error.name = 'GA4React intialization failed';\n error.message = JSON.stringify(event, ['message', 'arguments', 'type', 'name']);\n reject(error);\n }\n };\n\n var onChangeReadyState = () => {\n switch (document.readyState) {\n case 'interactive':\n case 'complete':\n if (!GA4React.isInitialized()) {\n head.appendChild(scriptAsync);\n document.removeEventListener('readystatechange', onChangeReadyState);\n }\n\n break;\n }\n };\n\n if (document.readyState !== 'complete') {\n document.addEventListener('readystatechange', onChangeReadyState);\n } else {\n onChangeReadyState();\n }\n\n setTimeout(() => {\n reject(new Error('GA4React Timeout'));\n }, this.timeout);\n });\n }\n /**\r\n * @desc send pageview event to gtag\r\n * @param path\r\n */\n\n\n pageview(path, location, title) {\n return this.gtag('event', 'page_view', {\n page_path: path,\n page_location: location || window.location,\n page_title: title || document.title\n });\n }\n /**\r\n * @desc set event and send to gtag\r\n * @param action\r\n * @param label\r\n * @param category\r\n * @param nonInteraction\r\n */\n\n\n event(action, label, category, nonInteraction) {\n if (nonInteraction === void 0) {\n nonInteraction = false;\n }\n\n return this.gtag('event', action, {\n event_label: label,\n event_category: category,\n non_interaction: nonInteraction\n });\n }\n /**\r\n * @desc direct access to gtag\r\n * @param args\r\n */\n\n\n gtag() {\n //@ts-ignore\n return window.gtag(...arguments);\n }\n /**\r\n * @desc ga is initialized?\r\n */\n\n\n static isInitialized() {\n switch (typeof window[GA4ReactGlobalIndex] !== 'undefined') {\n case true:\n return true;\n\n default:\n return false;\n }\n }\n /**\r\n * @desc get ga4react from global\r\n */\n\n\n static getGA4React() {\n if (GA4React.isInitialized()) {\n return window[GA4ReactGlobalIndex];\n } else {\n console.error(new Error('GA4React is not initialized'));\n }\n }\n\n}\n\nvar outputGA4 = (children, setComponents, ga4) => {\n setComponents(React.Children.map(children, (child, index) => {\n if (!React.isValidElement(child)) {\n return React.createElement(React.Fragment, null, child);\n } //@ts-ignore\n\n\n if (child.type && typeof child.type.name !== 'undefined') {\n return React.cloneElement(child, {\n //@ts-ignore\n ga4: ga4,\n index\n });\n } else {\n return child;\n }\n }));\n};\n\nvar GA4R = (_ref) => {\n var {\n code,\n timeout,\n config,\n additionalCode,\n children,\n options\n } = _ref;\n var [components, setComponents] = useState(null);\n useEffect(() => {\n if (!GA4React.isInitialized()) {\n var ga4manager = new GA4React(\"\" + code, config, additionalCode, timeout, options);\n ga4manager.initialize().then(ga4 => {\n outputGA4(children, setComponents, ga4);\n }, err => {\n console.error(err);\n });\n } else {\n var ga4 = GA4React.getGA4React();\n\n if (ga4) {\n outputGA4(children, setComponents, ga4);\n }\n }\n }, []);\n return React.createElement(React.Fragment, null, components);\n};\n\nvar useGA4React = (gaCode, gaConfig, gaAdditionalCode, gaTimeout, options) => {\n var [ga4, setGA4] = useState(undefined);\n useEffect(() => {\n if (gaCode) {\n switch (GA4React.isInitialized()) {\n case false:\n var ga4react = new GA4React(\"\" + gaCode, gaConfig, gaAdditionalCode, gaTimeout, options);\n ga4react.initialize().then(ga4 => {\n setGA4(ga4);\n }, err => {\n console.error(err);\n });\n break;\n\n case true:\n setGA4(GA4React.getGA4React());\n break;\n }\n } else {\n setGA4(GA4React.getGA4React());\n }\n }, [gaCode]);\n return ga4;\n};\n\nfunction withTracker(MyComponent) {\n return props => {\n var {\n path,\n location,\n title,\n gaCode,\n gaTimeout,\n gaConfig,\n gaAdditionalCode,\n options\n } = props;\n useEffect(() => {\n switch (GA4React.isInitialized()) {\n case true:\n var ga4 = GA4React.getGA4React();\n\n if (ga4) {\n ga4.pageview(path, location, title);\n }\n\n break;\n\n default:\n case false:\n var ga4react = new GA4React(\"\" + gaCode, gaConfig, gaAdditionalCode, gaTimeout, options);\n ga4react.initialize().then(ga4 => {\n ga4.pageview(path, location, title);\n }, err => {\n console.error(err);\n });\n break;\n }\n });\n return React.createElement(MyComponent, Object.assign({}, props));\n };\n}\n\nexport default GA4React;\nexport { GA4R, GA4React, useGA4React, withTracker };\n//# sourceMappingURL=ga-4-react.esm.js.map\n","import React from 'react';\n\nimport { useHistory } from 'react-router-dom';\n\nimport GA4React from 'ga-4-react';\n\ninterface RouteChangeTrackerProps {\n\tid: string;\n}\n\nconst RouteChangeTracker: React.FC = ({ id, children }) => {\n\tconst history = useHistory();\n\tReact.useEffect(() => {\n\t\tif (process.env.NODE_ENV === 'production') {\n\t\t\tconst ga4react = new GA4React(id);\n\n\t\t\tga4react.initialize().then((ga4) => {\n\t\t\t\tga4.pageview(window.location.pathname + window.location.search);\n\n\t\t\t\thistory.listen((location, action) => {\n\t\t\t\t\tif (GA4React.isInitialized()) {\n\t\t\t\t\t\tga4react.pageview(location.pathname + location.search);\n\t\t\t\t\t\tga4react.gtag('set', 'page', location.pathname);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}, console.error);\n\t\t}\n\t}, []);\n\n\treturn <>{children}>;\n};\n\nexport default RouteChangeTracker;\n","import * as React from 'react';\n\nexport const MainLayout: React.FC = (props) => {\n\treturn \n\t\t{props.children}\n\t
;\n};\n","import * as React from 'react';\nimport { NavLink } from 'react-router-dom';\n\nimport ImageLazy from '@common/react/components/UI/ImageLazy/ImageLazy';\n\nconst year = new Date().getFullYear();\n\nconst Footer: React.FC = () => {\n\treturn ;\n};\n\nexport default Footer;\n","import React from 'react';\nimport { Route, RouteProps } from 'react-router-dom';\n\nimport ErrorBoundaryWithSentry from '@common/react/components/UI/ErrorBoundaryWithSentry/ErrorBoundaryWithSentry';\n\nimport { MainLayout } from '@app/components/Layouts/MainLayout';\n\nimport Footer from '@app/components/UI/Footer/Footer';\n\ninterface Props extends RouteProps {\n\tcomponent: any;\n}\n\nconst RouteWithFooter: React.FC = ({ component: Component, ...rest }) => (\n\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t \n\t\t\t }\n\t/>\n);\n\nexport default RouteWithFooter;\n","import * as React from 'react';\n\nimport { getMoneyString } from '@commonTuna/react/components/Utils';\n\nimport '@app/scss/components/addToCartButton.scss';\nimport { Special } from '@app/objects/Special';\nimport { CartItem, transformSpecialToCartItem } from '@app/objects/CartItem';\nimport useShoppingCart from '@app/hooks/useShoppingCart';\n\ninterface Props {\n\tspecial: Special | CartItem;\n\twithTotal?: boolean;\n}\n\nconst AddToCartButton: React.FC = (props) => {\n\tconst specialForStore = transformSpecialToCartItem(props.special);\n\tconst { addCartItem, updateCartItemQuantity, getItem } = useShoppingCart();\n\n\tconst [isInitialized, setIsInitialized] = React.useState(false);\n\n\tReact.useEffect(() => {\n\t\tsetIsInitialized(true);\n\t}, [isInitialized]);\n\n\tconst storedItem: CartItem | undefined = getItem(specialForStore.id);\n\n\tconst withTotal = props.withTotal ?? true;\n\n\tconst getQuantityTitle = (quantity: number) => {\n\t\treturn `${quantity} unit${quantity > 1 ? 's' : ''}`;\n\t};\n\n\tconst quantity = storedItem?.quantity;\n\tconst showQuantity = isInitialized && storedItem && quantity;\n\n\treturn \n\t\t{showQuantity\n\t\t\t?
\n\t\t\t\t
updateCartItemQuantity(storedItem.id, quantity - 1)}\n\t\t\t\t>\n\t\t\t\t\t–\n\t\t\t\t \n\t\t\t\t
\n\t\t\t\t\t
{getQuantityTitle(quantity)}
\n\t\t\t\t\t{withTotal &&
{getMoneyString(storedItem.itemTotal || 0)}
}\n\t\t\t\t
\n\t\t\t\t
updateCartItemQuantity(storedItem.id, quantity + 1)}\n\t\t\t\t>\n\t\t\t\t\t+\n\t\t\t\t \n\t\t\t
\n\t\t\t:
addCartItem(specialForStore, 1)}>Add to cart \n\t\t}\n\t
;\n};\n\nexport default AddToCartButton;\n","import React from 'react';\nimport { CartProvider, useCart } from 'react-use-cart';\n\nimport { List } from '@common/typescript/objects/List';\n\nimport { request } from '@app/components/Api';\nimport { Special } from '@app/objects/Special';\nimport { transformSpecialToCartItem } from '@app/objects/CartItem';\n\nconst CartProviderWithUpdate: React.FC = ({ children }) => {\n\tconst {\n\t\titems, updateItem, removeItem, isEmpty,\n\t} = useCart();\n\n\tconst cartItemsIds = React.useMemo(() => items.map((item) => item.id), []);\n\n\tconst updateCartItems = (specialsList: Array) => {\n\t\tif (!isEmpty) {\n\t\t\tif (cartItemsIds.length > specialsList.length) {\n\t\t\t\tconst specialsIds = specialsList.map((special) => special.id.toString());\n\t\t\t\tconst shouldDelete = cartItemsIds.filter((id) => !specialsIds.includes(id));\n\n\t\t\t\tfor (let i = 0; i < shouldDelete.length; i++) {\n\t\t\t\t\tremoveItem(shouldDelete[i]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < cartItemsIds.length; i++) {\n\t\t\t\tconst actualSpecial = specialsList.find((special) => special.id.toString() === cartItemsIds[i]);\n\t\t\t\tif (actualSpecial) {\n\t\t\t\t\tconst specialForStore = transformSpecialToCartItem(actualSpecial);\n\t\t\t\t\tupdateItem(actualSpecial.id.toString(), specialForStore);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tconst firstLoad = () => {\n\t\tif (cartItemsIds.length === 0) return;\n\n\t\trequest>('specialsList', {\n\t\t\tids: cartItemsIds,\n\t\t})\n\t\t\t.then((res) => {\n\t\t\t\tupdateCartItems(res.list);\n\t\t\t})\n\t\t\t.catch((err) => console.log(err));\n\t};\n\n\tReact.useEffect(() => {\n\t\tfirstLoad();\n\t}, []);\n\n\treturn <>\n\t\t{children}\n\t>;\n};\n\nconst CartProviderWithUpdateWrapper: React.FC = ({ children }) => {\n\treturn \n\t\t\n\t\t\t{children}\n\t\t \n\t ;\n};\n\nexport default CartProviderWithUpdateWrapper;\n","import * as React from 'react';\n\nimport { useApplicationContext } from '@common/react/components/Core/Application/Application';\n\ninterface OwnProps {\n\trender?: (logout: (event: React.MouseEvent) => void) => JSX.Element;\n\tclearState?: boolean;\n}\n\nconst Logout: React.FC = ({\n\trender,\n\tclearState,\n}) => {\n\tconst { logout } = useApplicationContext();\n\n\tconst logoutHandler = (event: React.MouseEvent) => {\n\t\tevent.preventDefault();\n\t\tlogout(clearState);\n\t};\n\n\treturn render ? render(logoutHandler) : Logout ;\n};\n\nexport default Logout;\n","import React from 'react';\n\nimport { RequestButton, RequestButtonProps } from '@common/react/components/UI/LoadingButton/LoadingButton';\nimport { useApplicationContext } from '@common/react/components/Core/Application/Application';\n\ninterface Props extends Omit, 'requestType' | 'requestProps' | 'children'> {\n\tonSuccess?: () => void;\n\twrapper?: (children) => React.ReactNode;\n\tchildren?: any;\n}\n\nconst TransmutationBack: React.FC = ({\n\tonSuccess,\n\tchildren = ,\n\ttitle = 'Login back',\n\twrapper = (children) => children,\n\t...props\n}) => {\n\tconst {\n\t\tgetTransmutationFlag,\n\t} = useApplicationContext();\n\tconst transmuted = getTransmutationFlag();\n\treturn <>\n\t\t{transmuted && wrapper( {\n\t\t\t\twindow.location.href = '/';\n\t\t\t\tonSuccess && onSuccess();\n\t\t\t}}\n\t\t\tonError={(err) => {\n\t\t\t\tconsole.log(err);\n\t\t\t}}\n\t\t\t{...props}\n\t\t\ttitle={title}\n\t\t\trequestType=\"transmutation\"\n\t\t\trequestProps={{\n\t\t\t\tid: 0,\n\t\t\t\ttransmutation: !transmuted,\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t )}\n\t>;\n};\n\nexport default TransmutationBack;\n","import React from 'react';\n\nimport Message from 'antd/lib/message';\nimport Modal from 'antd/lib/modal';\n\nimport { request } from '@app/components/Api';\n\nconst DashboardTopAlert: React.FC<{objectId: number}> = ({ objectId }) => {\n\tconst handleClick = () => {\n\t\trequest('sendConfirmEmail', { id: objectId })\n\t\t\t.then(() => Modal.success({ content: 'The activation email has been successfully sent.' }))\n\t\t\t.catch(Message.error);\n\t};\n\n\treturn ;\n};\n\nexport default DashboardTopAlert;\n","import React from 'react';\nimport { useCart } from 'react-use-cart';\nimport { useLocation } from 'react-router-dom';\n\nimport Popover from 'antd/lib/popover';\n\nimport LinkWithPrevLocation from '@common/react/components/UI/LinkWithPrevLocation/LinkWithPrevLocation';\nimport { getPopupContainer } from '@common/react/components/Utils/Utils';\nimport { useApplicationContext } from '@common/react/components/Core/Application/Application';\n\nimport { getMoneyString } from '@commonTuna/react/components/Utils';\n\nimport { ShoppingCartItem } from '@app/components/UI/ShoppingCartInformation/ShoppingCartInformation';\nimport { transformStoredItemToCartItem } from '@app/objects/CartItem';\n\ninterface Props {\n\twithoutPopover?: boolean;\n}\n\nconst hidePaths = [\n\t'shopping-cart',\n\t'checkout',\n\t'ordering',\n];\n\nconst ShoppingCartDropdown: React.FC = ({ withoutPopover }) => {\n\tconst [isInitialized, setIsInitialized] = React.useState(false);\n\tconst [showAll, setShowAll] = React.useState(false);\n\tconst location = useLocation();\n\tconst { items, cartTotal, totalItems } = useCart();\n\tconst { getUser } = useApplicationContext();\n\tconst user = getUser();\n\n\tReact.useEffect(() => {\n\t\tsetIsInitialized(true);\n\t}, []);\n\n\tconst totalCount = isInitialized ? totalItems : 0;\n\n\tReact.useEffect(() => {\n\t\tif (totalCount === 0) {\n\t\t\tsetShowAll(false);\n\t\t}\n\t}, [totalCount > 0]);\n\n\tconst content = (\n\t\t\n\t\t\t
\n\t\t\t
\n\t\t\t\t{totalCount}\n\t\t\t
\n\t\t
\n\t );\n\n\tif (withoutPopover || totalCount === 0) {\n\t\treturn {content}
;\n\t}\n\tconst cartItems = items.map(transformStoredItemToCartItem);\n\tconst cartTotalOriginal = cartItems.reduce((acc, item) => acc + (item.originalPrice * (item.quantity || 1)), 0);\n\n\treturn \n\t\t
0 && !(hidePaths.some((path) => location.pathname.includes(path)))}\n\t\t\tplacement=\"bottom\"\n\t\t\tgetTooltipContainer={getPopupContainer}\n\t\t\toverlayClassName=\"shopping-cart__popover\"\n\t\t\tcontent={\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{cartItems.slice(0, showAll ? items.length : 1).map((item) =>\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t )}\n\t\t\t\t\t\t \n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\tTotal:\n\t\t\t\t\t\t\t\t{' '}\n\t\t\t\t\t\t\t\t{getMoneyString(cartTotal)}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{getMoneyString(cartTotalOriginal)}\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{items.length > 1 ? setShowAll((prev) => !prev)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{showAll ? '' : `+${items.length - 1} `}\n\t\t\t\t\t\t\t\tShow All\n\t\t\t\t\t\t\t : null}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tCheck out\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t}\n\t\t>\n\t\t\t{content}\n\t\t \n\t
;\n};\n\nexport default ShoppingCartDropdown;\n","import React from 'react';\nimport { useHistory } from 'react-router-dom';\n\nimport Drawer from 'antd/lib/drawer';\n\nimport { useApplicationContext } from '@common/react/components/Core/Application/Application';\nimport Logout from '@common/react/components/UI/Logout/Logout';\nimport { transformArrayToList } from '@common/typescript/objects/List';\n\nimport { Menu as CustomMenu } from '@app/components/UI/Menu/Menu';\nimport { User, UserRole } from '@app/objects/User';\n\ninterface BurgerMenuProps {\n\tgetPopupContainer?: (node) => HTMLElement;\n}\n\nexport const menu = [\n\t{\n\t\tpath: '/specials',\n\t\tname: 'Specials Shop',\n\t\tclassName: 'menu-item_gray',\n\t},\n\t{\n\t\tpath: '/doctors',\n\t\tname: 'Schedule Appointment',\n\t\tclassName: 'menu-item_orange',\n\t},\n\t{\n\t\tpath: '/login',\n\t\tname: 'Patient Login',\n\t\tprivate: false,\n\t\tclassName: 'menu-item_blue',\n\t},\n\t{\n\t\tpath: '',\n\t\tname: 'Search',\n\t\ticon: 'search',\n\t\tclassName: 'bold-title',\n\t\tprivate: true,\n\t\tchildren: transformArrayToList([\n\t\t\t{\n\t\t\t\tpath: '/doctors',\n\t\t\t\tname: 'Doctors',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/procedures',\n\t\t\t\tname: 'Procedures',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/specialties',\n\t\t\t\tname: 'Specialties',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/clinics',\n\t\t\t\tname: 'Clinics',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/locations',\n\t\t\t\tname: 'Locations',\n\t\t\t},\n\t\t]),\n\t},\n\t{\n\t\tpath: '/doctors',\n\t\tname: 'Doctors',\n\t\tprivate: false,\n\t},\n\t{\n\t\tpath: '/procedures',\n\t\tname: 'Procedures',\n\t\tprivate: false,\n\t},\n\t{\n\t\tpath: '/specialties',\n\t\tname: 'Specialties',\n\t\tprivate: false,\n\t},\n\t{\n\t\tpath: '/clinics',\n\t\tname: 'Clinics',\n\t\tprivate: false,\n\t},\n\t{\n\t\tpath: '/locations',\n\t\tname: 'Locations',\n\t\tprivate: false,\n\t},\n\t{\n\t\tpath: '/profile',\n\t\tname: 'Profile',\n\t\ticon: 'user-circle',\n\t\tclassName: 'bold-title',\n\t\tprivate: true,\n\t},\n\t{\n\t\tpath: '/dashboard',\n\t\tname: 'Dashboard',\n\t\ticon: 'home',\n\t\tclassName: 'bold-title',\n\t\tprivate: true,\n\t},\n\t{\n\t\tpath: '/appointment-list',\n\t\tname: 'Appointments',\n\t\ticon: 'calendar-plus-o',\n\t\tclassName: 'bold-title',\n\t\tprivate: true,\n\t},\n\t{\n\t\tpath: '/analysis-list',\n\t\tname: 'Lab. Orders',\n\t\ticon: 'flask',\n\t\tclassName: 'bold-title',\n\t\tprivate: true,\n\t},\n\t{\n\t\tpath: '/bills',\n\t\tname: 'Bills',\n\t\ticon: 'usd',\n\t\tclassName: 'bold-title',\n\t\tprivate: true,\n\t},\n\t{\n\t\tpath: '',\n\t\tname: 'Documents',\n\t\ticon: 'file-code-o',\n\t\tclassName: 'bold-title',\n\t\tprivate: true,\n\t\tchildren: transformArrayToList([\n\t\t\t{\n\t\t\t\tpath: '/orders',\n\t\t\t\tname: 'Purchases',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/document-list',\n\t\t\t\tname: 'Health Records',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/questionnaires',\n\t\t\t\tname: 'Questionnaires',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/consent-forms',\n\t\t\t\tname: 'Consent|Medical Documents',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/instructions',\n\t\t\t\tname: 'Instructions',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/prescriptions-list',\n\t\t\t\tname: 'Prescriptions',\n\t\t\t},\n\t\t]),\n\t},\n\t{\n\t\tpath: '',\n\t\tadmin: true,\n\t\tname: 'Admin',\n\t\ticon: 'user-secret',\n\t\tclassName: 'bold-title',\n\t\tchildren: transformArrayToList([\n\t\t\t{\n\t\t\t\tpath: '/user-list',\n\t\t\t\tname: 'Users',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/shortLink-list',\n\t\t\t\tname: 'Short Links',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/authLink-list',\n\t\t\t\tname: 'Auth Links',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/user-session-list',\n\t\t\t\tname: 'Entry Log Journal',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/page-list',\n\t\t\t\tname: 'Pages',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/inquiry-list',\n\t\t\t\tname: 'Inquiries',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/email-templates',\n\t\t\t\tname: 'Email Templates',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/marketing-emails',\n\t\t\t\tname: 'Marketing Emails',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/emailLogs',\n\t\t\t\tname: 'Email Log',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/smsLogs',\n\t\t\t\tname: 'Sms Log',\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: '/base-hosted-service-list',\n\t\t\t\tname: 'Hosted Services',\n\t\t\t},\n\t\t]),\n\t},\n\t{\n\t\tpath: '',\n\t\tname: '',\n\t\tprivate: true,\n\t\tnode: \n\t\t\t \n\t\t\t\t\tLogout\n\t\t\t\t }\n\t\t\t\tclearState\n\t\t\t/>\n\t\t ,\n\t},\n];\n\nconst BurgerMenu: React.FC = ({ getPopupContainer }) => {\n\tconst [open, setOpen] = React.useState(false);\n\tconst { getUser } = useApplicationContext();\n\tconst user = getUser();\n\tconst onClose = () => setOpen(false);\n\tconst history = useHistory();\n\n\tReact.useEffect(() => {\n\t\tsetOpen(false);\n\t}, [history.location.pathname]);\n\n\tconst resultMenu = React.useMemo(() => {\n\t\treturn menu.filter((item) => (item.admin\n\t\t\t? user && user.role === UserRole.Admin\n\t\t\t: item.private === undefined || (user && item.private) || (!user && !item.private)));\n\t}, [user]);\n\n\treturn <>\n\t\t\n\t\t\t \n\t\t \n\t\t setOpen((prev) => !prev)}>\n\t\t\t \n\t\t \n\t>;\n};\n\nexport default BurgerMenu;\n","import React from 'react';\n\ninterface Props {\n\taddress: string;\n\tclassName?: string;\n}\n\nconst LocationLink: React.FC = ({ address, children, className }) => {\n\tconst link = React.useMemo(() => {\n\t\tlet res = `https://maps.google.com/maps/search/?api=1&query=${address}`;\n\t\tif (typeof window !== 'undefined') {\n\t\t\tif (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {\n\t\t\t\tres = `maps://maps.google.com/maps/search/?api=1&query=${address}`;\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}, [address]);\n\n\treturn \n\t\t{children}\n\t ;\n};\n\nexport default LocationLink;\n","import React from 'react';\n\nimport Select from 'antd/lib/select';\n\nimport Autocomplete, { OptionType } from '@common/react/components/Forms/Autocomplete/Autocomplete';\nimport { WithId } from '@common/typescript/objects/WithId';\nimport { Nullable } from '@common/typescript/objects/Nullable';\n\nimport { DoctorSpecialty } from '@commonTuna/react/objects/DoctorSpecialty';\nimport { GlobalProcedure } from '@commonTuna/react/objects/GlobalProcedure';\nimport ImageWithSkeleton from '@commonTuna/react/components/UI/ImageWithSkeleton/ImageWithSkeleton';\n\nimport { Doctor } from '@app/objects/Doctor';\n\ninterface SearchResultRow extends WithId {\n\tdoctor: Nullable;\n\tspecialties: Nullable;\n\tglobalProcedure: Nullable;\n}\n\ninterface Props {\n\tvalue: string;\n\tonSelect: (value, option) => void;\n\tonChange: (value) => void;\n\tinitType?: SearchType;\n\tonSearchClick?: (e, value) => void;\n\tonCloseClick?: (e, value, setValue) => void;\n\tinitFocus?: boolean;\n}\n\ninterface Options {\n\tlabel: React.ReactNode;\n\toptions: Array;\n}\n\nexport const emptyValues = {\n\tdoctorId: undefined,\n\tglobalProcedureId: undefined,\n\tspecialtyId: undefined,\n\tglobalPayerId: undefined,\n\tspecialId: undefined,\n\tlocationId: undefined,\n\tprofessionId: undefined,\n};\n\nexport const clearValues = Object.keys(emptyValues)\n\t.map((key) => ({ name: key, value: undefined } as any))\n\t.concat([{ name: 'text', value: '' }]);\n\nconst { Option } = Select;\n\nenum SearchType {\n\tAll = 0,\n\tDoctor = 1,\n\tProcedure = 2,\n\tSpeciality = 3,\n\tClinic = 4,\n\tInsurance = 5,\n\tSpecial = 6,\n\tLocation = 7\n}\n\nconst searchOptions = [\n\t{ name: 'All', value: SearchType.All },\n\t{ name: 'Doctors', value: SearchType.Doctor },\n\t{ name: 'Procedures', value: SearchType.Procedure },\n\t{ name: 'Specialities', value: SearchType.Speciality },\n\t{ name: 'Clinics', value: SearchType.Clinic },\n\t{ name: 'Insurances', value: SearchType.Insurance },\n\t{ name: 'Specials', value: SearchType.Special },\n\t{ name: 'Locations', value: SearchType.Location },\n];\n\nconst sections = ['doctor', 'globalProcedure', 'specialty', 'insurance', 'clinic', 'profession', 'special', 'location'];\n\nconst Search: React.FC = ({\n\tvalue, onChange, onSelect, initType, onSearchClick, initFocus, onCloseClick,\n}) => {\n\tconst [type, setType] = React.useState(initType || SearchType.All);\n\tconst ref = React.useRef(null);\n\tconst [currentValue, setCurrentValue] = React.useState(value);\n\n\tReact.useEffect(() => {\n\t\tinitFocus && ref.current?.focus();\n\t}, [initFocus]);\n\n\tReact.useEffect(() => {\n\t\tif (value !== currentValue) {\n\t\t\tsetCurrentValue(value);\n\t\t}\n\t}, [value]);\n\n\tconst handleChange = (value) => {\n\t\tsetCurrentValue(value);\n\t};\n\n\tconst renderTitle = (title, icon) => <>\n\t\t{icon}\n\t\t{' '}\n\t\t{title}\n\t>;\n\n\tconst renderItem = (value: React.ReactNode, label: React.ReactNode, option: OptionType): OptionType => {\n\t\treturn {\n\t\t\tvalue,\n\t\t\tlabel,\n\t\t\titem: option.item,\n\t\t\tkey: option.item.id,\n\t\t};\n\t};\n\n\tconst getSection = (section: string, filteredOptions: Array): Options => {\n\t\tif (section === 'doctor') {\n\t\t\treturn {\n\t\t\t\tlabel: renderTitle('Doctors', ),\n\t\t\t\toptions: filteredOptions.map((option) => renderItem(`Doctor: ${option.item.doctor.nameEn}`, option.item.doctor.nameEn, option)),\n\t\t\t};\n\t\t}\n\t\tif (section === 'globalProcedure') {\n\t\t\treturn {\n\t\t\t\tlabel: renderTitle(\n\t\t\t\t\t'Procedures',\n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t ,\n\t\t\t\t),\n\t\t\t\toptions: filteredOptions.map((option) => renderItem(\n\t\t\t\t\t`Procedure: ${option.item.globalProcedure.name}`,\n\t\t\t\t\toption.item.globalProcedure.name,\n\t\t\t\t\toption,\n\t\t\t\t)),\n\t\t\t};\n\t\t}\n\t\tif (section === 'specialty') {\n\t\t\treturn {\n\t\t\t\tlabel: renderTitle('Specialties', ),\n\t\t\t\toptions: filteredOptions.map((option) => renderItem(`Specialty: ${option.item.specialty.name}`, option.item.specialty.name, option)),\n\t\t\t};\n\t\t}\n\t\tif (section === 'insurance') {\n\t\t\treturn {\n\t\t\t\tlabel: renderTitle('Insurances', ),\n\t\t\t\toptions: filteredOptions.map((option) => renderItem(\n\t\t\t\t\t`Insurance: ${option.item.insurance.name}`,\n\t\t\t\t\t<>\n\t\t\t\t\t\t{option.item.insurance.avatar\n\t\t\t\t\t\t\t&& \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{option.item.insurance.name}\n\t\t\t\t\t>,\n\t\t\t\t\toption,\n\t\t\t\t)),\n\t\t\t};\n\t\t}\n\t\tif (section === 'clinic') {\n\t\t\treturn {\n\t\t\t\tlabel: renderTitle('Clinics', ),\n\t\t\t\toptions: filteredOptions.map((option) =>\n\t\t\t\t\trenderItem(\n\t\t\t\t\t\t`Clinic: ${option.item.clinic.company?.name} - ${option.item.clinic.nameEn}`,\n\t\t\t\t\t\t`${option.item.clinic.company?.name} - ${option.item.clinic.nameEn}`,\n\t\t\t\t\t\toption,\n\t\t\t\t\t)),\n\t\t\t};\n\t\t}\n\t\tif (section === 'profession') {\n\t\t\treturn {\n\t\t\t\tlabel: renderTitle('Professions', ),\n\t\t\t\toptions: filteredOptions\n\t\t\t\t\t.map((option) => renderItem(\n\t\t\t\t\t\t`Profession: ${option.item.profession.nameEn}`,\n\t\t\t\t\t\toption.item.profession.nameEn,\n\t\t\t\t\t\toption,\n\t\t\t\t\t)),\n\t\t\t};\n\t\t}\n\t\tif (section === 'special') {\n\t\t\treturn {\n\t\t\t\tlabel: renderTitle('Specials', ),\n\t\t\t\toptions: filteredOptions.map((option) => renderItem(\n\t\t\t\t\t`Special: ${option.item.special.name}`,\n\t\t\t\t\t<>\n\t\t\t\t\t\t{option.item.special.avatar\n\t\t\t\t\t\t\t? \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
: null}\n\t\t\t\t\t\t{option.item.special.name}\n\t\t\t\t\t>,\n\t\t\t\t\toption,\n\t\t\t\t)),\n\t\t\t};\n\t\t}\n\t\tif (section === 'location') {\n\t\t\treturn {\n\t\t\t\tlabel: renderTitle('Locations', ),\n\t\t\t\toptions: filteredOptions.map((option) => renderItem(`Location: ${option.item.location.name}`, option.item.location.name, option)),\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tlabel: '',\n\t\t\toptions: [{\n\t\t\t\tvalue: '', label: '', item: '', key: -1,\n\t\t\t}],\n\t\t};\n\t};\n\n\tconst getOptions = (options: Array): Array => {\n\t\tconst result: Array = [];\n\t\tfor (let i = 0; i < sections.length; i++) {\n\t\t\tconst section = sections[i];\n\t\t\tconst filteredOptions = options.filter((o) => o.item[section] !== null);\n\t\t\tif (filteredOptions.length > 0) {\n\t\t\t\tresult.push(getSection(section, filteredOptions));\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\treturn <>\n\t\t {\n\t\t\t\tsetType(value);\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (ref.current) {\n\t\t\t\t\t\tref.current.focus();\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t}}\n\t\t>\n\t\t\t{searchOptions.map((item) => \n\t\t\t\t{item.name}\n\t\t\t )}\n\t\t \n\t\t\n\t\t\tautocompleteRef={ref}\n\t\t\ttype=\"search\"\n\t\t\tloadOnFocus\n\t\t\tgetOptions={getOptions}\n\t\t\tvalue={currentValue}\n\t\t\tonSelect={onSelect}\n\t\t\tonChange={handleChange}\n\t\t\tantdProps={{\n\t\t\t\tstyle: { width: '100%' },\n\t\t\t\tdefaultActiveFirstOption: false,\n\t\t\t\tplaceholder: 'Start type for search...',\n\t\t\t\tonKeyDown: (event) => {\n\t\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\t\tonChange && onChange(currentValue);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}}\n\t\t\tparams={{ count: 5, searchType: type }}\n\t\t/>\n\t\t onSearchClick?.(e, currentValue)} />\n\t\t onCloseClick?.(e, currentValue, setCurrentValue)} />\n\t>;\n};\n\nexport default Search;\n","import React from 'react';\n\nimport { shallowEqual, useDispatch, useSelector } from 'react-redux';\nimport { useLocation, useHistory, NavLink } from 'react-router-dom';\n\nimport { bindActionCreators } from 'redux';\n\nimport Tag from 'antd/lib/tag';\n\nimport { parseQuery } from '@common/typescript/utils/url';\nimport { BaseParams } from '@common/react/objects/BaseParams';\nimport Logout from '@common/react/components/UI/Logout/Logout';\nimport { getUserName } from '@common/react/utils/utils';\nimport ImageLazy from '@common/react/components/UI/ImageLazy/ImageLazy';\nimport TransmutationBack from '@common/react/components/Forms/TransmutationBack';\nimport { getSearchParamsFromUrl } from '@common/react/utils/FIltersParamsFromUrl/FiltersParamsFromUrl';\nimport Avatar from '@common/react/components/Forms/Avatar';\nimport { useApplicationContext } from '@common/react/components/Core/Application/Application';\n\nimport { ApplicationState } from '@app/store';\nimport { actionCreators } from '@app/store/HeaderSearch';\nimport DashboardTopAlert from '@app/components/UI/DashboardTopAlert/DashboardTopAlert';\nimport { SearchFilterState } from '@app/store/SearchFilter';\nimport ShoppingCartDropdown from '@app/components/UI/ShoppingCartDropdown/ShoppingCartDropdown';\nimport BurgerMenu from '@app/components/UI/Header/BurgerMenu';\nimport { useMenuStateProviderContext } from '@app/components/UI/Menu/MenuStateProvider';\nimport LocationLink from '@app/components/UI/LocationLink/LocationLink';\nimport Search, { clearValues, emptyValues } from '@app/components/UI/Header/Search';\nimport { STORAGE_KEYS } from '@app/objects/StorageKeys';\nimport { User } from '@app/objects/User';\n\nimport '@app/scss/pages/headerSearch.scss';\n\nconst HeaderSearch: React.FC = () => {\n\tconst history = useHistory();\n\tconst location = useLocation();\n\tconst {\n\t\tgetTransmutationFlag,\n\t\tgetUser,\n\t} = useApplicationContext();\n\tconst transmuted = getTransmutationFlag();\n\tconst user = getUser();\n\tconst state = useSelector((state: ApplicationState) => state.header, shallowEqual);\n\tconst searchFilterData = useSelector((state: ApplicationState) => state.searchFilterData, shallowEqual);\n\tconst dispatch = useDispatch();\n\tconst { setState } = bindActionCreators(actionCreators, dispatch);\n\tconst context = useMenuStateProviderContext();\n\tconst { state: { mounted }, actions: { setState: setMenuState } } = context;\n\tconst locationData = useSelector((state: ApplicationState) => state.buildData?.item?.location, shallowEqual);\n\n\tconst userName = user ? (user.firstName || user.lastName ? getUserName(user) : user.email) : '';\n\tconst [keys, setKeys] = React.useState({ key: 'initial' });\n\n\tconst [isOpen, setIsOpen] = React.useState(false);\n\n\tconst toggle = () => setIsOpen(!isOpen);\n\n\tconst [values, setValues] = React.useState({\n\t\tlocationName: '',\n\t\tglobalPayerName: '',\n\t\ttext: '',\n\t\tlanguages: [],\n\t\tcertificates: [],\n\t});\n\n\tconst handleUrl = (arr: Array<{ name: string, value: any}>) => {\n\t\tconst searchObj = location.pathname === '/doctors' ? parseQuery(location.search)\n\t\t\t: { ...state, text: undefined };\n\n\t\tarr.forEach(({ name, value }) => {\n\t\t\tsearchObj[name] = value instanceof Array ? `[${value}]` : `${value}`;\n\t\t});\n\n\t\tconst emptyValues = ['', 'null', 'undefined', undefined, null, '-1', '[]'];\n\n\t\tconst search = Object.keys(searchObj)\n\t\t\t.filter((k) => emptyValues.indexOf(searchObj[k]) === -1)\n\t\t\t.map((k) => `${k}=${searchObj[k]}`).join('&');\n\n\t\tif (location.pathname !== '/doctors') {\n\t\t\thistory.push(`/doctors?${search}`);\n\t\t} else {\n\t\t\thistory.replace(`${location.pathname.replace(/\\/\\d+/, '/1')}?${search}`);\n\t\t}\n\t};\n\n\tconst onSelectSearch = (value, option) => {\n\t\tconst obj = option.props.item;\n\t\tconst update = (name, value) => {\n\t\t\tsetState({\n\t\t\t\t...state,\n\t\t\t\t...emptyValues,\n\t\t\t\t[name]: value,\n\t\t\t});\n\t\t\thandleUrl([...clearValues, { name, value }]);\n\t\t};\n\n\t\tif (obj.doctor !== null) {\n\t\t\tsetState({\n\t\t\t\t...state,\n\t\t\t\t...emptyValues,\n\t\t\t});\n\t\t\thistory.push(`/doctors/${obj.doctor.portalPathEn}`);\n\t\t} else if (obj.specialty !== null && obj.specialty !== undefined) {\n\t\t\tupdate('specialtyIds', [obj.specialty.id]);\n\t\t} else if (obj.globalProcedure !== null) {\n\t\t\tupdate('globalProcedureIds', [obj.globalProcedure.id]);\n\t\t} else if (obj.clinic !== null) {\n\t\t\tsetState({\n\t\t\t\t...state,\n\t\t\t\t...emptyValues,\n\t\t\t});\n\t\t\thistory.push(`/clinics/${obj.clinic.portalPathEn}`);\n\t\t} else if (obj.insurance !== null) {\n\t\t\tupdate('globalPayerIds', [obj.insurance.id]);\n\t\t} else if (obj.special !== null) {\n\t\t\tsetState({\n\t\t\t\t...state,\n\t\t\t\t...emptyValues,\n\t\t\t});\n\t\t\thistory.push(`/specials/${obj.special.path}`);\n\t\t} else if (obj.location !== null) {\n\t\t\tsetState({\n\t\t\t\t...state,\n\t\t\t\t...emptyValues,\n\t\t\t});\n\t\t\thistory.push(`/locations/${obj.location.path}`);\n\t\t}\n\t};\n\n\tconst handleSearchFilterResult = (searchObj: BaseParams, result: SearchFilterState) => {\n\t\tconst text = searchObj.text;\n\t\tif (!text) {\n\t\t\tif (result.doctorName) {\n\t\t\t\thandleUrl([...clearValues, { name: 'doctorId', value: searchObj.doctorId }]);\n\t\t\t} else if (result.globalProcedureName) {\n\t\t\t\thandleUrl([...clearValues, { name: 'globalProcedureId', value: searchObj.globalProcedureId }]);\n\t\t\t} else if (result.specialtyName) {\n\t\t\t\thandleUrl([...clearValues, { name: 'specialtyId', value: searchObj.specialtyId }]);\n\t\t\t} else if (result.locationName) {\n\t\t\t\thandleUrl([...clearValues, { name: 'locationId', value: searchObj.locationId }]);\n\t\t\t}\n\t\t}\n\n\t\tsetKeys((prev) => ({\n\t\t\t...prev,\n\t\t\tglobalProcedureIds: Math.random(),\n\t\t\tspecialtyIds: Math.random(),\n\t\t}));\n\t\tsetState(searchObj);\n\t};\n\n\tReact.useEffect(() => {\n\t\tlet searchObj: BaseParams = {};\n\n\t\tif (location.pathname === '/doctors') {\n\t\t\tsearchObj = getSearchParamsFromUrl(location);\n\t\t} else {\n\t\t\tsearchObj = {\n\t\t\t\tdoctorId: -1,\n\t\t\t\tspecialtyId: -1,\n\t\t\t\tglobalProcedureId: -1,\n\t\t\t};\n\t\t}\n\n\t\tif (searchObj.text) {\n\t\t\thandleUrl([\n\t\t\t\t...clearValues,\n\t\t\t\t{ name: 'text', value: searchObj.text },\n\t\t\t]);\n\t\t\tsetValues((prev) => ({\n\t\t\t\t...prev,\n\t\t\t\ttext: searchObj.text,\n\t\t\t}));\n\t\t}\n\n\t\thandleSearchFilterResult(searchObj, searchFilterData);\n\t}, []);\n\n\tReact.useEffect(() => {\n\t\tlet text = state.text;\n\t\tif (!text) {\n\t\t\tif (searchFilterData.doctorName) {\n\t\t\t\ttext = `Doctor: ${searchFilterData.doctorName}`;\n\t\t\t} else if (searchFilterData.globalProcedureName) {\n\t\t\t\ttext = `Procedure: ${searchFilterData.globalProcedureName}`;\n\t\t\t} else if (searchFilterData.specialtyName) {\n\t\t\t\ttext = `Specialty: ${searchFilterData.specialtyName}`;\n\t\t\t} else if (searchFilterData.locationName) {\n\t\t\t\ttext = `Location: ${searchFilterData.locationName}`;\n\t\t\t}\n\t\t}\n\n\t\tsetValues((prev) => ({\n\t\t\t...prev,\n\t\t\t...searchFilterData,\n\t\t\ttext: text || '',\n\t\t}));\n\t}, [searchFilterData]);\n\n\tReact.useEffect(() => {\n\t\t// setIsOpen(false);\n\t\tsetMenuState((prev) => ({ ...prev, open: false }));\n\t}, [history.location.pathname]);\n\tconst showAlert = user && !user?.emailConfirmed && !!user.email;\n\n\treturn (\n\t\t<>\n\t\t\t{user && showAlert ? \n\t\t\t\t \n\t\t\t
: null}\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t{locationData ?
\n\t\t\t\t\t\t\t \n \n\t\t\t\t\t\t\t{locationData.nameEn}\n\t\t\t\t\t\t : null}\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t\tsetState({\n\t\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t\ttext: value,\n\t\t\t\t\t\t\t\t\t\t...emptyValues,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tsetValues((prev) => ({\n\t\t\t\t\t\t\t\t\t\t...prev,\n\t\t\t\t\t\t\t\t\t\ttext: value,\n\t\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t\t\thandleUrl([\n\t\t\t\t\t\t\t\t\t\t...clearValues,\n\t\t\t\t\t\t\t\t\t\t{ name: 'text', value },\n\t\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tinitFocus={isOpen}\n\t\t\t\t\t\t\t\tonSearchClick={(e, value) => {\n\t\t\t\t\t\t\t\t\tif (!value) {\n\t\t\t\t\t\t\t\t\t\tsetIsOpen(false);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetState({\n\t\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t\ttext: value,\n\t\t\t\t\t\t\t\t\t\t...emptyValues,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tsetValues((prev) => ({\n\t\t\t\t\t\t\t\t\t\t...prev,\n\t\t\t\t\t\t\t\t\t\ttext: value,\n\t\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t\t\thandleUrl([\n\t\t\t\t\t\t\t\t\t\t...clearValues,\n\t\t\t\t\t\t\t\t\t\t{ name: 'text', value },\n\t\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tonCloseClick={(e, value, setValue) => {\n\t\t\t\t\t\t\t\t\tsetState({\n\t\t\t\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t\t\t\ttext: '',\n\t\t\t\t\t\t\t\t\t\t...emptyValues,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\thandleUrl([\n\t\t\t\t\t\t\t\t\t\t...clearValues,\n\t\t\t\t\t\t\t\t\t\t{ name: 'text', value: '' },\n\t\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t\t\tsetKeys((prev) => ({ ...prev, key: Math.random() }));\n\t\t\t\t\t\t\t\t\tsetValues((prev) => ({ ...prev, text: '' }));\n\t\t\t\t\t\t\t\t\tif (value) setValue('');\n\t\t\t\t\t\t\t\t\tif (!['doctorId', 'specialtyId', 'globalProcedureId', 'locationId', 'globalPayerId']\n\t\t\t\t\t\t\t\t\t\t.some((key) => state[key] && state[key] > 0) && !value) {\n\t\t\t\t\t\t\t\t\t\tsetIsOpen(false);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tDoctors \n\t\t\t\t\t\t\t\t\t\tProcedures \n\t\t\t\t\t\t\t\t\t\tSpecialties \n\t\t\t\t\t\t\t\t\t\tLocations \n\t\t\t\t\t\t\t\t\t\tClinics \n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
toggle()}>\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
node.closest('.search-page') || document.body} />\n\t\t\t\t\t \n\t\t\t\t\t{user ? \n\t\t\t\t\t\t
\n\t\t\t\t\t\t\tSpecials Shop \n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\tSchedule an Appointment \n\t\t\t\t\t\t
\n\t\t\t\t\t
: null}\n\t\t\t\t\t{user\n\t\t\t\t\t\t? \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t{/*\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{user && user.unviewedMessagesCount > 0 && {user.unviewedMessagesCount}
}\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t*/}\n\t\t\t\t\t\t\t\t{/* \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t */}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t{user && user.unviewedMessagesCount > 0 && (\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t{user.unviewedMessagesCount}\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t{user.unviewedNotificationsCount > 0 && (\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t{user.unviewedNotificationsCount}\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t localStorage.removeItem(STORAGE_KEYS.CHECKOUT_UID)}\n\t\t\t\t\t\t\t\t\twrapper={(children) => {children} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\tclearState\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t{mounted\n\t\t\t\t\t\t\t\t\t\t? setMenuState((prev) => ({ ...prev, open: !prev.open }))}>\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t: \n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t
\n\t\t\t\t\t\t: \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\tSpecials Shop \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\tSchedule an Appointment \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\tPatient Login \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tContact Us\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tEMR\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t \n\t\t\t
\n\t\t>\n\t);\n};\n\nexport default HeaderSearch;\n","import * as React from 'react';\nimport { NavLink } from 'react-router-dom';\n\nimport { MenuItem as BaseMenuItem } from '@common/react/objects/MenuItem';\nimport { Nullable } from '@common/typescript/objects/Nullable';\n\nimport { CountersState } from '@app/store/Counters';\nimport { User } from '@app/objects/User';\n\nimport '@app/scss/components/menu.scss';\n\ninterface MenuItem extends BaseMenuItem {\n\tnode?: React.ReactNode;\n\ticon?: React.ReactNode;\n}\n\ninterface MenuItemProps extends Omit {\n\titem: MenuItem;\n\tcounters?: CountersState;\n}\n\ninterface MenuProps {\n\titems: Array;\n\tcounters?: CountersState;\n\tclassName?: string;\n\twithChildren?: boolean;\n\tbasePath?: string;\n\tpathKey?: string;\n\tdefaultOpen?: boolean;\n\tuser?: Nullable;\n}\n\nconst Item: React.FC = ({\n\titem,\n\tcounters,\n\twithChildren,\n\tbasePath,\n\tpathKey,\n\tdefaultOpen,\n\tuser,\n}) => {\n\tconst [open, setOpen] = React.useState(defaultOpen || ((typeof item.isOpen !== 'undefined') ? item.isOpen : false));\n\n\tconst condition = withChildren && item.children && item.children.list && item.children.list.length > 0;\n\tconst path = item[pathKey || 'path'];\n\tconst { exact = false, isActive } = item;\n\n\t// tslint:disable-next-line:max-line-length\n\tconst className = `menu-component__item ${open && condition\n\t\t? 'menu-component__item_open' : ''} ${condition\n\t\t? 'menu-component__item_with-children' : ''} ${item.className || ''}`;\n\n\tconst requiredBadge = React.useMemo(() => {\n\t\treturn {\n\t\t\t'/chats': {\n\t\t\t\tcondition: !!user && user.unviewedMessagesCount > 0,\n\t\t\t\tvalue: user?.unviewedMessagesCount,\n\t\t\t\ttitle: 'Unviewed messages',\n\t\t\t},\n\t\t\t'/document-list': {\n\t\t\t\tcondition: !!counters && counters.notViewedDocumentsCount > 0,\n\t\t\t\tvalue: counters?.notViewedDocumentsCount,\n\t\t\t\ttitle: 'Not read documents',\n\t\t\t},\n\t\t\t'/questionnaires': {\n\t\t\t\tcondition: !!counters && counters.notAnsweredDiseasesCount > 0,\n\t\t\t\tvalue: counters?.notAnsweredDiseasesCount,\n\t\t\t\ttitle: 'Not answered questionnaires',\n\t\t\t},\n\t\t\t'/consent-forms': {\n\t\t\t\tcondition: !!counters && counters.notAnsweredConsentsCount > 0,\n\t\t\t\tvalue: counters?.notAnsweredConsentsCount,\n\t\t\t\ttitle: 'Not signed consent forms',\n\t\t\t},\n\t\t\t'/instructions': {\n\t\t\t\tcondition: !!counters && counters.notReadInstructionsCount > 0,\n\t\t\t\tvalue: counters?.notReadInstructionsCount,\n\t\t\t\ttitle: 'Not read instructions',\n\t\t\t},\n\t\t\t'/prescriptions-list': {\n\t\t\t\tcondition: !!counters && counters.notViewedPrescriptionsCount > 0,\n\t\t\t\tvalue: counters?.notViewedPrescriptionsCount,\n\t\t\t\ttitle: 'Not read prescriptions',\n\t\t\t},\n\t\t\t'/bills': {\n\t\t\t\tcondition: !!counters && counters.notPaidBillItemsCount > 0,\n\t\t\t\tvalue: counters?.notPaidBillItemsCount,\n\t\t\t\ttitle: 'Not paid bills count',\n\t\t\t},\n\t\t};\n\t}, [user, counters]);\n\n\tconst totalBadge = React.useMemo(() => {\n\t\treturn {\n\t\t\t'/document-list': {\n\t\t\t\tcondition: !!counters && counters.totalDocumentsCount > 0,\n\t\t\t\tvalue: counters?.totalDocumentsCount,\n\t\t\t\ttitle: 'Total documents count',\n\t\t\t},\n\t\t\t'/questionnaires': {\n\t\t\t\tcondition: !!counters && counters.totalDiseasesCount > 0,\n\t\t\t\tvalue: counters?.totalDiseasesCount,\n\t\t\t\ttitle: 'Total questionnaires count',\n\t\t\t},\n\t\t\t'/consent-forms': {\n\t\t\t\tcondition: !!counters && counters.totalConsentsCount > 0,\n\t\t\t\tvalue: counters?.totalConsentsCount,\n\t\t\t\ttitle: 'Total consent forms count',\n\t\t\t},\n\t\t\t'/instructions': {\n\t\t\t\tcondition: !!counters && counters.totalInstructionsCount > 0,\n\t\t\t\tvalue: counters?.totalInstructionsCount,\n\t\t\t\ttitle: 'Total instructions count',\n\t\t\t},\n\t\t\t'/prescriptions-list': {\n\t\t\t\tcondition: !!counters && counters.totalPrescriptionsCount > 0,\n\t\t\t\tvalue: counters?.totalPrescriptionsCount,\n\t\t\t\ttitle: 'Total prescriptions count',\n\t\t\t},\n\t\t\t'/bills': {\n\t\t\t\tcondition: !!counters && counters.totalBillItemsCount > 0,\n\t\t\t\tvalue: counters?.totalBillItemsCount,\n\t\t\t\ttitle: 'Total bills count',\n\t\t\t},\n\t\t};\n\t}, [counters]);\n\n\tconst toggleMenu = () => {\n\t\tsetOpen(!open);\n\t};\n\n\tif (item.node) {\n\t\treturn <>{item.node}>;\n\t}\n\n\tconst icon = item.icon && ;\n\n\treturn (\n\t\t\n\t\t\t{path ? item.externalLink\n\t\t\t\t? \n\t\t\t\t\t{icon}\n\t\t\t\t\t{item.name}\n\t\t\t\t \n\t\t\t\t: (\n\t\t\t\t\t\n\t\t\t\t\t\t{icon}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{item.name}\n\t\t\t\t\t\t \n\t\t\t\t\t\t{requiredBadge[item.path]?.condition\n\t\t\t\t\t\t\t? \n\t\t\t\t\t\t\t\t{requiredBadge[item.path].value}\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{totalBadge[item.path]?.condition\n\t\t\t\t\t\t\t? \n\t\t\t\t\t\t\t\t{totalBadge[item.path].value}\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t}\n\t\t\t\t\t \n\t\t\t\t)\n\t\t\t\t: \n\t\t\t\t\t{icon}\n\t\t\t\t\t{item.name}\n\t\t\t\t \n\t\t\t}\n\t\t\t{condition\n\t\t\t\t&& <>\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{item.children && item.children.list.map((child, index) =>\n\t\t\t\t\t\t\t\t )}\n\t\t\t\t\t\t \n\t\t\t\t\t
\n\t\t\t\t>\n\t\t\t}\n\t\t \n\t);\n};\n\nexport const Menu: React.FC = ({\n\tclassName = '',\n\titems,\n\twithChildren = false,\n\tbasePath,\n\tpathKey,\n\tdefaultOpen,\n\tcounters,\n\tuser,\n}) => {\n\tconst menuItems = items || [];\n\n\treturn \n\t\t{menuItems.map((item, index) =>\n\t\t\t )}\n\t ;\n};\n","import * as React from 'react';\n\nimport once from 'lodash/once';\n\nexport interface MenuStateProviderContextState {\n\topen: boolean;\n\tmounted: boolean;\n}\n\nexport interface MenuStateProviderContext {\n\tstate: MenuStateProviderContextState;\n\tactions: {setState};\n}\n\nexport const createMenuStateProviderContext = once(() => React.createContext({} as MenuStateProviderContext));\n\nexport const useMenuStateProviderContext: () => MenuStateProviderContext = () => React.useContext(createMenuStateProviderContext());\n\nexport const MenuStateProvider: React.FC = ({ children }) => {\n\tconst ItemContext = createMenuStateProviderContext();\n\n\tconst [state, setState] = React.useState({ open: false, mounted: false });\n\n\tconst value = {\n\t\tstate,\n\t\tactions: {\n\t\t\tsetState,\n\t\t},\n\t};\n\n\treturn (\n\t\t\n\t\t\t{children}\n\t\t \n\t);\n};\n","import React from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { bindActionCreators } from 'redux';\n\nimport { useApplicationContext, subscribe } from '@common/react/components/Core/Application/Application';\n\nimport { NotificationAction } from '@common/typescript/objects/NotificationAction';\n\nimport { PatientLocation } from '@app/objects/PatientLocation';\nimport * as LoginState from '@app/store/Login';\nimport { User } from '@app/objects/User';\n\nconst PatientLocationsSetter: React.FC = () => {\n\tconst { getUser } = useApplicationContext();\n\tconst user = getUser();\n\n\tconst dispatch = useDispatch();\n\tconst loginActions: LoginState.LoginActionCreators = React.useMemo(() =>\n\t\tbindActionCreators(LoginState.getActionCreators(), dispatch), []);\n\n\tconst handleNotify = (notification) => {\n\t\tswitch (notification.objectType) {\n\t\t\tcase 'UpdatePatientLocation':\n\t\t\t\tconst userData = notification.data as User;\n\t\t\t\tconst patientLocation: PatientLocation = notification.data.value;\n\t\t\t\tif (user && (user.id === userData.id)) {\n\t\t\t\t\tif (notification.action === NotificationAction.Add) {\n\t\t\t\t\t\tconst patientLocationIndex = user.patientLocations.findIndex((pl) => pl.id === patientLocation.id);\n\t\t\t\t\t\tif (patientLocationIndex >= 0) {\n\t\t\t\t\t\t\tconst newPatientLocations = user.patientLocations.map((pl, index) => {\n\t\t\t\t\t\t\t\tif (index === patientLocationIndex) {\n\t\t\t\t\t\t\t\t\treturn { ...pl, ...patientLocation };\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn pl;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tloginActions.updateUser({ patientLocations: [...newPatientLocations] });\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tloginActions.updateUser({ patientLocations: [...user.patientLocations, patientLocation] });\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (notification.action === NotificationAction.Delete) {\n\t\t\t\t\t\tloginActions.updateUser({ patientLocations: [...user.patientLocations.filter((q) => q.id !== patientLocation.id)] });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\tReact.useEffect(subscribe(handleNotify), [user?.id]);\n\n\treturn <>>;\n};\n\nexport default PatientLocationsSetter;\n","import { BaseUser } from '@common/react/objects/BaseUser';\nimport {\n\tLoginState as BaseLoginState,\n\tLoginActionCreators as BaseLoginActionCreators,\n\tgetActionCreators as baseGetActionCreators,\n\tgetReducer as baseGetReducer,\n} from '@common/react/store/Login';\n\nimport { User } from '@app/objects/User';\nimport { ApplicationState } from '@app/store/index';\n\nexport { TypeKeys } from '@common/react/store/Login';\n\nexport type LoginState = BaseLoginState\n\nexport type LoginActionCreators = BaseLoginActionCreators\n\nexport function getActionCreators() {\n\treturn baseGetActionCreators();\n}\n\nexport function getReducer() {\n\treturn baseGetReducer();\n}\n","import React from 'react';\n\nimport { LogoLoaderPage } from '@commonTuna/react/components/UI/LogoLoader/LogoLoader';\n\nconst PortalLoader: React.FC = () => {\n\treturn ;\n};\n\nexport const params = {\n\tfallback: ,\n};\n\nexport default PortalLoader;\n","import React from 'react';\n\nimport LinkWithPrevLocation from '@common/react/components/UI/LinkWithPrevLocation/LinkWithPrevLocation';\n\nimport emptyCart from '@images/empty-cart.png';\n\nconst EmptyCart: React.FC = () => {\n\treturn \n\t\t
\n\t\t\t
\n\t\t
\n\t\t
You have no items in your shopping cart. \n\t\t
\n\t\t\tLet's go buy something!\n\t\t \n\t
;\n};\n\nexport default EmptyCart;\n","import React from 'react';\nimport { useCart } from 'react-use-cart';\n\nimport Tag from 'antd/lib/tag';\n\nimport { getMoneyString } from '@commonTuna/react/components/Utils';\nimport ImageWithSkeleton from '@commonTuna/react/components/UI/ImageWithSkeleton/ImageWithSkeleton';\nimport { numberWithComma } from '@commonTuna/react/utils/NumberWithComma/NumberWithComma';\n\nimport '@app/scss/components/shoppingCartInformation.scss';\nimport AddToCartButton from '@app/components/UI/AddToCartButton/AddToCartButton';\nimport EmptyCart from '@app/components/UI/EmptyCart/EmptyCart';\nimport { CartItem, transformStoredItemToCartItem } from '@app/objects/CartItem';\nimport useShoppingCart from '@app/hooks/useShoppingCart';\nimport { SpecialLocation } from '@app/components/Pages/Specials/SpecialCard';\nimport WithPathLink from '@app/components/UI/WithPathLink/WithPathLink';\nimport { getLocationName } from '@app/components/Utils';\nimport ProductTag from '@app/components/Pages/Products/ProductTag';\nimport Stars from '@app/components/UI/Stars/Stars';\nimport LocationInfo from '@app/components/Pages/DoctorPortal/LocationInfo';\n\nimport noImage from '@images/no-image.jpg';\n\ninterface Props {\n\tcheckout?: React.ReactNode;\n}\n\nexport const ShoppingCartItem: React.FC<{item: CartItem, forCheckout?: boolean}> = ({ item, forCheckout = true }) => {\n\tconst { removeCartItem } = useShoppingCart();\n\tconst locationRate = (\n\t\t\n\t\t\t \n\t\t \n\t\t{numberWithComma(item.location?.averageReviewRate || 0)}\n\t\t{' '}\n\t\t(\n\t\t{item.location?.totalReviewCount || 0}\n\t\t)\n\t
);\n\n\tconst main = (<>\n\t\t\n\t\t\t{item.name} \n\t\t \n\t\t{item.location && !forCheckout\n\t\t\t&& \n\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t \n\t\t\t\t{locationRate}\n\t\t\t
\n\t\t}\n\t\t{item.procedures?.length ? \n\t\t\tProcedures: \n\t\t\t{item.procedures.map((item) =>\n\t\t\t\t\n\t\t\t\t\t{item.procedure.name}\n\t\t\t\t )}\n\t\t
: null}\n\t\t{item.products?.length ? \n\t\t\t
Products: \n\t\t\t{item.products.map((item) => item.product\n\t\t\t\t&&
)}\n\t\t
: null}\n\t\t{/* {forCheckout ? <>\n\t\t\t{getMoneyString(item.price)} \n\t\t\t{getMoneyString(item.originalPrice)} \n\t\t> : null} */}\n\t>);\n\n\treturn \n\t\t
removeCartItem(item.id)} />\n\t\t\n\t\t\t \n\t\t \n\t\t\n\t\t\t\n\t\t\t\t{forCheckout && item.location ? <>\n\t\t\t\t\t
\n\t\t\t\t\t\t{main}\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{locationRate}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t> : main}\n\t\t\t
\n\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t{getMoneyString(item.price * (item.quantity || 1))} \n\t\t\t\t\t{getMoneyString(item.originalPrice * (item.quantity || 1))} \n\t\t\t\t
\n\t\t\t
\n\t\t \n\t ;\n};\n\nconst ShoppingCartInformation: React.FC = ({ checkout }) => {\n\tconst { items, cartTotal, isEmpty } = useCart();\n\tconst cartItems = items.map(transformStoredItemToCartItem);\n\tconst cartTotalOriginal = cartItems.reduce((acc, item) => acc + (item.originalPrice * (item.quantity || 1)), 0);\n\n\treturn \n\t\t{isEmpty ?
\n\t\t\t:
\n\t\t\t\t
\n\t\t\t\t\t{cartItems.map((item) =>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t )}\n\t\t\t\t \n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\tTotal:\n\t\t\t\t\t\t{' '}\n\t\t\t\t\t\t{getMoneyString(cartTotal)}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t{getMoneyString(cartTotalOriginal)}\n\t\t\t\t\t\t \n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t{checkout}\n\t\t\t
\n\t\t}\n\t
;\n};\n\nexport default ShoppingCartInformation;\n","import React from 'react';\nimport ContentLoader from 'react-content-loader';\n\nconst PreviewImageLoader = (props) => (\n\t\n\t\t \n\t \n);\n\nexport default PreviewImageLoader;\n","import React from 'react';\n\ninterface Props {\n\tvalue: number;\n\tclassName?: string;\n}\n\nconst Stars: React.FC = ({\n\tvalue,\n\tclassName = '',\n}) => {\n\treturn <>\n\t\t{Array\n\t\t\t.from({ length: Math.round(value || 0) })\n\t\t\t.map((_, i) => i)\n\t\t\t.map((i) => )}\n\t>;\n};\n\nexport default Stars;\n","import React from 'react';\n\nimport { AliasToken } from 'antd/es/theme/interface';\n\ninterface ThemeConfig {\n\ttoken: Partial;\n}\n\nconst data: Partial = {\n\tborderRadius: 6,\n\tcolorPrimary: '#fba10d',\n};\n\nexport const theme: ThemeConfig = {\n\ttoken: {\n\t\tcolorPrimary: data.colorPrimary,\n\t\tborderRadius: data.borderRadius,\n\t\tcolorInfo: data.colorPrimary,\n\t\tcolorInfoText: data.colorPrimary,\n\t},\n};\n","import React from 'react';\n\nimport { shallowEqual, useSelector } from 'react-redux';\n\nimport { STORAGE_KEYS } from '@app/objects/StorageKeys';\nimport { ApplicationState } from '@app/store';\nimport { LoginState } from '@app/store/Login';\n\nconst UserStateTracker: React.FC = ({ children }) => {\n\tconst { user } = useSelector((state) => state.login, shallowEqual);\n\n\tReact.useEffect(() => {\n\t\tif (!user) {\n\t\t\tlocalStorage.removeItem(STORAGE_KEYS.CHECKOUT_UID);\n\t\t}\n\t}, [user]);\n\n\treturn <>{children}>;\n};\n\nexport default UserStateTracker;\n","import * as React from 'react';\n\nimport LinkWithPrevLocation from '@common/react/components/UI/LinkWithPrevLocation/LinkWithPrevLocation';\n\ninterface Props {\n\tprefix: string;\n\tpath: string;\n\tclassName?: string;\n}\n\nconst WithPathLink: React.FC = ({\n\tprefix, path, children, className,\n}) => {\n\treturn <>\n\t\t{path\n\t\t\t? \n\t\t\t\t{children}\n\t\t\t \n\t\t\t: <>\n\t\t\t\t{children}\n\t\t\t>\n\t\t}\n\t>;\n};\n\nexport default WithPathLink;\n","import * as React from 'react';\n\nimport moment, { Moment } from 'moment';\n\nimport { Location } from '@app/objects/Location';\nimport { LocationPortal } from '@app/objects/CompanyPortal';\n\ninterface Named {\n\tfirstName: string;\n\tlastName: string;\n}\n\ninterface NamedWithEmail extends Named {\n\temail: string;\n}\n\nexport const getAppContainer = (): HTMLElement => document.body.querySelector('.app-container') || document.body;\n\nexport const showTime = (time, dots: boolean = true) => {\n\tif (!time) return '-';\n\tconst [h, m] = time.split(':');\n\tif (+h === 0 && +m === 0) return `12:${m} a${dots ? '.' : ''}m${dots ? '.' : ''}`;\n\treturn `${+h > 12 ? `${+h - 12 >= 10 ? '' : 0}${+h - 12}` : h}:${m} ${+h >= 12 && +h !== 24 ? 'p' : 'a'}${dots ? '.' : ''}m${dots ? '.' : ''}`;\n};\n\nexport const getParentWidth = (parentSelector: string): number | undefined => {\n\tif (typeof document !== 'undefined' && typeof window !== 'undefined') {\n\t\tconst parentEl = document.querySelector(parentSelector);\n\t\tif (!parentEl) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst parentStyle = window.getComputedStyle(parentEl, null);\n\t\tif (!parentStyle.width) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn parseInt(parentStyle.width, 10)\n\t\t\t- parseInt(parentStyle.paddingLeft || '', 10)\n\t\t\t- parseInt(parentStyle.paddingRight || '', 10);\n\t}\n};\n\nexport const getUserNameOrUnnamedWithEmail = (item?: NamedWithEmail) => {\n\tif (item) {\n\t\tconst name = (!item.lastName && !item.firstName) ? 'Unnamed' : `${item.lastName || ''} ${item.firstName || ''}`;\n\t\treturn `${name} ${item.email ? `(${item.email})` : ''}`;\n\t}\n\treturn '';\n};\n\nexport const timeSpanToMinutes = (timeSpan: string): number | null => {\n\tconst timeArr = timeSpan.split(':');\n\tif (timeArr.length === 3) {\n\t\tconst hours = +timeArr[0];\n\t\tconst minutes = +timeArr[1];\n\t\treturn hours ? hours * 60 + minutes : minutes;\n\t}\n\treturn null;\n};\n\nexport const getLocationName = (\n\tlocation: Location | LocationPortal,\n\ttruncateName: boolean = true,\n\twithoutContainer?: boolean,\n\tfullCompanyName?: boolean,\n) => {\n\tconst companyName = fullCompanyName\n\t\t? `${location?.company?.name || ''}${\n\t\t\tlocation?.company?.portalShortName ? ` (${location?.company?.portalShortName}) ` : ''}`\n\t\t: location?.company?.portalShortName || location?.company?.name;\n\tconst name = companyName ? `${truncateString(companyName, 25, truncateName)} - ${location.nameEn}` : `${location.nameEn}`;\n\n\treturn withoutContainer ? name : \n\t\t{name}\n\t
;\n};\n\nexport const getLocationAddress = (location: Location) => {\n\tconst arr = [location.addressEn, location.city, location.state, location.zip].filter((str) => str);\n\treturn arr.filter((e) => e).join(', ');\n};\n\nconst truncateString = (str: string, maxLength: number, truncateName: boolean) => {\n\tif (truncateName && str.length > maxLength) {\n\t\treturn `${str.slice(0, maxLength - 3)}...`;\n\t}\n\treturn str;\n};\n\nexport const dateTimeFormatString = 'MM/DD/YYYY h:mm A';\n\nexport const dateToUtc = (date): Moment => {\n\tconst offset = moment().utcOffset();\n\treturn moment(date).subtract(offset, 'minutes');\n};\n\nexport const dateToUtcString = (date, format): string => {\n\tconst utc = dateToUtc(date);\n\treturn moment(utc).format(format);\n};\n","import React from 'react';\nimport { useCart } from 'react-use-cart';\n\nimport { getLocalStorageValue } from '@common/react/utils/localStorage/localStorage';\n\nimport { STORAGE_KEYS } from '@app/objects/StorageKeys';\n\nconst useShoppingCart = () => {\n\tconst {\n\t\tremoveItem, addItem, updateItemQuantity, getItem,\n\t} = useCart();\n\tconst uid = getLocalStorageValue(STORAGE_KEYS.CHECKOUT_UID, null);\n\n\tconst removeUid = () => {\n\t\tif (uid) {\n\t\t\tlocalStorage.removeItem(STORAGE_KEYS.CHECKOUT_UID);\n\t\t}\n\t};\n\n\tconst removeCartItem = (itemId) => {\n\t\tremoveItem(itemId);\n\t\tremoveUid();\n\t};\n\n\tconst addCartItem = (item, quantity) => {\n\t\taddItem(item, quantity);\n\t\tremoveUid();\n\t};\n\n\tconst updateCartItemQuantity = (itemId, quantity) => {\n\t\tupdateItemQuantity(itemId, quantity);\n\t\tremoveUid();\n\t};\n\n\treturn {\n\t\tremoveCartItem,\n\t\taddCartItem,\n\t\tupdateCartItemQuantity,\n\t\tgetItem,\n\t};\n};\n\nexport default useShoppingCart;\n","import { Item } from 'react-use-cart';\n\nimport { Nullable } from '@common/typescript/objects/Nullable';\n\nimport { Special, SpecialProcedure, SpecialProduct } from '@app/objects/Special';\n\nexport interface CartItem extends Item {\n\tname: string;\n\toriginalPrice: number;\n\tdescription: string;\n\tpath: string;\n\tlocationId: Nullable;\n\tlocation: {\n\t\tid: number;\n\t\tnameEn: string,\n\t\tnameEs: string,\n\t\tportalPathEn: string;\n\t\tcompany?: {\n\t\t\tportalShortName: string;\n\t\t\tname: string;\n\t\t}\n\t\taddressEn: string;\n\t\tcity: string;\n\t\tstate: string;\n\t\tzip: string;\n\t\taverageReviewRate: number;\n\t\ttotalReviewCount: number;\n\t};\n\tproducts: Array;\n\tprocedures: Array;\n\tavatar: string;\n\toriginalAvatar: string;\n}\n\nexport const transformSpecialToCartItem = (special: Special | CartItem): CartItem => {\n\treturn {\n\t\tid: special.id.toString(),\n\t\tprice: special.price,\n\t\tname: special.name,\n\t\toriginalPrice: special.originalPrice,\n\t\tpath: special.path,\n\t\tdescription: special.description,\n\t\tlocationId: special.locationId,\n\t\tlocation: {\n\t\t\tid: special.location?.id ?? 0,\n\t\t\tnameEn: special.location?.nameEn ?? '',\n\t\t\tnameEs: special.location?.nameEs ?? '',\n\t\t\tportalPathEn: special.location?.portalPathEn ?? '',\n\t\t\tcompany: {\n\t\t\t\tportalShortName: special.location?.company?.portalShortName ?? '',\n\t\t\t\tname: special.location?.company?.name ?? '',\n\t\t\t},\n\t\t\taddressEn: special.location?.addressEn,\n\t\t\tcity: special.location?.city,\n\t\t\tstate: special.location?.state,\n\t\t\tzip: special.location?.zip,\n\t\t\taverageReviewRate: special.location?.averageReviewRate,\n\t\t\ttotalReviewCount: special.location?.totalReviewCount,\n\t\t},\n\t\tproducts: special.products,\n\t\tprocedures: special.procedures,\n\t\tavatar: special.avatar,\n\t\toriginalAvatar: special.originalAvatar,\n\t};\n};\n\nexport const transformStoredItemToCartItem = (item: Item): CartItem => {\n\treturn {\n\t\tid: item.id,\n\t\tname: item.name || '',\n\t\tprice: item.price || 0,\n\t\toriginalPrice: item.originalPrice || 0,\n\t\tpath: item.path || '',\n\t\tdescription: item.description || '',\n\t\tlocationId: item.locationId || null,\n\t\tlocation: item.location || { id: 0, nameEn: '', nameEs: '' },\n\t\tavatar: item.avatar || '',\n\t\toriginalAvatar: item.originalAvatar || '',\n\t\tquantity: item.quantity,\n\t\titemTotal: item.itemTotal,\n\t\tproducts: item.products,\n\t\tprocedures: item.procedures,\n\t};\n};\n","export const STORAGE_KEYS = {\n\tCHECKOUT_UID: 'checkout-uid',\n};\n","import { BaseUser } from '@common/react/objects/BaseUser';\nimport { Nullable } from '@common/typescript/objects/Nullable';\n\nimport { Gender } from '@commonTuna/react/objects/Enums';\n\nimport { Insurance } from '@app/objects/Insurance';\nimport { DrivingLicense } from '@app/objects/DrivingLicense';\nimport { Suffix } from '@app/objects/Suffix';\nimport { MarriageStatus } from '@app/objects/MarriageStatus';\nimport { PatientLocation } from '@app/objects/PatientLocation';\n\nexport enum UserRole {\n\tAdmin = 1,\n\tUser = 2,\n\tSupport = 3\n}\n\nexport const UserRoleNames = {\n\t[UserRole.Admin]: 'Admin',\n\t[UserRole.User]: 'User',\n\t[UserRole.Support]: 'Support',\n};\n\nexport interface User extends BaseUser {\n\tavatar: string;\n\toriginalAvatar: string;\n\n\trole: UserRole;\n\n\tsuffix: Suffix;\n\tfirstName: string;\n\tlastName: string;\n\temail: string;\n\tbirthDate: Nullable;\n\tgender: Nullable;\n\tphoneNumber: string;\n\n\tmarriageStatus: MarriageStatus;\n\n\temergencyContactName: string;\n\temergencyContactPhone: string;\n\temergencyContactRelation: string;\n\n\taddress: string;\n\tcity: string;\n\tregion: string;\n\tzip: string;\n\n\tinsurances: Array;\n\tpatientLocations: Array;\n\n\tdrivingLicenses: Array;\n\n\tallowEmail: boolean;\n\tallowSms: boolean;\n\tallowCalls: boolean;\n\tallowPush: boolean;\n\tagreementForSignUp: boolean;\n\n\temailConfirmed: boolean;\n\tphoneNumberConfirmed: boolean;\n\n\tenableSounds: boolean;\n\tbrowserNotifications: boolean;\n\n\tcompletedRegistration: boolean;\n\tcolor: string | null;\n\tlastLoggedIn?: number;\n\ttime: number;\n\n\tbaseUtcOffset: string;\n\n\tethnicityId: Nullable;\n}\n\nexport interface RegistrationUser extends User {\n\tpassword: string;\n\trepeatPassword: string;\n\tcaptcha?: string;\n}\n","import * as React from 'react';\nimport { Switch } from 'react-router-dom';\n\nimport loadable from '@loadable/component';\nimport 'regenerator-runtime/runtime';\n\nimport { loadableDelay } from '@common/react/loadable/loadableSettings';\nimport NotFoundRoute from '@common/react/components/Routes/NotFoundRoute';\n\nimport { LogoLoaderPage } from '@commonTuna/react/components/UI/LogoLoader/LogoLoader';\n\nimport DashboardRoute from '@app/components/Routes/DashboardRoute';\nimport RouteWithFooter from '@app/components/Routes/RouteWithFooter';\nimport Layout from '@app/components/Layout';\n\nconst params = {\n\tfallback: ,\n};\n\n/* --------------Admin---------------*/\nconst Profile = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ProfilePage\" */\n\t\t'@app/components/Pages/Profile'\n\t)), params);\nconst Dashboard = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"DashboardPage\" */\n\t\t'@app/components/Pages/Admin/Dashboard/Dashboard'\n\t)), params);\nconst ChatsPage = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ChatsPage\" */\n\t\t'@app/components/Pages/Admin/Chats/Chats'\n\t)), params);\nconst Questionnaires = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"QuestionnairesPage\" */\n\t\t'@app/components/Pages/Admin/Invites/Questionnaires'\n\t)), params);\nconst ConsentForms = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ConsentFormsPage\" */\n\t\t'@app/components/Pages/Admin/Invites/ConsentForms'\n\t)), params);\nconst Instructions = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"InstructionsPage\" */\n\t\t'@app/components/Pages/Admin/Invites/Instructions'\n\t)), params);\nconst Analyzes = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"AnalyzesPage\" */\n\t\t'@app/components/Pages/Admin/Analyzes/Analyzes'\n\t)), params);\nconst Appointments = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"AppointmentsPage\" */\n\t\t'@app/components/Pages/Admin/Appointments/Appointments'\n\t)), params);\nconst AppointmentViewer = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"AppointmentViewerPage\" */\n\t\t'@app/components/Pages/Admin/Appointments/Appointment'\n\t)), params);\nconst Documents = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"DocumentsPage\" */\n\t\t'@app/components/Pages/Admin/Documents/Documents'\n\t)), params);\nconst Doctors = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"SearchPage\" */\n\t\t'@app/components/Pages/Doctors'\n\t)), params);\nconst Prescriptions = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"DocumentsPage\" */\n\t\t'@app/components/Pages/Admin/Prescriptions/Prescriptions'\n\t)), params);\nconst Users = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Users\" */\n\t\t'@app/components/Pages/Admin/Users/Users'\n\t)), params);\nconst ShortLinks = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ShortLinks\" */\n\t\t'@app/components/Pages/Admin/ShortLinks/ShortLinks'\n\t)), params);\nconst AuthLinks = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"AuthLinks\" */\n\t\t'@common/react/components/Pages/AuthLinks/AuthLinks'\n\t)), params);\nconst AuthLinksFilters = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"AuthLinksFilters\" */\n\t\t'@commonTuna/react/components/Pages/Admin/AuthLinks/AuthLinksFilters'\n\t)), params);\nconst UserSessions = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"UserSessions\" */\n\t\t'@app/components/Pages/Admin/UserSessions/UserSessions'\n\t)), params);\nconst Notifications = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"NotificationsPage\" */\n\t\t'@app/components/Pages/Admin/Notifications/Notifications'\n\t)), params);\nconst SystemNotifications = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"SystemNotificationsPage\" */\n\t\t'@app/components/Pages/Admin/Notifications/SystemNotifications'\n\t)), params);\nconst SystemNotificationTypes = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"SystemNotificationTypes\" */\n\t\t'@app/components/Pages/Admin/Notifications/SystemNotificationTypes'\n\t)), params);\nconst Pages = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"PagesPage\" */\n\t\t'@app/components/Pages/Admin/Pages/Pages'\n\t)), params);\nconst PageEditor = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"PageEditorPage\" */\n\t\t'@app/components/Pages/Admin/Pages/PageEditor'\n\t)), params);\nconst Orders = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"OrdersPage\" */\n\t\t'@app/components/Pages/Admin/Orders/Orders'\n\t)), params);\nconst Inquiries = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Inquiries\" */\n\t\t'@app/components/Pages/Admin/Inquiries/Inquiries'\n\t)), params);\nconst Bills = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"BillsPage\" */\n\t\t'@app/components/Pages/Admin/Bills/Bills'\n\t)), params);\nconst Checkout = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"CheckoutPage\" */\n\t\t'@app/components/Pages/Admin/Checkout/Checkout'\n\t)), params);\nconst EmailTemplates = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"EmailTemplatesPage\" */\n\t\t'@app/components/Pages/Admin/EmailTemplates/EmailTemplates'\n\t)), params);\nconst MarketingEmails = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"MarketingEmailsPage\" */\n\t\t'@app/components/Pages/Admin/MarketingEmails/MarketingEmails'\n\t)), params);\nconst SmsLogs = loadable(\n\t() =>\n\t\tloadableDelay(import(/* webpackChunkName: \"SmsLogs\" */\n\t\t\t'@commonTuna/react/components/Pages/Admin/SmsLogs/SmsLogs'\n\t\t)),\n\tparams,\n);\nconst EmailLogs = loadable(\n\t() =>\n\t\tloadableDelay(import(/* webpackChunkName: \"EmailLogs\" */\n\t\t\t'@commonTuna/react/components/Pages/Admin/EmailLogs/EmailLogs'\n\t\t)),\n\tparams,\n);\nconst Ordering = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Ordering\" */\n\t\t'@app/components/Pages/Admin/Ordering/Ordering'\n\t)), params);\nconst BaseHostedServices = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"BaseHostedServicesPage\" */\n\t\t'@app/components/Pages/Admin/BaseHostedServices/BaseHostedServices'\n\t)), params);\nconst PageAccesses = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"PageAccessesPage\" */\n\t\t'@app/components/Pages/Admin/PageAccesses/PageAccesses'\n\t)), params);\n\n/* ------------Admin end-------------*/\n\nconst Home = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Home\" */\n\t\t'@app/components/Pages/Home/Home'\n\t)), params);\nconst Login = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"LoginPage\" */\n\t\t'@app/components/Pages/Login/Login'\n\t)), params);\nconst Recover = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"RecoverPage\" */\n\t\t'@app/components/Pages/Recover/Recover'\n\t)), params);\nconst Confirm = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ConfirmPage\" */\n\t\t'@app/components/Pages/Confirm/Confirm'\n\t)), params);\nconst ContactSupport = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ContactSupportPage\" */\n\t\t'@app/components/Pages/ContactSupport/ContactSupport'\n\t)), params);\nconst Register = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"RegisterPage\" */\n\t\t'@app/components/Pages/Register/Register'\n\t)), params);\nconst Confirmation = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ConfirmationPage\" */\n\t\t'@app/components/Pages/Confirmation/Confirmation'\n\t)), params);\nconst ChangeEmailConfirmation = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ChangeEmailConfirmation\" */\n\t\t'@app/components/Pages/Register/ChangeEmailConfirmation'\n\t)), params);\nconst CompanyPortalComponent = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"PortalFromBBY\" */\n\t\t'@app/components/Pages/FromBBY/CompanyPortal'\n\t)), params);\nconst DoctorPortalComponent = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"DoctorPortalComponent\" */\n\t\t'@app/components/Pages/DoctorPortal'\n\t)), params);\nconst DoctorReview = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"DoctorReview\" */\n\t\t'@app/components/Pages/DoctorReview'\n\t)), params);\nconst Specialties = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Specialties\" */\n\t\t'@app/components/Pages/Specialties/Specialties'\n\t)), params);\nconst Locations = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Locations\" */\n\t\t'@app/components/Pages/Region/Regions'\n\t)), params);\nconst Location = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Region\" */\n\t\t'@app/components/Pages/Region/Region'\n\t)), params);\nconst Specialty = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Specialty\" */\n\t\t'@app/components/Pages/Specialties/Specialty'\n\t)), params);\nconst Specials = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Specials\" */\n\t\t'@app/components/Pages/Specials/Specials'\n\t)), params);\nconst Special = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Special\" */\n\t\t'@app/components/Pages/Specials/Special'\n\t)), params);\nconst Product = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Product\" */\n\t\t'@app/components/Pages/Products/Product'\n\t)), params);\nconst Procedures = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Procedures\" */\n\t\t'@app/components/Pages/Procedures/Procedures'\n\t)), params);\nconst ProcedurePage = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ProcedurePage\" */\n\t\t'@app/components/Pages/Procedures/ProcedurePage'\n\t)), params);\nconst PrivacyPolicy = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"PrivacyPolicy\" */\n\t\t'@app/components/Pages/PrivacyPolicy/PrivacyPolicy'\n\t)), params);\nconst RegistrationArticle = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"RegistrationArticle\" */\n\t\t'@app/components/Pages/RegistrationArticle/RegistrationArticle'\n\t)), params);\nconst Inquiry = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"Inquiry\" */\n\t\t'@app/components/Pages/Inquiry/Inquiry'\n\t)), params);\nconst ExpiredLink = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ExpiredLink\" */\n\t\t'@app/components/Pages/ExpiredLink/ExpiredLink'\n\t)), params);\nconst ShoppingCart = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ShoppingCart\" */\n\t\t'@app/components/Pages/ShoppingCart/ShoppingCart'\n\t)), params);\nconst QuickPay = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"QuickPayPage\" */\n\t\t'@app/components/Pages/QuickPay/QuickPay'\n\t)), params);\nconst ErrorPage = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ErrorPage\" */ '@common/react/components/Pages/ErrorPage/ErrorPage')), params);\nconst PaymentsProcessing = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"PaymentsProcessing\" */\n\t\t'@app/components/Pages/PaymentsProcessing/PaymentsProcessing'\n\t)), params);\nconst Clinics = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ClinicsPage\" */\n\t\t'@app/components/Pages/Clinics/Clinics'\n\t)), params);\nconst ClinicPortalComponent = loadable(() =>\n\tloadableDelay(import(/* webpackChunkName: \"ClinicPortalComponent\" */\n\t\t'@app/components/Pages/Clinics/ClinicPortalComponent'\n\t)), params);\n\nexport const routes = (\n\t\n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t } />} title=\"Auth Links\" />\n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t \n );\n","import { Action, Reducer, ActionCreatorsMapObject } from 'redux';\n\nimport { AppThunkAction } from '@app/store/index';\n\n/* interface AppointmentInvitesCounters {\n\tappointmentId: number;\n\tnotAnsweredInvitesCount: number;\n\tnotReadInstructionsCount: number;\n} */\n\nexport interface CountersState {\n\tnotViewedDocumentsCount: number;\n\tnotAnsweredDiseasesCount: number;\n\tnotAnsweredConsentsCount: number;\n\tnotReadInstructionsCount: number;\n\tnotViewedPrescriptionsCount: number;\n\tnotPaidBillItemsCount: number;\n\n\ttotalDocumentsCount: number;\n\ttotalDiseasesCount: number;\n\ttotalConsentsCount: number;\n\ttotalInstructionsCount: number;\n\ttotalPrescriptionsCount: number;\n\ttotalBillItemsCount: number;\n}\n\nexport enum CountersTypeKeys {\n\tSET_COUNTERS_STATE = 'SET_COUNTERS_STATE',\n\tUPDATE_COUNTERS = 'UPDATE_COUNTERS'\n}\n\nexport interface SetCountersState {\n\ttype: CountersTypeKeys.SET_COUNTERS_STATE;\n\tpayload: CountersState;\n}\n\ninterface UpdateCounters {\n\ttype: CountersTypeKeys.UPDATE_COUNTERS;\n\tdata: object;\n}\n\nexport type Actions = SetCountersState | UpdateCounters;\n\nexport interface CountersActionCreators extends ActionCreatorsMapObject {\n\tsetCountersState: (state: CountersState) => AppThunkAction;\n\tupdateCounters: (data: object) => AppThunkAction;\n}\n\nexport const countersActionCreators = {\n\tsetCountersState: (state: CountersState): AppThunkAction => (dispatch, getState) => {\n\t\tdispatch({ type: CountersTypeKeys.SET_COUNTERS_STATE, payload: { ...state } });\n\t},\n\tupdateCounters: (data: object): AppThunkAction => (dispatch, getState) => {\n\t\tdispatch({ type: CountersTypeKeys.UPDATE_COUNTERS, data });\n\t},\n};\n\nconst initialState = {\n\tnotViewedDocumentsCount: 0,\n\tnotAnsweredDiseasesCount: 0,\n\tnotAnsweredConsentsCount: 0,\n\tnotReadInstructionsCount: 0,\n\tnotViewedPrescriptionsCount: 0,\n\tnotPaidBillItemsCount: 0,\n\ttotalDocumentsCount: 0,\n\ttotalDiseasesCount: 0,\n\ttotalConsentsCount: 0,\n\ttotalInstructionsCount: 0,\n\ttotalPrescriptionsCount: 0,\n\ttotalBillItemsCount: 0,\n};\n\nexport const reducer: Reducer = (\n\tstate: CountersState = initialState,\n\tincomingAction: Action,\n) => {\n\tconst action = incomingAction as Actions;\n\tswitch (action.type) {\n\t\tcase CountersTypeKeys.SET_COUNTERS_STATE:\n\t\t\treturn { ...action.payload };\n\t\tcase CountersTypeKeys.UPDATE_COUNTERS:\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.data,\n\t\t\t};\n\t\tdefault:\n\t\t\treturn state;\n\t}\n};\n","import {\n\tTypeKeys as ItemKeys, InitStorageAction as ItemInitStorageAction, InitStorageAction as InitStorageItemAction, TypeKeys as ItemTypeKeys,\n} from '@common/react/store/Item';\nimport { SetItemsAction, TypeKeys } from '@common/react/store/ItemsProviderStore';\n\nimport { BaseInvite } from '@commonTuna/react/objects/BaseInvite';\n\nimport { Init } from '@app/objects/Init';\nimport { SetCountersState, CountersTypeKeys } from '@app/store/Counters';\nimport { SearchFilterTypeKeys, SetSearchFilterState } from '@app/store/SearchFilter';\n\nexport const customReduxActions = (dispatch, init: Init) => {\n\tconst buildDataAction: InitStorageItemAction = {\n\t\ttype: ItemTypeKeys.INITSTORAGE,\n\t\tstorageName: 'buildData',\n\t\titem: {\n\t\t\tbuildNumber: init.buildNumber,\n\t\t\tbuildDate: init.buildDate,\n\t\t\tmaxNameLength: init.maxNameLength,\n\t\t\t...(init as any),\n\t\t},\n\t};\n\n\tdispatch(buildDataAction);\n\n\tif (init.companyTemplateInvites) {\n\t\tconst companyTemplateInvitesAction: SetItemsAction = {\n\t\t\ttype: TypeKeys.SETITEMS,\n\t\t\tstorageName: 'companyTemplateInvites',\n\t\t\titems: init.companyTemplateInvites,\n\t\t\ttotal: init.companyTemplateInvites.length,\n\t\t\tobjectType: 'invite',\n\t\t\tparams: {\n\t\t\t\tcount: 100,\n\t\t\t\tisCompanyTemplate: true,\n\t\t\t\tisAnswered: false,\n\t\t\t},\n\t\t};\n\n\t\tdispatch(companyTemplateInvitesAction);\n\t}\n\n\tif (init.userRegistrationSteps) {\n\t\tconst userRegistrationStepsAction: ItemInitStorageAction = {\n\t\t\ttype: ItemKeys.INITSTORAGE,\n\t\t\tstorageName: 'userRegistrationSteps',\n\t\t\titem: init.userRegistrationSteps,\n\t\t};\n\n\t\tdispatch(userRegistrationStepsAction);\n\t}\n\n\tif (init.counters) {\n\t\tconst countersAction: SetCountersState = {\n\t\t\ttype: CountersTypeKeys.SET_COUNTERS_STATE,\n\t\t\tpayload: init.counters,\n\t\t};\n\n\t\tdispatch(countersAction);\n\t}\n\n\tif (init.searchFilterData) {\n\t\tconst searchFilterAction: SetSearchFilterState = {\n\t\t\ttype: SearchFilterTypeKeys.SET_SEARCH_FILTER_STATE,\n\t\t\tpayload: init.searchFilterData,\n\t\t};\n\n\t\tdispatch(searchFilterAction);\n\t}\n\n\tif (init.hostOptions) {\n\t\tconst hostOptionsAction: InitStorageItemAction = {\n\t\t\ttype: ItemTypeKeys.INITSTORAGE,\n\t\t\tstorageName: 'hostOptions',\n\t\t\titem: init.hostOptions,\n\t\t};\n\n\t\tdispatch(hostOptionsAction);\n\t}\n};\n","export const SET_PATIENT_LOCATION = 'SET_PATIENT_LOCATION';\nexport const SET_SEARCH_STATE = 'SET_SEARCH_STATE';\n","import { Action, ActionCreatorsMapObject, Reducer } from 'redux';\n\nimport { BaseAppThunkAction } from '@common/react/store';\n\nimport { SET_SEARCH_STATE } from '@app/store/constants';\nimport { User } from '@app/objects/User';\nimport { ApplicationState } from '@app/store/index';\n\nexport interface HeaderState {\n\tdoctorId?: number;\n\tglobalProcedureId?: number;\n\tspecialtyId?: number;\n\tglobalPayerId?: number;\n\ttext?: string;\n\tlocationId?: number;\n\tlanguageIds?: Array;\n\tfrom?: number | null;\n\tglobalProcedureIds?: Array;\n\tspecialtyIds?: Array;\n\tcertificateIds?: Array;\n\tregionIds?: Array;\n\tlocationIds?: Array;\n\tglobalPayerIds?: Array;\n\tgender?: number;\n}\n\ninterface SetAction extends Action {\n\tpayload: HeaderState;\n}\n\nexport interface HeaderActionCreators extends ActionCreatorsMapObject {\n\tsetState: (state: HeaderState) => BaseAppThunkAction;\n}\n\nexport const actionCreators: HeaderActionCreators = {\n\tsetState: (state: HeaderState) => (dispatch) => {\n\t\tdispatch({\n\t\t\ttype: SET_SEARCH_STATE,\n\t\t\tpayload: { ...state },\n\t\t});\n\t},\n};\n\nconst initialState = {};\n\nexport const reducer: Reducer = (state: HeaderState = initialState, action: Action) => {\n\tswitch (action.type) {\n\t\tcase SET_SEARCH_STATE:\n\t\t\treturn { ...(action as SetAction).payload };\n\t}\n\n\treturn state;\n};\n","import { Action, Reducer, ActionCreatorsMapObject } from 'redux';\n\nimport { Language } from '@commonTuna/react/objects/Language';\nimport { Certificate } from '@commonTuna/react/objects/Certificate';\n\nimport { AppThunkAction } from '@app/store/index';\n\nexport interface SearchFilterState {\n\tlocationName: string;\n\tglobalPayerName: string;\n\tspecialtyName?: string;\n\tdoctorName?: string;\n\tglobalProcedureName?: string;\n\tglobalProcedures?: Array;\n\tspecialties?: Array;\n\tlanguages: Array;\n\tcertificates: Array;\n}\n\nexport enum SearchFilterTypeKeys {\n\tSET_SEARCH_FILTER_STATE = 'SET_SEARCH_FILTER_STATE',\n\tUPDATE_SEARCH_FILTER = 'UPDATE_SEARCH_FILTER'\n}\n\nexport interface SetSearchFilterState {\n\ttype: SearchFilterTypeKeys.SET_SEARCH_FILTER_STATE;\n\tpayload: SearchFilterState;\n}\n\ninterface UpdateSearchFilter {\n\ttype: SearchFilterTypeKeys.UPDATE_SEARCH_FILTER;\n\tdata: object;\n}\n\nexport type Actions = SetSearchFilterState | UpdateSearchFilter;\n\nexport interface SearchFilterActionCreators extends ActionCreatorsMapObject {\n\tsetSearchFilterState: (state: SearchFilterState) => AppThunkAction;\n\tupdateSearchFilter: (data: object) => AppThunkAction;\n}\n\nexport const searchFilterActionCreators = {\n\tsetSearchFilterState: (state: SearchFilterState): AppThunkAction => (dispatch, getState) => {\n\t\tdispatch({ type: SearchFilterTypeKeys.SET_SEARCH_FILTER_STATE, payload: { ...state } });\n\t},\n\tupdateSearchFilter: (data: object): AppThunkAction => (dispatch, getState) => {\n\t\tdispatch({ type: SearchFilterTypeKeys.UPDATE_SEARCH_FILTER, data });\n\t},\n};\n\nconst initialState = {\n\tlocationName: '',\n\tglobalPayerName: '',\n\tspecialtyName: '',\n\tdoctorName: '',\n\tglobalProcedureName: '',\n\tglobalProcedures: [],\n\tspecialties: [],\n\tlanguages: [],\n\tcertificates: [],\n};\n\nexport const reducer: Reducer = (\n\tstate: SearchFilterState = initialState,\n\tincomingAction: Action,\n) => {\n\tconst action = incomingAction as Actions;\n\tswitch (action.type) {\n\t\tcase SearchFilterTypeKeys.SET_SEARCH_FILTER_STATE:\n\t\t\treturn { ...action.payload };\n\t\tcase SearchFilterTypeKeys.UPDATE_SEARCH_FILTER:\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.data,\n\t\t\t};\n\t\tdefault:\n\t\t\treturn state;\n\t}\n};\n","import { fetch } from 'domain-task';\n\nimport { BaseApplicationState } from '@common/react/store';\nimport { BaseUser } from '@common/react/objects/BaseUser';\nimport { BaseParams } from '@common/typescript/objects/BaseParams';\n\ninterface Message {\n\tsuccess: number;\n\tresponse: T;\n\tsession: string;\n}\n\nexport interface ResponseError {\n\tmessage: string;\n\tcode: number;\n\tname?: string;\n}\n\nconst baseRequest = <\n\tT,\n\tTUser extends BaseUser,\n\tTApplicationState extends BaseApplicationState\n>(type: string, data: BaseParams = {}, state?: TApplicationState, signal?: AbortSignal): Promise => {\n\treturn fetch('api/post', {\n\t\tcredentials: 'same-origin',\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-type': 'application/json; charset=utf-8',\n\t\t\tCookie: `session=${state ? state.login.session : ''}`,\n\t\t},\n\t\tbody: JSON.stringify({\n\t\t\ttype,\n\t\t\tdata: JSON.stringify(data),\n\t\t}),\n\t\tsignal,\n\t})\n\t\t.then((response) => response.json() as Message)\n\t\t.then((data: Message) => {\n\t\t\tif (!data.success) {\n\t\t\t\tthrow data.response as ResponseError;\n\t\t\t}\n\n\t\t\treturn data.response as T;\n\t\t});\n};\n\nconst request = <\n\tT,\n\tTUser extends BaseUser,\n\tTApplicationState extends BaseApplicationState\n\t>(type: string, data: BaseParams = {}, state?: TApplicationState, signal?: AbortSignal): Promise => {\n\treturn baseRequest(type, data, state, signal)\n\t\t.catch((error: ResponseError) => {\n\t\t\tif (error.name === 'AbortError') {\n\t\t\t\tthrow new Error('Aborted');\n\t\t\t}\n\t\t\tif (error.message === 'Access denied' && window) {\n\t\t\t\twindow.location.href = '/';\n\t\t\t}\n\n\t\t\tconsole.log(error.message);\n\t\t\tthrow error.message as string;\n\t\t});\n};\n\nexport { baseRequest, request };\n","import * as React from 'react';\n\nimport { FormikProps } from 'formik';\nimport { MentionProps } from 'antd/lib/mentions';\n\nimport { List } from '@common/typescript/objects/List';\nimport { BaseUser, BaseUserWithAvatar } from '@common/react/objects/BaseUser';\nimport { Nullable } from '@common/typescript/objects/Nullable';\nimport { File, FileInterface } from '@common/typescript/objects/FileInterface';\nimport { ButtonsProps, ChatFormComponentState } from '@common/react/components/Chat/ChatMessageForm';\nimport { Notification } from '@common/typescript/objects/Notification';\nimport { ApplicationStateWithChats, ChatsActionCreators } from '@common/react/components/Chat/Store/Chats';\n\nexport enum ChatMessageType {\n\tRegular = 0,\n\tVoiceMessage = 1,\n\tEmail = 2,\n\tPhoneCall = 3,\n\tVideoChat = 4,\n\tVideoMessage = 5,\n\tSticker = 6,\n\tGiphy = 7,\n\tTenor = 8,\n\tForwardedMessage = 9,\n\tReplyMessage = 10,\n\tUserAttached = 11,\n\tUserDetached = 12,\n}\n\nexport enum ChatRoomType {\n\tVideo,\n\tAudio\n}\n\nexport enum ChatKind\n{\n\tPersonal = 0,\n\tConference = 1,\n\tGroup = 2,\n\tHelp = 3,\n\tSos = 4,\n\tBot = 5,\n}\n\nexport interface Chat {\n\tid: number;\n\tkind: ChatKind;\n\ttime: number;\n\tname: string;\n\tcontacts: Array;\n\tcontactsIds: Array;\n\tmessages: List;\n\tlastMessage: Nullable;\n\tunviewedMessagesCount: number;\n\tuserId: number;\n\tarchive?: boolean;\n}\n\nexport enum ChatPlugins {\n\tRegular = 0,\n\tVoiceMessage = 1,\n\tEmail = 2,\n\tPhoneCall = 3,\n\tVideoChat = 4,\n\tVideoMessage = 5,\n\tSticker = 6,\n\tGiphy = 7,\n\tTenor = 8,\n\tForward = 9,\n\tReply = 10,\n\tUserAttached = 11,\n\tUserDetached = 12,\n\tEdit = 16,\n\tDeleted = 17,\n\tVoiceCall = 18,\n\tTyping = 26,\n\tFiles = 27,\n\tEmoji = 28,\n\tMentions = 29,\n\tReactions = 30,\n\tLinkPreview = 31,\n\tLinkPreviewGroup = 32,\n\tColorBox = 33,\n\tSearching = 34,\n\tArchive = 35,\n\tAddChat = 36,\n\tOnlineFilter = 37,\n\tAllChats = 38,\n\tCompleteChat = 39,\n\tLeaveChat = 40,\n\tChatNameEditor = 41,\n\tCopy = 42,\n\tModalPlugin = 44,\n\tTemplate = 45,\n\tAdaptiveCards = 46,\n\tSendLater = 47,\n}\n\nexport interface ChatPlugin {\n\tformButton?: (formikBag: FormikProps, props: ChatFormButtonsProps) => React.ReactNode;\n\tformComponent?: (props: MentionProps) => React.ReactNode;\n\tmessageControlWrapper?: ({ chat, render }) => React.ReactNode;\n\tlistComponent?: (props) => React.ReactNode;\n\tadditionalComponent?: (props) => React.ReactNode;\n\tmessage?: {\n\t\trender: ({\n\t\t\tmessage, contacts, withRemoteId, onMouseEnter, lastVideoCallId, onImageClick,\n\t\t}) => React.ReactNode;\n\t\tlastMessage?: ({ message, chat, userId }) => React.ReactNode;\n\t\tnotification?: ({ message, withRemoteId, contacts }) => React.ReactNode;\n\t};\n\tformTag?: (formikBag: FormikProps, { state, setState, waveColor }) => React.ReactNode;\n\tmessagesHeaderAction?:\n\t\t({\n\t\t\tcurrentChat,\n\t\t\tuser,\n\t\t\tleaveChat,\n\t\t\thistory,\n\t\t\tpatientId,\n\t\t\tstate,\n\t\t\tcompleteChat,\n\t\t\twithRemoteId,\n\t\t\tactions,\n\t\t\tstorageName,\n\t\t} : {\n\t\t\tcurrentChat,\n\t\t\tuser,\n\t\t\tleaveChat,\n\t\t\thistory,\n\t\t\tpatientId,\n\t\t\tstate,\n\t\t\tcompleteChat,\n\t\t\twithRemoteId,\n\t\t\tactions: ChatsActionCreators>,\n\t\t\tstorageName\n\t\t}) => React.ReactNode;\n\tchatMessageAction?: ({\n\t\tedit, remove, isEdit, message, update, fromUser, options, reply,\n\t}) => React.ReactNode;\n\tchatsListHeaderComponent?: ({\n\t\tfilters, handleChange, selectChat, pageSettings, user,\n\t}) => React.ReactNode;\n\tonMessageListClick?: (e, chat: Chat) => void;\n\tmessageAttachment?: (message) => React.ReactNode;\n\tmessageAttachmentBefore?: (message) => React.ReactNode;\n\tnotificationHandler?: (\n\t\tnotification: Notification,\n\t\tstoreName: string,\n\t\tactions: ChatsActionCreators>,\n\t\toptions: any // plugin options\n\t) => void;\n\tsendButtonWrapper?: (button, formikBag, disabled) => React.ReactNode;\n\toptions?: any;\n}\n\nexport type ChatListHeaderSettingsType = Array React.ReactNode)>;\n\ntype CustomComponent = (({\n\tcurrentChat, user, leaveChat, history, patientId, state, completeChat, withRemoteId, actions,\n}) => React.ReactNode);\n\nexport type ChatMessagesHeaderSettingsType = Array;\n\nexport type ChatNameType = ({\n\tcurrentChat, user, withRemoteId, patientId,\n}) => React.ReactNode;\n\nexport interface EmojiReaction {\n\tid: number;\n\tuserId: number;\n\tuser: BaseUserWithAvatar;\n\tobjectId: number;\n\tobject: ChatMessage;\n\treaction: string;\n\tanimate?: boolean;\n}\n\nexport interface BaseChatMessage {\n\tid: number;\n\ttext: string;\n\tchatId: number;\n\tfiles?: Array;\n\tloading?: boolean;\n}\n\nexport interface ChatMessage {\n\tid: number;\n\ttext: string;\n\tchatId: number;\n\tchat?: Chat;\n\tuserId: number;\n\tuser?: BaseUserWithAvatar;\n\ttime: number;\n\tsendingTime: number;\n\tmessageViewers: Array;\n\tviewed: boolean;\n\tviewLoading?: boolean;\n\tfiles: Array;\n\temojiReactions: Array;\n\tchatMessageType: ChatMessageType;\n\tchatRoomType?: ChatRoomType;\n\tinnerChatMessageId: Nullable;\n\tinnerChatMessage: Nullable;\n\tloading?: boolean;\n}\n\nexport interface ChatMessageAccess {\n\tchatMessageObject?: ChatMessage;\n\tid: number;\n\tmessage: number;\n\ttime: number;\n\tuser?: BaseUserWithAvatar;\n\tuserId: number;\n\tviewed: boolean;\n}\n\nexport interface ChatUser {\n\tid: number;\n\tchatId: number;\n\tuserId: number;\n\tuser?: BaseUserWithAvatar;\n\tchat?: Chat;\n}\n\nexport interface NewMessage {\n\tid: number;\n\ttext: string;\n\tchatId: number;\n\n\tbytes: Array;\n\tfiles: Array;\n\tattachments: Array;\n\tchatMessageType: ChatMessageType;\n\tinnerChatMessageId?: number;\n\tsendingTime?: number;\n}\n\nexport interface ChatFormButtonsProps extends ButtonsProps {\n\tchat: Chat;\n\tisEditMessage?: boolean;\n\twaveColor?: string;\n\tsetState: React.Dispatch>;\n\tchatId?: number;\n\tgetPopupContainer?: (node) => HTMLElement;\n}\n\nexport type ChatFormButtonsWrappers = {\n\t[key in ChatPlugins]?: (children) => React.ReactNode;\n};\n\nexport type ChatFormButtonsComponents = ChatPlugins | ((formikBag: FormikProps, props: ChatFormButtonsProps) => React.ReactNode);\n\nexport enum ChatHeaderButtons {\n\tVoice,\n\tVideo,\n\tMail\n}\n\nexport enum StickerType {\n\tImage,\n\tGiphy\n}\n\nexport type ChatMessageActionsComponent = ChatPlugins\n\t| (({\n\t\tremove, update, edit, isEdit, message, fromUser, options,\n\t}) => React.ReactNode);\n\nexport type ChatOtherComponents = ChatPlugins | (({\n\tchat, defaultIdx, setImg, files, basePath,\n}) => React.ReactNode);\n\nexport interface ChatStickerCollectionItem {\n\timage: string;\n\tdescription?: string;\n\tfullImage?: string;\n}\n\nexport interface ChatStickerCollection {\n\titems: Array;\n\timage: string;\n\tdescription?: string;\n\tenable?: boolean;\n}\n","import * as React from 'react';\n\nimport Mentions from 'antd/lib/mentions';\nimport Tag from 'antd/lib/tag';\nimport {\n\tFieldProps, FormikProps,\n} from 'formik';\nimport * as Yup from 'yup';\nimport message from 'antd/lib/message';\nimport Popover from 'antd/lib/popover';\n\nimport {\n\tChat,\n\tChatMessage,\n\tChatMessageType,\n\tNewMessage,\n} from '@common/react/components/Chat/Chat';\nimport Button from '@common/react/components/Forms/Button';\nimport FormikField from '@common/react/components/Forms/FormikField/FormikField';\nimport { getUserName } from '@common/react/utils/utils';\nimport { BaseUser, BaseUserWithAvatar } from '@common/react/objects/BaseUser';\nimport { FileInterface, FileType } from '@common/typescript/objects/FileInterface';\nimport FormikRef from '@common/react/components/Core/ItemEditor/FormikRef';\nimport { RecordResult } from '@common/react/utils/record-audio';\nimport { uploadFile } from '@common/react/components/Forms/Files/File';\nimport {\n\tuseChatSettingsProviderContext,\n} from '@common/react/components/Chat/ChatSettingsProvider';\nimport { imageExtensions } from '@common/react/components/Chat/Chats';\nimport { ItemProvider } from '@common/react/components/Core/ItemProvider/ItemProvider';\nimport { ItemEditor } from '@common/react/components/Core/ItemEditor/ItemEditor';\n\nexport interface ButtonsProps {\n\tonUploadFile: (file: FileInterface) => void;\n}\n\ninterface ComponentProps {\n\tchat: Chat;\n\teditMessage: ChatMessage | null;\n\tsetEdit: (message) => void;\n\tafterSubmit?: (message) => void;\n\tsendClassName?: string;\n\tonImageClick?: (e, file: FileInterface) => void;\n\tactionsInPopup?: boolean;\n\tfilesAfterButtons?: boolean;\n\tgetActionPopupContainer?: (node) => HTMLElement;\n\tgetUserAvatar?: (user) => React.ReactNode;\n\treplyMessage?: ChatMessage | null;\n\tsetReply?: (message) => void;\n}\n\ninterface ContactsHash {\n\t[index: number]: string;\n}\n\nexport interface ChatFormComponentState {\n\tisLoading: boolean;\n\tcontacts: ContactsHash;\n\n\trecordAudioResult: RecordResult | undefined;\n\trecordVideoResult: RecordResult | undefined;\n}\n\nconst getValidationSchema = (maxLength: number) => Yup.object().shape({\n\ttext: Yup.string().max(maxLength, `max characters count: ${maxLength}`),\n});\n\nconst transformContactsToHash = (contacts: Array) => contacts.reduce((map, obj) => {\n\tmap[obj.id] = getUserName(obj);\n\treturn map;\n}, {});\n\ninterface FilesProps {\n\tformikBag: FormikProps;\n\tonRemoveUploadedFile: (id, formikBag) => void;\n\tstate: ChatFormComponentState;\n\tsetState: React.Dispatch>;\n\tonImageClick?: (e, f) => void;\n}\n\nconst Files: React.FC = ({\n\tformikBag, onRemoveUploadedFile, onImageClick, state, setState,\n}) => {\n\tconst context = useChatSettingsProviderContext();\n\n\tif (!context?.state) throw 'need ChatSettingsContext';\n\n\tconst {\n\t\tstate: {\n\t\t\tformSettings,\n\t\t\tformTags,\n\t\t\tplugins,\n\t\t},\n\t} = context;\n\tconst { waveColor } = formSettings;\n\n\treturn \n\t\t{formikBag.values.files\n\t\t\t.map((f) => (\n\t\t\t\t
onRemoveUploadedFile(f.id, formikBag)}\n\t\t\t\t\tclosable\n\t\t\t\t\tcloseIcon={ }\n\t\t\t\t>\n\t\t\t\t\t{imageExtensions.includes(f.extension?.toLowerCase())\n\t\t\t\t\t\t? (\n\t\t\t\t\t\t\t onImageClick && onImageClick(e, f)}\n\t\t\t\t\t\t\t\tclassName=\"chat-form-file-tag-image\"\n\t\t\t\t\t\t\t\tsrc={f.thumb}\n\t\t\t\t\t\t\t\talt={f.name}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t\t: \n\t\t\t\t\t}\n\t\t\t\t\t \n\t\t\t\t\t{f.name} \n \n\t\t\t\t \n\t\t\t))\n\t\t}\n\t\t
\n\t\t\t{formTags.map((plugin) => \n\t\t\t\t{plugins[plugin]?.formTag?.(formikBag, { state, setState, waveColor })}\n\t\t\t )}\n\t\t \n\t
;\n};\n\nconst ChatMessageForm: React.FC = (props) => {\n\tconst {\n\t\tsendClassName = 'btn-primary', chat, onImageClick, editMessage, setEdit, actionsInPopup, filesAfterButtons,\n\t} = props;\n\tconst {\n\t\tgetActionPopupContainer, replyMessage, setReply, getUserAvatar,\n\t} = props;\n\tconst form = React.useRef | null>(null);\n\n\tconst context = useChatSettingsProviderContext();\n\n\tif (!context?.state) throw 'need ChatSettingsContext';\n\n\tconst {\n\t\tstate: {\n\t\t\tformButtons,\n\t\t\tchatFormButtonsWrappers,\n\t\t\trequests,\n\t\t\tformSettings,\n\t\t\terrorHandlers,\n\t\t\tplugins,\n\t\t\tmessageControl,\n\t\t\tmessageControlWrappers,\n\t\t\tsendButtonWrapper,\n\t\t},\n\t} = context;\n\tconst { maxAttachmentsCount, maxMessageLength, waveColor } = formSettings;\n\n\tconst [state, _setState] = React.useState({\n\t\tisLoading: false,\n\t\tcontacts: props.chat ? transformContactsToHash(props.chat.contacts) : {},\n\t\trecordAudioResult: undefined,\n\t\trecordVideoResult: undefined,\n\t});\n\tconst setState = React.useCallback((newState) => _setState((state) => ({ ...state, ...newState })), []);\n\tconst buttonWrapper = sendButtonWrapper && plugins[sendButtonWrapper]?.sendButtonWrapper;\n\n\tReact.useEffect(() => {\n\t\tsetState({\n\t\t\tcontacts: props.chat ? transformContactsToHash(props.chat.contacts) : {},\n\t\t});\n\t}, [props.chat]);\n\n\tconst onUploadFile = (file: FileInterface, formikBag: FormikProps) => {\n\t\tformikBag.setValues((prev) => {\n\t\t\tconst nextFiles = formikBag.values.files.concat(file);\n\n\t\t\tif (nextFiles.length > maxAttachmentsCount) {\n\t\t\t\tmessage.info(`Max Attachment files count: ${maxAttachmentsCount}`);\n\t\t\t\treturn prev;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfiles: prev.files.concat(file),\n\t\t\t};\n\t\t});\n\t};\n\n\tconst onRemoveUploadedFile = (id: number, formikBag) => {\n\t\tformikBag.setValues((prev) => {\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfiles: prev.files.filter((f) => f.id !== id),\n\t\t\t};\n\t\t});\n\t};\n\n\tconst onKeyDown = (e: KeyboardEvent) => {\n\t\tconst formikBag = form.current;\n\n\t\tif (formikBag && e.ctrlKey && e.code === 'Enter') {\n\t\t\te.preventDefault();\n\t\t\tformikBag.submitForm();\n\t\t}\n\t};\n\n\tconst handlePaste = (e: React.ClipboardEvent, formikBag: FormikProps) => {\n\t\tconst items = Array.from(e.clipboardData.items).filter((x) => /^image\\//.test(x.type));\n\n\t\titems.forEach((item) => {\n\t\t\tconst blob = item?.getAsFile();\n\n\t\t\tuploadFile({\n\t\t\t\tfile: blob,\n\t\t\t\ttype: 'chatMessage',\n\t\t\t\tobjectId: -1,\n\t\t\t\tfileType: FileType.File,\n\t\t\t})\n\t\t\t\t.then((data) => onUploadFile(data, formikBag))\n\t\t\t\t.catch((err: any) => {\n\t\t\t\t\tmessage.error(typeof err === 'object' ? err.message : err);\n\t\t\t\t});\n\t\t});\n\t};\n\n\tReact.useEffect(() => {\n\t\tdocument.addEventListener('keydown', onKeyDown);\n\t\treturn () => document.removeEventListener('keydown', onKeyDown);\n\t}, []);\n\n\tconst MentionComponent = React.useMemo(() => {\n\t\treturn ({ placement, ...props }: any) => {\n\t\t\tconst mention = (onKeyDown) => {\n\t\t\t\tconst handleKeyDown = (e) => {\n\t\t\t\t\tonKeyDown && onKeyDown(e);\n\t\t\t\t\tprops.onKeyDown && props.onKeyDown(e);\n\t\t\t\t};\n\t\t\t\treturn messageControl && plugins[messageControl]?.formComponent\n\t\t\t\t\t? plugins[messageControl]?.formComponent?.({ placement, ...props, onKeyDown: handleKeyDown })\n\t\t\t\t\t: ;\n\t\t\t};\n\t\t\tif (!messageControlWrappers || messageControlWrappers.some((plugin) => !plugins[plugin]?.messageControlWrapper)) {\n\t\t\t\treturn <>{mention(undefined)}>;\n\t\t\t}\n\n\t\t\treturn <>\n\t\t\t\t{(messageControlWrappers?.reduce(\n\t\t\t\t\t(acc, plugin) =>\n\t\t\t\t\t\t(handleKeyDown) => {\n\t\t\t\t\t\t\treturn <>\n\t\t\t\t\t\t\t\t{plugins[plugin]?.messageControlWrapper?.({\n\t\t\t\t\t\t\t\t\tchat,\n\t\t\t\t\t\t\t\t\trender: (onKeyDown) => {\n\t\t\t\t\t\t\t\t\t\tconst keyDownHandler = (e) => {\n\t\t\t\t\t\t\t\t\t\t\tonKeyDown && onKeyDown(e);\n\t\t\t\t\t\t\t\t\t\t\thandleKeyDown && handleKeyDown(e);\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\treturn acc(keyDownHandler);\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t>;\n\t\t\t\t\t\t},\n\t\t\t\t\tmention,\n\t\t\t\t) || mention)?.(undefined)}\n\t\t\t>;\n\t\t};\n\t}, [messageControl, `${messageControlWrappers}`, chat.id]);\n\n\tconst validationSchema = React.useMemo(() => {\n\t\treturn getValidationSchema(maxMessageLength);\n\t}, []);\n\n\tconst mentionOptions = React.useMemo(() => {\n\t\treturn chat.contacts.map((item) => {\n\t\t\tconst name = getUserName(item);\n\n\t\t\treturn {\n\t\t\t\tvalue: name,\n\t\t\t\tlabel: <>\n\t\t\t\t\t{getUserAvatar && {getUserAvatar(item)}
}\n\t\t\t\t\t{name} \n\t\t\t\t>,\n\t\t\t};\n\t\t});\n\t}, [chat.contacts, messageControl && plugins[messageControl]?.formComponent]);\n\n\tconst getActions = (formikBag) => \n\t\t{formButtons\n\t\t\t.map((button) => {\n\t\t\t\tconst props = {\n\t\t\t\t\tonUploadFile: (f) => onUploadFile(f, formikBag),\n\t\t\t\t\tsetState: _setState,\n\t\t\t\t\twaveColor,\n\t\t\t\t\tisEditMessage: !!editMessage,\n\t\t\t\t\tchatId: chat.id,\n\t\t\t\t\tgetPopupContainer: getActionPopupContainer,\n\t\t\t\t\tchat,\n\t\t\t\t};\n\t\t\t\tconst wrapper = typeof button !== 'function' && chatFormButtonsWrappers[button]\n\t\t\t\t\t? chatFormButtonsWrappers[button] : (children) => {children} ;\n\n\t\t\t\tconst buttonRender = typeof button === 'function'\n\t\t\t\t\t? button\n\t\t\t\t\t: plugins[button] && plugins[button]?.formButton !== null\n\t\t\t\t\t\t? plugins[button]?.formButton\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\treturn !buttonRender ? null : wrapper ? wrapper(buttonRender(formikBag, props)) : buttonRender(formikBag, props);\n\t\t\t})\n\t\t}\n\t ;\n\n\tconst initValue = {\n\t\ttext: editMessage?.text || '',\n\t\tid: editMessage?.id || -1,\n\t\tchatId: editMessage?.chatId || chat.id,\n\t\tfiles: editMessage?.files.map((f) => f.file) || [],\n\t\tattachments: [],\n\t\tbytes: [],\n\t\tchatMessageType: replyMessage ? ChatMessageType.ReplyMessage : ChatMessageType.Regular,\n\t\tinnerChatMessageId: replyMessage?.id,\n\t} as NewMessage;\n\n\treturn \n\t\tkey={editMessage ? 'editMessage' : replyMessage ? 'replyMessage' : 'newMessage'}\n\t\ttype={editMessage && requests.updateMessage ? requests.updateMessage : requests.chatMessage}\n\t\tid={editMessage?.id || -1}\n\t\tskipInitLoad\n\t\titem={initValue}\n\t\tloadRequest=\"\"\n\t\tadd={initValue}\n\t\tvalidationSchema={validationSchema}\n\t\tclearForSubmit={(values) => {\n\t\t\tconst item = values;\n\n\t\t\titem.chatId = props.chat.id;\n\t\t\titem.attachments = item.files.map((f) => f.id);\n\t\t\treturn item;\n\t\t}}\n\t\tonSaveRequestError={(e) => (errorHandlers?.onSaveMessageLoadError || message.error)(e)}\n\t\treadonly={false}\n\t\ttransformAfterSave={() => ({\n\t\t\ttext: '',\n\t\t\tid: -1,\n\t\t\tchatId: chat.id,\n\t\t\tfiles: [],\n\t\t\tattachments: [],\n\t\t\tbytes: [],\n\t\t\tchatMessageType: ChatMessageType.Regular,\n\t\t\tinnerChatMessageId: undefined,\n\t\t})}\n\t\tsaveRequest={editMessage && requests.updateMessage ? requests.updateMessage : requests.chatMessage}\n\t>\n\t\t\n\t\t\tformikProps={{\n\t\t\t\tenableReinitialize: true,\n\t\t\t}}\n\t\t\tafterSubmit={(item, res) => {\n\t\t\t\t_setState((prev) => ({\n\t\t\t\t\t...prev,\n\t\t\t\t\trecordAudioResult: undefined,\n\t\t\t\t\trecordVideoResult: undefined,\n\t\t\t\t}));\n\t\t\t\tprops.afterSubmit && props.afterSubmit(res);\n\t\t\t\tif (editMessage) {\n\t\t\t\t\tsetEdit(null);\n\t\t\t\t}\n\t\t\t\tif (replyMessage) {\n\t\t\t\t\tsetReply && setReply(null);\n\t\t\t\t}\n\t\t\t}}\n\t\t\tbeforeSubmit={(values, actions, submit) => {\n\t\t\t\tconst {\n\t\t\t\t\ttext, files, attachments, bytes,\n\t\t\t\t} = values;\n\n\t\t\t\tif (!(text.replace(/\\s/g, '') || files?.length || attachments?.length || bytes?.length)) return;\n\t\t\t\tsubmit();\n\t\t\t}}\n\t\t\tformProps={{\n\t\t\t\tid: 'new-chat-message',\n\t\t\t\tclassName: 'chat-form-component',\n\t\t\t}}\n\t\t\tshowMessages={false}\n\t\t\tedit={(formikBag, _, { loading }) => {\n\t\t\t\tconst disabled = !formikBag.values.files.length\n\t\t\t\t\t&& !formikBag.values.text.replace(/\\s/g, '').length\n\t\t\t\t\t&& formikBag.values.bytes.length <= 0;\n\t\t\t\treturn <>\n\t\t\t\t\t{\n\t\t\t\t\t\treplyMessage\n\t\t\t\t\t\t\t? (\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tplugins[replyMessage.chatMessageType]?.message?.render({\n\t\t\t\t\t\t\t\t\t\t\t\tmessage: replyMessage,\n\t\t\t\t\t\t\t\t\t\t\t\tcontacts: [],\n\t\t\t\t\t\t\t\t\t\t\t\twithRemoteId: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tonImageClick: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseEnter: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tlastVideoCallId: undefined,\n\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
setReply && setReply(null)}\n\t\t\t\t\t\t\t\t\t\tclassName=\"form-reply-message__cancel btn btn-default btn-sm\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t) : null\n\t\t\t\t\t}\n\t\t\t\t\t \n\t\t\t\t\t) =>\n\t\t\t\t\t\t\t form.setFieldValue(field.name, typeof e === 'string' ? e : e?.currentTarget?.value)}\n\t\t\t\t\t\t\t\tclassName=\"form-control\"\n\t\t\t\t\t\t\t\tautoSize\n\t\t\t\t\t\t\t\tplaceholder=\"Start typing your message\"\n\t\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t\t\tvalue={field.value}\n\t\t\t\t\t\t\t\tonPaste={formSettings.allowPasteImages ? (e) => handlePaste(e, formikBag) : undefined}\n\t\t\t\t\t\t\t\t{...(messageControl && plugins[messageControl]?.formComponent\n\t\t\t\t\t\t\t\t\t? { options: mentionOptions } : {})}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t\n\t\t\t\t\t\t{filesAfterButtons ? null :
}\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{formSettings.underFormLabel &&
\n\t\t\t\t\t\t\t\t{formSettings.underFormLabel}\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t{!actionsInPopup ? getActions(formikBag)\n\t\t\t\t\t\t\t\t: (\n\t\t\t\t\t\t\t\t\t
node.closest('.chat-message-flex') || document.body}\n\t\t\t\t\t\t\t\t\t\ttrigger=\"click\"\n\t\t\t\t\t\t\t\t\t\tcontent={getActions(formikBag)}\n\t\t\t\t\t\t\t\t\t\tplacement=\"topRight\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\teditMessage ?
setEdit(null)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tCancel\n\t\t\t\t\t\t\t\t : null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{buttonWrapper\n\t\t\t\t\t\t\t\t? buttonWrapper(\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\tSend\n\t\t\t\t\t\t\t\t\t ,\n\t\t\t\t\t\t\t\t\tformikBag,\n\t\t\t\t\t\t\t\t\tdisabled || loading,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: (\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\tSend\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t{filesAfterButtons ? : null}\n\t\t\t\t>;\n\t\t\t}}\n\t\t/>\n\t ;\n};\n\nexport default ChatMessageForm;\n","import * as React from 'react';\n\nexport const defaultChatMessagesError = ({ reload }) => {\n\treturn \n\t\t
\n\t\t\tOops... we couldn't upload the messages,\n\t\t\t \n\t\t\tbut our team is already working on it\n\t\t \n\t\t \n\t\t reload()}>\n\t\t\tClick to reload messages\n\t\t \n\t
;\n};\n","import React from 'react';\n\nconst useScrollTo = (\n\trefreshId: number | string | null,\n\tprevent?: boolean,\n\tafterScrollStart?: () => void,\n) => {\n\tconst ref = React.useRef(null);\n\n\tReact.useEffect(() => {\n\t\tconst scrollContainer = ref.current;\n\n\t\tif (scrollContainer && !prevent) {\n\t\t\tscrollContainer.scrollIntoView({ block: 'end' });\n\t\t\tsetTimeout(() => afterScrollStart && afterScrollStart(), 0);\n\t\t}\n\t}, [refreshId]);\n\n\treturn ref;\n};\n\nexport default useScrollTo;\n","import * as React from 'react';\nimport { shallowEqual, useSelector } from 'react-redux';\nimport { useHistory } from 'react-router-dom';\n\nimport Message from 'antd/lib/message';\n\nimport { parseQuery } from '@common/typescript/utils/url';\nimport { getUserName } from '@common/react/utils/utils';\nimport { getAvatar } from '@common/react/utils/getAvatar';\nimport { replaceSearchUrl } from '@common/react/components/Utils/Utils';\nimport {\n\tChat,\n\tChatMessage,\n\tChatMessageActionsComponent,\n\tChatMessageType, ChatPlugins,\n} from '@common/react/components/Chat/Chat';\nimport { ApplicationStateWithChats, ChatsActionCreators } from '@common/react/components/Chat/Store/Chats';\nimport { BaseUserWithAvatar } from '@common/react/objects/BaseUser';\nimport { BaseApplicationState } from '@common/react/store';\nimport { dateFormat, dateTimeFormat } from '@common/typescript/Utils';\nimport { File } from '@common/typescript/objects/FileInterface';\nimport {\n\tdefaultTransformFiltersBeforeHandleUrl,\n\tItemsProvider,\n\tuseItemsProviderContext,\n} from '@common/react/components/Core/ItemsProvider/ItemsProvider';\nimport {\n\tChatSettingsProviderContext,\n\tPluginsDictionary,\n\tuseChatSettingsProviderContext,\n} from '@common/react/components/Chat/ChatSettingsProvider';\nimport Loader from '@common/react/components/Core/LoadingProvider/Loader';\nimport { deleteConfirmation } from '@common/react/components/Modal/Modal';\nimport { defaultChatMessagesError } from '@common/react/components/Chat/ChatComponents';\nimport useScrollTo from '@common/react/hooks/useScrollTo';\n\ntype ListProps = OwnProps;\n\ntype Actions = ChatsActionCreators>;\n\ninterface OwnProps {\n\tactions: Actions;\n\tchat: Chat;\n\tuser: BaseUserWithAvatar;\n\tcontext: ChatSettingsProviderContext;\n\tsetEdit: (message) => void;\n\teditMessage?: ChatMessage | null;\n\tsetReplyMessage: (message) => void;\n\treplyMessage?: ChatMessage | null;\n\tloader?: React.ReactElement;\n\tonImageClick?: (e, file: File) => void;\n\tgetUserAvatar?: (user) => React.ReactNode;\n}\n\nexport interface ChatItemProps {\n\tmessage: ChatMessage;\n\twithRemoteId: boolean;\n\tfromUser: boolean;\n\twithoutBadge: boolean;\n\tuser: BaseUserWithAvatar;\n\tremove: () => void;\n\tupdate: (message) => void;\n\tedit: (message) => void;\n\treply: (message) => void;\n\tisEdit: boolean;\n\tplugins: PluginsDictionary;\n\tonMouseEnter?: (message: ChatMessage) => void;\n\tcontacts: Array;\n\tonImageClick?: (e, file: File) => void;\n\tgetUserAvatar?: (user) => React.ReactNode;\n\tlastVideoCallId?: number;\n\tmessageActions?: Array;\n\tshowActionsByHover?: boolean;\n\tscrollIntoView?: boolean;\n\tafterScroll?: () => void;\n\tgetViewerAvatar?: (messageViewers) => React.ReactNode;\n\tattachments?: Array;\n\tattachmentsBefore?: Array;\n}\n\nconst getMessageUser = (id: number, contacts: Array) =>\n\tcontacts.find((contact: BaseUserWithAvatar) => contact.id === id);\n\nconst allowMessageTypes = [\n\tChatMessageType.Regular,\n\tChatMessageType.Giphy,\n\tChatMessageType.Tenor,\n\tChatMessageType.Sticker,\n];\n\nconst ChatMessageItem: React.FC = ({\n\tmessage,\n\twithoutBadge,\n\tfromUser,\n\tuser,\n\tonMouseEnter,\n\tcontacts,\n\tonImageClick,\n\tplugins,\n\tshowActionsByHover,\n\tafterScroll,\n\treply,\n\tattachments,\n\tattachmentsBefore,\n\t...rest\n}) => {\n\tconst ref = useScrollTo(rest.scrollIntoView ? 0 : message.id, !rest.scrollIntoView, afterScroll);\n\tconst { withRemoteId, lastVideoCallId } = rest;\n\tconst context = useChatSettingsProviderContext();\n\n\tconst { state: { onMessageDoubleClick } } = context;\n\n\tconst className = `chat-message-list-component__item ${\n\t\tfromUser ? 'chat-message-list-component__item_you' : ''} ${\n\t\twithoutBadge ? 'chat-message-list-component__item_withoutBadge' : ''} ${\n\t\tmessage.viewed ? '' : 'chat-message-list-component__item_unviewed'} ${\n\t\trest.isEdit ? 'chat-message-list-component__item_edit' : ''\n\t}`;\n\n\tconst {\n\t\tgetUserAvatar = (user) =>
,\n\t\tgetViewerAvatar = (messageViewer) => \n\t\t\t{messageViewer?.user?.avatar\n\t\t\t\t?
\n\t\t\t\t:
{messageViewer?.user?.firstName} }\n\t\t
,\n\t} = rest;\n\n\tconst handleClick = (e) => {\n\t\tconst ignoreNode = [\n\t\t\t'.chat-file-tag',\n\t\t\t'.message-action',\n\t\t\t'.btn-chat-message-reaction',\n\t\t\t'.chat-message-reactions',\n\t\t\t'.chat-message-list-component__viewers',\n\t\t\t'.ant-tooltip',\n\t\t\t'.ant-popover',\n\t\t];\n\n\t\tif (e.detail > 1 && allowMessageTypes.includes(message.chatMessageType)\n\t\t\t&& !ignoreNode.some((node) => e.target?.classList.contains(node) || e.target?.closest(node))) {\n\t\t\tonMessageDoubleClick && onMessageDoubleClick(e, message, reply);\n\t\t}\n\t};\n\n\tconst messageRender = plugins[message.chatMessageType]\n\t\t? plugins[message.chatMessageType]?.message?.render\n\t\t: () => null;\n\n\treturn (message.chatMessageType !== ChatMessageType.Email || withRemoteId)\n\t\t? (\n\t\t\t onMouseEnter(message) : undefined}\n\t\t\t>\n\t\t\t\t{\n\t\t\t\t\tgetViewerAvatar && \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmessage.messageViewers && message.messageViewers\n\t\t\t\t\t\t\t\t.filter((messageViewer) => messageViewer.viewed && message.userId !== messageViewer.userId)\n\t\t\t\t\t\t\t\t.map((messageViewer) =>\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t{getViewerAvatar(messageViewer)}\n\t\t\t\t\t\t\t\t\t
)\n\t\t\t\t\t\t}\n\t\t\t\t\t
\n\t\t\t\t}\n\t\t\t\t{attachmentsBefore?.map((plugin) => (\n\t\t\t\t\tplugins?.[plugin]?.messageAttachmentBefore ? \n\t\t\t\t\t\t{plugins?.[plugin]?.messageAttachmentBefore?.(message)}\n\t\t\t\t\t : null))}\n\t\t\t\t\n\t\t\t\t\t{!withoutBadge && user\n\t\t\t\t\t&& <>\n\t\t\t\t\t\t{getUserAvatar(user)}\n\t\t\t\t\t\t
{getUserName(user)}
\n\t\t\t\t\t>\n\t\t\t\t\t}\n\t\t\t\t\t{!withoutBadge && !user && withRemoteId\n\t\t\t\t\t&&
{user ? getUserName(user) : 'DELETED'}
}\n\t\t\t\t\t
\n\t\t\t\t\t\t{dateFormat(message.time)}\n\t\t\t\t\t\t{' '}\n\t\t\t\t\t\t{dateTimeFormat(message.time)}\n\t\t\t\t\t
\n\t\t\t\t\t{messageRender?.({\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tcontacts,\n\t\t\t\t\t\tonImageClick,\n\t\t\t\t\t\twithRemoteId,\n\t\t\t\t\t\tonMouseEnter,\n\t\t\t\t\t\tlastVideoCallId,\n\t\t\t\t\t})}\n\t\t\t\t\t{attachments?.map((plugin) => (\n\t\t\t\t\t\tplugins?.[plugin]?.messageAttachment ?
\n\t\t\t\t\t\t\t{plugins?.[plugin]?.messageAttachment?.(message)}\n\t\t\t\t\t\t : null))}\n\t\t\t\t
\n\t\t\t\t{\n\t\t\t\t\trest.messageActions?.length\n\t\t\t\t\t\t? (\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{rest.messageActions.map((action) => {\n\t\t\t\t\t\t\t\t\tconst props = {\n\t\t\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\t\t\tedit: rest.edit,\n\t\t\t\t\t\t\t\t\t\tisEdit: rest.isEdit,\n\t\t\t\t\t\t\t\t\t\tremove: rest.remove,\n\t\t\t\t\t\t\t\t\t\tupdate: rest.update,\n\t\t\t\t\t\t\t\t\t\treply,\n\t\t\t\t\t\t\t\t\t\tfromUser,\n\t\t\t\t\t\t\t\t\t\toptions: typeof action === 'function' ? undefined : plugins[action]?.options,\n\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\t\tif (typeof action === 'function') {\n\t\t\t\t\t\t\t\t\t\treturn action(props);\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\treturn {plugins[action]?.chatMessageAction?.(props)} ;\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t) : null\n\t\t\t\t}\n\t\t\t ) : null;\n};\n\nexport const ScrollTo: React.FC<{refreshId: number | string | null, prevent?: boolean}> = ({ refreshId, prevent }) => {\n\tconst ref = useScrollTo(refreshId, prevent);\n\n\treturn
;\n};\n\nconst ChatMessageList: React.FC = (props) => {\n\tconst {\n\t\tuser,\n\t\tchat,\n\t\tloader,\n\t\tactions,\n\t\tonImageClick,\n\t\tgetUserAvatar,\n\t\tcontext: chatSettingsContext,\n\t} = props;\n\tconst {\n\t\tsetEdit, editMessage, replyMessage, setReplyMessage,\n\t} = props;\n\tconst history = useHistory();\n\tconst [scrollToMessageId, setScrollToMessageId] = React.useState(() => {\n\t\tconst params = parseQuery(history.location.search);\n\t\treturn +(params.messageId || 0);\n\t});\n\n\tconst lastScrollData = React.useRef<{top: number, height: number}>({ top: 0, height: 0 });\n\n\tconst [scrollId, setScrollId] = React.useState(null);\n\tconst [error, setError] = React.useState('');\n\tconst [loadingMore, setLoadingMore] = React.useState(false);\n\tconst listRef = React.useRef(null);\n\n\tconst context = useItemsProviderContext();\n\tconst {\n\t\tstate: {\n\t\t\titems,\n\t\t\tpagination,\n\t\t\tloading,\n\t\t\tfilters,\n\t\t},\n\t\tactions: {\n\t\t\tload,\n\t\t\tloadMore,\n\t\t},\n\t} = context;\n\n\tconst {\n\t\tstate: {\n\t\t\trequests,\n\t\t\twithRemoteId,\n\t\t\tchatStoreSettings: { getMessages },\n\t\t\tmessageActions,\n\t\t\terrorHandlers,\n\t\t\tmessagesLoadMoreIndicator,\n\t\t\tplugins,\n\t\t\tstorageName,\n\t\t\tshowActionsByHover,\n\t\t\tavatarSettings,\n\t\t\trequest,\n\t\t},\n\t} = chatSettingsContext;\n\n\tconst messages = useSelector((state: BaseApplicationState) => {\n\t\treturn getMessages(chat.id)(state);\n\t}, shallowEqual);\n\n\tconst reload = (useResult: {use: boolean} = { use: true }) => {\n\t\tsetError('');\n\t\tconst otherChat = chat.contacts.every((contact) => (contact as any).remoteId !== user.id);\n\t\tconst userId = otherChat ? (chat.contacts as any).find((contact) => contact.remoteId && contact.remoteId > 0)?.remoteId : undefined;\n\n\t\tload({ chatId: chat.id, userId: withRemoteId ? userId || 0 : undefined }, false, false, false, true, useResult)\n\t\t\t.then((res) => {\n\t\t\t\tres.list.length > 0 && setScrollId(res.list[0].id);\n\t\t\t})\n\t\t\t.catch((e) => {\n\t\t\t\tsetError(e);\n\t\t\t});\n\t};\n\n\tReact.useEffect(() => {\n\t\thistory.listen((location, action) => {\n\t\t\tconst messageId = +(parseQuery(location.search).messageId || 0);\n\t\t\tif (messageId) {\n\t\t\t\tsetScrollToMessageId(messageId);\n\t\t\t}\n\t\t});\n\t}, []);\n\n\tReact.useEffect(() => {\n\t\tconst useResult = { use: true };\n\t\tif ((filters.chatId !== chat.id || props.initLoad) && !messages) {\n\t\t\treload(useResult);\n\t\t\treturn () => {\n\t\t\t\tuseResult.use = false;\n\t\t\t};\n\t\t}\n\t\titems.length > 0 && setScrollId(items[items.length - 1].id);\n\t\tmessages && setError('');\n\t}, [chat.id]);\n\n\tReact.useEffect(() => {\n\t\tif (items.length > 0 && items[items.length - 1].id) {\n\t\t\tsetScrollId(items[items.length - 1].id);\n\t\t}\n\t}, [items]);\n\n\tconst clickHandler = (e) => {\n\t\tif (e.target && e.target.nodeName === 'A' && e.target.className === 'chat-component__mention' && e.target.dataset.id) {\n\t\t\tconst contact = chat.contacts.find((item) => item.id === +e.target.dataset.id);\n\t\t\tcontact && Object.keys(plugins).forEach((plugin) => plugins[plugin]?.options?.onMentionClick?.(contact));\n\t\t}\n\t};\n\n\tconst setViewed = (message: ChatMessage) => {\n\t\tif (!message.viewLoading) {\n\t\t\tactions.updateMessage({ ...message, viewLoading: true }, storageName);\n\t\t\trequest(requests.chatMessageAccess, {\n\t\t\t\tviewed: true,\n\t\t\t\tmessage: message.id,\n\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tactions.updateMessage({ ...message, viewed: true, viewLoading: false }, storageName);\n\t\t\t\t})\n\t\t\t\t.catch((e) => {\n\t\t\t\t\t(errorHandlers?.onChatMessageAccessError || Message.error)(e);\n\t\t\t\t\tactions.updateMessage({ ...message, viewLoading: false }, storageName);\n\t\t\t\t});\n\t\t}\n\t};\n\n\tconst onScroll = (event) => {\n\t\tif (!event.target.classList.contains('chat-message-list-component')) return;\n\t\tconst scrollTop = (event.target as HTMLUListElement).scrollTop;\n\t\tif (items.length < pagination.total && !loading && scrollTop < 100 && lastScrollData.current.top - scrollTop > 0) {\n\t\t\tconst otherChat = chat.contacts.every((contact: any) => contact.remoteId !== user.id);\n\t\t\tconst userId = otherChat ? (chat.contacts as any).find((contact) => contact.remoteId && contact.remoteId > 0)?.remoteId : undefined;\n\n\t\t\tsetLoadingMore((loading) => {\n\t\t\t\tif (!loading) {\n\t\t\t\t\tloadMore({ chatId: chat.id, userId: withRemoteId ? userId || 0 : undefined }, true, true)\n\t\t\t\t\t\t.then(() => {\n\t\t\t\t\t\t\tif (listRef.current && lastScrollData.current.height > 0) {\n\t\t\t\t\t\t\t\tconst newHeight = listRef.current.scrollHeight;\n\t\t\t\t\t\t\t\tconst lastHeight = lastScrollData.current.height;\n\t\t\t\t\t\t\t\tlet top = newHeight - (lastHeight + lastScrollData.current.top);\n\t\t\t\t\t\t\t\tif (top < 0) {\n\t\t\t\t\t\t\t\t\ttop = 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlistRef.current.scrollTo({ top, left: 0 });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((e) => {\n\t\t\t\t\t\t\t(errorHandlers?.onChatMessagesLoadError || Message.error)(e);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\t\tsetLoadingMore(false);\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t});\n\t\t}\n\n\t\tlastScrollData.current.top = scrollTop;\n\t\tlastScrollData.current.height = listRef.current?.scrollHeight || 0;\n\t};\n\n\tconst self = withRemoteId ? chat.contacts.find((contact) => (contact as any).remoteId === user.id) || user : user;\n\tconst contacts = chat.contacts.filter((contact) => (withRemoteId ? (contact as any).remoteId !== self.id : contact.id !== user.id));\n\tconst lastVideoCallId = React.useMemo(() => {\n\t\treturn items.length > 0 ? [...items]\n\t\t\t.reverse()\n\t\t\t.find((item) => item.chatMessageType === ChatMessageType.VideoChat)?.id : undefined;\n\t}, [items]);\n\n\tconst update = (message, params) => {\n\t\trequests.updateMessage && request(requests.updateMessage, {\n\t\t\tid: message.id,\n\t\t\t...params,\n\t\t})\n\t\t\t.then(() => {\n\t\t\t\tactions.updateMessage({ id: message.id, chatId: message.chatId, ...params }, storageName);\n\t\t\t});\n\t};\n\n\tconst remove = (message) => {\n\t\tif (messages && requests.removeMessage) {\n\t\t\treturn request(requests.removeMessage, {\n\t\t\t\tid: message.id,\n\t\t\t\tdeleted: true,\n\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tactions.removeMessage(request, requests.getChat, storageName, message, message.chatId);\n\t\t\t\t});\n\t\t}\n\t};\n\n\tconst handleRemove = (message) => {\n\t\tif (chatSettingsContext.state.removeMessageConfirmation) {\n\t\t\tdeleteConfirmation(\n\t\t\t\t() => remove(message),\n\t\t\t\t'This message will be permanently deleted and cannot be recovered. Are you sure?',\n\t\t\t);\n\t\t} else {\n\t\t\tremove(message);\n\t\t}\n\t};\n\n\tconst afterScrollToMessage = () => {\n\t\tconst params = parseQuery(history.location.search);\n\t\tif (params.messageId) {\n\t\t\tsetScrollToMessageId(0);\n\t\t\thistory.replace({\n\t\t\t\t...history.location,\n\t\t\t\tsearch: replaceSearchUrl(history.location.search, 'messageId', ''),\n\t\t\t});\n\t\t}\n\t};\n\n\treturn \n\t\t{loadingMore && messagesLoadMoreIndicator ?
\n\t\t\t{messagesLoadMoreIndicator}\n\t\t
: null}\n\t\t{error ? (errorHandlers?.chatMessagesErrorComponent || defaultChatMessagesError)({ reload })\n\t\t\t: <>\n\t\t\t\t{(items && loading) &&
}\n\t\t\t\t
\n\t\t\t\t\t{items?.map((item, index) => {\n\t\t\t\t\t\tconst withoutBadge: boolean = index > 0 && item.userId === items[index - 1].userId;\n\t\t\t\t\t\tconst messageUser = item.userId === self.id\n\t\t\t\t\t\t\t? { ...user, status: item.user?.status } as BaseUserWithAvatar\n\t\t\t\t\t\t\t: getMessageUser(item.userId, contacts);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tsetEdit(message);\n\t\t\t\t\t\t\t\tsetReplyMessage(null);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tattachmentsBefore={chatSettingsContext?.state?.messageAttachmentsBefore}\n\t\t\t\t\t\t\tattachments={chatSettingsContext?.state?.messageAttachments}\n\t\t\t\t\t\t\treply={(message) => {\n\t\t\t\t\t\t\t\tsetEdit(null);\n\t\t\t\t\t\t\t\tsetReplyMessage(message);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tisEdit={item.id === editMessage?.id || item.id === replyMessage?.id}\n\t\t\t\t\t\t\tremove={() => handleRemove(item)}\n\t\t\t\t\t\t\tupdate={(message) => update(item, message)}\n\t\t\t\t\t\t\tplugins={plugins}\n\t\t\t\t\t\t\tscrollIntoView={scrollToMessageId === item.id}\n\t\t\t\t\t\t\tafterScroll={afterScrollToMessage}\n\t\t\t\t\t\t\tshowActionsByHover={showActionsByHover}\n\t\t\t\t\t\t\tgetViewerAvatar={avatarSettings.viewerAvatar}\n\t\t\t\t\t\t/>;\n\t\t\t\t\t})}\n\t\t\t\t\t 0} />\n\t\t\t\t \n\t\t\t>\n\t\t}\n\t
;\n};\n\nconst ChatMessageListWrapper: React.FC> = (props) => {\n\tconst context = useChatSettingsProviderContext();\n\n\tif (!context?.state) throw 'need ChatSettingsContext';\n\n\tconst { state: { requests, storageName, chatStoreSettings: { getMessages } } } = context;\n\n\tconst messages = useSelector(getMessages(props.chat.id), shallowEqual);\n\n\treturn \n\t\titems={messages?.list}\n\t\tsyncItems={messages?.list}\n\t\ttype={requests.chatMessage}\n\t\ttransformFiltersBeforeHandleUrl={(filters) => ({\n\t\t\t...defaultTransformFiltersBeforeHandleUrl(filters),\n\t\t\tpageSize: undefined,\n\t\t})}\n\t\tpagination={{\n\t\t\ttotal: messages?.count, current: 1, pageSize: 20,\n\t\t}}\n\t\tfilters={{ chatId: props.chat.id }}\n\t\tonItemsChange={(items, filters, res) => filters?.chatId && props.actions.setMessages({\n\t\t\tlist: items,\n\t\t\toffset: res?.offset ?? items.length - (filters?.pageSize || 20),\n\t\t\texecution: 0,\n\t\t\tcount: res?.count ?? items.length,\n\t\t}, filters.chatId, storageName)}\n\t>\n\t\t \n\t ;\n};\n\nexport default ChatMessageListWrapper;\n","import * as React from 'react';\nimport { shallowEqual, useDispatch, useSelector } from 'react-redux';\nimport { useHistory } from 'react-router-dom';\n\nimport once from 'lodash/once';\nimport { bindActionCreators } from 'redux';\n\nimport {\n\tChat,\n\tChatFormButtonsComponents,\n\tChatFormButtonsWrappers,\n\tChatMessage,\n\tChatMessageActionsComponent,\n\tChatMessageType,\n\tChatOtherComponents,\n\tChatPlugins,\n\tChatPlugin,\n\tChatListHeaderSettingsType,\n\tChatNameType,\n\tChatMessagesHeaderSettingsType,\n} from '@common/react/components/Chat/Chat';\nimport { getAvatar } from '@common/react/utils/getAvatar';\nimport * as ChatsState from '@common/react/components/Chat/Store/Chats';\nimport { List } from '@common/typescript/objects/List';\n\nimport { BaseParams } from '@common/react/objects/BaseParams';\nimport { BaseUserWithAvatar } from '@common/typescript/objects/BaseUser';\nimport { getUserName } from '@common/react/utils/utils';\nimport { RegularMessagePlugin } from '@common/react/components/Chat/RegularMessagePlugin/RegularMessagePlugin';\nimport { FilePlugin } from '@common/react/components/Chat/FilesPlugin/FilesPlugin';\nimport { handleUrl } from '@common/react/utils/FIltersParamsFromUrl/FiltersParamsFromUrl';\nimport { RequestType } from '@common/react/components/RequestProvider/RequestProvider';\nimport { useApplicationContext } from '@common/react/components/Core/Application/Application';\n\nexport interface ChatSettingsRequests {\n\tchat: string;\n\tchatUser: string;\n\tchatMessage: string;\n\tchatMessageAccess: string;\n\ttyping: string;\n\tloadChats: string;\n\tloadMessages: string;\n\tgetChat: string;\n\tcompleteChat?: string;\n\tremoveMessage?: string;\n\tupdateMessage?: string;\n\tchatEmojiReactionMessage?: string;\n\tgetOrCreatePersonalChat: string;\n}\n\nexport interface ChatSettingsNotificationTypes {\n\tchat: string;\n\tchatUser: string;\n\tchatMessage: string;\n\tchatMessageAccess: string;\n\tchatReaction: string;\n\ttyping: string;\n\tupdateChatCounterNotification: string;\n\tupdateUserMessagesCountNotification: string;\n\taddChatFromArchive?: string;\n}\n\nexport interface ChatSettingsUserSettings {\n\tuseBrowserNotification: boolean;\n\tsound: boolean;\n}\n\nexport interface ChatSettingsAvatarSettings {\n\t// maybe better return components with special interface\n\tgetUserAvatar: (user: any) => React.ReactNode;\n\tgetUserAvatarAtMention?: (user: any) => React.ReactNode;\n\tgetChatAvatar: (chat: any, userId: number) => React.ReactNode;\n\tnotificationAvatar: (state: any) => React.ReactNode;\n\tviewerAvatar?: (state: any) => React.ReactNode;\n}\n\nexport interface ChatSettingsFormSettings {\n\tsendByEnter: boolean;\n\tunderFormLabel: string;\n\tallowPasteImages: boolean;\n\tmaxAttachmentsCount: number;\n\tmaxMessageLength: number;\n\twaveColor?: string;\n}\n\nexport interface ChatSettingsChatPageSettings {\n\tpath: string;\n\tchatIdUrlKey: string;\n\tarchive: string;\n}\n\nexport interface ErrorHandlers {\n\tonChatsLoadError?: (err: string) => void;\n\tonChatMessagesLoadError?: (err: string) => void;\n\tonSaveMessageLoadError?: (err: string) => void;\n\tonChatMessageAccessError?: (err: string) => void;\n\tchatMessagesErrorComponent?: ({ reload }) => React.ReactNode;\n}\n\nexport interface ChatSettingsProviderProps {\n\tchildren: any;\n\tstorageName?: string;\n\trequests?: ChatSettingsRequests;\n\tnotificationTypes?: ChatSettingsNotificationTypes;\n\tuserSettings?: ChatSettingsUserSettings;\n\tavatarSettings?: ChatSettingsAvatarSettings;\n\tformSettings?: ChatSettingsFormSettings;\n\tformButtons?: Array;\n\tformTags?: Array;\n\theaderButtons?: Array;\n\tmessageTypes?: Array;\n\totherComponents?: Array;\n\tpageSettings?: ChatSettingsChatPageSettings;\n\tchatFormButtonsWrappers?: ChatFormButtonsWrappers;\n\tchatStoreSettings?: ChatStoreSettings;\n\ttitle?: string;\n\twithRemoteId?: boolean;\n\tchatsFilters?: BaseParams;\n\tchatListHeaderSettings?: ChatListHeaderSettingsType;\n\trenderChatName?: ChatNameType;\n\tmessagesHeaderComponents?: ChatMessagesHeaderSettingsType;\n\tnotificationHideDelay?: number;\n\tmaxChatMessageNotificationCount?: number;\n\tmessageActions?: Array;\n\tremoveMessageConfirmation?: boolean;\n\terrorHandlers?: ErrorHandlers;\n\temptyChatListMessage?: React.ReactNode | (({ filters, load }) => React.ReactNode);\n\tbasePath?: string;\n\tmessagesLoadMoreIndicator?: React.ReactNode;\n\tplugins?: PluginsDictionary;\n\tlistComponent?: Array;\n\tmessageControl?: ChatPlugins;\n\tmessageControlWrappers?: Array;\n\tshowActionsByHover?: boolean;\n\tshowMessagesButtonInVideoModal?: boolean;\n\topenModalFromNotification?: boolean;\n\topenInModal?: boolean;\n\tonMessageDoubleClick?: (e: React.MouseEvent, message: ChatMessage, reply: (message) => void) => void;\n\tmessageAttachments?: Array;\n\tmessageAttachmentsBefore?: Array;\n\tsendButtonWrapper?: ChatPlugins;\n\tgetUser?: () => BaseUserWithAvatar;\n\trequest?: RequestType;\n}\n\nexport type PluginsDictionary = {\n\t[key in ChatPlugins]?: ChatPlugin;\n};\n\nexport interface ChatSettingsProviderContextState {\n\trequests: ChatSettingsRequests;\n\tplugins: PluginsDictionary;\n\tstorageName: string;\n\tnotificationTypes: ChatSettingsNotificationTypes;\n\tformSettings: ChatSettingsFormSettings;\n\tformButtons: Array;\n\totherComponents: Array;\n\tchatFormButtonsWrappers: ChatFormButtonsWrappers;\n\tpageSettings: ChatSettingsChatPageSettings;\n\tchatStoreSettings: ChatStoreSettings;\n\ttitle: string;\n\tavatarSettings: ChatSettingsAvatarSettings;\n\tformTags: Array;\n\twithRemoteId: boolean;\n\tchatListHeaderSettings: ChatListHeaderSettingsType;\n\tmessagesHeaderComponents: ChatMessagesHeaderSettingsType;\n\tnotificationHideDelay: number;\n\tmaxChatMessageNotificationCount: number;\n\tgetUser: () => BaseUserWithAvatar;\n\trequest: RequestType;\n\tmessageActions?: Array;\n\tchatsFilters?: BaseParams;\n\trenderChatName?: ChatNameType;\n\tremoveMessageConfirmation?: boolean;\n\terrorHandlers?: ErrorHandlers;\n\temptyChatListMessage?: React.ReactNode | (({ filters, load }) => React.ReactNode);\n\tbasePath?: string;\n\tmessagesLoadMoreIndicator?: React.ReactNode;\n\tlistComponent?: Array;\n\tmessageControl?: ChatPlugins;\n\tmessageControlWrappers?: Array;\n\tshowActionsByHover?: boolean;\n\tshowMessagesButtonInVideoModal?: boolean;\n\tmodalMode?: boolean;\n\topenModalFromNotification?: boolean;\n\tonMessageDoubleClick?: (e: React.MouseEvent, message: ChatMessage, reply: (message) => void) => void;\n\topenInModal?: boolean;\n\tmessageAttachments?: Array;\n\tmessageAttachmentsBefore?: Array;\n\tsendButtonWrapper?: ChatPlugins;\n\treloadChatId?: number;\n}\n\nexport interface ChatSettingsProviderContextActions {\n\tsetChatsFilters: (filters: BaseParams) => void;\n\tsetModalMode: (modalMode: boolean | ((value) => boolean)) => void;\n\tstartChat: (data, requestName?: string, openChat?: boolean) => Promise;\n\tsetReloadChatId: (id: number | undefined | ((value) => any)) => void;\n}\n\nexport interface ChatSettingsProviderContext {\n\tstate: ChatSettingsProviderContextState;\n\tactions: ChatSettingsProviderContextActions;\n}\n\nexport interface ChatStoreSettings {\n\tgetActionCreators?: any;\n\tgetChatStore: (store) => ({chats: List, chatsLoaded: boolean});\n\tgetMessages: (chatId) => (state) => (List | undefined);\n\tgetCurrentChat: (state) => Chat | null;\n\tuserUnviewedMessagesCountName: string;\n}\n\nexport const getUserPick = (chat, userId): JSX.Element => {\n\tconst users = chat.contacts.filter((user: BaseUserWithAvatar) => user.id !== userId);\n\tif (users.length === 1) {\n\t\treturn
;\n\t}\n\n\treturn \n\t\t{users.slice(0, 4).map((user: BaseUserWithAvatar) =>\n\t\t\t
)}\n\t
;\n};\n\nexport const createChatSettingsProviderContext = once(() => React.createContext({} as ChatSettingsProviderContext));\n\nexport const useChatSettingsProviderContext: () => ChatSettingsProviderContext = () =>\n\tReact.useContext(createChatSettingsProviderContext());\n\nexport const chatRequests = {\n\tchat: 'chat',\n\tchatUser: 'chatUser',\n\tchatMessage: 'chatMessage',\n\tchatMessageAccess: 'chatMessageAccess',\n\ttyping: 'typing',\n\tcompleteChat: 'chatArchive',\n\tremoveMessage: 'deleteChatMessage',\n\tupdateMessage: 'changeChatMessage',\n\tchatEmojiReactionMessage: 'chatEmojiReactionSave',\n\tloadChats: 'chatList',\n\tloadMessages: 'chatMessageList',\n\tgetChat: 'getChat',\n\tgetOrCreatePersonalChat: 'getOrCreatePersonalChat',\n};\n\nexport const ChatSettingsProvider: (p: ChatSettingsProviderProps) => React.ReactElement = (props) => {\n\tconst {\n\t\trequest: defaultRequest,\n\t\tgetUser: defaultGetUser,\n\t} = useApplicationContext();\n\tconst {\n\t\tchildren,\n\t\tstorageName = 'chats',\n\t\trequests = chatRequests,\n\t\tnotificationTypes = {\n\t\t\tchat: 'Chat',\n\t\t\tchatUser: 'ChatUser',\n\t\t\tchatMessage: 'ChatMessage',\n\t\t\tchatReaction: 'ChatEmojiReaction',\n\t\t\tchatMessageAccess: 'ChatMessageAccess',\n\t\t\ttyping: 'Typing',\n\t\t\tupdateChatCounterNotification: 'UpdateChatCounterNotification',\n\t\t\tupdateUserMessagesCountNotification: 'UpdateUserMessagesCountNotification',\n\t\t\taddChatFromArchive: 'AddChatFromArchive',\n\t\t},\n\t\tformSettings = {\n\t\t\tsendByEnter: false,\n\t\t\tunderFormLabel: '',\n\t\t\tallowPasteImages: false,\n\t\t\tmaxAttachmentsCount: 5,\n\t\t\tmaxMessageLength: 500,\n\t\t},\n\t\tformButtons = [],\n\t\tpageSettings = {\n\t\t\tpath: '/chats',\n\t\t\tchatIdUrlKey: 'chatId',\n\t\t\tarchive: 'archive',\n\t\t},\n\t\tchatFormButtonsWrappers = {},\n\t\totherComponents = [],\n\t\tmessageActions = [],\n\t\tavatarSettings = {\n\t\t\tgetUserAvatar: (user) =>
,\n\t\t\tgetUserAvatarAtMention: (user) =>
,\n\t\t\tgetChatAvatar: getUserPick,\n\t\t\tnotificationAvatar: (state) => ,\n\t\t},\n\t\tchatStoreSettings = {\n\t\t\tgetChatStore: (state) => ({ chats: state.chats.chats, chatsLoaded: state.chats.chatsLoaded }),\n\t\t\tgetMessages: (chatId) => (state) => state.chats.messages[chatId] || undefined,\n\t\t\tgetCurrentChat: (state) => state.chats.currentChat,\n\t\t\tuserUnviewedMessagesCountName: 'unviewedMessagesCount',\n\t\t} as ChatStoreSettings,\n\t\ttitle = 'Chats',\n\t\tformTags = [],\n\t\trenderChatName = undefined,\n\t\tmessagesHeaderComponents = [],\n\t\twithRemoteId = false,\n\t\tchatsFilters: chatsFiltersProps = {},\n\t\tchatListHeaderSettings = [],\n\t\tnotificationHideDelay = 5000,\n\t\tmaxChatMessageNotificationCount = 5,\n\t\tremoveMessageConfirmation = true,\n\t\terrorHandlers,\n\t\temptyChatListMessage = 'There are no chats',\n\t\tbasePath,\n\t\tmessagesLoadMoreIndicator,\n\t\tplugins = {\n\t\t\t[ChatPlugins.Files]: FilePlugin,\n\t\t} as any,\n\t\tlistComponent = [],\n\t\tmessageControlWrappers = [],\n\t\tmessageControl,\n\t\tshowActionsByHover = true,\n\t\tshowMessagesButtonInVideoModal,\n\t\topenInModal,\n\t\topenModalFromNotification = openInModal,\n\t\tmessageAttachments,\n\t\tmessageAttachmentsBefore,\n\t\tsendButtonWrapper,\n\t\tonMessageDoubleClick,\n\t\trequest = defaultRequest,\n\t\tgetUser = defaultGetUser,\n\t} = props;\n\tconst user = getUser();\n\tconst ChatSettingsProviderContext = createChatSettingsProviderContext();\n\tconst history = useHistory();\n\tconst dispatch = useDispatch();\n\tconst actions = React.useMemo(() => bindActionCreators(\n\t\t(chatStoreSettings.getActionCreators || ChatsState.getActionCreators)(),\n\t\tdispatch,\n\t), []);\n\tconst [modalMode, setModalMode] = React.useState(false);\n\tconst [chatsFilters, setChatsFilters] = React.useState(chatsFiltersProps);\n\tconst { chatsLoaded } = useSelector(chatStoreSettings.getChatStore, shallowEqual);\n\tconst [reloadChatId, setReloadChatId] = React.useState();\n\n\tconst startChat = (data, requestName: string = requests?.getOrCreatePersonalChat, openChat: boolean = true) => {\n\t\treturn request(requestName, data)\n\t\t\t.then((result) => {\n\t\t\t\tif (chatsLoaded) {\n\t\t\t\t\tactions.addChat(result, storageName);\n\t\t\t\t\tactions.selectChat(result, storageName);\n\t\t\t\t}\n\t\t\t\t(openInModal || !openChat) && handleUrl(\n\t\t\t\t\t{ chatId: result.id },\n\t\t\t\t\thistory.location,\n\t\t\t\t\thistory,\n\t\t\t\t\tundefined,\n\t\t\t\t\t'',\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tif (openChat) {\n\t\t\t\t\tif (openInModal) {\n\t\t\t\t\t\tsetModalMode((prev) => true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\thistory.push({\n\t\t\t\t\t\t\tpathname: pageSettings.path,\n\t\t\t\t\t\t\tsearch: `?${pageSettings.chatIdUrlKey}=${result.id}`,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\thandleUrl(\n\t\t\t\t\t{ chatId: result.id },\n\t\t\t\t\thistory.location,\n\t\t\t\t\thistory,\n\t\t\t\t\tundefined,\n\t\t\t\t\t'',\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t});\n\t};\n\n\tconst value: {state: ChatSettingsProviderContextState, actions: ChatSettingsProviderContextActions} = React.useMemo(() => ({\n\t\tstate: {\n\t\t\trequests,\n\t\t\tstorageName,\n\t\t\tnotificationTypes,\n\t\t\tformSettings,\n\t\t\tformButtons,\n\t\t\tchatFormButtonsWrappers,\n\t\t\totherComponents,\n\t\t\tpageSettings,\n\t\t\tavatarSettings,\n\t\t\tchatStoreSettings: { getActionCreators: ChatsState.getActionCreators, ...chatStoreSettings },\n\t\t\ttitle,\n\t\t\tformTags,\n\t\t\trenderChatName,\n\t\t\twithRemoteId,\n\t\t\tchatsFilters,\n\t\t\tchatListHeaderSettings,\n\t\t\tmessagesHeaderComponents,\n\t\t\tnotificationHideDelay,\n\t\t\tmaxChatMessageNotificationCount,\n\t\t\tmessageActions,\n\t\t\tremoveMessageConfirmation,\n\t\t\terrorHandlers,\n\t\t\temptyChatListMessage,\n\t\t\tbasePath,\n\t\t\tmessagesLoadMoreIndicator,\n\t\t\tplugins: {\n\t\t\t\t...plugins,\n\t\t\t\t[ChatPlugins.Regular]: RegularMessagePlugin,\n\t\t\t},\n\t\t\tlistComponent,\n\t\t\tmessageControl,\n\t\t\tmessageControlWrappers,\n\t\t\tshowActionsByHover,\n\t\t\tshowMessagesButtonInVideoModal,\n\t\t\tmodalMode,\n\t\t\topenModalFromNotification,\n\t\t\topenInModal,\n\t\t\tmessageAttachments,\n\t\t\tmessageAttachmentsBefore,\n\t\t\tsendButtonWrapper,\n\t\t\tonMessageDoubleClick,\n\t\t\treloadChatId,\n\t\t\tgetUser,\n\t\t\trequest,\n\t\t},\n\t\tactions: {\n\t\t\tsetChatsFilters,\n\t\t\tsetModalMode,\n\t\t\tstartChat,\n\t\t\tsetReloadChatId,\n\t\t},\n\t}), [modalMode, actions, chatsLoaded, chatsFilters, reloadChatId, user]);\n\n\treturn (\n\t\t\n\t\t\t{children}\n\t\t \n\t);\n};\n","import { Chat, ChatKind } from '@common/react/components/Chat/Chat';\nimport { getUserName } from '@common/react/utils/utils';\n\nimport { BaseUserWithAvatar } from '@common/react/objects/BaseUser';\nimport { linkRegex, regularLink } from '@common/react/components/UI/LinkPreview/LinkPreview';\n\nexport const getChatName = (chat: Chat, userId: number) => {\n\tconst contacts = chat.contacts.filter((user: BaseUserWithAvatar) => user.id !== userId);\n\n\treturn chat.kind === ChatKind.Personal\n\t\t? contacts.length === 1 ? getUserName(contacts[0]) : chat.name\n\t\t: chat.name\n\t\t\t? chat.name\n\t\t\t: contacts.map((contact: BaseUserWithAvatar, index) => (index > 0 ? ', ' : '') + getUserName(contact));\n};\n\nexport const transformMentionMessage = (text: string, contacts: Array, withLink: boolean) => {\n\treturn contacts.reduce((newText, contact) => {\n\t\tconst name = getUserName(contact);\n\t\tconst regx = new RegExp(`@${name}`, 'g');\n\n\t\treturn newText.replace(\n\t\t\tregx,\n\t\t\twithLink ? `${getUserName(contact)} ` : getUserName(contact),\n\t\t);\n\t}, text);\n};\n\nconst linkReplacer = (text: string, ...rest) => {\n\treturn typeof rest?.[7] === 'string' && rest[7].includes('emoji-icon') ? text : regularLink(text);\n};\n\nexport const transformLinks = (text: string) => {\n\tconst regex = new RegExp(linkRegex);\n\treturn text.replace(regex, linkReplacer);\n};\n","import * as React from 'react';\n\nimport { Chat } from '@common/react/components/Chat/Chat';\n\nimport { getChatName } from '@common/react/components/Chat/ChatUtils';\nimport {\n\tuseChatSettingsProviderContext,\n\tgetUserPick,\n} from '@common/react/components/Chat/ChatSettingsProvider';\n\ninterface ChatItemProps {\n\tchat: Chat;\n\tuserId: number;\n\tselectedChatId: number | null;\n\tonSelect: (chat: Chat) => void;\n\tgetUser?: (chat, userId) => React.ReactNode;\n}\n\nexport const ChatItem: React.FC = ({\n\tchat, userId, selectedChatId, onSelect, getUser = getUserPick,\n}) => {\n\tconst lastMessage = chat.lastMessage;\n\n\tconst context = useChatSettingsProviderContext();\n\n\tif (!context?.state) throw 'need ChatSettingsContext';\n\n\tconst { state: { plugins, listComponent } } = context;\n\tconst name = getChatName(chat, userId);\n\n\treturn onSelect(chat)}>\n\t\t{getUser(chat, userId)}\n\t\t 0 ? 'chat-list__item-content__padding' : ''}`}>\n\t\t\t
\n\t\t\t\t{name}\n\t\t\t
\n\t\t\t
\n\t\t\t\t{\n\t\t\t\t\tlastMessage ? plugins[lastMessage.chatMessageType]?.message?.lastMessage?.({\n\t\t\t\t\t\tmessage: lastMessage,\n\t\t\t\t\t\tchat,\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t}) : null\n\t\t\t\t}\n\t\t\t \n\t\t\t{listComponent?.map((plugin) =>
\n\t\t\t\t{plugins[plugin]?.listComponent?.({ chat })}\n\t\t\t )}\n\t\t\t{chat.unviewedMessagesCount > 0 &&
{chat.unviewedMessagesCount}
}\n\t\t
\n\t ;\n};\n","import React from 'react';\n\nconst useServerEffect = (callback) => {\n\tReact.useMemo(() => {\n\t\tif (typeof window === 'undefined') {\n\t\t\tcallback();\n\t\t}\n\t}, []);\n};\n\nexport default useServerEffect;\n","import * as React from 'react';\n\nimport { bindActionCreators } from 'redux';\nimport { shallowEqual, useDispatch, useSelector } from 'react-redux';\nimport { useHistory } from 'react-router-dom';\n\nimport Message from 'antd/lib/message';\n\nimport { ChatsActionCreators, ApplicationStateWithChats } from '@common/react/components/Chat/Store/Chats';\nimport { BaseUserWithAvatar } from '@common/react/objects/BaseUser';\nimport { List } from '@common/typescript/objects/List';\nimport ChatMessageList from '@common/react/components/Chat/ChatMessageList';\nimport ChatMessageForm from '@common/react/components/Chat/ChatMessageForm';\nimport { ChatItem } from '@common/react/components/Chat/ChatListItem';\nimport { deleteConfirmation } from '@common/react/components/Modal/Modal';\nimport { Chat, ChatMessage } from '@common/react/components/Chat/Chat';\nimport { BaseApplicationState } from '@common/react/store';\nimport { parseQuery } from '@common/typescript/utils/url';\nimport { ItemsProvider, useItemsProviderContext } from '@common/react/components/Core/ItemsProvider/ItemsProvider';\nimport '@common/react/scss/components/chats.scss';\nimport {\n\tChatSettingsProviderContext,\n\tuseChatSettingsProviderContext,\n} from '@common/react/components/Chat/ChatSettingsProvider';\n\nimport useServerEffect from '@common/react/hooks/useServerEffect';\nimport Button from '@common/react/components/Forms/Button';\nimport { File as FileInterface } from '@common/typescript/objects/FileInterface';\nimport Loader from '@common/react/components/Core/LoadingProvider/Loader';\n\ninterface OwnProps {\n\tactions: Actions;\n\tinitLoad: boolean;\n\tpreventRedirectToChat?: boolean;\n\tcontext: ChatSettingsProviderContext;\n}\n\ntype Actions = ChatsActionCreators>;\n\nexport const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'heic', 'heif'];\n\nconst Chats: React.FC = (props) => {\n\tconst { actions, context: chatSettingsContext, preventRedirectToChat } = props;\n\tconst history = useHistory();\n\tconst {\n\t\tstate: {\n\t\t\trequests,\n\t\t\tpageSettings,\n\t\t\tchatStoreSettings,\n\t\t\tchatListHeaderSettings,\n\t\t\totherComponents,\n\t\t\temptyChatListMessage,\n\t\t\tbasePath,\n\t\t\tplugins,\n\t\t\tstorageName,\n\t\t\tgetUser,\n\t\t\trequest,\n\t\t},\n\t\tactions: { setChatsFilters },\n\t} = chatSettingsContext;\n\tconst {\n\t\tstate: {\n\t\t\tavatarSettings, messagesHeaderComponents, renderChatName, withRemoteId, modalMode, openInModal, reloadChatId,\n\t\t},\n\t\tactions: {\n\t\t\tsetReloadChatId,\n\t\t},\n\t} = chatSettingsContext;\n\tconst user = getUser();\n\n\tconst { currentChat } = useSelector((state: BaseApplicationState) => ({\n\t\tcurrentChat: chatStoreSettings.getCurrentChat(state),\n\t}), shallowEqual);\n\tconst messages = useSelector(chatStoreSettings.getMessages(currentChat?.id), shallowEqual);\n\n\tconst context = useItemsProviderContext();\n\tconst {\n\t\tstate: {\n\t\t\titems, loading, pagination, filters,\n\t\t}, actions: { load, handleChange, loadMore },\n\t} = context;\n\n\tconst patientId = React.useRef(null);\n\tconst [state, setState] = React.useState({ completeChatLoading: false });\n\tconst [editMessage, setEdit] = React.useState(null);\n\tconst [replyMessage, setReplyMessage] = React.useState(null);\n\n\tconst [img, setImg] = React.useState();\n\tconst images = React.useMemo(() => {\n\t\tconst files: Array = [];\n\t\t[...(messages?.list || [])].reverse().forEach((message) => {\n\t\t\t[...message.files].reverse().forEach((f) => (imageExtensions.includes(f.file.extension?.toLowerCase()) ? files.push(f) : ''));\n\t\t});\n\t\treturn files;\n\t}, [messages]);\n\tconst imageIndex = React.useMemo(() => {\n\t\tconst index = images.findIndex((image) => image.file.id === img?.file.id);\n\t\treturn index < 0 ? null : index;\n\t}, [images, img]);\n\n\tconst emptyMessage = React.useMemo(() => {\n\t\treturn typeof emptyChatListMessage === 'function' ? emptyChatListMessage({ filters, load }) : emptyChatListMessage;\n\t}, [filters, emptyChatListMessage, load]);\n\n\tconst chatsListHandleChange = (e) => {\n\t\tsetTimeout(() => {\n\t\t\tif (e?.currentTarget) {\n\t\t\t\tsetChatsFilters({ [e?.currentTarget.name]: e?.currentTarget.value });\n\t\t\t} else {\n\t\t\t\tsetChatsFilters(e);\n\t\t\t}\n\t\t}, 0);\n\t\treturn handleChange(e);\n\t};\n\n\tconst selectChat = (chat: Chat | null) => {\n\t\tconst search = parseQuery(history.location.search);\n\t\tconst archive = search[pageSettings.archive] || false;\n\n\t\tif (!(modalMode || openInModal || preventRedirectToChat) || pageSettings.path === history.location.pathname) {\n\t\t\tif (chat) {\n\t\t\t\thistory.replace({\n\t\t\t\t\tpathname: pageSettings.path,\n\t\t\t\t\tsearch: `?${pageSettings.chatIdUrlKey}=${chat.id}&${pageSettings.archive}=${archive}`,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\thistory.replace({\n\t\t\t\t\tpathname: pageSettings.path,\n\t\t\t\t\tsearch: '',\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tsetReplyMessage(null);\n\t\tactions.selectChat(chat, storageName);\n\t};\n\n\tconst leaveChat = () => {\n\t\tdeleteConfirmation(() => {\n\t\t\tif (currentChat && user) {\n\t\t\t\trequest(requests.chatUser, {\n\t\t\t\t\tchatId: currentChat.id,\n\t\t\t\t\tuserId: user.id,\n\t\t\t\t\tdeleted: true,\n\t\t\t\t})\n\t\t\t\t\t.then(() => {\n\t\t\t\t\t\thandleChange()\n\t\t\t\t\t\t\t.then((res) => {\n\t\t\t\t\t\t\t\tconst chat = res?.list.filter((chat) => chat.id !== currentChat?.id)?.[0];\n\t\t\t\t\t\t\t\tselectChat(chat || null);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t}\n\t\t});\n\t};\n\n\tconst completeChat = (chat: Chat) => {\n\t\tsetState((prevState) => ({\n\t\t\t...prevState,\n\t\t\tcompleteChatLoading: true,\n\t\t}));\n\t\tif (!requests.completeChat) return;\n\n\t\treturn request(requests.completeChat, {\n\t\t\tid: chat.id,\n\t\t\tarchive: !chat.archive,\n\t\t})\n\t\t\t.then((res) => {\n\t\t\t\thandleChange();\n\t\t\t})\n\t\t\t.catch((e) => {\n\t\t\t\tMessage.error(e);\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tsetState((prevState) => ({\n\t\t\t\t\t...prevState,\n\t\t\t\t\tcompleteChatLoading: false,\n\t\t\t\t}));\n\t\t\t});\n\t};\n\n\tuseServerEffect(() => {\n\t\tconst search = parseQuery(history.location.search);\n\t\tconst chatId = +search[pageSettings.chatIdUrlKey] || null;\n\t\tconst archive = search[pageSettings.archive] === 'true';\n\n\t\tactions.loadChats(request, requests.loadChats, storageName, (data: List) => {\n\t\t\tif (data.list.length > 0) {\n\t\t\t\tif (chatId && chatId > 0) {\n\t\t\t\t\tactions.selectChat(data.list.find((chat) => chat.id === chatId), storageName);\n\t\t\t\t\tactions.loadMessages(request, requests.loadMessages, storageName, chatId, false);\n\t\t\t\t} else {\n\t\t\t\t\tactions.selectChat(data.list[0], storageName);\n\t\t\t\t\tdata.list[0] && actions.loadMessages(request, requests.loadMessages, storageName, data.list[0]?.id, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}, { ...filters, archive, chatId });\n\t});\n\n\tconst onLoad = (chatId, data) => {\n\t\tif (data.list.length > 0) {\n\t\t\tif (chatId && chatId > 0 && data.list[0].id === chatId) {\n\t\t\t\tactions.selectChat(data.list.find((chat) => chat.id === chatId), storageName);\n\t\t\t\tsetChatsFilters({ archive: data.list[0].archive });\n\t\t\t} else {\n\t\t\t\tactions.selectChat(data.list[0], storageName);\n\t\t\t}\n\n\t\t\tif (!(modalMode || openInModal || preventRedirectToChat) || pageSettings.path === history.location.pathname) {\n\t\t\t\thistory.replace({\n\t\t\t\t\tpathname: pageSettings.path,\n\t\t\t\t\tsearch: `?${pageSettings.chatIdUrlKey}=${data.list[0].id}&${pageSettings.archive}=${data.list[0].archive}`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\n\tReact.useEffect(() => {\n\t\tif (props.initLoad) {\n\t\t\tconst search = parseQuery(history.location.search);\n\t\t\tconst chatId = reloadChatId || +search[pageSettings.chatIdUrlKey] || null;\n\t\t\tconst archive = search[pageSettings.archive] === 'true';\n\n\t\t\tload({ chatId, archive }).then((data: List) => {\n\t\t\t\tonLoad(chatId, data);\n\t\t\t});\n\t\t}\n\t}, []);\n\n\tReact.useEffect(() => {\n\t\tif (reloadChatId && !props.initLoad) {\n\t\t\tconst search = parseQuery(history.location.search);\n\t\t\tconst chatId = reloadChatId;\n\t\t\tconst archive = search[pageSettings.archive] === 'true';\n\n\t\t\tload({ chatId, archive }).then((data: List