refactor(stage-ui): rename analytics runtime path (#2466)

This commit is contained in:
RainbowBird
2026-09-04 23:37:45 +08:00
committed by GitHub
parent ab2c1c99bb
commit 05007ce3ca
47 changed files with 33 additions and 33 deletions
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { all } from '@proj-airi/i18n'
import { useAnalytics } from '@proj-airi/stage-ui/composables/use-analytics'
import { isAnalyticsAvailableInBuild } from '@proj-airi/stage-ui/libs/analytics'
import { isAnalyticsAvailableInBuild } from '@proj-airi/stage-ui/libs/product-signals'
import { useSettings } from '@proj-airi/stage-ui/stores/settings'
import { FieldCheckbox, FieldCombobox, useTheme } from '@proj-airi/ui'
import { computed } from 'vue'
+2 -2
View File
@@ -31,8 +31,8 @@
"./features/motions/live2d": "./src/features/motions/live2d/index.ts",
"./libs/inference/adapters/*": "./src/libs/inference/adapters/*.ts",
"./libs/inference": "./src/libs/inference/index.ts",
"./libs/analytics": "./src/libs/analytics/index.ts",
"./libs/analytics/*": "./src/libs/analytics/*.ts",
"./libs/product-signals": "./src/libs/product-signals/index.ts",
"./libs/product-signals/*": "./src/libs/product-signals/*.ts",
"./libs/pinia": "./src/libs/pinia/index.ts",
"./libs/providers/stream-transcription": "./src/libs/providers/stream-transcription/index.ts",
"./libs/providers/providers/aliyun-nls": "./src/libs/providers/providers/aliyun-nls/index.ts",
@@ -28,7 +28,7 @@ vi.mock('vue-i18n', () => ({
}),
}))
vi.mock('../libs/analytics', () => ({
vi.mock('../libs/product-signals', () => ({
captureAnalyticsEvent: analyticsMocks.posthogCaptureMock,
enableAnalytics: analyticsMocks.ensureAnalyticsInitializedMock,
getAnalytics: () => ({
@@ -1,12 +1,12 @@
import type { ControlsIslandAction } from '../libs/analytics/events/controls-island'
import type { ControlsIslandAction } from '../libs/product-signals/events/controls-island'
import type { SpeechOutputStopReason } from '../stores/speech-output-control'
import { isStageCapacitor, isStageTamagotchi } from '@proj-airi/stage-shared'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { captureAnalyticsEvent, enableAnalytics, getAnalytics, getAnalyticsPrivacyPolicyUrl, isAnalyticsAvailableInBuild } from '../libs/analytics'
import { captureTrackButtonEvent } from '../libs/analytics/events/interaction'
import { captureAnalyticsEvent, enableAnalytics, getAnalytics, getAnalyticsPrivacyPolicyUrl, isAnalyticsAvailableInBuild } from '../libs/product-signals'
import { captureTrackButtonEvent } from '../libs/product-signals/events/interaction'
import { useSettingsAnalytics } from '../stores/settings/analytics'
import { useSettingsGeneral } from '../stores/settings/general'
@@ -36,7 +36,7 @@ export type MessageInputMode = 'text' | 'voice'
export type ConversationEventSource = 'new_session' | 'fork' | 'history' | 'share_button' | 'unknown'
export type AiUsageSource = 'reported' | 'estimated' | 'unavailable'
/** Stable, low-cardinality actions emitted by the Electron controls island. */
export type { ControlsIslandAction } from '../libs/analytics/events/controls-island'
export type { ControlsIslandAction } from '../libs/product-signals/events/controls-island'
/**
* Full stage vocabulary of the cross-surface `oauth_callback_failed` event.
@@ -1,11 +1,11 @@
import type { ObjectDirective, Plugin } from 'vue'
import type { TrackButtonEvent } from '../libs/analytics/events/interaction'
import type { TrackButtonEvent } from '../libs/product-signals/events/interaction'
import { captureTrackButtonEvent } from '../libs/analytics/events/interaction'
import { captureTrackButtonEvent } from '../libs/product-signals/events/interaction'
export type { ControlsIslandAction } from '../libs/analytics/events/controls-island'
export type { TrackButtonEvent } from '../libs/analytics/events/interaction'
export type { ControlsIslandAction } from '../libs/product-signals/events/controls-island'
export type { TrackButtonEvent } from '../libs/product-signals/events/interaction'
/**
* Creates the DOM directive used by the app-level tracking plugin.
@@ -11,7 +11,7 @@ const posthogMocks = vi.hoisted(() => ({
})),
}))
vi.mock('./analytics', () => ({
vi.mock('./product-signals', () => ({
getAnalyticsIdentitySnapshot: posthogMocks.getAnalyticsIdentitySnapshot,
}))
+1 -1
View File
@@ -1,5 +1,5 @@
import { useAuthStore } from '../stores/auth'
import { getAnalyticsIdentitySnapshot } from './analytics'
import { getAnalyticsIdentitySnapshot } from './product-signals'
import { SERVER_URL } from './server'
/**
@@ -1,10 +1,10 @@
import { createOpenAI } from '@xsai-ext/providers/create'
import { getActivePinia } from 'pinia'
import { AIRI_CHAT_SESSION_ID_HEADER } from '../../../../libs/analytics-headers'
import { getAuthToken } from '../../../../libs/auth'
import { SERVER_URL } from '../../../../libs/server'
import { useChatSessionStore } from '../../../../stores/chat/session-store'
import { AIRI_CHAT_SESSION_ID_HEADER } from '../../../product-signals/headers'
export const OFFICIAL_ICON = 'i-solar:star-bold-duotone'
@@ -13,7 +13,7 @@ import {
AIRI_CHAT_APP_SURFACE_HEADER,
AIRI_CHAT_ROUND_ID_HEADER,
AIRI_CHAT_SESSION_ID_HEADER,
} from '../libs/analytics-headers'
} from '../libs/product-signals/headers'
import { useChatStore } from './chat'
import { useConsciousnessSettingsStore } from './modules/consciousness-settings'
@@ -94,7 +94,7 @@ vi.mock('../composables', () => ({
getConversationAnalyticsSurface: () => 'web',
}))
vi.mock('../libs/analytics', () => ({
vi.mock('../libs/product-signals', () => ({
getAnalytics: () => ({
emit: (event: { name: string }, properties: unknown) => {
switch (event.name) {
+3 -3
View File
@@ -17,13 +17,13 @@ import { shallowRef, toRaw } from 'vue'
import { getConversationAnalyticsSurface } from '../composables'
import { useAiriRuntimePrompt } from '../composables/use-airi-runtime-prompt'
import { activeTurnSpan, startSpan } from '../composables/use-io-tracer'
import { extractMessageText, isCloudSyncableMessage } from '../libs/chat-sync'
import { createChatAnalyticsHooks, getProviderMode } from '../libs/product-signals/events/chat'
import {
AIRI_CHAT_APP_SURFACE_HEADER,
AIRI_CHAT_ROUND_ID_HEADER,
AIRI_CHAT_SESSION_ID_HEADER,
} from '../libs/analytics-headers'
import { createChatAnalyticsHooks, getProviderMode } from '../libs/analytics/events/chat'
import { extractMessageText, isCloudSyncableMessage } from '../libs/chat-sync'
} from '../libs/product-signals/headers'
import { useLLM } from './ai/chat-llm/llm'
import { resolveLlmTools } from './ai/chat-llm/tool-resolver'
import { useLlmToolsStore } from './ai/chat-llm/tools'
@@ -51,7 +51,7 @@ vi.mock('../../database/repos/chat-sessions.repo', () => ({
},
}))
vi.mock('../../libs/analytics', () => ({
vi.mock('../../libs/product-signals', () => ({
captureAnalyticsEvent: vi.fn(),
}))
@@ -13,7 +13,6 @@ import { defineStore, storeToRefs } from 'pinia'
import { computed, ref, watch } from 'vue'
import { chatSessionsRepo } from '../../database/repos/chat-sessions.repo'
import { captureAnalyticsEvent } from '../../libs/analytics'
import { authedFetch } from '../../libs/auth-fetch'
import {
applyCreateActions,
@@ -24,6 +23,7 @@ import {
mergeCloudMessagesIntoLocal,
reconcileLocalAndRemote,
} from '../../libs/chat-sync'
import { captureAnalyticsEvent } from '../../libs/product-signals'
import { SERVER_URL } from '../../libs/server'
import { useAuthStore } from '../auth'
import { useAiriCardStore } from '../modules/airi-card'
@@ -9,7 +9,7 @@ import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { DEFAULT_ARTISTRY_WIDGET_SPAWNING_PROMPT } from '../../constants/prompts/character-defaults'
import { captureAnalyticsEvent } from '../../libs/analytics'
import { captureAnalyticsEvent } from '../../libs/product-signals'
import { useSettingsStageModel } from '../settings/stage-model'
import { useArtistryStore } from './artistry'
import { useConsciousnessStore } from './consciousness'