mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-20 23:32:14 +00:00
Add navigate method to Analytics provider (#5367)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
bb1abdc8cc
commit
d3fa4908ef
@ -13,6 +13,7 @@ export interface AnalyticProvider {
|
|||||||
setWorkspace: (ws: string) => void
|
setWorkspace: (ws: string) => void
|
||||||
handleEvent: (event: string) => void
|
handleEvent: (event: string) => void
|
||||||
handleError: (error: Error) => void
|
handleError: (error: Error) => void
|
||||||
|
navigate: (path: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Analytics = {
|
export const Analytics = {
|
||||||
@ -51,6 +52,12 @@ export const Analytics = {
|
|||||||
providers.forEach((provider) => {
|
providers.forEach((provider) => {
|
||||||
provider.handleError(error)
|
provider.handleError(error)
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
navigate (path: string): void {
|
||||||
|
providers.forEach((provider) => {
|
||||||
|
provider.navigate(path)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import { Analytics } from '@hcengineering/analytics'
|
||||||
import { clone } from '@hcengineering/core'
|
import { clone } from '@hcengineering/core'
|
||||||
import { derived, get, writable } from 'svelte/store'
|
import { derived, get, writable } from 'svelte/store'
|
||||||
import { closePopup } from './popups'
|
import { closePopup } from './popups'
|
||||||
@ -177,6 +178,7 @@ export function navigate (location: PlatformLocation, replace = false): boolean
|
|||||||
if (cur !== url) {
|
if (cur !== url) {
|
||||||
const data = !embeddedPlatform ? null : { location }
|
const data = !embeddedPlatform ? null : { location }
|
||||||
const _url = !embeddedPlatform ? url : undefined
|
const _url = !embeddedPlatform ? url : undefined
|
||||||
|
Analytics.navigate(url)
|
||||||
if (replace) {
|
if (replace) {
|
||||||
history.replaceState(data, '', _url)
|
history.replaceState(data, '', _url)
|
||||||
} else {
|
} else {
|
||||||
|
@ -250,7 +250,7 @@ export function start (
|
|||||||
lastNameFirst?: string
|
lastNameFirst?: string
|
||||||
},
|
},
|
||||||
port: number,
|
port: number,
|
||||||
extraConfig?: Record<string, string>
|
extraConfig?: Record<string, string | undefined>
|
||||||
): () => void {
|
): () => void {
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import { StorageConfiguration } from '@hcengineering/server-core'
|
|||||||
import serverToken from '@hcengineering/server-token'
|
import serverToken from '@hcengineering/server-token'
|
||||||
import { start } from '.'
|
import { start } from '.'
|
||||||
|
|
||||||
export function startFront (ctx: MeasureContext, extraConfig?: Record<string, string>): void {
|
export function startFront (ctx: MeasureContext, extraConfig?: Record<string, string | undefined>): void {
|
||||||
const defaultLanguage = process.env.DEFAULT_LANGUAGE ?? 'en'
|
const defaultLanguage = process.env.DEFAULT_LANGUAGE ?? 'en'
|
||||||
const languages = process.env.LANGUAGES ?? 'en,ru'
|
const languages = process.env.LANGUAGES ?? 'en,ru'
|
||||||
const SERVER_PORT = parseInt(process.env.SERVER_PORT ?? '8080')
|
const SERVER_PORT = parseInt(process.env.SERVER_PORT ?? '8080')
|
||||||
|
Loading…
Reference in New Issue
Block a user