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,EARaC,GACXhF,EAAAA,cAAA,QAAME,UAAW,UAAU8E,EAAM9E,aAC/BF,EAAAA,cAAA,OAAKE,UAAU,iBACjBF,EAAAA,cAAA,OAAKiF,UAAW,GAAGD,EAAM5E,SAAU8E,WAAW,kC","sources":["webpack://frontend-build-tools/./src/project/components/organisms/complianceWatch/complianceWatch.jsx","webpack://frontend-build-tools/./src/feature/compliance-watch/compliance-watch.js","webpack://frontend-build-tools/./src/foundation/Helpers/formatCurrency.js","webpack://frontend-build-tools/./src/foundation/apiRequest/apiRequest.js","webpack://frontend-build-tools/./src/foundation/utilities/datetime.js","webpack://frontend-build-tools/./src/project/components/atoms/icon/icon.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\r\nimport Icon from 'atoms/icon';\r\nimport { addZero, secondsToHourMinutesSeconds } from 'foundation/utilities/datetime';\r\nimport { useSelector } from 'react-redux';\r\n\r\nconst ComplianceWatch = ({ updateEverySecond, showClockIcon, withSeconds }) => {\r\n const user = useSelector(state => state.currentUser.currentUser);\r\n const timeNow = Date.now();\r\n updateEverySecond = updateEverySecond ?? 1;\r\n\r\n let loggedInTime = user.loginTimeStamp ? Math.round(parseInt((timeNow - Date.parse(user.loginTimeStamp))/ 1000, 10)) : null;\r\n const [time, setTime] = useState(new Date(timeNow));\r\n const [countUpTime, setCountUpTime] = useState(null);\r\n const clockIcon = loggedInTime ? '#StopClock' : '#Clock';\r\n\r\n useEffect(() => {\r\n if (loggedInTime) {\r\n setCountUpTime(loggedInTime);\r\n }\r\n\r\n const interval = setInterval(() => {\r\n if (loggedInTime) {\r\n setCountUpTime(prevCount => (prevCount + updateEverySecond));\r\n } else {\r\n setTime(new Date());\r\n }\r\n }, updateEverySecond * 1000);\r\n\r\n return () => {\r\n clearInterval(interval);\r\n };\r\n }, [loggedInTime]);\r\n\r\n const showTime = (withSeconds = false) => {\r\n if (time instanceof Date) {\r\n return `${addZero(time.getHours())}:${addZero(time.getMinutes())}${withSeconds ? ':' + addZero(time.getSeconds()) : ''}`;\r\n }\r\n return null;\r\n };\r\n\r\n const countUp = () => {\r\n if (countUpTime && !isNaN(countUpTime)) {\r\n const count = secondsToHourMinutesSeconds(countUpTime);\r\n return `${addZero(count.hours)}:${addZero(count.minutes)}:${addZero(count.seconds)}`;\r\n }\r\n return null;\r\n };\r\n return (\r\n <>\r\n
\r\n { showClockIcon && }\r\n \r\n {loggedInTime ? countUp() : showTime(withSeconds)}\r\n \r\n
\r\n \r\n );\r\n};\r\n\r\n\r\n\r\nexport default ComplianceWatch;","import React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport BaseFeature from 'foundation/base/base';\r\nimport ComplianceWatch from 'organisms/complianceWatch';\r\nimport { Provider } from 'react-redux';\r\nimport { store } from 'app/shared/store';\r\n\r\nclass ComplianceWatchComponent extends BaseFeature {\r\n constructor(element) {\r\n super(element);\r\n this.element = element;\r\n this.isInit = false;\r\n\r\n this.init();\r\n }\r\n\r\n init() {\r\n if (this.isInit) return;\r\n\r\n this.load();\r\n }\r\n\r\n load() {\r\n ReactDOM.render(\r\n \r\n \r\n , this.element);\r\n }\r\n}\r\n\r\nexport default ComplianceWatchComponent;\r\n","export const formatCurrency = (number, useFixed, noCurrency) => {\r\n let options = {\r\n style: 'currency',\r\n currency: 'DKK',\r\n maximumFractionDigits: 2,\r\n minimumFractionDigits: 2\r\n };\r\n\r\n if (useFixed) {\r\n options.maximumFractionDigits = 0;\r\n options.minimumFractionDigits = 0;\r\n }\r\n\r\n if (noCurrency) {\r\n delete options.currency;\r\n delete options.style;\r\n }\r\n\r\n return new Intl.NumberFormat('da-DA', options).format(number);\r\n};\r\n\r\nexport const currencyInputPattern = (text) => {\r\n const regex = /^[\\d]*([,\\d]{1,3})?$/;\r\n const matched = text.match(regex);\r\n if (matched) {\r\n return matched[0];\r\n }\r\n return text.substring(0, text.length - 1);\r\n};\r\n","import axios from 'axios';\r\nimport debug from 'debug';\r\n\r\nconst log = debug('Feature:APIRequest');\r\n\r\naxios.interceptors.response.use((response) => {\r\n // Any status code that lie within the range of 2xx cause this function to trigger\r\n // Do something with response data\r\n\r\n // TOD: Add tracking here\r\n log('Success', response);\r\n return response;\r\n}, (error) => {\r\n // Any status codes that falls outside the range of 2xx cause this function to trigger\r\n // Do something with response error\r\n\r\n // TOD: Add tracking here\r\n log('Error', error);\r\n return Promise.reject(error);\r\n});\r\n\r\nconst apiRequest = (url, settings = {}) => axios({\r\n method: settings?.method || 'GET',\r\n url,\r\n data: settings?.data,\r\n params: settings?.params,\r\n config: settings?.config\r\n});\r\n\r\n/**\r\n * Helper function for extracting correct statusText from\r\n * error.response.data and NOT error.response.StatusText\r\n * This is not handled correct by IIS or load-balancer\r\n *\r\n * @param {Object} error\r\n */\r\nexport const unwrapErrorStatusText = (error) => {\r\n try {\r\n if (!error?.response) {\r\n const errorWithNoStatus = error.toString();\r\n return { status: null, statusText: errorWithNoStatus };\r\n }\r\n const { status = null, data: { StatusText = null } } = error?.response;\r\n return {\r\n status,\r\n statusText: StatusText\r\n };\r\n } catch (err) {\r\n return {\r\n status: '',\r\n statusText: ''\r\n };\r\n }\r\n};\r\n\r\nexport const unwrapError = (error) => {\r\n try {\r\n if (!error?.response) {\r\n const errorWithNoStatus = error.toString();\r\n return { status: null, statusText: errorWithNoStatus };\r\n }\r\n const { status = null, data: { StatusText = null, Data = { } } } = error?.response;\r\n return {\r\n status,\r\n statusText: StatusText,\r\n data: Data\r\n };\r\n } catch (err) {\r\n return {\r\n status: '',\r\n statusText: '',\r\n data: {}\r\n };\r\n }\r\n};\r\n\r\nexport const unwrapSuccessData = (success) => {\r\n const { status = null, data: { StatusText = null, Data = { } } } = success;\r\n\r\n return {\r\n status,\r\n statusText: StatusText,\r\n data: Data\r\n };\r\n};\r\n\r\nexport default apiRequest;\r\n","export const addZero = (time) => {\r\n if (isNaN(time)) {\r\n return '';\r\n }\r\n\r\n return time < 10 ? '0' + time : time;\r\n};\r\n\r\nexport const secondsToHourMinutesSeconds = (sec) => {\r\n if (typeof sec !== 'number') {\r\n sec = parseInt(sec, 10);\r\n }\r\n\r\n const hours = Math.floor(sec / 3600);\r\n const minutes = Math.floor((sec % 3600) / 60);\r\n const seconds = sec % 60;\r\n\r\n return {\r\n hours,\r\n minutes,\r\n seconds\r\n };\r\n};\r\n\r\nexport const millisecondsToDayHourMinutesSeconds = (ms) => {\r\n const seconds = Math.floor((ms / 1000) % 60);\r\n const minutes = Math.floor((ms / 1000 / 60) % 60);\r\n const hours = Math.floor((ms / (1000 * 60 * 60)) % 24);\r\n const days = Math.floor(ms / (1000 * 60 * 60 * 24));\r\n return {\r\n hours,\r\n minutes,\r\n seconds,\r\n days\r\n };\r\n};\r\n\r\nexport const formatDate = function (date, includeTime = true) {\r\n if (!includeTime) {\r\n return `${date.getDate()}/${(date.getMonth() + 1)}/${date.getFullYear()}`;\r\n }\r\n\r\n const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();\r\n\r\n return `${date.getDate()}/${(date.getMonth() + 1)}/${date.getFullYear()} kl. ${date.getHours()}:${minutes}`;\r\n};\r\n\r\nexport const formatShortDate = function (date) {\r\n return `${date.getDate()}/${(date.getMonth() + 1)}/${date.getFullYear()}`;\r\n};\r\n","import React from 'react';\r\nimport PropTypes from 'prop-types';\r\n\r\nconst Icon = props => (\r\n \r\n \r\n\t\t\r\n\t\r\n \r\n);\r\n\r\nexport default Icon;\r\n"],"names":["_ref","updateEverySecond","showClockIcon","withSeconds","user","useSelector","state","currentUser","timeNow","Date","now","loggedInTime","loginTimeStamp","Math","round","parseInt","parse","time","setTime","useState","countUpTime","setCountUpTime","clockIcon","useEffect","interval","setInterval","prevCount","clearInterval","React","id","className","Icon","iconId","countUp","isNaN","count","secondsToHourMinutesSeconds","addZero","hours","minutes","seconds","arguments","length","undefined","getHours","getMinutes","getSeconds","showTime","ComplianceWatchComponent","BaseFeature","constructor","element","super","this","isInit","init","load","ReactDOM","Provider","store","ComplianceWatch","settings","formatCurrency","number","useFixed","noCurrency","options","style","currency","maximumFractionDigits","minimumFractionDigits","Intl","NumberFormat","format","log","debug","axios","interceptors","response","use","error","Promise","reject","unwrapErrorStatusText","status","statusText","toString","data","StatusText","err","unwrapError","Data","unwrapSuccessData","success","url","method","params","config","sec","floor","millisecondsToDayHourMinutesSeconds","ms","days","formatShortDate","date","getDate","getMonth","getFullYear","props","xlinkHref","xmlnsXlink"],"sourceRoot":""}