chore: 导入清理前的完整工程状态(含 Capacitor 原生壳,作为回滚备份点)

This commit is contained in:
toor
2026-10-21 11:50:10 +08:00
committed by trae-solo-agent
commit 8ded87a3a8
389 changed files with 52242 additions and 0 deletions
@@ -0,0 +1,9 @@
import { captureCookAcquisition } from '~/utils/acquisition'
export default defineNuxtPlugin({
name: 'cook-acquisition',
enforce: 'pre',
setup() {
captureCookAcquisition()
},
})
+52
View File
@@ -0,0 +1,52 @@
import { isPrivateAnalyticsUrl, resolveClarityConfig, setCookEventTracker } from '~/utils/analytics'
export default defineNuxtPlugin(() => {
const config = useRuntimeConfig().public
const clarity = resolveClarityConfig({
projectId: config.clarityProjectId,
domains: config.clarityDomains,
}, window.location.href, import.meta.dev)
if (!clarity || navigator.doNotTrack === '1'
|| (navigator as Navigator & { globalPrivacyControl?: boolean }).globalPrivacyControl
|| (document.referrer && isPrivateAnalyticsUrl(document.referrer))) {
return
}
let stopped = false
const script = useScriptClarity({
id: clarity.projectId,
scriptOptions: { bundle: false, proxy: false, trigger: 'manual' },
scriptInput: { src: `https://www.clarity.ms/tag/${clarity.projectId}`, referrerpolicy: 'no-referrer' },
})
function stop() {
stopped = true
try {
window.clarity?.('stop')
}
catch {
// A recorder error must not prevent login navigation.
}
}
// Stop before a SPA navigation can expose a callback URL to the recorder.
useRouter().beforeEach((to) => {
if (isPrivateAnalyticsUrl(new URL(to.fullPath, window.location.origin).href)) {
stop()
}
})
setCookEventTracker((name) => {
if (!stopped && !isPrivateAnalyticsUrl(window.location.href))
return script.proxy.clarity('event', name)
})
onNuxtReady(() => {
if (stopped || isPrivateAnalyticsUrl(window.location.href))
return
void script.load().then(() => {
if (stopped)
stop()
}).catch(() => undefined)
})
})
@@ -0,0 +1,7 @@
export default defineNuxtPlugin({
name: 'cook-user-data-sync',
dependsOn: ['cook-auth'],
setup() {
useUserDataSync().install()
},
})
+27
View File
@@ -0,0 +1,27 @@
import { useDebounceFn } from '@vueuse/core'
import { applyYunleHostLayout, waitForYunleHost } from '~/utils/yunleHost'
/**
* 在云乐坊 App 容器内打开时,按宿主的展示形态、安全区与胶囊位置调整布局
*/
export default defineNuxtPlugin({
name: 'cook-yunle-host',
setup() {
void waitForYunleHost().then(async (host) => {
if (!host)
return
const root = document.documentElement
const sync = async () => {
try {
applyYunleHostLayout(root, await host.getEnv(), window.innerWidth)
}
catch {}
}
await sync()
// 旋转屏幕或页面收起 / 恢复标题栏后,安全区与胶囊位置都会变化
window.addEventListener('resize', useDebounceFn(sync, 150))
})
},
})
@@ -0,0 +1,7 @@
export default defineNuxtPlugin({
name: 'cook-auth',
dependsOn: ['cook-acquisition'],
setup() {
void useYunlefunAuth().initialize()
},
})