@4399ywkf/cli 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/templates/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/AppTheme.tsx +136 -0
- package/dist/templates/DIRECTORY_STRUCTURE.md +141 -0
- package/dist/templates/GlobalProvider/AppTheme.tsx +136 -0
- package/dist/templates/GlobalProvider/Locale.tsx +84 -0
- package/dist/templates/GlobalProvider/Query.tsx +12 -0
- package/dist/templates/GlobalProvider/StyleRegistry.tsx +9 -0
- package/dist/templates/GlobalProvider/index.tsx +23 -0
- package/dist/templates/HarmonyOS_Sans_Bold.woff2 +0 -0
- package/dist/templates/HarmonyOS_Sans_Medium.woff2 +0 -0
- package/dist/templates/HarmonyOS_Sans_Regular.woff2 +0 -0
- package/dist/templates/Locale.tsx +49 -54
- package/dist/templates/MainContentWrap.tsx +11 -15
- package/dist/templates/Query.tsx +12 -0
- package/dist/templates/StyleRegistry.tsx +9 -0
- package/dist/templates/ThemeContext.tsx +27 -24
- package/dist/templates/analyzeUnusedKeys.ts +506 -0
- package/dist/templates/app/.i18nrc.js +57 -0
- package/dist/templates/app/config/env/.env.public.tpl +2 -19
- package/dist/templates/app/config/jwt/index.ts +4 -4
- package/dist/templates/app/config/request/error-handler.ts +67 -0
- package/dist/templates/app/config/request/index.ts +127 -129
- package/dist/templates/app/config/request/interceptors.ts +118 -0
- package/dist/templates/app/config/request/token-manager.ts +23 -0
- package/dist/templates/app/config/request/types.ts +63 -0
- package/dist/templates/app/config/rspack/rspack.config.mjs +62 -61
- package/dist/templates/app/config/rspack/rspack.prod.mjs +41 -62
- package/dist/templates/app/docs/DIRECTORY_STRUCTURE.md +141 -0
- package/dist/templates/app/docs/glossary.md +11 -0
- package/dist/templates/app/locales/zh-CN/common.json +3 -0
- package/dist/templates/app/package.json.tpl +8 -25
- package/dist/templates/app/public/fonts/HarmonyOS_Sans_Bold.woff2 +0 -0
- package/dist/templates/app/public/fonts/HarmonyOS_Sans_Medium.woff2 +0 -0
- package/dist/templates/app/public/fonts/HarmonyOS_Sans_Regular.woff2 +0 -0
- package/dist/templates/app/react-app-env.d.ts +13 -8
- package/dist/templates/app/scripts/i18nWorkflow/analyzeUnusedKeys.ts +506 -0
- package/dist/templates/app/scripts/i18nWorkflow/cleanUnusedKeys.ts +344 -0
- package/dist/templates/app/scripts/i18nWorkflow/const.ts +18 -0
- package/dist/templates/app/scripts/i18nWorkflow/flattenLocaleKeys.ts +139 -0
- package/dist/templates/app/scripts/i18nWorkflow/genDefaultLocale.ts +19 -0
- package/dist/templates/app/scripts/i18nWorkflow/genDiff.ts +49 -0
- package/dist/templates/app/scripts/i18nWorkflow/i18nConfig.ts +7 -0
- package/dist/templates/app/scripts/i18nWorkflow/index.ts +11 -0
- package/dist/templates/app/scripts/i18nWorkflow/protectedPatterns.ts +91 -0
- package/dist/templates/app/scripts/i18nWorkflow/utils.ts +76 -0
- package/dist/templates/app/src/bootstrap/index.ts +34 -0
- package/dist/templates/app/src/components/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/app/src/config/env.ts +84 -0
- package/dist/templates/app/src/index.tsx +13 -51
- package/dist/templates/app/src/layout/GlobalProvider/AppTheme.tsx +136 -0
- package/dist/templates/app/src/layout/GlobalProvider/Locale.tsx +84 -0
- package/dist/templates/app/src/layout/GlobalProvider/Query.tsx +12 -0
- package/dist/templates/app/src/layout/GlobalProvider/StyleRegistry.tsx +9 -0
- package/dist/templates/app/src/layout/GlobalProvider/index.tsx +23 -0
- package/dist/templates/app/src/layout/Locale.tsx +14 -18
- package/dist/templates/app/src/layout/MainContentWrap.tsx +11 -15
- package/dist/templates/app/src/layout/ThemeContext.tsx +27 -24
- package/dist/templates/app/src/locales/default/common.ts +3 -1
- package/dist/templates/app/src/locales/utils.ts +23 -0
- package/dist/templates/app/src/micro/garfish.ts +53 -0
- package/dist/templates/app/src/pages/base/index.tsx +280 -25
- package/dist/templates/app/src/routes.tsx +21 -12
- package/dist/templates/app/src/types/global.d.ts +19 -0
- package/dist/templates/app/src/utils/index.ts +3 -1
- package/dist/templates/app/store/middleware/createDevtools.ts +7 -7
- package/dist/templates/app/tsconfig.json +19 -3
- package/dist/templates/base/index.tsx +280 -25
- package/dist/templates/bootstrap/index.ts +34 -0
- package/dist/templates/cleanUnusedKeys.ts +344 -0
- package/dist/templates/common.json +3 -0
- package/dist/templates/common.ts +3 -1
- package/dist/templates/components/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/config/env/.env.public.tpl +2 -19
- package/dist/templates/config/env.ts +84 -0
- package/dist/templates/config/jwt/index.ts +4 -4
- package/dist/templates/config/request/error-handler.ts +67 -0
- package/dist/templates/config/request/index.ts +127 -129
- package/dist/templates/config/request/interceptors.ts +118 -0
- package/dist/templates/config/request/token-manager.ts +23 -0
- package/dist/templates/config/request/types.ts +63 -0
- package/dist/templates/config/rspack/rspack.config.mjs +62 -61
- package/dist/templates/config/rspack/rspack.prod.mjs +41 -62
- package/dist/templates/const.ts +18 -0
- package/dist/templates/createDevtools.ts +7 -7
- package/dist/templates/default/common.ts +3 -1
- package/dist/templates/docs/DIRECTORY_STRUCTURE.md +141 -0
- package/dist/templates/docs/glossary.md +11 -0
- package/dist/templates/env/.env.public.tpl +2 -19
- package/dist/templates/env.ts +83 -2
- package/dist/templates/error-handler.ts +67 -0
- package/dist/templates/flattenLocaleKeys.ts +139 -0
- package/dist/templates/fonts/HarmonyOS_Sans_Bold.woff2 +0 -0
- package/dist/templates/fonts/HarmonyOS_Sans_Medium.woff2 +0 -0
- package/dist/templates/fonts/HarmonyOS_Sans_Regular.woff2 +0 -0
- package/dist/templates/garfish.ts +53 -0
- package/dist/templates/genDefaultLocale.ts +19 -0
- package/dist/templates/genDiff.ts +49 -0
- package/dist/templates/global.d.ts +19 -0
- package/dist/templates/glossary.md +11 -0
- package/dist/templates/i18nConfig.ts +7 -0
- package/dist/templates/i18nWorkflow/analyzeUnusedKeys.ts +506 -0
- package/dist/templates/i18nWorkflow/cleanUnusedKeys.ts +344 -0
- package/dist/templates/i18nWorkflow/const.ts +18 -0
- package/dist/templates/i18nWorkflow/flattenLocaleKeys.ts +139 -0
- package/dist/templates/i18nWorkflow/genDefaultLocale.ts +19 -0
- package/dist/templates/i18nWorkflow/genDiff.ts +49 -0
- package/dist/templates/i18nWorkflow/i18nConfig.ts +7 -0
- package/dist/templates/i18nWorkflow/index.ts +11 -0
- package/dist/templates/i18nWorkflow/protectedPatterns.ts +91 -0
- package/dist/templates/i18nWorkflow/utils.ts +76 -0
- package/dist/templates/index.tsx +280 -25
- package/dist/templates/interceptors.ts +118 -0
- package/dist/templates/jwt/index.ts +4 -4
- package/dist/templates/layout/GlobalProvider/AppTheme.tsx +136 -0
- package/dist/templates/layout/GlobalProvider/Locale.tsx +84 -0
- package/dist/templates/layout/GlobalProvider/Query.tsx +12 -0
- package/dist/templates/layout/GlobalProvider/StyleRegistry.tsx +9 -0
- package/dist/templates/layout/GlobalProvider/index.tsx +23 -0
- package/dist/templates/layout/Locale.tsx +14 -18
- package/dist/templates/layout/MainContentWrap.tsx +11 -15
- package/dist/templates/layout/ThemeContext.tsx +27 -24
- package/dist/templates/locales/default/common.ts +3 -1
- package/dist/templates/locales/utils.ts +23 -0
- package/dist/templates/locales/zh-CN/common.json +3 -0
- package/dist/templates/micro/garfish.ts +53 -0
- package/dist/templates/middleware/createDevtools.ts +7 -7
- package/dist/templates/package.json.tpl +8 -25
- package/dist/templates/page.tsx +21 -19
- package/dist/templates/pages/base/index.tsx +280 -25
- package/dist/templates/protectedPatterns.ts +91 -0
- package/dist/templates/public/fonts/HarmonyOS_Sans_Bold.woff2 +0 -0
- package/dist/templates/public/fonts/HarmonyOS_Sans_Medium.woff2 +0 -0
- package/dist/templates/public/fonts/HarmonyOS_Sans_Regular.woff2 +0 -0
- package/dist/templates/react-app-env.d.ts +13 -8
- package/dist/templates/request/error-handler.ts +67 -0
- package/dist/templates/request/index.ts +127 -129
- package/dist/templates/request/interceptors.ts +118 -0
- package/dist/templates/request/token-manager.ts +23 -0
- package/dist/templates/request/types.ts +63 -0
- package/dist/templates/routes.tsx +21 -12
- package/dist/templates/rspack/rspack.config.mjs +62 -61
- package/dist/templates/rspack/rspack.prod.mjs +41 -62
- package/dist/templates/rspack.config.mjs +62 -61
- package/dist/templates/rspack.prod.mjs +41 -62
- package/dist/templates/scripts/i18nWorkflow/analyzeUnusedKeys.ts +506 -0
- package/dist/templates/scripts/i18nWorkflow/cleanUnusedKeys.ts +344 -0
- package/dist/templates/scripts/i18nWorkflow/const.ts +18 -0
- package/dist/templates/scripts/i18nWorkflow/flattenLocaleKeys.ts +139 -0
- package/dist/templates/scripts/i18nWorkflow/genDefaultLocale.ts +19 -0
- package/dist/templates/scripts/i18nWorkflow/genDiff.ts +49 -0
- package/dist/templates/scripts/i18nWorkflow/i18nConfig.ts +7 -0
- package/dist/templates/scripts/i18nWorkflow/index.ts +11 -0
- package/dist/templates/scripts/i18nWorkflow/protectedPatterns.ts +91 -0
- package/dist/templates/scripts/i18nWorkflow/utils.ts +76 -0
- package/dist/templates/src/bootstrap/index.ts +34 -0
- package/dist/templates/src/components/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/src/config/env.ts +84 -0
- package/dist/templates/src/index.tsx +13 -51
- package/dist/templates/src/layout/GlobalProvider/AppTheme.tsx +136 -0
- package/dist/templates/src/layout/GlobalProvider/Locale.tsx +84 -0
- package/dist/templates/src/layout/GlobalProvider/Query.tsx +12 -0
- package/dist/templates/src/layout/GlobalProvider/StyleRegistry.tsx +9 -0
- package/dist/templates/src/layout/GlobalProvider/index.tsx +23 -0
- package/dist/templates/src/layout/Locale.tsx +14 -18
- package/dist/templates/src/layout/MainContentWrap.tsx +11 -15
- package/dist/templates/src/layout/ThemeContext.tsx +27 -24
- package/dist/templates/src/locales/default/common.ts +3 -1
- package/dist/templates/src/locales/utils.ts +23 -0
- package/dist/templates/src/micro/garfish.ts +53 -0
- package/dist/templates/src/pages/base/index.tsx +280 -25
- package/dist/templates/src/routes.tsx +21 -12
- package/dist/templates/src/types/global.d.ts +19 -0
- package/dist/templates/src/utils/index.ts +3 -1
- package/dist/templates/store/middleware/createDevtools.ts +7 -7
- package/dist/templates/token-manager.ts +23 -0
- package/dist/templates/tsconfig.json +19 -3
- package/dist/templates/type.ts +23 -24
- package/dist/templates/types/global.d.ts +19 -0
- package/dist/templates/utils/index.ts +3 -1
- package/dist/templates/utils.ts +23 -0
- package/dist/templates/zh-CN/common.json +3 -0
- package/package.json +19 -21
- package/dist/templates/app/config/sentry/sentry.config.ts +0 -188
- package/dist/templates/app/src/hooks/useRouteTitle.tsx +0 -36
- package/dist/templates/app/src/hooks/useSentry.ts +0 -92
- package/dist/templates/app/src/pages/base/layout.tsx +0 -6
- package/dist/templates/app/src/pages/base/page.tsx +0 -25
- package/dist/templates/app/src/utils/env.ts +0 -3
- package/dist/templates/app/src/utils/format.ts +0 -21
- package/dist/templates/app/src/utils/getMicroApp.ts +0 -39
- package/dist/templates/app/src/utils/sentry.ts +0 -187
- package/dist/templates/app/src/utils/sentryDecorators.ts +0 -34
- package/dist/templates/app/src/utils/updateVersion.ts +0 -186
- package/dist/templates/base/layout.tsx +0 -6
- package/dist/templates/base/page.tsx +0 -25
- package/dist/templates/config/public/404.png +0 -0
- package/dist/templates/config/public/favicon.ico +0 -0
- package/dist/templates/config/public/images/banner_market_modal.webp +0 -0
- package/dist/templates/config/public/images/chatmode_chat_dark.webp +0 -0
- package/dist/templates/config/public/images/chatmode_chat_light.webp +0 -0
- package/dist/templates/config/public/images/chatmode_docs_dark.webp +0 -0
- package/dist/templates/config/public/images/chatmode_docs_light.webp +0 -0
- package/dist/templates/config/public/images/empty_topic_dark.webp +0 -0
- package/dist/templates/config/public/images/empty_topic_light.webp +0 -0
- package/dist/templates/config/public/images/screenshot_background.webp +0 -0
- package/dist/templates/config/public/images/theme_auto.webp +0 -0
- package/dist/templates/config/public/images/theme_dark.webp +0 -0
- package/dist/templates/config/public/images/theme_light.webp +0 -0
- package/dist/templates/config/public/index.html +0 -29
- package/dist/templates/config/sentry/sentry.config.ts +0 -188
- package/dist/templates/format.ts +0 -21
- package/dist/templates/getMicroApp.ts +0 -39
- package/dist/templates/hooks/useRouteTitle.tsx +0 -36
- package/dist/templates/hooks/useSentry.ts +0 -92
- package/dist/templates/layout.tsx +0 -6
- package/dist/templates/pages/base/layout.tsx +0 -6
- package/dist/templates/pages/base/page.tsx +0 -25
- package/dist/templates/sentry/sentry.config.ts +0 -188
- package/dist/templates/sentry.config.ts +0 -188
- package/dist/templates/sentry.ts +0 -187
- package/dist/templates/sentryDecorators.ts +0 -34
- package/dist/templates/src/hooks/useRouteTitle.tsx +0 -36
- package/dist/templates/src/hooks/useSentry.ts +0 -92
- package/dist/templates/src/pages/base/layout.tsx +0 -6
- package/dist/templates/src/pages/base/page.tsx +0 -25
- package/dist/templates/src/utils/env.ts +0 -3
- package/dist/templates/src/utils/format.ts +0 -21
- package/dist/templates/src/utils/getMicroApp.ts +0 -39
- package/dist/templates/src/utils/sentry.ts +0 -187
- package/dist/templates/src/utils/sentryDecorators.ts +0 -34
- package/dist/templates/src/utils/updateVersion.ts +0 -186
- package/dist/templates/updateVersion.ts +0 -186
- package/dist/templates/useRouteTitle.tsx +0 -36
- package/dist/templates/useSentry.ts +0 -92
- package/dist/templates/utils/env.ts +0 -3
- package/dist/templates/utils/format.ts +0 -21
- package/dist/templates/utils/getMicroApp.ts +0 -39
- package/dist/templates/utils/sentry.ts +0 -187
- package/dist/templates/utils/sentryDecorators.ts +0 -34
- package/dist/templates/utils/updateVersion.ts +0 -186
- /package/dist/templates/app/{config/public → public}/404.png +0 -0
- /package/dist/templates/app/{config/public → public}/favicon.ico +0 -0
- /package/dist/templates/app/{config/public → public}/images/banner_market_modal.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/chatmode_chat_dark.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/chatmode_chat_light.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/chatmode_docs_dark.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/chatmode_docs_light.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/empty_topic_dark.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/empty_topic_light.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/screenshot_background.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/theme_auto.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/theme_dark.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/theme_light.webp +0 -0
- /package/dist/templates/app/{config/public → public}/index.html +0 -0
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import * as Sentry from '@sentry/react';
|
|
2
|
-
|
|
3
|
-
// 性能监控
|
|
4
|
-
export const sentryPerformance = {
|
|
5
|
-
// 开始性能追踪
|
|
6
|
-
startSpan: (name: string, op?: string) => {
|
|
7
|
-
return Sentry.startSpan(
|
|
8
|
-
{
|
|
9
|
-
name,
|
|
10
|
-
op: op || 'custom',
|
|
11
|
-
},
|
|
12
|
-
(span) => {
|
|
13
|
-
return span;
|
|
14
|
-
},
|
|
15
|
-
);
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
// 测量函数执行时间
|
|
19
|
-
measureFunction: <T extends any[], R>(fn: (...args: T) => R, name: string, op?: string): ((...args: T) => R) => {
|
|
20
|
-
return (...args: T): R => {
|
|
21
|
-
return Sentry.startSpan(
|
|
22
|
-
{
|
|
23
|
-
name,
|
|
24
|
-
op: op || 'function',
|
|
25
|
-
},
|
|
26
|
-
() => fn(...args),
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
// 测量异步函数
|
|
32
|
-
measureAsyncFunction: <T extends any[], R>(fn: (...args: T) => Promise<R>, name: string, op?: string): ((...args: T) => Promise<R>) => {
|
|
33
|
-
return async (...args: T): Promise<R> => {
|
|
34
|
-
return Sentry.startSpan(
|
|
35
|
-
{
|
|
36
|
-
name,
|
|
37
|
-
op: op || 'async_function',
|
|
38
|
-
},
|
|
39
|
-
async () => await fn(...args),
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
// 添加面包屑
|
|
45
|
-
addBreadcrumb: (message: string, category?: string, level?: Sentry.SeverityLevel) => {
|
|
46
|
-
Sentry.addBreadcrumb({
|
|
47
|
-
message,
|
|
48
|
-
category: category || 'custom',
|
|
49
|
-
level: level || 'info',
|
|
50
|
-
timestamp: Date.now() / 1000,
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
// 手动创建 span
|
|
55
|
-
withSpan: <T>(name: string, op: string, callback: () => T): T => {
|
|
56
|
-
return Sentry.startSpan({ name, op }, callback);
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// 错误报告
|
|
61
|
-
export const sentryError = {
|
|
62
|
-
// 捕获异常
|
|
63
|
-
captureException: (error: Error, context?: Record<string, any>) => {
|
|
64
|
-
Sentry.withScope((scope) => {
|
|
65
|
-
if (context) {
|
|
66
|
-
Object.entries(context).forEach(([key, value]) => {
|
|
67
|
-
scope.setExtra(key, value);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
Sentry.captureException(error);
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
// 捕获消息
|
|
75
|
-
captureMessage: (message: string, level?: Sentry.SeverityLevel) => {
|
|
76
|
-
Sentry.captureMessage(message, level || 'info');
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
// 手动报告错误
|
|
80
|
-
reportError: (error: Error, tags?: Record<string, string>) => {
|
|
81
|
-
Sentry.withScope((scope) => {
|
|
82
|
-
if (tags) {
|
|
83
|
-
Object.entries(tags).forEach(([key, value]) => {
|
|
84
|
-
scope.setTag(key, value);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
scope.setLevel('error');
|
|
88
|
-
Sentry.captureException(error);
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// 用户上下文
|
|
94
|
-
export const sentryUser = {
|
|
95
|
-
// 设置用户信息
|
|
96
|
-
setUser: (user: { id: string; email?: string; username?: string }) => {
|
|
97
|
-
Sentry.setUser(user);
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
// 清除用户信息
|
|
101
|
-
clearUser: () => {
|
|
102
|
-
Sentry.setUser(null);
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
// 设置用户反馈
|
|
106
|
-
showReportDialog: (options?: Sentry.ReportDialogOptions) => {
|
|
107
|
-
Sentry.showReportDialog(options);
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// 自定义标签和上下文
|
|
112
|
-
export const sentryContext = {
|
|
113
|
-
// 设置标签
|
|
114
|
-
setTag: (key: string, value: string) => {
|
|
115
|
-
Sentry.setTag(key, value);
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
// 设置上下文
|
|
119
|
-
setContext: (key: string, context: Record<string, any>) => {
|
|
120
|
-
Sentry.setContext(key, context);
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
// 设置额外信息
|
|
124
|
-
setExtra: (key: string, extra: any) => {
|
|
125
|
-
Sentry.setExtra(key, extra);
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// ✨ 新增:会话管理
|
|
130
|
-
export const sentrySession = {
|
|
131
|
-
// 开始用户会话
|
|
132
|
-
startUserSession: (userId: string, userInfo?: { email?: string; username?: string }) => {
|
|
133
|
-
// 设置用户信息
|
|
134
|
-
Sentry.setUser({
|
|
135
|
-
id: userId,
|
|
136
|
-
...userInfo,
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// 开始会话
|
|
140
|
-
Sentry.startSession();
|
|
141
|
-
|
|
142
|
-
// 添加会话开始的面包屑
|
|
143
|
-
Sentry.addBreadcrumb({
|
|
144
|
-
message: `User session started for ${userId}`,
|
|
145
|
-
category: 'session',
|
|
146
|
-
level: 'info',
|
|
147
|
-
});
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
// 结束用户会话
|
|
151
|
-
endUserSession: () => {
|
|
152
|
-
Sentry.addBreadcrumb({
|
|
153
|
-
message: 'User session ended',
|
|
154
|
-
category: 'session',
|
|
155
|
-
level: 'info',
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
Sentry.endSession();
|
|
159
|
-
Sentry.setUser(null);
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
// 记录页面访问(会话活动)
|
|
163
|
-
recordPageView: (pageName: string, url: string) => {
|
|
164
|
-
Sentry.addBreadcrumb({
|
|
165
|
-
message: `Page view: ${pageName}`,
|
|
166
|
-
category: 'navigation',
|
|
167
|
-
level: 'info',
|
|
168
|
-
data: {
|
|
169
|
-
url,
|
|
170
|
-
timestamp: new Date().toISOString(),
|
|
171
|
-
},
|
|
172
|
-
});
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
// 记录用户操作(保持会话活跃)
|
|
176
|
-
recordUserAction: (action: string, details?: Record<string, any>) => {
|
|
177
|
-
Sentry.addBreadcrumb({
|
|
178
|
-
message: `User action: ${action}`,
|
|
179
|
-
category: 'user',
|
|
180
|
-
level: 'info',
|
|
181
|
-
data: {
|
|
182
|
-
...details,
|
|
183
|
-
timestamp: new Date().toISOString(),
|
|
184
|
-
},
|
|
185
|
-
});
|
|
186
|
-
},
|
|
187
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { sentryPerformance } from './sentry';
|
|
2
|
-
|
|
3
|
-
// 函数性能监控装饰器
|
|
4
|
-
export function withSentryPerformance(name: string, op = 'function') {
|
|
5
|
-
return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
|
|
6
|
-
const originalMethod = descriptor.value;
|
|
7
|
-
|
|
8
|
-
descriptor.value = sentryPerformance.measureFunction(
|
|
9
|
-
originalMethod,
|
|
10
|
-
name,
|
|
11
|
-
op,
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
return descriptor;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// 异步函数性能监控装饰器
|
|
19
|
-
export function withSentryAsyncPerformance(
|
|
20
|
-
name: string,
|
|
21
|
-
op = 'async_function',
|
|
22
|
-
) {
|
|
23
|
-
return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
|
|
24
|
-
const originalMethod = descriptor.value;
|
|
25
|
-
|
|
26
|
-
descriptor.value = sentryPerformance.measureAsyncFunction(
|
|
27
|
-
originalMethod,
|
|
28
|
-
name,
|
|
29
|
-
op,
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
return descriptor;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { message, notification } from 'antd';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
const APP_NAME = process.env.APP_NAME;
|
|
5
|
-
interface IVersionRecord {
|
|
6
|
-
action: '' | 'refreshedByClick';
|
|
7
|
-
stack: string[];
|
|
8
|
-
}
|
|
9
|
-
// 对应的数组的key
|
|
10
|
-
const RECORD_KEY = `${APP_NAME}_version_record`;
|
|
11
|
-
|
|
12
|
-
// 当前版本号
|
|
13
|
-
let CUR_VERSION = '';
|
|
14
|
-
// 页面是否有通知
|
|
15
|
-
let CUR_STATE = false;
|
|
16
|
-
// 是否通过点击通知触发刷新
|
|
17
|
-
let REFRESHED_BY_CLICK = false;
|
|
18
|
-
|
|
19
|
-
window.addEventListener('beforeunload', () => {
|
|
20
|
-
if (!REFRESHED_BY_CLICK) {
|
|
21
|
-
const recordStr = localStorage.getItem(RECORD_KEY);
|
|
22
|
-
if (recordStr === null) return;
|
|
23
|
-
const record: IVersionRecord = JSON.parse(recordStr);
|
|
24
|
-
if (record.action !== '') {
|
|
25
|
-
record.action = '';
|
|
26
|
-
localStorage.setItem(RECORD_KEY, JSON.stringify(record));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const Interval = {
|
|
32
|
-
clearInterval: function () {
|
|
33
|
-
cancelAnimationFrame(this.timer);
|
|
34
|
-
},
|
|
35
|
-
setInterval: function (callback: any, interval: any) {
|
|
36
|
-
let startTime = new Date().valueOf();
|
|
37
|
-
let endTime = new Date().valueOf();
|
|
38
|
-
const self: any = this; // eslint-disable-line
|
|
39
|
-
const loop = () => {
|
|
40
|
-
self.timer = requestAnimationFrame(loop);
|
|
41
|
-
endTime = new Date().valueOf();
|
|
42
|
-
if (endTime - startTime >= interval) {
|
|
43
|
-
endTime = startTime = new Date().valueOf();
|
|
44
|
-
callback?.(); // eslint-disable-line
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
this.timer = requestAnimationFrame(loop);
|
|
48
|
-
return this.timer;
|
|
49
|
-
},
|
|
50
|
-
timer: 0,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 读取到更新的json文件版本内容
|
|
55
|
-
*/
|
|
56
|
-
const fetchUpdateVersionFile = () => {
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
fetch('/update_version.json')
|
|
59
|
-
.then(res => {
|
|
60
|
-
return res.body;
|
|
61
|
-
})
|
|
62
|
-
.then(body => {
|
|
63
|
-
const reader = body?.getReader();
|
|
64
|
-
if (reader) {
|
|
65
|
-
reader
|
|
66
|
-
.read()
|
|
67
|
-
.then(val => {
|
|
68
|
-
let str = '';
|
|
69
|
-
if (val.value) {
|
|
70
|
-
for (let i = 0; i < val.value.length; i++) {
|
|
71
|
-
str += String.fromCharCode(val.value[i]);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return JSON.parse(str);
|
|
75
|
-
})
|
|
76
|
-
.then(json => {
|
|
77
|
-
resolve(json);
|
|
78
|
-
})
|
|
79
|
-
.catch(err => {
|
|
80
|
-
reject(err);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
.catch(err => {
|
|
85
|
-
reject(err);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const ENV = process.env.NODE_ENV;
|
|
91
|
-
|
|
92
|
-
const notifyUserUpdate = () => {
|
|
93
|
-
const handleClick = () => {
|
|
94
|
-
REFRESHED_BY_CLICK = true;
|
|
95
|
-
const recordStr = localStorage.getItem(RECORD_KEY);
|
|
96
|
-
if (recordStr === null) return;
|
|
97
|
-
const record: IVersionRecord = JSON.parse(recordStr);
|
|
98
|
-
record.action = 'refreshedByClick';
|
|
99
|
-
localStorage.setItem(RECORD_KEY, JSON.stringify(record));
|
|
100
|
-
window.location.reload();
|
|
101
|
-
};
|
|
102
|
-
const handleClose = () => {
|
|
103
|
-
Interval.clearInterval();
|
|
104
|
-
message.open({
|
|
105
|
-
content: '页面将不会提示更新',
|
|
106
|
-
type: 'warning',
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
const openNotification = () => {
|
|
110
|
-
const element = React.createElement(
|
|
111
|
-
'div', // 类型
|
|
112
|
-
{
|
|
113
|
-
onClick: handleClick,
|
|
114
|
-
style: { color: '#1677ff', cursor: 'pointer' },
|
|
115
|
-
}, // 属性
|
|
116
|
-
'页面已更新,请点击此处刷新页面!', // 子元素
|
|
117
|
-
);
|
|
118
|
-
notification.warning({
|
|
119
|
-
description: element,
|
|
120
|
-
duration: null,
|
|
121
|
-
message: '温馨提示',
|
|
122
|
-
onClose: handleClose,
|
|
123
|
-
placement: 'bottomRight',
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
openNotification();
|
|
127
|
-
CUR_STATE = true;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const handleMain = (version: string, handleCb: any, fetchDelay: number) => {
|
|
131
|
-
// 记录当前版本号
|
|
132
|
-
CUR_VERSION = version;
|
|
133
|
-
// 从本地获取历史记录
|
|
134
|
-
const oldVersionRecordStr = localStorage.getItem(RECORD_KEY);
|
|
135
|
-
// 继承历史记录中的action、stack
|
|
136
|
-
let oldAction: IVersionRecord['action'] = '';
|
|
137
|
-
const oldStack: IVersionRecord['stack'] = [version];
|
|
138
|
-
if (oldVersionRecordStr !== null) {
|
|
139
|
-
const record: IVersionRecord = JSON.parse(oldVersionRecordStr);
|
|
140
|
-
oldAction = record.action;
|
|
141
|
-
}
|
|
142
|
-
// 创建变量记录版本、操作
|
|
143
|
-
const curVersionRecord: IVersionRecord = {
|
|
144
|
-
action: oldAction,
|
|
145
|
-
stack: oldStack,
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
localStorage.setItem(RECORD_KEY, JSON.stringify(curVersionRecord));
|
|
149
|
-
|
|
150
|
-
Interval.setInterval(() => {
|
|
151
|
-
fetchUpdateVersionFile().then((res: any) => {
|
|
152
|
-
// 读取版本记录
|
|
153
|
-
const versionRecordStr = localStorage.getItem(RECORD_KEY);
|
|
154
|
-
if (typeof versionRecordStr === 'string') {
|
|
155
|
-
const versionRecord: IVersionRecord = JSON.parse(versionRecordStr);
|
|
156
|
-
// 读取对应栈
|
|
157
|
-
const lastVersion = versionRecord.stack[0];
|
|
158
|
-
localStorage.setItem(RECORD_KEY, JSON.stringify(versionRecord));
|
|
159
|
-
// 在服务器的版本与当前版本不一致
|
|
160
|
-
if (res.version !== CUR_VERSION) {
|
|
161
|
-
if (CUR_STATE === false) {
|
|
162
|
-
// 发起通知
|
|
163
|
-
handleCb();
|
|
164
|
-
} else if (
|
|
165
|
-
versionRecord.action === 'refreshedByClick' &&
|
|
166
|
-
lastVersion !== CUR_VERSION
|
|
167
|
-
) {
|
|
168
|
-
// 上一个标签页更新过,且当前标签页未更新
|
|
169
|
-
REFRESHED_BY_CLICK = true;
|
|
170
|
-
window.location.reload();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}, fetchDelay);
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
export const openUpdateVersionNotify = (fetchDelay: number) => {
|
|
179
|
-
// 开发环境没有必要开启版本检测功能
|
|
180
|
-
if (ENV === 'development') {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
fetchUpdateVersionFile().then((res: any) => {
|
|
184
|
-
handleMain(res.version, notifyUserUpdate, fetchDelay);
|
|
185
|
-
});
|
|
186
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useThemeStore } from '@store/theme';
|
|
2
|
-
import { Button } from 'antd';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
export default function BasePage() {
|
|
6
|
-
const theme = useThemeStore(state => state.theme);
|
|
7
|
-
const setTheme = useThemeStore(state => state.setTheme);
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<>
|
|
11
|
-
<Button type="primary">antd按钮</Button>
|
|
12
|
-
<button
|
|
13
|
-
type="button"
|
|
14
|
-
className={
|
|
15
|
-
' dark:text-red-600 dark:bg-[var(--tailwindssantd-color-primary)] bg-[var(--tailwindssantd-color-primary)]'
|
|
16
|
-
}
|
|
17
|
-
>
|
|
18
|
-
tailwind按钮
|
|
19
|
-
</button>
|
|
20
|
-
<button type="button" onClick={() => setTheme('dark')}>
|
|
21
|
-
切换主题({theme})
|
|
22
|
-
</button>
|
|
23
|
-
</>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html style="height: 100%">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
6
|
-
<meta name="renderer" content="webkit" />
|
|
7
|
-
<meta
|
|
8
|
-
name="viewport"
|
|
9
|
-
content="width=device-width,initial-scale=1.0,user-scalable=no"
|
|
10
|
-
/>
|
|
11
|
-
<title><%= title %></title>
|
|
12
|
-
</head>
|
|
13
|
-
<body style="height: 100%">
|
|
14
|
-
<!--[if lt IE 9]>
|
|
15
|
-
<p class="browsehappy">
|
|
16
|
-
You are using an <strong>outdated</strong> browser. Please
|
|
17
|
-
<a href="http://browsehappy.com/">upgrade your browser</a> to improve
|
|
18
|
-
your experience.
|
|
19
|
-
</p>
|
|
20
|
-
<![endif]-->
|
|
21
|
-
<div id="<%= mountRoot %>" style="height: 100%; width: 100%"></div>
|
|
22
|
-
<div id="notificationContainer"></div>
|
|
23
|
-
<script>
|
|
24
|
-
function push(subapp) {
|
|
25
|
-
history.pushState(null, subapp, subapp);
|
|
26
|
-
}
|
|
27
|
-
</script>
|
|
28
|
-
</body>
|
|
29
|
-
</html>
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import * as Sentry from '@sentry/react';
|
|
2
|
-
|
|
3
|
-
// Sentry 配置接口
|
|
4
|
-
export interface SentryConfig {
|
|
5
|
-
dsn: string;
|
|
6
|
-
environment: string;
|
|
7
|
-
release?: string;
|
|
8
|
-
sampleRate: number;
|
|
9
|
-
tracesSampleRate: number;
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
sessionSampleRate: number;
|
|
12
|
-
beforeSend?: (event: Sentry.ErrorEvent, hint: Sentry.EventHint) => Sentry.ErrorEvent | null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// 开发环境配置
|
|
16
|
-
const developmentConfig: Partial<SentryConfig> = {
|
|
17
|
-
enabled: true, // 开发环境可以选择关闭
|
|
18
|
-
sampleRate: 1.0,
|
|
19
|
-
tracesSampleRate: 1.0,
|
|
20
|
-
sessionSampleRate: 1.0, // 开发环境记录所有会话
|
|
21
|
-
beforeSend: (event, hint) => {
|
|
22
|
-
console.group('🐛 Sentry Event (Development)');
|
|
23
|
-
console.log('Event:', event);
|
|
24
|
-
console.log('Hint:', hint);
|
|
25
|
-
console.log('Event:', event);
|
|
26
|
-
console.groupEnd();
|
|
27
|
-
|
|
28
|
-
return event;
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// 生产环境配置
|
|
33
|
-
const productionConfig: Partial<SentryConfig> = {
|
|
34
|
-
enabled: true,
|
|
35
|
-
sampleRate: 1.0, // 临时设置为100%以排查问题,后续可调整
|
|
36
|
-
tracesSampleRate: 0.1, // 提高到10%性能采样
|
|
37
|
-
sessionSampleRate: 1.0, // 记录所有会话以获得准确的健康度数据
|
|
38
|
-
beforeSend: (event, hint) => {
|
|
39
|
-
// 生产环境也打印日志以便调试
|
|
40
|
-
console.log('🐛 Sentry Event (Production):', event);
|
|
41
|
-
|
|
42
|
-
// 过滤敏感信息
|
|
43
|
-
if (event.exception) {
|
|
44
|
-
const error = event.exception.values?.[0];
|
|
45
|
-
if (error?.value?.includes('密码') || error?.value?.includes('token')) {
|
|
46
|
-
return null; // 不发送包含敏感信息的错误
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return event;
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// 获取环境配置
|
|
54
|
-
const getEnvironmentConfig = (): Partial<SentryConfig> => {
|
|
55
|
-
const env = process.env.NODE_ENV || 'development';
|
|
56
|
-
console.log(env, 'env');
|
|
57
|
-
switch (env) {
|
|
58
|
-
case 'development':
|
|
59
|
-
return developmentConfig;
|
|
60
|
-
case 'production':
|
|
61
|
-
return productionConfig;
|
|
62
|
-
default:
|
|
63
|
-
return developmentConfig;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// 基础配置
|
|
68
|
-
const baseConfig: SentryConfig = {
|
|
69
|
-
dsn: process.env.REACT_APP_SENTRY_DSN || '',
|
|
70
|
-
environment: process.env.SENTRY_ENV || 'development',
|
|
71
|
-
enabled: true,
|
|
72
|
-
sampleRate: 1.0,
|
|
73
|
-
tracesSampleRate: 1.0,
|
|
74
|
-
sessionSampleRate: 1.0, // 默认记录所有会话
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// 合并配置
|
|
78
|
-
export const sentryConfig: SentryConfig = {
|
|
79
|
-
...baseConfig,
|
|
80
|
-
...getEnvironmentConfig(),
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// 安全的会话重放集成初始化
|
|
84
|
-
const getSafeReplayIntegration = () => {
|
|
85
|
-
try {
|
|
86
|
-
return Sentry.replayIntegration({
|
|
87
|
-
maskAllText: false,
|
|
88
|
-
maskAllInputs: false,
|
|
89
|
-
blockAllMedia: true,
|
|
90
|
-
networkDetailAllowUrls: [window.location.origin],
|
|
91
|
-
}) as any; // 添加类型断言
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.warn('会话重放初始化失败:', error);
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// 初始化 Sentry
|
|
99
|
-
export const initSentry = () => {
|
|
100
|
-
// 修复 fetch 上下文问题
|
|
101
|
-
if (typeof window !== 'undefined' && window.fetch) {
|
|
102
|
-
window.fetch = window.fetch.bind(window);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (!sentryConfig.enabled || !sentryConfig.dsn) {
|
|
106
|
-
console.warn('❌ Sentry not enabled or DSN not provided');
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const integrations = [Sentry.browserTracingIntegration()];
|
|
111
|
-
|
|
112
|
-
// 安全地添加会话重放集成
|
|
113
|
-
const replayIntegration = getSafeReplayIntegration();
|
|
114
|
-
if (replayIntegration && !window.__GARFISH__) {
|
|
115
|
-
// 目前微服务无法使用会话重放
|
|
116
|
-
integrations.push(replayIntegration);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
Sentry.init({
|
|
120
|
-
dsn: sentryConfig.dsn,
|
|
121
|
-
environment: sentryConfig.environment,
|
|
122
|
-
sampleRate: sentryConfig.sampleRate,
|
|
123
|
-
tracesSampleRate: sentryConfig.tracesSampleRate,
|
|
124
|
-
beforeSend: sentryConfig.beforeSend,
|
|
125
|
-
|
|
126
|
-
// 使用自定义传输层,确保fetch上下文正确
|
|
127
|
-
transport: Sentry.makeBrowserOfflineTransport((options) => Sentry.makeFetchTransport(options, window.fetch.bind(window))),
|
|
128
|
-
|
|
129
|
-
// 设置追踪的 URL 匹配规则
|
|
130
|
-
tracePropagationTargets: ['localhost', /^https:\/\/yourapi\.domain\.com\/api/],
|
|
131
|
-
|
|
132
|
-
// 使用安全的集成配置
|
|
133
|
-
integrations,
|
|
134
|
-
|
|
135
|
-
// 错误过滤
|
|
136
|
-
ignoreErrors: [
|
|
137
|
-
// 忽略常见的无害错误
|
|
138
|
-
'Non-Error promise rejection captured',
|
|
139
|
-
'ResizeObserver loop limit exceeded',
|
|
140
|
-
'Script error.',
|
|
141
|
-
'Network Error',
|
|
142
|
-
'Loading chunk',
|
|
143
|
-
'Loading CSS chunk',
|
|
144
|
-
],
|
|
145
|
-
|
|
146
|
-
// URL 过滤
|
|
147
|
-
denyUrls: [
|
|
148
|
-
// 忽略浏览器扩展
|
|
149
|
-
/extensions\//i,
|
|
150
|
-
/^chrome:\/\//i,
|
|
151
|
-
/^moz-extension:\/\//i,
|
|
152
|
-
],
|
|
153
|
-
|
|
154
|
-
// 只在会话重放可用时设置这些选项
|
|
155
|
-
...(replayIntegration && {
|
|
156
|
-
replaysSessionSampleRate: 0.1,
|
|
157
|
-
replaysOnErrorSampleRate: 1.0,
|
|
158
|
-
}),
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// 设置应用上下文
|
|
162
|
-
Sentry.setContext('app', {
|
|
163
|
-
name: process.env.APP_NAME || 'React App',
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
// ✨ 手动开始会话(确保会话被正确追踪)
|
|
167
|
-
Sentry.startSession();
|
|
168
|
-
|
|
169
|
-
console.log('✅ Sentry initialized successfully with session tracking');
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
// ✨ 新增:会话管理工具
|
|
173
|
-
export const sentrySession = {
|
|
174
|
-
// 开始新会话
|
|
175
|
-
startSession: () => {
|
|
176
|
-
Sentry.startSession();
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
// 结束当前会话
|
|
180
|
-
endSession: () => {
|
|
181
|
-
Sentry.endSession();
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
// 标记会话为崩溃
|
|
185
|
-
captureSession: (crashed: boolean = false) => {
|
|
186
|
-
Sentry.captureSession(crashed);
|
|
187
|
-
},
|
|
188
|
-
};
|