2019-11-19 07:30:42 +03:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
2019-11-20 08:48:27 +03:00
|
|
|
import 'url-search-params-polyfill';
|
2019-11-19 07:30:42 +03:00
|
|
|
|
2023-11-01 17:27:29 +03:00
|
|
|
import Router from './dashboard/router'
|
|
|
|
import ErrorBoundary from './dashboard/error-boundary'
|
|
|
|
import * as api from './dashboard/api'
|
|
|
|
import * as timer from './dashboard/util/realtime-update-timer'
|
2023-01-02 18:42:57 +03:00
|
|
|
|
|
|
|
timer.start()
|
2019-11-19 07:30:42 +03:00
|
|
|
|
|
|
|
const container = document.getElementById('stats-react-container')
|
|
|
|
|
|
|
|
if (container) {
|
|
|
|
const site = {
|
|
|
|
domain: container.dataset.domain,
|
|
|
|
offset: container.dataset.offset,
|
2020-12-16 12:52:47 +03:00
|
|
|
hasGoals: container.dataset.hasGoals === 'true',
|
2023-06-13 13:26:33 +03:00
|
|
|
conversionsEnabled: container.dataset.conversionsEnabled === 'true',
|
|
|
|
funnelsEnabled: container.dataset.funnelsEnabled === 'true',
|
|
|
|
propsEnabled: container.dataset.propsEnabled === 'true',
|
2023-08-05 16:35:31 +03:00
|
|
|
hasProps: container.dataset.hasProps === 'true',
|
2023-06-13 13:26:33 +03:00
|
|
|
funnels: JSON.parse(container.dataset.funnels),
|
2022-03-22 17:09:45 +03:00
|
|
|
statsBegin: container.dataset.statsBegin,
|
2023-05-03 11:46:13 +03:00
|
|
|
nativeStatsBegin: container.dataset.nativeStatsBegin,
|
2021-03-16 11:40:25 +03:00
|
|
|
embedded: container.dataset.embedded,
|
2021-04-12 12:21:07 +03:00
|
|
|
background: container.dataset.background,
|
2022-05-03 10:38:59 +03:00
|
|
|
isDbip: container.dataset.isDbip === 'true',
|
2022-11-22 15:50:58 +03:00
|
|
|
flags: JSON.parse(container.dataset.flags),
|
|
|
|
validIntervalsByPeriod: JSON.parse(container.dataset.validIntervalsByPeriod)
|
2019-11-19 07:30:42 +03:00
|
|
|
}
|
|
|
|
|
2020-08-13 13:45:18 +03:00
|
|
|
const loggedIn = container.dataset.loggedIn === 'true'
|
2021-06-16 15:00:07 +03:00
|
|
|
const currentUserRole = container.dataset.currentUserRole
|
2021-03-02 12:15:43 +03:00
|
|
|
const sharedLinkAuth = container.dataset.sharedLinkAuth
|
|
|
|
if (sharedLinkAuth) {
|
|
|
|
api.setSharedLinkAuth(sharedLinkAuth)
|
|
|
|
}
|
2020-08-13 13:45:18 +03:00
|
|
|
|
2020-07-15 12:14:53 +03:00
|
|
|
const app = (
|
|
|
|
<ErrorBoundary>
|
2021-06-16 15:00:07 +03:00
|
|
|
<Router site={site} loggedIn={loggedIn} currentUserRole={currentUserRole} />
|
2020-07-15 12:14:53 +03:00
|
|
|
</ErrorBoundary>
|
|
|
|
)
|
|
|
|
|
|
|
|
ReactDOM.render(app, container);
|
2019-11-19 07:30:42 +03:00
|
|
|
}
|