{"version":3,"sources":["routes.js","@hooks/firebaseDashcam.js","@components/firebase/index.js","App.js","serviceWorker.js","index.js","@redux/store.js","@redux/companies.js","@redux/notification.js","@redux/realityMesh.js","@redux/assets.js","@redux/pointCloud.js","@redux/documentCategories.js","@redux/inspection.js","@redux/annotationTypes.js","@redux/dashcams.js","@redux/firebase.js","@redux/reducers.js","@configs/firebaseConfig.js","@redux/selectors/auth.js","@configs/endpoints.js","@helpers/authUtils.js","@redux/auth.js","@redux/action/auth.js","@helpers/api.js","@redux/annotation.js","@redux/reports.js","@redux/activityLogs.js","@redux/statistics.js","@redux/archive.js","@redux/general.js"],"names":["Home","React","lazy","Analytics","Settings","Report","NotFound","Login","SignUp","Logout","AiTraining","DashcamMonitoringV2","BindedDashcam","NewBindedDashcam","GenerateQrCode","personalization","userManagement","AssetList","PrivateRouteWithRedux","connect","state","user","auth","isAuthenticated","Component","component","roles","rest","companies","useSelector","s","useEffect","db","ref","on","snapshot","data","val","Object","keys","length","cleanData","forEach","k","camera_id","push","dispatch","type","console","log","off","isLoading","apiGetProfile","render","props","indexOf","role","to","pathname","from","location","routes","path","name","exact","route","Route","noTopBar","loading","NonAuthLayout","Loadable","loader","loaded","default","AuthLayout","withLayout","WrappedComponent","HOC","this","Layout","map","index","key","fallback","Boolean","window","hostname","match","removeConsole","warn","error","Sentry","dsn","ReactDOM","store","configureStore","placement","document","getElementById","navigator","serviceWorker","ready","then","registration","unregister","API_GET_COMPANIES","API_GET_COMPANIES_FAIL","API_GET_COMPANIES_SUCCESS","initialState","CREATE_NOTIFICATION","CREATE_NOTIFICATION_SUCCESS","GET_NOTIFICATION_FAIL","GET_NOTIFICATION_SUCCESS","CLEAR_REALITY_MESHES","API_GET_REALITY_MESHES","API_GET_REALITY_MESHES_FAIL","API_GET_REALITY_MESHES_SUCCESS","GET_ASSET_SUMMARY","GET_ASSET_SUMMARY_SUCCESS","GET_ASSET_SUMMARY_FAIL","NEW_ASSETS_LIST","CLEAR_POINT_CLOUDS","API_GET_POINT_CLOUDS","API_GET_POINT_CLOUDS_FAIL","API_GET_POINT_CLOUDS_SUCCESS","UPDATE_VALUE","value","label","CREATE_INSPECTION","CREATE_INSPECTION_FAIL","CREATE_INSPECTION_SUCCESS","GET_INSPECTION_SUCCESS","combineReducers","action","notification","annotation","archive","realityMesh","assets","newData","d","item","id","summary","activityLogs","reports","statistics","pointCloud","documentCategories","inspection","annotationTypes","NAMESPACE","dashcams","general","firebase","composeEnhancers","__REDUX_DEVTOOLS_EXTENSION_COMPOSE__","compose","appliedMiddleware","applyMiddleware","thunk","createStore","reducers","getStore","getState","initializeApp","apiKey","authDomain","databaseURL","projectId","storageBucket","messagingSenderId","appId","measurementId","database","createSelector","URL","process","CLIENT_SECRET","CLIENT_ID","endpoints","getToken","registerAccount","getProfile","getNotification","updateAnnotation","getAnnotation","getAssetSummary","getRemoteConfig","updateRemoteConfig","getStatistics","getPointCloudsForAsset","assetId","getRealityMeshesForAsset","createInspection","createReport","deleteReport","deleteAnnotation","createArchiveRequest","uploadInspectionMedia","inspectionId","getInspection","getReports","getActivityLogs","updateInspectionMedia","mediaId","getUsers","addUser","updateUser","user_id","updateUserAccessDetections","restoreAnnotation","deleteAnnotationAction","annotationId","actionId","getDashcam","addNewBindedDashcam","unbindDashcam","getOrder","updateCompany","getLoggedInUser","Cookies","get","JSON","parse","loginUser","username","password","history","redirect_url","Api","endpoint","client_id","client_secret","grant_type","onSuccess","response","token","payload","set","stringify","image","access_token","access_annotations_type_list","email","onFail","status","logoutUser","remove","INIT_STATE","passwordResetStatus","p","params","detection_types","latitude","parseFloat","longitude","company_id","sort","i","user_from_cookie","refresh_token","err","url","hasFile","xhr","XMLHttpRequest","isGet","toLowerCase","urlParams","entries","e","join","open","requestHeaders","Accept","header","setRequestHeader","onload","target","responseText","onerror","formData","FormData","append","send","UPDATE_DETECTION","UPDATE_DETECTION_SUCCESS","UPDATE_DETECTION_FAIL","DELETE_ANNOTATION","DELETE_ANNOTATION_SUCCESS","DELETE_ANNOTATION_FAIL","RESTORE_ANNOTATION","RESTORE_ANNOTATION_SUCCESS","RESTORE_ANNOTATION_FAIL","GET_ANNOTATION","GET_ANNOTATION_FAIL","GET_ANNOTATION_SUCCESS","RELOAD_ANNOTATION","RELOAD_ANNOTATION_FAIL","RELOAD_ANNOTATION_SUCCESS","apiUpdateDetections","isAppendExistingData","reloadAnnotation","filters","detectionData","detection","is_false_detection","filter","f","_","uniqBy","page","combinedData","mergeArraysOfObjectsUniqueById","a","b","parseInt","initialData","GET_REPORTS","GET_REPORTS_FAIL","GET_REPORTS_SUCCESS","CREATE_REPORT","CREATE_REPORT_FAIL","CREATE_REPORT_SUCCESS","DELETE_REPORT","DELETE_REPORT_FAIL","DELETE_REPORT_SUCCESS","asset_id","r","alert","current_page","asset_ids","GET_ACTIVITY_LOGS","GET_ACTIVITY_LOGS_FAIL","GET_ACTIVITY_LOGS_SUCCESS","isNext","next_page_url","oldIds","newLogs","includes","GET_STATISTICS","GET_STATISTICS_FAIL","GET_STATISTICS_SUCCESS","CREATE_ARCHIVE","CREATE_ARCHIVE_FAIL","CREATE_ARCHIVE_SUCCESS","createArchive","TOGGLE_DEV","toggleDev","flag","isDev"],"mappings":"+XASMA,EAAOC,IAAMC,MAAK,kBAAM,8EACxBC,EAAYF,IAAMC,MAAK,kBAAM,8EAC7BE,EAAWH,IAAMC,MAAK,kBAAM,wEAC5BG,EAASJ,IAAMC,MAAK,kBAAM,8EAC1BI,EAAWL,IAAMC,MAAK,kBAAM,mCAC5BK,EAAQN,IAAMC,MAAK,kBAAM,8EACzBM,EAASP,IAAMC,MAAK,kBAAM,8EAC1BO,EAASR,IAAMC,MAAK,kBAAM,mCAC1BQ,EAAaT,IAAMC,MAAK,kBAAM,gEAC9BS,EAAsBV,IAAMC,MAAK,kBAAM,8EACvCU,EAAgBX,IAAMC,MAAK,kBAAM,8EACjCW,EAAmBZ,IAAMC,MAAK,kBAAM,8EACpCY,EAAiBb,IAAMC,MAAK,kBAAM,iEAClCa,E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react\";\nimport { Redirect, Route } from \"react-router-dom\";\nimport { connect } from \"react-redux\";\nimport { isAuthenticated } from \"@redux/selectors/auth\";\nimport { apiGetProfile } from \"@redux/action/auth\";\nimport { useSelector } from \"react-redux\";\nimport useFirebaseDashcamHook from '@hooks/firebaseDashcam';\n\n// lazy load all the views\nconst Home = React.lazy(() => import(\"./pages/home/\"));\nconst Analytics = React.lazy(() => import(\"./pages/analyticsV2/\"));\nconst Settings = React.lazy(() => import(\"./pages/settings/\"));\nconst Report = React.lazy(() => import(\"./pages/reportV2\"));\nconst NotFound = React.lazy(() => import(\"./pages/notfound/\"));\nconst Login = React.lazy(() => import(\"./pages/auth/Login\"));\nconst SignUp = React.lazy(() => import(\"./pages/auth/SignUp\"));\nconst Logout = React.lazy(() => import(\"./pages/auth/Logout\"));\nconst AiTraining = React.lazy(() => import(\"./pages/aiTraining\"));\nconst DashcamMonitoringV2 = React.lazy(() => import('./pages/DashcamMonitoringV2'));\nconst BindedDashcam = React.lazy(() => import(\"./pages/bindedDashcam\"));\nconst NewBindedDashcam = React.lazy(() => import(\"./pages/newBindedDashcam\"));\nconst GenerateQrCode = React.lazy(() => import(\"./pages/generateQrCode\"));\nconst personalization = React.lazy(() => import('./pages/personalization'));\nconst userManagement = React.lazy(() => import('./pages/userManagement'))\nconst AssetList = React.lazy(() => import('./pages/assetList'))\n\n// handle auth and authorization\nconst PrivateRoute = ({\n component: Component,\n roles,\n user,\n isAuthenticated,\n ...rest\n}) => {\n const { companies } = useSelector((s) => s);\n useFirebaseDashcamHook();\n React.useEffect(() => {\n if (isAuthenticated && !companies.isLoading && companies.data.length == 0) {\n apiGetProfile();\n }\n }, [companies.data.length, companies.isLoading, isAuthenticated]);\n return (\n {\n if (!isAuthenticated) {\n // not logged in so redirect to login page with the return url\n return (\n \n );\n }\n\n // check if route is restricted by role\n if (roles && roles.indexOf(user.role) === -1) {\n // role not authorised so redirect to home page\n return ;\n }\n\n // authorised so return component\n return ;\n }}\n />\n );\n};\n\nconst PrivateRouteWithRedux = connect((state) => ({\n user: state.auth.user,\n isAuthenticated: isAuthenticated(state),\n}))(PrivateRoute);\n\nconst routes = [\n // does not require token\n {\n path: \"/login\",\n name: \"Login\",\n exact: true,\n component: Login,\n route: Route,\n },\n {\n path: \"/sign-up\",\n name: \"SignUp\",\n exact: true,\n component: SignUp,\n route: Route,\n },\n {\n path: \"/logout\",\n name: \"Logout\",\n exact: true,\n component: Logout,\n route: Route,\n },\n {\n path: \"/home\",\n name: \"Home\",\n exact: true,\n component: Home,\n route: PrivateRouteWithRedux,\n roles: [\"hq\", \"branch\"],\n },\n {\n path: \"/analytics\",\n name: \"Analytics\",\n exact: true,\n component: Analytics,\n route: PrivateRouteWithRedux,\n roles: [\"hq\", \"branch\"],\n },\n {\n path: \"/report\",\n name: \"Report\",\n exact: true,\n component: Report,\n route: PrivateRouteWithRedux,\n roles: [\"hq\", \"branch\"],\n },\n {\n path: \"/settings\",\n name: \"Settings\",\n exact: true,\n component: Settings,\n roles: [\"hq\", \"branch\"],\n route: PrivateRouteWithRedux,\n },\n {\n path: \"/ai-training\",\n name: \"AI Training\",\n exact: true,\n component: AiTraining,\n roles: [\"hq\", \"branch\"],\n route: PrivateRouteWithRedux,\n },\n {\n path: \"/dashcam\",\n name: \"Camera Monitoring\",\n exact: true,\n component: DashcamMonitoringV2,\n roles: [\"hq\", \"branch\"],\n route: PrivateRouteWithRedux,\n },\n {\n path: \"/binded-dashcam\",\n name: \"Binded Camera\",\n exact: true,\n component: BindedDashcam,\n roles: [\"hq\", \"branch\"],\n route: PrivateRouteWithRedux,\n },\n {\n path: \"/new-binded-dashcam\",\n name: \"New Binded Camera\",\n exact: true,\n component: NewBindedDashcam,\n route: PrivateRouteWithRedux,\n roles: [\"hq\", \"branch\"],\n noTopBar: true,\n },\n {\n path: \"/generate-qr\",\n name: \"Generate QR Code\",\n exact: true,\n component: GenerateQrCode,\n roles: [\"hq\", \"branch\"],\n route: PrivateRouteWithRedux,\n },\n {\n path: \"/user-management\",\n name: \"User Management\",\n exact: true,\n component: userManagement,\n roles: [\"hq\", \"branch\"],\n route: PrivateRouteWithRedux,\n },\n {\n path: \"/personalization\",\n name: \"Personalization\",\n exact: true,\n component: personalization,\n route: PrivateRouteWithRedux,\n },\n {\n path: \"/personalization/:parameter\",\n name: \"Personalization\",\n exact: true,\n component: personalization,\n roles: [\"hq\", \"branch\"],\n route: PrivateRouteWithRedux,\n },\n {\n path: \"/asset-list\",\n name: \"Asset List\",\n exact: true,\n component: AssetList,\n roles: [\"hq\", \"branch\"],\n route: PrivateRouteWithRedux,\n },\n {\n path: \"/\",\n exact: true,\n component: () => ,\n route: PrivateRouteWithRedux,\n },\n {\n component: () => ,\n route: Route,\n },\n];\n\nexport { routes, PrivateRouteWithRedux };\n","import { useEffect } from 'react';\nimport { db } from \"@configs/firebaseConfig\";\nimport { dispatch } from \"@redux/store\";\n\nexport default () => {\n useEffect(() => {\n db.ref(\"dashcams\").on(\"value\", (snapshot) => {\n const data = snapshot.val();\n if (!data || Object.keys(data).length === 0) {\n console.log(\"no response\");\n return;\n }\n const cleanData = [{}];//must start with null first index since camera id must same with index. eg: camera id 1 = index 1, therefore index 0 must have dummy null object\n const keys = Object.keys(data);\n keys.forEach(k => {\n if (!!data[k]?.camera_id) {\n cleanData.push(data[k]);\n }\n })\n dispatch({ type: \"dashcams/SET_DASHCAMS\", data: cleanData });\n });\n return () => db.ref(\"dashcams\").off(\"value\");\n }, []);\n}","import { useEffect } from \"react\";\nimport { db } from \"@configs/firebaseConfig\";\nimport { dispatch } from \"@redux/store\";\n\nexport default (props) => {\n useEffect(() => {\n db.ref(\"notifications/assets/\").on(\"value\", (snapshot) => {\n const data = snapshot.val();\n if (!data || Object.keys(data).length === 0) {\n console.log(\"no response\");\n }\n dispatch({ type: \"firebase/SET_FIREBASE_ASSETS\", data });\n });\n return () => db.ref(\"notifications/assets/\").off();\n }, []);\n return null;\n};\n","import React, { Component, Suspense, useEffect } from \"react\";\nimport { BrowserRouter, Switch } from \"react-router-dom\";\nimport { connect } from \"react-redux\";\nimport Loadable from \"react-loadable\";\nimport { routes } from \"./routes\";\nimport { isAuthenticated } from \"@redux/selectors/auth\";\nimport Firebase from \"@components/firebase\";\n\n// Themes\nimport \"./assets/scss/DefaultTheme.scss\";\n\n// Lazy loading and code splitting -\n// Derieved idea from https://blog.logrocket.com/lazy-loading-components-in-react-16-6-6cea535c0b52\nconst loading = () =>
;\n\n// All layouts/containers\nconst NonAuthLayout = Loadable({\n loader: () => import(\"@components/NonAuthLayout\"),\n render(loaded, props) {\n let Component = loaded.default;\n return ;\n },\n loading,\n});\n\nconst AuthLayout = Loadable({\n loader: () => import(\"@components/AuthLayout\"),\n render(loaded, props) {\n let Component = loaded.default;\n return (\n <>\n \n \n \n );\n },\n loading,\n});\n\n/**\n * Exports the component with layout wrapped to it\n * @param {} WrappedComponent\n */\nconst withLayout = (WrappedComponent) => {\n const HOC = class extends Component {\n render() {\n return ;\n }\n };\n\n return connect()(HOC);\n};\n\n/**\n * Main app component\n */\nconst App = (props) => {\n const Layout = props.isAuthenticated ? AuthLayout : NonAuthLayout;\n\n return (\n \n \n {routes.map((route, index) => (\n (\n \n {route.noTopBar ? (\n \n \n \n ) : (\n \n \n \n )}\n \n ))}\n />\n ))}\n \n \n );\n};\n\nconst mapStateToProps = (state) => ({\n isAuthenticated: isAuthenticated(state),\n});\n\nexport default connect(mapStateToProps)(App);\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read http://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit http://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See http://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport App from \"./App\";\nimport * as serviceWorker from \"./serviceWorker\";\nimport * as Sentry from \"@sentry/browser\";\nimport { Provider } from \"react-redux\";\nimport { configureStore } from \"@redux/store\";\nimport { ToastProvider } from \"react-toast-notifications\";\nimport './index.css';\n\nfunction removeConsole() {}\n\nif (process.env.NODE_ENV !== \"development\") {\n console.log = removeConsole;\n console.warn = removeConsole;\n console.error = removeConsole;\n\n Sentry.init({\n dsn: \"https://b6fa9f9281804958aed8afc3d92938a8@o406540.ingest.sentry.io/5278247\",\n });\n}\n\nReactDOM.render(\n \n \n \n \n ,\n document.getElementById(\"root\")\n);\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: http://bit.ly/CRA-PWA\nserviceWorker.unregister();\n","import thunk from 'redux-thunk';\nimport logger from 'redux-logger';\nimport { createStore, applyMiddleware, compose } from 'redux';\nimport reducers from './reducers';\n\nlet store;\n\nexport const configureStore = initialState => {\n const composeEnhancers =\n window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;\n\n const appliedMiddleware = (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') ? applyMiddleware(thunk, logger) : applyMiddleware(thunk);\n store = initialState\n ? createStore(\n reducers,\n initialState,\n composeEnhancers(appliedMiddleware),\n )\n : createStore(reducers, composeEnhancers(appliedMiddleware));\n\n return store;\n}\nexport default store;\nconst getStore = () => store;\nexport const getState = () => getStore() && getStore().getState();\nexport const dispatch = data => getStore() && getStore().dispatch(data);\n","\nconst NAMESPACE = 'companies';\n\nexport const API_GET_COMPANIES = `${NAMESPACE}/API_GET_COMPANIES`;\nexport const API_GET_COMPANIES_FAIL = `${NAMESPACE}/API_GET_COMPANIES_FAIL`;\nexport const API_GET_COMPANIES_SUCCESS = `${NAMESPACE}/API_GET_COMPANIES_SUCCESS`;\n\nconst initialState = {\n isLoading: false,\n data: [],\n error: null\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case API_GET_COMPANIES:\n return { ...state, isLoading: true, error: null };\n case API_GET_COMPANIES_FAIL:\n return { ...state, isLoading: false, error: action.error };\n case API_GET_COMPANIES_SUCCESS:\n return { ...state, isLoading: false, data: action.data };\n default:\n return state;\n }\n};\n","import { dispatch } from \"./store\";\nimport Api from \"@helpers/api\";\nimport { endpoints } from \"@configs/endpoints\";\n\nconst NAMESPACE = \"notification\";\n\nexport const CREATE_NOTIFICATION = `${NAMESPACE}/CREATE_NOTIFICATION`;\nexport const CREATE_NOTIFICATION_FAIL = `${NAMESPACE}/CREATE_NOTIFICATION_FAIL`;\nexport const CREATE_NOTIFICATION_SUCCESS = `${NAMESPACE}/CREATE_NOTIFICATION_SUCCESS`;\n\nconst GET_NOTIFICATION = `${NAMESPACE}/GET_NOTIFICATION`;\nconst GET_NOTIFICATION_FAIL = `${NAMESPACE}/GET_NOTIFICATION_FAIL`;\nconst GET_NOTIFICATION_SUCCESS = `${NAMESPACE}/GET_NOTIFICATION_SUCCESS`;\n\nexport const createNotification = (data, onSuccess) => {\n dispatch({ type: GET_NOTIFICATION });\n\n Api({\n endpoint: endpoints.createNotification(data.asset_id),\n data,\n onSuccess: (response) => {\n dispatch({\n type: CREATE_NOTIFICATION_SUCCESS,\n data: response.data,\n });\n !!onSuccess && onSuccess(response.data.id);\n },\n onFail: (error) => {\n dispatch({ type: CREATE_NOTIFICATION_FAIL, error });\n },\n });\n};\n\nexport const getNotification = () => {\n dispatch({ type: GET_NOTIFICATION });\n\n Api({\n endpoint: endpoints.getNotification(),\n onSuccess: (response) => {\n dispatch({\n type: GET_NOTIFICATION_SUCCESS,\n data: response.data,\n });\n },\n onFail: (error) => dispatch({ type: GET_NOTIFICATION_FAIL, error }),\n });\n};\n\nconst initialState = {\n isLoading: false,\n data: {},\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case CREATE_NOTIFICATION:\n return { ...state, isLoading: true };\n case CREATE_NOTIFICATION_SUCCESS:\n case GET_NOTIFICATION_SUCCESS:\n return { ...state, isLoading: false, data: action.data };\n case GET_NOTIFICATION_FAIL:\n return { ...state, isLoading: false, error: action.error };\n default:\n return state;\n }\n};\n","import { dispatch } from \"./store\";\nimport Api from \"@helpers/api\";\nimport { endpoints } from \"@configs/endpoints\";\n\nconst NAMESPACE = \"reality-mesh\";\n\nexport const CLEAR_REALITY_MESHES = `${NAMESPACE}/CLEAR_REALITY_MESHES`;\nexport const API_GET_REALITY_MESHES = `${NAMESPACE}/API_GET_REALITY_MESHES`;\nexport const API_GET_REALITY_MESHES_FAIL = `${NAMESPACE}/API_GET_REALITY_MESHES_FAIL`;\nexport const API_GET_REALITY_MESHES_SUCCESS = `${NAMESPACE}/API_GET_REALITY_MESHES_SUCCESS`;\n\nexport const clearRealityMeshes = () =>\n dispatch({ type: CLEAR_REALITY_MESHES });\n\nexport const apiGetRealityMeshes = assetId => {\n dispatch({ type: API_GET_REALITY_MESHES });\n Api({\n endpoint: endpoints.getRealityMeshesForAsset(assetId),\n onSuccess: response => {\n dispatch({ type: API_GET_REALITY_MESHES_SUCCESS, data: response.data });\n },\n onFail: error => {\n dispatch({ type: API_GET_REALITY_MESHES_FAIL, error });\n }\n });\n};\nconst initialState = {\n isLoading: false,\n data: []\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case CLEAR_REALITY_MESHES:\n return { ...state, isLoading: false, data: [] };\n case API_GET_REALITY_MESHES:\n return { ...state, isLoading: true };\n case API_GET_REALITY_MESHES_SUCCESS:\n return { ...state, isLoading: false, ...action.data };\n case API_GET_REALITY_MESHES_FAIL:\n return { ...state, isLoading: false, error: action.error };\n default:\n return state;\n }\n};\n","import { dispatch } from './store';\nimport Api from '@helpers/api';\nimport { endpoints } from '@configs/endpoints';\nconst NAMESPACE = 'assets';\n\nexport const GET_ASSET_SUMMARY = `${NAMESPACE}/GET_ASSET_SUMMARY`;\nexport const GET_ASSET_SUMMARY_SUCCESS = `${NAMESPACE}/GET_ASSET_SUMMARY_SUCCESS`;\nexport const GET_ASSET_SUMMARY_FAIL = `${NAMESPACE}/GET_ASSET_SUMMARY_FAIL`;\n\nexport const NEW_ASSETS_LIST = `${NAMESPACE}/NEW_ASSETS_LIST`;\n\nexport const apiGetAssetSummary = id => {\n dispatch({ type: GET_ASSET_SUMMARY });\n Api({\n endpoint: endpoints.getAssetSummary(id),\n onSuccess: ({ data }) => {\n dispatch({ type: GET_ASSET_SUMMARY_SUCCESS, data, id });\n },\n onFail: () => dispatch({ type: GET_ASSET_SUMMARY_FAIL })\n });\n}\nconst initialState = {\n isLoading: true,\n data: []\n};\n\nexport default (state = initialState, action) => {\n const { data } = state;\n switch (action.type) {\n case GET_ASSET_SUMMARY:\n return { ...state, isLoading: true };\n case GET_ASSET_SUMMARY_SUCCESS:\n const newData = data.map(d => {\n const item = { ...d };\n if (d.id == action.id) {\n item.summary = action.data;\n }\n return item;\n })\n return { ...state, isLoading: false, data: newData };\n case GET_ASSET_SUMMARY_FAIL:\n return { ...state, isLoading: false };\n case NEW_ASSETS_LIST:\n return { ...state, data: [...action.data], isLoading: false };\n default:\n return state;\n }\n}\n","import { dispatch } from \"./store\";\nimport Api from \"@helpers/api\";\nimport { endpoints } from \"@configs/endpoints\";\n\nconst NAMESPACE = \"point-clouds\";\n\nexport const CLEAR_POINT_CLOUDS = `${NAMESPACE}/CLEAR_POINT_CLOUDS`;\nexport const API_GET_POINT_CLOUDS = `${NAMESPACE}/API_GET_POINT_CLOUDS`;\nexport const API_GET_POINT_CLOUDS_FAIL = `${NAMESPACE}/API_GET_POINT_CLOUDS_FAIL`;\nexport const API_GET_POINT_CLOUDS_SUCCESS = `${NAMESPACE}/API_GET_POINT_CLOUDS_SUCCESS`;\n\nexport const clearPointClouds = () => dispatch({ type: CLEAR_POINT_CLOUDS });\n\nexport const apiGetPointClouds = assetId => {\n dispatch({ type: API_GET_POINT_CLOUDS });\n Api({\n endpoint: endpoints.getPointCloudsForAsset(assetId),\n onSuccess: response => {\n dispatch({ type: API_GET_POINT_CLOUDS_SUCCESS, data: response.data });\n },\n onFail: error => {\n dispatch({ type: API_GET_POINT_CLOUDS_FAIL, error });\n }\n });\n};\nconst initialState = {\n isLoading: false,\n data: []\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case CLEAR_POINT_CLOUDS:\n return { ...state, isLoading: false, data: [] };\n case API_GET_POINT_CLOUDS:\n return { ...state, isLoading: true };\n case API_GET_POINT_CLOUDS_SUCCESS:\n return { ...state, isLoading: false, ...action.data };\n case API_GET_POINT_CLOUDS_FAIL:\n return { ...state, isLoading: false, error: action.error };\n default:\n return state;\n }\n};\n","import { dispatch } from \"./store\";\n\nconst NAMESPACE = \"document-categories\";\n\nexport const UPDATE_VALUE = `${NAMESPACE}/UPDATE_VALUE`;\n\nconst initialState = {\n isLoading: false,\n data: [\n { value: 1, label: \"Planning\" },\n { value: 2, label: \"Development\" },\n { value: 3, label: \"Construction\" },\n { value: 4, label: \"Operation & Maintenance\" },\n { value: 5, label: \"Decommission\" },\n ],\n};\n\nexport const setDocumentCategories = (data) =>\n dispatch({ type: UPDATE_VALUE, data });\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case UPDATE_VALUE:\n return { ...state, data: action.data };\n default:\n return state;\n }\n};\n","import { dispatch } from \"./store\";\nimport Api from \"@helpers/api\";\nimport { endpoints } from \"@configs/endpoints\";\n\nconst NAMESPACE = \"inspection\";\n\nexport const CREATE_INSPECTION = `${NAMESPACE}/CREATE_INSPECTION`;\nexport const CREATE_INSPECTION_FAIL = `${NAMESPACE}/CREATE_INSPECTION_FAIL`;\nexport const CREATE_INSPECTION_SUCCESS = `${NAMESPACE}/CREATE_INSPECTION_SUCCESS`;\n\nconst GET_INSPECTION = `${NAMESPACE}/GET_INSPECTION`;\nconst GET_INSPECTION_FAIL = `${NAMESPACE}/GET_INSPECTION_FAIL`;\nconst GET_INSPECTION_SUCCESS = `${NAMESPACE}/GET_INSPECTION_SUCCESS`;\n\nexport const createInspection = (data, onSuccess) => {\n dispatch({ type: GET_INSPECTION });\n\n Api({\n endpoint: endpoints.createInspection(data.asset_id),\n data,\n onSuccess: response => {\n dispatch({\n type: CREATE_INSPECTION_SUCCESS,\n data: response.data,\n });\n !!onSuccess && onSuccess(response.data.id);\n },\n onFail: error => {\n dispatch({ type: CREATE_INSPECTION_FAIL, error });\n }\n });\n};\n\nexport const getInspection = (inspection_id) => {\n dispatch({ type: GET_INSPECTION });\n\n Api({\n endpoint: endpoints.getInspection(inspection_id),\n onSuccess: response => {\n dispatch({\n type: GET_INSPECTION_SUCCESS,\n data: response.data,\n });\n },\n onFail: error => dispatch({ type: GET_INSPECTION_FAIL, error })\n });\n};\n\nconst initialState = {\n isLoading: false,\n data: {}\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case CREATE_INSPECTION:\n return { ...state, isLoading: true };\n case CREATE_INSPECTION_SUCCESS:\n case GET_INSPECTION_SUCCESS:\n return { ...state, isLoading: false, data: action.data };\n case CREATE_INSPECTION_FAIL:\n return { ...state, isLoading: false, error: action.error };\n default:\n return state;\n }\n};\n","const NAMESPACE = \"annotationTypes\";\n\nconst initialState = {\n isLoading: true,\n data: [],\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case NAMESPACE + '/SET_ANNOTATION_TYPES':\n return { ...state, data: action.data };\n default:\n return state;\n }\n};\n","const NAMESPACE = \"dashcams\";\n\nconst initialState = {\n isLoading: true,\n data: [],\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case NAMESPACE + \"/SET_DASHCAMS\":\n return { ...state, data: action.data };\n default:\n return state;\n }\n};\n","const NAMESPACE = \"firebase\";\n\nconst initialState = {\n isLoading: true,\n data: [],\n type: null,\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case NAMESPACE + \"/SET_FIREBASE_ASSETS\":\n return { ...state, data: action.data, type: \"assets\" };\n case NAMESPACE + \"/SET_FIREBASE_USERS\":\n return { ...state, data: action.data, type: \"users\" };\n default:\n return state;\n }\n};\n","import { combineReducers } from \"redux\";\nimport auth from \"./auth\";\nimport companies from \"./companies\";\nimport notification from \"./notification\";\nimport annotation from \"./annotation\";\nimport realityMesh from \"./realityMesh\";\nimport assets from \"./assets\";\nimport pointCloud from \"./pointCloud\";\nimport documentCategories from \"./documentCategories\";\nimport inspection from \"./inspection\";\nimport reports from \"./reports\";\nimport statistics from \"./statistics\";\nimport activityLogs from \"./activityLogs\";\nimport archive from \"./archive\";\nimport annotationTypes from \"./annotationTypes\";\nimport dashcams from \"./dashcams\";\nimport general from \"./general\";\nimport firebase from \"./firebase\";\n\nexport default combineReducers({\n auth,\n companies,\n notification,\n annotation,\n archive,\n realityMesh,\n assets,\n activityLogs,\n reports,\n statistics,\n pointCloud,\n documentCategories,\n inspection,\n annotationTypes,\n dashcams,\n general,\n firebase,\n});\n","import firebase from \"firebase\";\n\nconst firebaseConfig = {\n apiKey: \"AIzaSyAMeKss7KdJp-TPqXmgpFdvrVX0SVgC5_8\",\n authDomain: \"envis-5ebd0.firebaseapp.com\",\n databaseURL: \"https://envis-5ebd0-default-rtdb.firebaseio.com\",\n projectId: \"envis-5ebd0\",\n storageBucket: \"envis-5ebd0.appspot.com\",\n messagingSenderId: \"867295773672\",\n appId: \"1:867295773672:web:d611b3251618b9d2efda5d\",\n measurementId: \"G-WX8YCVKBGX\"\n};\nconst firebaseApp = firebase.initializeApp(firebaseConfig);\nexport const db = firebaseApp.database();\n","import { createSelector } from 'reselect';\n\nexport const isAuthenticated = createSelector(\n [s => s],\n s => !!s.auth.user,\n);\n","export const URL = process.env.REACT_APP_ENDPOINT_URL;\nexport const CLIENT_SECRET = \"sgHOG2NyyVECAiam7JS4QBJVPMhzrQ6eFh3SVSFa\";\nexport const CLIENT_ID = 1;\n\nexport const endpoints = {\n getToken: () => [\"POST\", URL + \"oauth/token\"],\n registerAccount: () => [\"POST\", URL + \"signup\"],\n getProfile: () => [\"GET\", URL + \"api/profile\"],\n getNotification: () => [\"GET\", URL + \"api/notification\"],\n updateAnnotation: (id) => [\"POST\", URL + \"api/annotations/\" + id],\n getAnnotation: () => [\"GET\", URL + \"api/annotations\"],\n getAssetSummary: (id) => [\"GET\", URL + \"api/asset-summary/\" + id],\n getRemoteConfig: () => [\"GET\", URL + \"api/remote-config\"],\n updateRemoteConfig: () => [\"POST\", URL + \"api/remote-config/update\"],\n getStatistics: () => [\"GET\", URL + \"api/statistics\"],\n getPointCloudsForAsset: (assetId) => [\"GET\", URL + `api/assets/${assetId}/point-clouds`],\n getRealityMeshesForAsset: (assetId) => [\"GET\", URL + `api/assets/${assetId}/reality-meshes`],\n createInspection: (assetId) => [\"POST\", URL + `api/assets/${assetId}/aerial-inspections`],\n createReport: () => [\"POST\", URL + `api/report`],\n deleteReport: (id) => [\"DELETE\", URL + \"api/report/\" + id],\n deleteAnnotation: (id) => [\"DELETE\", URL + \"api/annotations/\" + id],\n createArchiveRequest: () => [\"POST\", URL + `api/archive`],\n uploadInspectionMedia: (inspectionId) => [\"POST\", URL + `api/aerial-inspections/${inspectionId}/inspection-medias`],\n getInspection: (inspectionId) => [\"GET\", URL + `api/aerial-inspections/${inspectionId}`],\n getReports: () => [\"GET\", URL + \"api/report\"],\n getActivityLogs: () => [\"GET\", URL + \"api/activity-log\"],\n updateInspectionMedia: (mediaId) => [\"POST\", URL + `api/inspection-medias/${mediaId}`],\n getUsers: () => [\"GET\", URL + `api/user`],\n addUser: () => [\"POST\", URL + `api/user`],\n updateUser: (user_id) => [\"POST\", URL + `api/user/${user_id}/update`],\n updateUserAccessDetections: (user_id) => [\"POST\", URL + `api/user/${user_id}/update_access_annotation`],\n restoreAnnotation: (id) => [\"POST\", URL + `api/annotations/restore?annotation_ids=${id}`],\n deleteAnnotationAction: (annotationId, actionId) => [\"DELETE\", URL + `api/annotations/${annotationId}/actions/${actionId}`],\n getDashcam: () => [\"GET\", URL + \"api/dashcams\"],\n addNewBindedDashcam: () => [\"POST\", URL + \"api/dashcams\"],\n unbindDashcam: (id) => [\"DELETE\", URL + `api/dashcams/${id}`],\n getOrder: () => [\"GET\", URL + `api/order`],\n updateCompany: (id) => [\"PUT\", URL + `api/company/${id}`]\n};\n","import jwtDecode from 'jwt-decode';\nimport { Cookies } from \"react-cookie\";\n\n/**\n * Checks if user is authenticated\n */\nconst isUserAuthenticated = () => {\n const user = getLoggedInUser();\n if (!user) {\n return false;\n }\n const decoded = jwtDecode(user.token);\n const currentTime = Date.now() / 1000;\n if (decoded.exp < currentTime) {\n console.warn('access token expired');\n return false;\n }\n else {\n return true;\n }\n}\n\n/**\n * Returns the logged in user\n */\nconst getLoggedInUser = () => {\n const cookies = new Cookies();\n const user = cookies.get(\"user\");\n return user ? (typeof (user) == 'object' ? user : JSON.parse(user)) : null;\n}\n\nexport { isUserAuthenticated, getLoggedInUser };","import { Cookies } from \"react-cookie\";\nimport { getLoggedInUser } from '@helpers/authUtils';\nimport Api from '@helpers/api';\nimport { endpoints, CLIENT_SECRET, CLIENT_ID } from '@configs/endpoints';\nimport { dispatch } from './store';\nimport { apiGetProfile } from './action/auth';\n\nexport const LOGIN_USER = 'LOGIN_USER';\nexport const LOGIN_USER_SUCCESS = 'LOGIN_USER_SUCCESS';\nexport const LOGIN_USER_FAILED = 'LOGIN_USER_FAILED';\nexport const REGISTER_USER = 'REGISTER_USER';\nexport const REGISTER_USER_SUCCESS = 'REGISTER_USER_SUCCESS';\nexport const REGISTER_USER_FAILED = 'REGISTER_USER_FAILED';\nexport const LOGOUT_USER = 'LOGOUT_USER';\nexport const FORGET_PASSWORD = 'FORGET_PASSWORD';\nexport const FORGET_PASSWORD_SUCCESS = 'FORGET_PASSWORD_SUCCESS';\nexport const FORGET_PASSWORD_FAILED = 'FORGET_PASSWORD_FAILED';\n\nexport const loginUser = ({ username, password, history, redirect_url }) => {\n dispatch({ type: LOGIN_USER });\n Api({\n endpoint: endpoints.getToken(),\n data: {\n username,\n password,\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: 'password'\n },\n onSuccess: response => {\n const token = response;\n\n apiGetProfile({\n token,\n onSuccess: response => {\n const user = response.data;\n dispatch({\n type: LOGIN_USER_SUCCESS,\n payload: user\n });\n\n (new Cookies()).set(\"user\", JSON.stringify({\n id: user.id,\n image: user.image,\n companies: user.companies,\n // TODO: why fail to save departments to cookie\n // departments: user.departments,\n username,\n name: user.name,\n role: user.role,\n token: token.access_token,\n // refresh_token: token.refresh_token,\n access_annotations_type_list: user.access_annotations_type_list,\n email: user.email\n }), { path: \"/\" });\n\n if (!!redirect_url) {\n history.push(redirect_url);\n } else {\n history.push('/home');\n }\n },\n onFail: response => {\n let error = 'Sorry, please try again later';\n if (response.status === 400) {\n error = 'Sorry, wrong user name or password';\n }\n dispatch({ type: LOGIN_USER_FAILED, payload: error });\n },\n })\n },\n onFail: response => {\n let error = 'Sorry, please try again later';\n if (response.status === 400) {\n error = 'Sorry, wrong user name or password';\n }\n dispatch({ type: LOGIN_USER_FAILED, payload: error });\n },\n });\n}\n\nexport const loginUserSuccess = (user) => ({\n type: LOGIN_USER_SUCCESS,\n payload: user\n});\n\nexport const loginUserFailed = (error) => ({\n type: LOGIN_USER_FAILED,\n payload: error\n});\n\nexport const registerUser = (fullname, email, password) => ({\n type: REGISTER_USER,\n payload: { fullname, email, password }\n});\n\nexport const registerUserSuccess = (user) => ({\n type: REGISTER_USER_SUCCESS,\n payload: user\n});\n\nexport const registerUserFailed = (error) => ({\n type: REGISTER_USER_FAILED,\n payload: error\n});\n\nexport const logoutUser = (history) => {\n dispatch({ type: LOGOUT_USER });\n (new Cookies()).remove('user');\n if (!history) {\n window.location = '/login';\n } else {\n history.push('/login');\n }\n}\n\nexport const forgetPassword = (username) => ({\n type: FORGET_PASSWORD,\n payload: { username }\n});\n\nexport const forgetPasswordSuccess = (passwordResetStatus) => ({\n type: FORGET_PASSWORD_SUCCESS,\n payload: passwordResetStatus\n});\n\nexport const forgetPasswordFailed = (error) => ({\n type: FORGET_PASSWORD_FAILED,\n payload: error\n});\n\n\nconst INIT_STATE = {\n user: getLoggedInUser(),\n loading: false\n};\n\n\nexport default (state = INIT_STATE, action) => {\n switch (action.type) {\n case LOGIN_USER:\n return { ...state, loading: true, error: null };\n case LOGIN_USER_SUCCESS:\n return { ...state, user: action.payload, loading: false, error: null };\n case LOGIN_USER_FAILED:\n return { ...state, error: action.payload, loading: false };\n case REGISTER_USER:\n return { ...state, loading: true };\n case 'SET_PROFILE':\n return { ...state, user: action.payload };\n case REGISTER_USER_SUCCESS:\n return { ...state, user: action.payload, loading: false, error: null };\n case REGISTER_USER_FAILED:\n return { ...state, error: action.payload, loading: false };\n case LOGOUT_USER:\n return { ...state, user: null };\n case FORGET_PASSWORD:\n return { ...state, loading: true };\n case FORGET_PASSWORD_SUCCESS:\n return { ...state, passwordResetStatus: action.payload, loading: false, error: null };\n case FORGET_PASSWORD_FAILED:\n return { ...state, error: action.payload, loading: false };\n default: return { ...state };\n }\n}\n","// only put action here if got problem with import cycle\nimport { Cookies } from \"react-cookie\";\nimport { dispatch } from \"@redux/store\";\nimport Api from \"@helpers/api\";\nimport { endpoints } from \"@configs/endpoints\";\n\nexport const apiGetProfile = (p) => {\n let onSuccess = () => null;\n let onFail = () => null;\n let token = null;\n if (!!p) {\n token = p.token;\n onSuccess = p.onSuccess;\n onFail = p.onFail;\n }\n const params = {\n endpoint: endpoints.getProfile(),\n onSuccess: (response) => {\n if (!!response.data.assets) {\n dispatch({ type: \"annotationTypes/SET_ANNOTATION_TYPES\", data: response.data.detection_types });\n\n const { assets } = response.data;\n\n for (let k = 0; k < assets.length; k++) {\n assets[k].latitude = parseFloat(assets[k].latitude);\n assets[k].longitude = parseFloat(assets[k].longitude);\n assets[k].company_id = response.data.id;\n }\n dispatch({ type: \"assets/NEW_ASSETS_LIST\", data: assets.sort((i) => (i.name == \"SILK\" ? 1 : -1)) });\n const user = response.data;\n const ck = new Cookies();\n const user_from_cookie = ck.get('user');\n\n if (user_from_cookie && user_from_cookie.token) {\n user.token = user_from_cookie.token;\n user.refresh_token = user_from_cookie.refresh_token\n }\n\n (new Cookies()).set(\"user\", JSON.stringify({\n id: user.id,\n image: user.image,\n companies: user.companies,\n // TODO: why fail to save departments to cookie\n // departments: user.departments,\n username: user.username,\n name: user.name,\n role: user.role,\n token: user.token,\n // refresh_token: user.refresh_token,\n access_annotations_type_list: user.access_annotations_type_list,\n email: user.email\n }), { path: \"/\" });\n dispatch({ type: 'SET_PROFILE', payload: user });\n }\n onSuccess(response);\n },\n onFail: (err) => onFail(err),\n };\n if (token && token.access_token) {\n params.token = token.access_token;\n }\n\n Api(params);\n};\n","import { getState } from '@redux/store';\nimport { Cookies } from \"react-cookie\";\nimport { logoutUser } from '@redux/auth';\nimport { isAuthenticated } from '@redux/selectors/auth';\n\nexport default ({\n endpoint,\n url,\n data = null,\n token = null,\n onSuccess = () => null,\n onFail = () => null,\n hasFile = false\n}) => {\n console.log('calling API ', endpoint, data);\n const xhr = new XMLHttpRequest();\n const isGet = endpoint ? endpoint[0].toLowerCase() === 'get' : url[0].toLowerCase() === 'get';\n let urlParams = '';\n if (isGet && !!data) {\n urlParams = '?' + Object.entries(data).map(e => e.join('=')).join('&');\n }\n if (!!data) {\n console.log('data in API call', data);\n }\n if (url) {\n xhr.open(url[0], url[1]);\n } else if (endpoint) {\n xhr.open(endpoint[0], endpoint[1] + urlParams);\n }\n const requestHeaders = {\n Accept: 'application/json',\n };\n\n if (!hasFile) {\n requestHeaders['Content-Type'] = 'application/json';\n }\n\n if (!token) {\n const ck = new Cookies();\n const user = ck.get('user');\n if (user && user.token) {\n token = user.token;\n }\n }\n\n if (token) {\n requestHeaders['Authorization'] = `Bearer ${token}`;\n }\n\n for (let header in requestHeaders) {\n xhr.setRequestHeader(header, requestHeaders[header]);\n }\n\n xhr.onload = ({ target }) => {\n if (target.status === 401) {\n console.log('API failed', target);\n onFail(target);\n if (isAuthenticated(getState())) {\n logoutUser();\n }\n return;\n }\n if (target.status > 299) {\n console.log('API failed', target);\n onFail(target);\n return;\n }\n\n console.log('API success ', target.responseText);\n\n if (target.status == 204) {\n onSuccess({});\n } else {\n onSuccess(JSON.parse(target.responseText));\n }\n };\n\n xhr.onerror = error => {\n console.log('API failed', error);\n onFail(error);\n };\n\n if (data && !isGet) {\n if (hasFile) {\n let formData = new FormData();\n if (data) {\n console.log('all params');\n for (const key of Object.keys(data)) {\n console.log(key, data[key]);\n formData.append(key, data[key]);\n }\n }\n xhr.send(formData);\n } else {\n xhr.send(JSON.stringify(data))\n }\n } else {\n xhr.send();\n }\n};","import { dispatch } from \"./store\";\nimport Api from \"@helpers/api\";\nimport { endpoints } from \"@configs/endpoints\";\nimport _ from \"lodash\";\nimport { mergeArraysOfObjectsUniqueById } from \"ofo-helpers\";\n\nconst NAMESPACE = \"annotation\";\n\nconst UPDATE_DETECTION = `${NAMESPACE}/UPDATE_DETECTION`;\nconst UPDATE_DETECTION_SUCCESS = `${NAMESPACE}/UPDATE_DETECTION_SUCCESS`;\nconst UPDATE_DETECTION_FAIL = `${NAMESPACE}/UPDATE_DETECTION_FAIL`;\n\nconst DELETE_ANNOTATION = `${NAMESPACE}/DELETE_ANNOTATION`;\nconst DELETE_ANNOTATION_SUCCESS = `${NAMESPACE}/DELETE_ANNOTATION_SUCCESS`;\nconst DELETE_ANNOTATION_FAIL = `${NAMESPACE}/DELETE_ANNOTATION_FAIL`;\n\nconst RESTORE_ANNOTATION = `${NAMESPACE}/RESTORE_ANNOTATION`;\nconst RESTORE_ANNOTATION_SUCCESS = `${NAMESPACE}/RESTORE_ANNOTATION_SUCCESS`;\nconst RESTORE_ANNOTATION_FAIL = `${NAMESPACE}/RESTORE_ANNOTATION_FAIL`;\n\nconst GET_ANNOTATION = `${NAMESPACE}/GET_ANNOTATION`;\nconst GET_ANNOTATION_FAIL = `${NAMESPACE}/GET_ANNOTATION_FAIL`;\nconst GET_ANNOTATION_SUCCESS = `${NAMESPACE}/GET_ANNOTATION_SUCCESS`;\n\nconst RELOAD_ANNOTATION = `${NAMESPACE}/RELOAD_ANNOTATION`;\nconst RELOAD_ANNOTATION_FAIL = `${NAMESPACE}/RELOAD_ANNOTATION_FAIL`;\nconst RELOAD_ANNOTATION_SUCCESS = `${NAMESPACE}/RELOAD_ANNOTATION_SUCCESS`;\n\nexport const apiUpdateDetections = (data, onSuccess = () => null, onFail = () => null) => {\n dispatch({ type: UPDATE_DETECTION });\n\n Api({\n endpoint: endpoints.updateAnnotation(data.id),\n data,\n onSuccess: (response) => {\n dispatch({ type: UPDATE_DETECTION_SUCCESS, data: response.data, params: data });\n onSuccess();\n },\n onFail: (error) => {\n onFail();\n dispatch({ type: UPDATE_DETECTION_FAIL, error });\n },\n });\n};\n\nexport const getAnnotation = (data, isAppendExistingData = false) => {\n dispatch({ type: GET_ANNOTATION, data });\n\n Api({\n endpoint: endpoints.getAnnotation(),\n data,\n onSuccess: (response) => dispatch({ type: GET_ANNOTATION_SUCCESS, data: response.data, isAppendExistingData }),\n onFail: (error) => dispatch({ type: GET_ANNOTATION_FAIL, error }),\n });\n};\n\nexport const deleteAnnotation = (id, onSuccess = () => null) => {\n dispatch({ type: DELETE_ANNOTATION, id });\n Api({\n endpoint: endpoints.deleteAnnotation(id),\n onSuccess: (response) => {\n dispatch({ type: DELETE_ANNOTATION_SUCCESS, id });\n onSuccess();\n },\n onFail: (error) => dispatch({ type: DELETE_ANNOTATION_FAIL, error }),\n });\n};\n\nexport const restoreAnnotation = (id, onSuccess = () => null) => {\n dispatch({ type: RESTORE_ANNOTATION, id });\n Api({\n endpoint: endpoints.restoreAnnotation(id),\n onSuccess: (response) => {\n dispatch({ type: RESTORE_ANNOTATION_SUCCESS, id });\n onSuccess();\n },\n onFail: (error) => dispatch({ type: RESTORE_ANNOTATION_FAIL, error }),\n });\n};\n\nexport const reloadAnnotation = (data, isAppendExistingData = false) => {\n dispatch({ type: RELOAD_ANNOTATION, data });\n\n Api({\n endpoint: endpoints.getAnnotation(),\n data,\n onSuccess: (response) => {\n dispatch({ type: RELOAD_ANNOTATION_SUCCESS, data: response.data, isAppendExistingData });\n },\n onFail: (error) => null,\n });\n};\n\nconst initialState = {\n isLoading: true,\n filters: {},\n data: { data: [] },\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case DELETE_ANNOTATION:\n case RESTORE_ANNOTATION:\n case UPDATE_DETECTION:\n case RELOAD_ANNOTATION:\n return { ...state, isLoading: true, error: null };\n case UPDATE_DETECTION_SUCCESS:\n const detectionData = state.data;\n detectionData.data = detectionData.data.map((i) => {\n let detection = i;\n if (i.id == action.params.id) {\n detection = { ...detection, ...action.params };\n }\n return detection;\n });\n if (action.params.is_false_detection == 1 || action.params.is_false_detection == 0) {\n detectionData.data = detectionData.data.filter((f) => {\n return f.id != action.params.id;\n });\n }\n\n return { ...state, isLoading: false, data: detectionData };\n case UPDATE_DETECTION_FAIL:\n return { ...state, isLoading: false, error: action.error };\n\n case GET_ANNOTATION:\n return { ...state, isLoading: true, error: null, filters: action.data };\n case GET_ANNOTATION_SUCCESS: {\n const newData = action.data;\n newData.data = _.uniqBy(action.data.data, \"id\");\n if (!state.filters.page && !action.isAppendExistingData) return { ...state, isLoading: false, data: newData };\n\n const combinedData = action.data;\n combinedData.data = mergeArraysOfObjectsUniqueById(state.data.data, action.data.data);\n combinedData.data.sort((a, b) => parseInt(b.id) - parseInt(a.id));\n return { ...state, isLoading: false, data: combinedData };\n }\n case DELETE_ANNOTATION_FAIL:\n case RESTORE_ANNOTATION_FAIL:\n case GET_ANNOTATION_FAIL:\n case RELOAD_ANNOTATION_FAIL:\n return { ...state, isLoading: false, error: action.error };\n\n case RESTORE_ANNOTATION_SUCCESS:\n case DELETE_ANNOTATION_SUCCESS: {\n const initialData = state.data;\n initialData.data = initialData.data.filter((i) => i.id != action.id);\n return { ...state, isLoading: false, data: initialData };\n }\n case RELOAD_ANNOTATION_SUCCESS: {\n const newData = action.data;\n newData.data = _.uniqBy(action.data.data, \"id\");\n if (!state.filters.page && !action.isAppendExistingData) return { ...state, isLoading: false, data: newData };\n\n const combinedData = action.data;\n combinedData.data = mergeArraysOfObjectsUniqueById(state.data.data, action.data.data);\n combinedData.data.sort((a, b) => parseInt(b.id) - parseInt(a.id));\n return { ...state, isLoading: false, data: combinedData };\n }\n default:\n return state;\n }\n};\n","import { dispatch, getState } from \"./store\";\nimport Api from \"@helpers/api\";\nimport { endpoints } from \"@configs/endpoints\";\n\nconst NAMESPACE = \"reports\";\n\nconst GET_REPORTS = `${NAMESPACE}/GET_REPORTS`;\nconst GET_REPORTS_FAIL = `${NAMESPACE}/GET_REPORTS_FAIL`;\nconst GET_REPORTS_SUCCESS = `${NAMESPACE}/GET_REPORTS_SUCCESS`;\n\nexport const CREATE_REPORT = `${NAMESPACE}/CREATE_REPORT`;\nexport const CREATE_REPORT_FAIL = `${NAMESPACE}/CREATE_REPORT_FAIL`;\nexport const CREATE_REPORT_SUCCESS = `${NAMESPACE}/CREATE_REPORT_SUCCESS`;\n\nexport const DELETE_REPORT = `${NAMESPACE}/DELETE_REPORT`;\nexport const DELETE_REPORT_FAIL = `${NAMESPACE}/DELETE_REPORT_FAIL`;\nexport const DELETE_REPORT_SUCCESS = `${NAMESPACE}/DELETE_REPORT_SUCCESS`;\n\nexport const createReport = ({ asset_id, from, to, onSuccess = () => null }) => {\n dispatch({ type: CREATE_REPORT });\n const data = { asset_id, from, to };\n Api({\n endpoint: endpoints.createReport(),\n data,\n onSuccess: r => {\n dispatch({ type: CREATE_REPORT_SUCCESS, data: r.data });\n onSuccess(r.data.id);\n },\n onFail: error => dispatch({ type: CREATE_REPORT_FAIL, error }),\n });\n};\nexport const deleteReport = (id, asset_id, onSuccess) => {\n dispatch({ type: DELETE_REPORT });\n\n Api({\n endpoint: endpoints.deleteReport(id),\n onSuccess: (response) => {\n dispatch({ type: DELETE_REPORT_SUCCESS, data: response.data });\n !!onSuccess && onSuccess();\n alert(\"Report has successfully been deleted\");\n getReports(asset_id, getState().reports.data.current_page);\n },\n onFail: (error) => {\n dispatch({ type: DELETE_REPORT_FAIL, error });\n alert(\"Your report could not be deleted, please try again later\")\n },\n });\n};\n\nexport const getReports = (asset_id, page = 1) => {\n dispatch({ type: GET_REPORTS });\n\n Api({\n endpoint: endpoints.getReports(),\n data: { asset_ids: asset_id, page },\n onSuccess: r => dispatch({ type: GET_REPORTS_SUCCESS, data: r.data }),\n onFail: error => dispatch({ type: GET_REPORTS_FAIL, error }),\n });\n};\n\nconst initialState = {\n isLoading: false,\n data: [],\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case DELETE_REPORT:\n case GET_REPORTS:\n case CREATE_REPORT:\n return { ...state, isLoading: true };\n case CREATE_REPORT_SUCCESS:\n case DELETE_REPORT_FAIL:\n case DELETE_REPORT_SUCCESS:\n return { ...state, isLoading: false };\n case GET_REPORTS_SUCCESS:\n return { ...state, isLoading: false, data: action.data };\n case GET_REPORTS_FAIL:\n return { ...state, isLoading: false, error: action.error };\n default:\n return state;\n }\n};\n","import { dispatch, getState } from \"./store\";\nimport Api from \"@helpers/api\";\nimport { endpoints } from \"@configs/endpoints\";\nimport _ from 'lodash';\n\nconst NAMESPACE = \"activity-logs\";\n\nconst GET_ACTIVITY_LOGS = `${NAMESPACE}/GET_ACTIVITY_LOGS`;\nconst GET_ACTIVITY_LOGS_FAIL = `${NAMESPACE}/GET_ACTIVITY_LOGS_FAIL`;\nconst GET_ACTIVITY_LOGS_SUCCESS = `${NAMESPACE}/GET_ACTIVITY_LOGS_SUCCESS`;\n\nexport const getActivityLogs = (isNext) => {\n if (isNext && getState().activityLogs.data.next_page_url == null) {\n return;\n }\n if (getState().activityLogs.isLoading) {\n return;\n }\n let page = 1;\n if (isNext) {\n page = getState().activityLogs.data.current_page + 1;\n }\n\n dispatch({ type: GET_ACTIVITY_LOGS });\n\n Api({\n endpoint: endpoints.getActivityLogs(),\n data: { page },\n onSuccess: response => {\n dispatch({\n type: GET_ACTIVITY_LOGS_SUCCESS,\n data: response.data,\n isNext,\n });\n },\n onFail: error => dispatch({ type: GET_ACTIVITY_LOGS_FAIL, error })\n });\n};\n\nconst initialState = {\n isLoading: false,\n data: { data: [] },\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case GET_ACTIVITY_LOGS_SUCCESS:\n {\n if (!action.isNext) {\n return { ...state, isLoading: false, data: action.data };\n }\n\n const oldIds = _.map(state.data, 'id')\n const newLogs = action.data.data.filter(item => !_.includes(oldIds, item.id));\n const data = action.data\n data.data = [...state.data.data, ...newLogs]\n\n return {\n ...state,\n isLoading: false,\n data,\n };\n }\n case GET_ACTIVITY_LOGS:\n return {\n ...state,\n isLoading: true,\n };\n case GET_ACTIVITY_LOGS_FAIL:\n return {\n ...state,\n isLoading: false,\n data: action.error,\n };\n default:\n return state;\n }\n};\n","import { dispatch } from \"./store\";\nimport Api from \"@helpers/api\";\nimport { endpoints } from \"@configs/endpoints\";\n\nconst NAMESPACE = \"statistics\";\n\nconst GET_STATISTICS = `${NAMESPACE}/GET_STATISTICS`;\nconst GET_STATISTICS_FAIL = `${NAMESPACE}/GET_STATISTICS_FAIL`;\nconst GET_STATISTICS_SUCCESS = `${NAMESPACE}/GET_STATISTICS_SUCCESS`;\n\nexport const getStatistics = (data) => {\n dispatch({\n type: GET_STATISTICS\n });\n\n Api({\n endpoint: endpoints.getStatistics(),\n data,\n onSuccess: response => {\n dispatch({\n type: GET_STATISTICS_SUCCESS,\n data: response.data,\n });\n },\n onFail: error => dispatch({\n type: GET_STATISTICS_FAIL,\n error\n })\n });\n};\n\nconst initialState = {\n isLoading: false,\n data: [],\n error: null\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case GET_STATISTICS_SUCCESS:\n return {\n ...state, isLoading: false, data: action.data\n };\n case GET_STATISTICS:\n return {\n ...state, isLoading: true, error: null\n };\n case GET_STATISTICS_FAIL:\n return {\n ...state, isLoading: false, error: action.error\n };\n default:\n return state;\n }\n};\n","import { dispatch } from \"./store\";\nimport Api from \"@helpers/api\";\nimport { endpoints } from \"@configs/endpoints\";\n\nconst NAMESPACE = \"archive\";\n\nexport const CREATE_ARCHIVE = `${NAMESPACE}/CREATE_ARCHIVE`;\nexport const CREATE_ARCHIVE_FAIL = `${NAMESPACE}/CREATE_ARCHIVE_FAIL`;\nexport const CREATE_ARCHIVE_SUCCESS = `${NAMESPACE}/CREATE_ARCHIVE_SUCCESS`;\n\nexport const createArchive = (data, onSuccess) => {\n dispatch({ type: CREATE_ARCHIVE });\n Api({\n endpoint: endpoints.createArchiveRequest(),\n data,\n onSuccess: (response) => {\n dispatch({\n type: CREATE_ARCHIVE_SUCCESS,\n data: response.data,\n });\n onSuccess();\n alert(\"Request has been sent\")\n },\n onFail: (error) => {\n dispatch({ type: CREATE_ARCHIVE_FAIL, error });\n alert(\"Sorry, request could not be sent, please try again later\")\n },\n });\n};\n\nconst initialState = {\n isLoading: false,\n data: [],\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case CREATE_ARCHIVE:\n return { ...state, isLoading: true };\n case CREATE_ARCHIVE_SUCCESS:\n case CREATE_ARCHIVE_FAIL:\n return {\n ...state,\n isLoading: false,\n };\n default:\n return state;\n }\n};\n","import { dispatch } from \"./store\";\n\nconst NAMESPACE = \"general\";\nexport const TOGGLE_DEV = `${NAMESPACE}/TOGGLE_DEV`;\n\nexport const toggleDev = (flag = null) => dispatch({ type: TOGGLE_DEV, flag });\nconst initialState = {\n isDev: process.env.NODE_ENV == \"development\",\n};\n\nexport default (state = initialState, action) => {\n switch (action.type) {\n case TOGGLE_DEV:\n return { ...state, isDev: action.flag == null ? !state.isDev : action.flag }\n default:\n return state;\n }\n};\n"],"sourceRoot":""}