Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

replaced imports with require for 'api'

Blue Moused3daa8cce32a
diff --git a/app/redux/sagas/auth/workers/deleteUserAccount.ts b/app/redux/sagas/auth/workers/deleteUserAccount.ts
index ed6f9224e..c873215c7 100644
--- a/app/redux/sagas/auth/workers/deleteUserAccount.ts
+++ b/app/redux/sagas/auth/workers/deleteUserAccount.ts
@@ -2,7 +2,7 @@ import { call, put } from 'redux-saga/effects'
import { authActions } from 'redux/reducers/auth'
import { alertsActions } from 'redux/reducers/alerts'
-import { deleteUser } from 'api'
+const { deleteUser } = require('api')
export default function* deleteUserAccountWorker({ payload: { errorCallback, successCallback, t } }: {
payload: {
diff --git a/app/redux/sagas/auth/workers/logout.ts b/app/redux/sagas/auth/workers/logout.ts
index 41875fdcb..37f9ede9a 100644
--- a/app/redux/sagas/auth/workers/logout.ts
+++ b/app/redux/sagas/auth/workers/logout.ts
@@ -2,7 +2,7 @@ import { call, put } from 'redux-saga/effects'
import Debug from 'debug'
import UIActions from 'redux/reducers/ui'
-import { getGeneralStats } from 'api'
+const { getGeneralStats } = require('api')
import { IStats } from '../../../models/IStats'
const debug = Debug('swetrix:rx:s:logout')
diff --git a/app/redux/sagas/auth/workers/signin.ts b/app/redux/sagas/auth/workers/signin.ts
index fce36bbd7..2369ad0a0 100644
--- a/app/redux/sagas/auth/workers/signin.ts
+++ b/app/redux/sagas/auth/workers/signin.ts
@@ -6,9 +6,9 @@ import { errorsActions } from 'redux/reducers/errors'
import UIActions from 'redux/reducers/ui'
import { setAccessToken } from 'utils/accessToken'
-import { login } from 'api'
import { setRefreshToken } from 'utils/refreshToken'
import sagaActions from '../../actions/index'
+const { login } = require('api')
export default function* singinWorker({ payload: { credentials, callback } }: {
payload: {
diff --git a/app/redux/sagas/auth/workers/signup.ts b/app/redux/sagas/auth/workers/signup.ts
index 55b64fd98..bb7166d20 100644
--- a/app/redux/sagas/auth/workers/signup.ts
+++ b/app/redux/sagas/auth/workers/signup.ts
@@ -4,9 +4,9 @@ import { errorsActions } from 'redux/reducers/errors'
import _omit from 'lodash/omit'
import { setAccessToken } from 'utils/accessToken'
-import { signup } from 'api'
import { setRefreshToken } from 'utils/refreshToken'
import sagaActions from '../../actions'
+const { signup } = require('api')
export default function* signupWorder({ payload: { data: rawData, callback } }: {
payload: {
diff --git a/app/redux/sagas/auth/workers/sso_auth.ts b/app/redux/sagas/auth/workers/sso_auth.ts
index 031676fc2..d0a2ed9cd 100644
--- a/app/redux/sagas/auth/workers/sso_auth.ts
+++ b/app/redux/sagas/auth/workers/sso_auth.ts
@@ -3,12 +3,12 @@ import { call, put, delay } from 'redux-saga/effects'
import { authActions } from 'redux/reducers/auth'
import { errorsActions } from 'redux/reducers/errors'
import { setAccessToken } from 'utils/accessToken'
-import {
- getJWTBySSOHash, generateSSOAuthURL,
-} from 'api'
import { setRefreshToken } from 'utils/refreshToken'
import { openBrowserWindow } from 'utils/generic'
import sagaActions from '../../actions/index'
+const {
+ getJWTBySSOHash, generateSSOAuthURL,
+} = require('api')
const AUTH_WINDOW_WIDTH = 600
const AUTH_WINDOW_HEIGHT = 800
diff --git a/app/redux/sagas/auth/workers/sso_link.ts b/app/redux/sagas/auth/workers/sso_link.ts
index e7def5607..b04f7c0b2 100644
--- a/app/redux/sagas/auth/workers/sso_link.ts
+++ b/app/redux/sagas/auth/workers/sso_link.ts
@@ -3,10 +3,10 @@ import { call, put, delay } from 'redux-saga/effects'
import { authActions } from 'redux/reducers/auth'
import { errorsActions } from 'redux/reducers/errors'
import { alertsActions } from 'redux/reducers/alerts'
-import {
- linkBySSOHash, generateSSOAuthURL, authMe,
-} from 'api'
import { openBrowserWindow } from 'utils/generic'
+const {
+ linkBySSOHash, generateSSOAuthURL, authMe,
+} = require('api')
const AUTH_WINDOW_WIDTH = 600
const AUTH_WINDOW_HEIGHT = 800
diff --git a/app/redux/sagas/auth/workers/sso_unlink.ts b/app/redux/sagas/auth/workers/sso_unlink.ts
index 8e4c8f030..2eaca06e6 100644
--- a/app/redux/sagas/auth/workers/sso_unlink.ts
+++ b/app/redux/sagas/auth/workers/sso_unlink.ts
@@ -5,10 +5,10 @@ import _includes from 'lodash/includes'
import { authActions } from 'redux/reducers/auth'
import { errorsActions } from 'redux/reducers/errors'
import { alertsActions } from 'redux/reducers/alerts'
-import {
- unlinkSSO, authMe,
-} from 'api'
import { SSO_PROVIDERS } from 'redux/constants'
+const {
+ unlinkSSO, authMe,
+} = require('api')
export interface ISSOUnlink {
payload: {
diff --git a/app/redux/sagas/auth/workers/updateUserProfile.ts b/app/redux/sagas/auth/workers/updateUserProfile.ts
index 303d1f3b2..776b92258 100644
--- a/app/redux/sagas/auth/workers/updateUserProfile.ts
+++ b/app/redux/sagas/auth/workers/updateUserProfile.ts
@@ -2,8 +2,8 @@ import { call, put } from 'redux-saga/effects'
import { authActions } from 'redux/reducers/auth'
import { errorsActions } from 'redux/reducers/errors'
-import { changeUserDetails } from 'api'
import { IUser } from '../../../models/IUser'
+const { changeUserDetails } = require('api')
export default function* updateUserProfileWorker({ payload: { data, callback } }: {
payload: {
diff --git a/app/redux/sagas/auth/workers/update_show_live_visitors_in_title.ts b/app/redux/sagas/auth/workers/update_show_live_visitors_in_title.ts
index 7d27ca0cf..66eee655e 100644
--- a/app/redux/sagas/auth/workers/update_show_live_visitors_in_title.ts
+++ b/app/redux/sagas/auth/workers/update_show_live_visitors_in_title.ts
@@ -2,8 +2,8 @@ import { call, put } from 'redux-saga/effects'
import { authActions } from 'redux/reducers/auth'
import { errorsActions } from 'redux/reducers/errors'
-import { setShowLiveVisitorsInTitle } from 'api'
import { IUser } from '../../../models/IUser'
+const { setShowLiveVisitorsInTitle } = require('api')
interface IPayload {
show: boolean
diff --git a/app/redux/sagas/auth/workers/verifyEmail.ts b/app/redux/sagas/auth/workers/verifyEmail.ts
index 706a1d2b7..eed2cf073 100644
--- a/app/redux/sagas/auth/workers/verifyEmail.ts
+++ b/app/redux/sagas/auth/workers/verifyEmail.ts
@@ -1,7 +1,7 @@
import { call, put } from 'redux-saga/effects'
import { authActions } from 'redux/reducers/auth'
-import { verifyEmail } from 'api'
+const { verifyEmail } = require('api')
export default function* verifyEmailWorker({ payload: { data, successfulCallback, errorCallback } }: {
payload: {
diff --git a/app/redux/sagas/ui/index.ts b/app/redux/sagas/ui/index.ts
index 8e530ebbd..21e55af4c 100644
--- a/app/redux/sagas/ui/index.ts
+++ b/app/redux/sagas/ui/index.ts
@@ -1,6 +1,5 @@
import { takeEvery, fork, takeLatest } from 'redux-saga/effects'
import sagaTypes from '../actions/types'
-
import loadProjects from './load_projects'
import initialise from './initialise'
import liveVisitors from './worker_live_visitors'
diff --git a/app/redux/sagas/ui/initialise.ts b/app/redux/sagas/ui/initialise.ts
index 640731d76..3337f88cf 100644
--- a/app/redux/sagas/ui/initialise.ts
+++ b/app/redux/sagas/ui/initialise.ts
@@ -3,10 +3,10 @@ import Debug from 'debug'
import { getAccessToken } from 'utils/accessToken'
import { getRefreshToken } from 'utils/refreshToken'
-import { getLastPost } from 'api/blog'
import UIActions from 'redux/reducers/ui'
import { isSelfhosted } from 'redux/constants'
import sagaActions from '../actions'
+const { getLastPost } = require('api/blog')
const debug = Debug('swetrix:rx:s:initialise')
diff --git a/app/redux/sagas/ui/load_alerts.ts b/app/redux/sagas/ui/load_alerts.ts
index 81e3a4390..9210f47f9 100644
--- a/app/redux/sagas/ui/load_alerts.ts
+++ b/app/redux/sagas/ui/load_alerts.ts
@@ -4,7 +4,7 @@ import _isString from 'lodash/isString'
import UIActions from 'redux/reducers/ui'
import { errorsActions } from 'redux/reducers/errors'
import { DEFAULT_ALERTS_TAKE, isSelfhosted } from 'redux/constants'
-import { getAlerts } from 'api'
+const { getAlerts } = require('api')
const debug = Debug('swetrix:rx:s:load-extensions')
diff --git a/app/redux/sagas/ui/load_extensions.ts b/app/redux/sagas/ui/load_extensions.ts
index f119aeaf6..aeefef3ca 100644
--- a/app/redux/sagas/ui/load_extensions.ts
+++ b/app/redux/sagas/ui/load_extensions.ts
@@ -3,9 +3,9 @@ import Debug from 'debug'
import UIActions from 'redux/reducers/ui'
import { isSelfhosted } from 'redux/constants'
-import {
+const {
getInstalledExtensions,
-} from '../../../api'
+} = require('api')
const debug = Debug('swetrix:rx:s:load-extensions')
diff --git a/app/redux/sagas/ui/load_metainfo.ts b/app/redux/sagas/ui/load_metainfo.ts
index 8ca0ac711..a508baa38 100644
--- a/app/redux/sagas/ui/load_metainfo.ts
+++ b/app/redux/sagas/ui/load_metainfo.ts
@@ -4,9 +4,9 @@ import Debug from 'debug'
import UIActions from 'redux/reducers/ui'
import { isSelfhosted } from 'redux/constants'
import { IMetainfo } from 'redux/models/IMetainfo'
-import {
+const {
getPaymentMetainfo,
-} from '../../../api'
+} = require('api')
const debug = Debug('swetrix:rx:s:metainfo')
diff --git a/app/redux/sagas/ui/load_projects.ts b/app/redux/sagas/ui/load_projects.ts
index a69bfe42e..b65c32267 100644
--- a/app/redux/sagas/ui/load_projects.ts
+++ b/app/redux/sagas/ui/load_projects.ts
@@ -7,9 +7,9 @@ import UIActions from 'redux/reducers/ui'
import { ENTRIES_PER_PAGE_DASHBOARD } from 'redux/constants'
import { IOverall } from 'redux/models/IProject'
-import {
- getProjects, getOverallStats, getLiveVisitors, getOverallStatsCaptcha,
-} from '../../../api'
+const {
+ getProjects, getOverallStats, getLiveVisitors, getOverallStatsCaptcha, logoutApi,
+} = require('../../../api')
const debug = Debug('swetrix:rx:s:load-projects')
diff --git a/app/redux/sagas/ui/load_shared_projects.ts b/app/redux/sagas/ui/load_shared_projects.ts
index ec4434c39..0ef734c08 100644
--- a/app/redux/sagas/ui/load_shared_projects.ts
+++ b/app/redux/sagas/ui/load_shared_projects.ts
@@ -7,9 +7,9 @@ import UIActions from 'redux/reducers/ui'
import { ENTRIES_PER_PAGE_DASHBOARD, isSelfhosted } from 'redux/constants'
import { IOverall } from 'redux/models/IProject'
-import {
+const {
getSharedProjects, getOverallStats, getLiveVisitors,
-} from '../../../api'
+} = require('api')
const debug = Debug('swetrix:rx:s:load-projects')
diff --git a/app/redux/sagas/ui/load_usageinfo.ts b/app/redux/sagas/ui/load_usageinfo.ts
index c697c7100..4f3c10acf 100644
--- a/app/redux/sagas/ui/load_usageinfo.ts
+++ b/app/redux/sagas/ui/load_usageinfo.ts
@@ -4,9 +4,9 @@ import Debug from 'debug'
import UIActions from 'redux/reducers/ui'
import { isSelfhosted } from 'redux/constants'
import { IUsageInfo } from 'redux/models/IUsageinfo'
-import {
+const {
getUsageInfo,
-} from '../../../api'
+} = require('api')
const debug = Debug('swetrix:rx:s:usageinfo')
diff --git a/app/redux/sagas/ui/share_verify.ts b/app/redux/sagas/ui/share_verify.ts
index 66bb9deae..151311d49 100644
--- a/app/redux/sagas/ui/share_verify.ts
+++ b/app/redux/sagas/ui/share_verify.ts
@@ -1,7 +1,6 @@
import { call, put } from 'redux-saga/effects'
-
-import { verifyShare } from 'api'
import sagaActions from '../actions'
+const { verifyShare } = require('api')
export default function* shareVerify({ payload: { data, successfulCallback, errorCallback } }: {
payload: {
diff --git a/app/redux/sagas/ui/worker_general_stats.ts b/app/redux/sagas/ui/worker_general_stats.ts
index c653f9879..5c781d81e 100644
--- a/app/redux/sagas/ui/worker_general_stats.ts
+++ b/app/redux/sagas/ui/worker_general_stats.ts
@@ -3,10 +3,10 @@ import {
} from 'redux-saga/effects'
import Debug from 'debug'
-import { getGeneralStats } from 'api'
import UIActions from 'redux/reducers/ui'
import { isSelfhosted } from 'redux/constants'
import { IStats } from 'redux/models/IStats'
+const { getGeneralStats } = require('api')
const debug = Debug('swetrix:rx:s:general-stats')
diff --git a/app/redux/sagas/ui/worker_live_visitors.ts b/app/redux/sagas/ui/worker_live_visitors.ts
index d39c5e415..cbab800cf 100644
--- a/app/redux/sagas/ui/worker_live_visitors.ts
+++ b/app/redux/sagas/ui/worker_live_visitors.ts
@@ -5,11 +5,11 @@ import _map from 'lodash/map'
import _filter from 'lodash/filter'
import _isEmpty from 'lodash/isEmpty'
-import { getLiveVisitors } from 'api'
import UIActions from 'redux/reducers/ui'
import { LIVE_VISITORS_UPDATE_INTERVAL, tabForSharedProject } from 'redux/constants'
import { ISharedProject } from '../../models/ISharedProject'
import { IProject } from '../../models/IProject'
+const { getLiveVisitors } = require('api')
export default function* liveVisitors() {
while (true) {