refactor(stage-*): analytics and telemetry, including consent (#1414)

---------

Co-authored-by-agent: Codex <267193182+codex@users.noreply.github.com>
Co-authored-by-agent: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: RainbowBird <rbxin2003@outlook.com>
Co-authored-by: Neko <neko@ayaka.moe>
This commit is contained in:
Rin
2026-03-24 13:01:39 +08:00
committed by GitHub
co-authored by autofix-ci[bot] RainbowBird Neko
parent 8baaff7778
commit f85a809d7c
37 changed files with 425 additions and 191 deletions
+9 -2
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { OnboardingDialog, ToasterRoot } from '@proj-airi/stage-ui/components'
import { useSharedAnalyticsStore } from '@proj-airi/stage-ui/stores/analytics'
import { OnboardingDialog, OnboardingStepAnalyticsNotice, ToasterRoot } from '@proj-airi/stage-ui/components'
import { isPosthogAvailableInBuild, useSharedAnalyticsStore } from '@proj-airi/stage-ui/stores/analytics'
import { useCharacterOrchestratorStore } from '@proj-airi/stage-ui/stores/character'
import { useChatSessionStore } from '@proj-airi/stage-ui/stores/chat/session-store'
import { useDisplayModelsStore } from '@proj-airi/stage-ui/stores/display-models'
@@ -59,6 +59,12 @@ const colors = computed(() => {
return [primaryColor.value, secondaryColor.value, tertiaryColor.value, isDark.value ? '#121212' : '#FFFFFF']
})
const onboardingExtraSteps = computed(() => {
return isPosthogAvailableInBuild()
? [{ id: 'analytics-notice', component: OnboardingStepAnalyticsNotice }]
: []
})
watch(settings.language, () => {
i18n.locale.value = settings.language.value
})
@@ -125,6 +131,7 @@ function handleSetupSkipped() {
<!-- First Time Setup Dialog -->
<OnboardingDialog
v-model="showingSetup"
:extra-steps="onboardingExtraSteps"
@configured="handleSetupConfigured"
@skipped="handleSetupSkipped"
/>
-1
View File
@@ -17,7 +17,6 @@ import App from './App.vue'
import { i18n } from './modules/i18n'
import './modules/posthog'
import '@proj-airi/font-cjkfonts-allseto/index.css'
import '@proj-airi/font-xiaolai/index.css'
import '@unocss/reset/tailwind.css'
+2 -29
View File
@@ -1,28 +1,8 @@
import messages from '@proj-airi/i18n/locales'
import { resolveSupportedLocale } from '@proj-airi/i18n'
import { createI18n } from 'vue-i18n'
const languageRemap: Record<string, string> = {
'zh-CN': 'zh-Hans',
'zh-TW': 'zh-Hant',
'zh-HK': 'zh-Hans', // TODO: remove this when zh-Hant is supported
'zh-Hant': 'zh-Hans', // TODO: remove this when zh-Hant is supported
'en-US': 'en',
'en-GB': 'en',
'en-AU': 'en',
'en': 'en',
'es-ES': 'es',
'es-MX': 'es',
'es-AR': 'es',
'es': 'es',
'vi': 'vi',
'vi-VN': 'vi',
'ru': 'ru',
'ru-RU': 'ru',
'fr': 'fr',
'fr-FR': 'fr',
}
function getLocale() {
let language = localStorage.getItem('settings/language')
@@ -31,14 +11,7 @@ function getLocale() {
language = navigator.language || 'en'
}
const languages = Object.keys(messages!)
if (languageRemap[language || 'en'] != null) {
language = languageRemap[language || 'en']
}
if (language && languages.includes(language))
return language
return 'en'
return resolveSupportedLocale(language, Object.keys(messages!))
}
export const i18n = createI18n({
-9
View File
@@ -1,9 +0,0 @@
import posthog from 'posthog-js'
import { DEFAULT_POSTHOG_CONFIG, POSTHOG_PROJECT_KEY_WEB } from '../../../../posthog.config'
if (!import.meta.env.DEV) {
posthog.init(POSTHOG_PROJECT_KEY_WEB, {
...DEFAULT_POSTHOG_CONFIG,
})
}