@mseep/anything-analyzer 3.6.50
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/.codeartsdoer/.codebaseignore +0 -0
- package/.codeartsdoer/AGENTS.md +12 -0
- package/.github/workflows/build.yml +146 -0
- package/README.en.md +264 -0
- package/README.md +276 -0
- package/RELEASE_NOTES.md +16 -0
- package/USAGE.md +490 -0
- package/color-preview-r3.html +414 -0
- package/color-preview.html +414 -0
- package/dev-app-update.yml +3 -0
- package/electron-builder.yml +36 -0
- package/electron.vite.config.ts +40 -0
- package/package.json +53 -0
- package/report-2026-04-13-copilot-claude-sonnet-4.6.md +955 -0
- package/resources/doloffer-logo.png +0 -0
- package/resources/entitlements.mac.plist +12 -0
- package/resources/icon.ico +0 -0
- package/resources/icon.png +0 -0
- package/src/main/ai/ai-analyzer.ts +517 -0
- package/src/main/ai/crypto-script-extractor.ts +206 -0
- package/src/main/ai/data-assembler.ts +205 -0
- package/src/main/ai/llm-router.ts +1120 -0
- package/src/main/ai/prompt-builder.ts +349 -0
- package/src/main/ai/scene-detector.ts +302 -0
- package/src/main/capture/capture-engine.ts +130 -0
- package/src/main/capture/interaction-recorder.ts +171 -0
- package/src/main/capture/js-injector.ts +57 -0
- package/src/main/capture/replay-engine.ts +256 -0
- package/src/main/capture/storage-collector.ts +76 -0
- package/src/main/cdp/cdp-manager.ts +233 -0
- package/src/main/db/database.ts +41 -0
- package/src/main/db/migrations.ts +235 -0
- package/src/main/db/repositories.ts +574 -0
- package/src/main/fingerprint/http-spoofing.ts +48 -0
- package/src/main/fingerprint/presets.ts +173 -0
- package/src/main/fingerprint/profile-generator.ts +115 -0
- package/src/main/fingerprint/profile-store.ts +52 -0
- package/src/main/index.ts +260 -0
- package/src/main/ipc.ts +856 -0
- package/src/main/logger.ts +42 -0
- package/src/main/mcp/mcp-config.ts +66 -0
- package/src/main/mcp/mcp-manager.ts +155 -0
- package/src/main/mcp/mcp-server.ts +1038 -0
- package/src/main/prompt-templates.ts +170 -0
- package/src/main/proxy/ca-manager.ts +204 -0
- package/src/main/proxy/cert-download-page.ts +171 -0
- package/src/main/proxy/cert-installer.ts +242 -0
- package/src/main/proxy/mitm-proxy-config.ts +37 -0
- package/src/main/proxy/mitm-proxy-server.ts +1085 -0
- package/src/main/proxy/system-proxy.ts +248 -0
- package/src/main/session/session-manager.ts +724 -0
- package/src/main/tab-manager.ts +582 -0
- package/src/main/updater.ts +111 -0
- package/src/main/window.ts +235 -0
- package/src/preload/hook-script.ts +270 -0
- package/src/preload/index.ts +211 -0
- package/src/preload/interaction-hook.ts +286 -0
- package/src/preload/stealth-script.ts +302 -0
- package/src/preload/target-preload.ts +15 -0
- package/src/renderer/App.tsx +656 -0
- package/src/renderer/components/AiLogDetail.tsx +173 -0
- package/src/renderer/components/AiLogList.tsx +101 -0
- package/src/renderer/components/AiLogView.module.css +364 -0
- package/src/renderer/components/AiLogView.tsx +86 -0
- package/src/renderer/components/AnalyzeBar.module.css +79 -0
- package/src/renderer/components/AnalyzeBar.tsx +104 -0
- package/src/renderer/components/BrowserPanel.module.css +67 -0
- package/src/renderer/components/BrowserPanel.tsx +90 -0
- package/src/renderer/components/ControlBar.module.css +47 -0
- package/src/renderer/components/ControlBar.tsx +205 -0
- package/src/renderer/components/HookLog.tsx +132 -0
- package/src/renderer/components/InteractionLog.tsx +183 -0
- package/src/renderer/components/MCPServerModal.tsx +427 -0
- package/src/renderer/components/PromptTemplateModal.tsx +254 -0
- package/src/renderer/components/ReportView.module.css +413 -0
- package/src/renderer/components/ReportView.tsx +429 -0
- package/src/renderer/components/RequestDetail.module.css +191 -0
- package/src/renderer/components/RequestDetail.tsx +202 -0
- package/src/renderer/components/RequestLog.module.css +69 -0
- package/src/renderer/components/RequestLog.tsx +208 -0
- package/src/renderer/components/SessionList.module.css +245 -0
- package/src/renderer/components/SessionList.tsx +247 -0
- package/src/renderer/components/SettingsModal.tsx +100 -0
- package/src/renderer/components/StatusBar.module.css +44 -0
- package/src/renderer/components/StatusBar.tsx +102 -0
- package/src/renderer/components/StorageView.module.css +41 -0
- package/src/renderer/components/StorageView.tsx +178 -0
- package/src/renderer/components/TabBar.module.css +88 -0
- package/src/renderer/components/TabBar.tsx +70 -0
- package/src/renderer/components/Titlebar.module.css +254 -0
- package/src/renderer/components/Titlebar.tsx +169 -0
- package/src/renderer/components/settings/FingerprintSection.tsx +198 -0
- package/src/renderer/components/settings/GeneralSection.tsx +164 -0
- package/src/renderer/components/settings/LLMSection.tsx +148 -0
- package/src/renderer/components/settings/MCPServerSection.tsx +136 -0
- package/src/renderer/components/settings/MitmProxySection.tsx +320 -0
- package/src/renderer/components/settings/ProxySection.tsx +110 -0
- package/src/renderer/css-modules.d.ts +4 -0
- package/src/renderer/hooks/useCapture.ts +383 -0
- package/src/renderer/hooks/useConfirm.tsx +91 -0
- package/src/renderer/hooks/useSession.ts +136 -0
- package/src/renderer/hooks/useTabs.ts +103 -0
- package/src/renderer/i18n/en.ts +167 -0
- package/src/renderer/i18n/index.ts +47 -0
- package/src/renderer/i18n/zh.ts +170 -0
- package/src/renderer/index.html +12 -0
- package/src/renderer/main.tsx +15 -0
- package/src/renderer/styles/global.css +144 -0
- package/src/renderer/styles/themes/ayu-dark.css +59 -0
- package/src/renderer/styles/themes/catppuccin.css +59 -0
- package/src/renderer/styles/themes/discord.css +59 -0
- package/src/renderer/styles/themes/dracula.css +59 -0
- package/src/renderer/styles/themes/github-dark.css +59 -0
- package/src/renderer/styles/themes/gruvbox.css +59 -0
- package/src/renderer/styles/themes/index.css +11 -0
- package/src/renderer/styles/themes/light.css +59 -0
- package/src/renderer/styles/themes/nord.css +59 -0
- package/src/renderer/styles/themes/one-dark.css +59 -0
- package/src/renderer/styles/themes/tokyo-night.css +59 -0
- package/src/renderer/styles/tokens.css +137 -0
- package/src/renderer/theme.ts +31 -0
- package/src/renderer/ui/Badge.module.css +38 -0
- package/src/renderer/ui/Badge.tsx +36 -0
- package/src/renderer/ui/Button.module.css +142 -0
- package/src/renderer/ui/Button.tsx +46 -0
- package/src/renderer/ui/Collapse.module.css +49 -0
- package/src/renderer/ui/Collapse.tsx +57 -0
- package/src/renderer/ui/CopyableBlock.module.css +56 -0
- package/src/renderer/ui/CopyableBlock.tsx +42 -0
- package/src/renderer/ui/Empty.module.css +19 -0
- package/src/renderer/ui/Empty.tsx +34 -0
- package/src/renderer/ui/Icons.tsx +346 -0
- package/src/renderer/ui/Input.module.css +103 -0
- package/src/renderer/ui/Input.tsx +94 -0
- package/src/renderer/ui/InputNumber.module.css +68 -0
- package/src/renderer/ui/InputNumber.tsx +104 -0
- package/src/renderer/ui/Modal.module.css +83 -0
- package/src/renderer/ui/Modal.tsx +67 -0
- package/src/renderer/ui/Popconfirm.module.css +73 -0
- package/src/renderer/ui/Popconfirm.tsx +74 -0
- package/src/renderer/ui/Progress.module.css +35 -0
- package/src/renderer/ui/Progress.tsx +30 -0
- package/src/renderer/ui/Select.module.css +91 -0
- package/src/renderer/ui/Select.tsx +100 -0
- package/src/renderer/ui/Spinner.module.css +44 -0
- package/src/renderer/ui/Spinner.tsx +27 -0
- package/src/renderer/ui/Switch.module.css +39 -0
- package/src/renderer/ui/Switch.tsx +43 -0
- package/src/renderer/ui/Tabs.module.css +76 -0
- package/src/renderer/ui/Tabs.tsx +53 -0
- package/src/renderer/ui/Tag.module.css +66 -0
- package/src/renderer/ui/Tag.tsx +47 -0
- package/src/renderer/ui/Timeline.module.css +42 -0
- package/src/renderer/ui/Timeline.tsx +29 -0
- package/src/renderer/ui/Toast.module.css +99 -0
- package/src/renderer/ui/Toast.tsx +90 -0
- package/src/renderer/ui/Tooltip.module.css +26 -0
- package/src/renderer/ui/Tooltip.tsx +23 -0
- package/src/renderer/ui/VirtualTable.module.css +230 -0
- package/src/renderer/ui/VirtualTable.tsx +416 -0
- package/src/renderer/ui/index.ts +55 -0
- package/src/shared/types.ts +695 -0
- package/tests/main/ai/crypto-script-extractor.test.ts +281 -0
- package/tests/main/ai/llm-router.test.ts +1537 -0
- package/tests/main/ai/prompt-builder.test.ts +178 -0
- package/tests/main/ai/scene-detector.test.ts +212 -0
- package/tests/main/db/migrations.test.ts +134 -0
- package/tests/main/release-workflow.test.ts +59 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +23 -0
- package/tsconfig.web.json +24 -0
- package/vitest.config.ts +13 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { VirtualTable, Tag, CopyableBlock } from '../ui'
|
|
3
|
+
import type { VTColumn } from '../ui'
|
|
4
|
+
import type { JsHookRecord, HookType } from '@shared/types'
|
|
5
|
+
|
|
6
|
+
interface HookLogProps {
|
|
7
|
+
hooks: JsHookRecord[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Color mapping for hook types
|
|
11
|
+
const HOOK_TYPE_COLORS: Record<HookType, 'info' | 'success' | 'purple' | 'orange'> = {
|
|
12
|
+
fetch: 'info',
|
|
13
|
+
xhr: 'success',
|
|
14
|
+
crypto: 'purple',
|
|
15
|
+
crypto_lib: 'purple',
|
|
16
|
+
cookie_set: 'orange',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function truncate(str: string | null, maxLen = 80): string {
|
|
20
|
+
if (!str) return '--'
|
|
21
|
+
return str.length > maxLen ? str.slice(0, maxLen) + '...' : str
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function prettyJson(str: string | null): string {
|
|
25
|
+
if (!str) return '(empty)'
|
|
26
|
+
try {
|
|
27
|
+
return JSON.stringify(JSON.parse(str), null, 2)
|
|
28
|
+
} catch {
|
|
29
|
+
return str
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Expanded row content
|
|
34
|
+
const ExpandedRow: React.FC<{ record: JsHookRecord }> = ({ record }) => (
|
|
35
|
+
<div style={{ padding: '4px 0' }}>
|
|
36
|
+
<CopyableBlock label="Arguments" content={prettyJson(record.arguments)} />
|
|
37
|
+
{record.result && <CopyableBlock label="Result" content={prettyJson(record.result)} />}
|
|
38
|
+
{record.call_stack && (
|
|
39
|
+
<div style={{ marginBottom: 12 }}>
|
|
40
|
+
<div style={{ fontSize: 'var(--font-size-base)', fontWeight: 600, color: 'var(--text-primary)', marginBottom: 6 }}>Call Stack</div>
|
|
41
|
+
<pre style={{
|
|
42
|
+
background: 'var(--color-surface)',
|
|
43
|
+
padding: 10,
|
|
44
|
+
borderRadius: 6,
|
|
45
|
+
fontFamily: 'var(--font-mono)',
|
|
46
|
+
fontSize: 'var(--font-size-xs)',
|
|
47
|
+
whiteSpace: 'pre-wrap',
|
|
48
|
+
wordBreak: 'break-all',
|
|
49
|
+
color: 'var(--text-muted)',
|
|
50
|
+
margin: 0,
|
|
51
|
+
}}>
|
|
52
|
+
{record.call_stack}
|
|
53
|
+
</pre>
|
|
54
|
+
</div>
|
|
55
|
+
)}
|
|
56
|
+
{record.related_request_id && (
|
|
57
|
+
<div style={{ fontSize: 'var(--font-size-sm)', color: 'var(--text-muted)' }}>
|
|
58
|
+
Related Request ID: <code style={{ background: 'var(--color-surface)', padding: '1px 4px', borderRadius: 3, fontSize: 'var(--font-size-xs)' }}>{record.related_request_id}</code>
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
const HookLog: React.FC<HookLogProps> = ({ hooks }) => {
|
|
65
|
+
const columns: VTColumn<JsHookRecord>[] = useMemo(() => [
|
|
66
|
+
{
|
|
67
|
+
key: 'timestamp',
|
|
68
|
+
title: 'Time',
|
|
69
|
+
dataIndex: 'timestamp',
|
|
70
|
+
width: 100,
|
|
71
|
+
render: (val) => new Date(val as number).toLocaleTimeString(),
|
|
72
|
+
sorter: (a, b) => a.timestamp - b.timestamp,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: 'hook_type',
|
|
76
|
+
title: 'Type',
|
|
77
|
+
dataIndex: 'hook_type',
|
|
78
|
+
width: 110,
|
|
79
|
+
render: (val) => <Tag color={HOOK_TYPE_COLORS[val as HookType] || 'default'}>{val as string}</Tag>,
|
|
80
|
+
filters: (['fetch', 'xhr', 'crypto', 'crypto_lib', 'cookie_set'] as HookType[]).map(t => ({ text: t, value: t })),
|
|
81
|
+
onFilter: (value, record) => record.hook_type === value,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: 'function_name',
|
|
85
|
+
title: 'Function',
|
|
86
|
+
dataIndex: 'function_name',
|
|
87
|
+
width: 160,
|
|
88
|
+
render: (val) => (
|
|
89
|
+
<code style={{ fontSize: 'var(--font-size-sm)', background: 'var(--color-surface)', padding: '1px 4px', borderRadius: 3, color: 'var(--color-warning)' }}>
|
|
90
|
+
{val as string}
|
|
91
|
+
</code>
|
|
92
|
+
),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: 'arguments',
|
|
96
|
+
title: 'Arguments',
|
|
97
|
+
dataIndex: 'arguments',
|
|
98
|
+
render: (val) => (
|
|
99
|
+
<span style={{ fontFamily: 'var(--font-mono)', fontSize: 'var(--font-size-sm)' }} title={val as string}>
|
|
100
|
+
{truncate(val as string)}
|
|
101
|
+
</span>
|
|
102
|
+
),
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
key: 'result',
|
|
106
|
+
title: 'Result',
|
|
107
|
+
dataIndex: 'result',
|
|
108
|
+
width: 200,
|
|
109
|
+
render: (val) => (
|
|
110
|
+
<span style={{ fontFamily: 'var(--font-mono)', fontSize: 'var(--font-size-sm)' }} title={(val as string) || ''}>
|
|
111
|
+
{truncate(val as string | null)}
|
|
112
|
+
</span>
|
|
113
|
+
),
|
|
114
|
+
},
|
|
115
|
+
], [])
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<VirtualTable<JsHookRecord>
|
|
119
|
+
columns={columns}
|
|
120
|
+
data={hooks}
|
|
121
|
+
rowKey="id"
|
|
122
|
+
height={400}
|
|
123
|
+
expandable={{
|
|
124
|
+
expandedRowRender: (record) => <ExpandedRow record={record} />,
|
|
125
|
+
rowExpandable: () => true,
|
|
126
|
+
}}
|
|
127
|
+
emptyText="No hook records captured yet"
|
|
128
|
+
/>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export default HookLog
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { VirtualTable, Tag } from '../ui'
|
|
3
|
+
import type { VTColumn } from '../ui'
|
|
4
|
+
import type { InteractionEvent, InteractionType } from '@shared/types'
|
|
5
|
+
import { useLocale } from '../i18n'
|
|
6
|
+
|
|
7
|
+
interface InteractionLogProps {
|
|
8
|
+
interactions: InteractionEvent[]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const TYPE_COLORS: Record<InteractionType, 'info' | 'success' | 'purple' | 'orange' | 'warning' | 'error'> = {
|
|
12
|
+
click: 'info',
|
|
13
|
+
dblclick: 'info',
|
|
14
|
+
input: 'success',
|
|
15
|
+
scroll: 'orange',
|
|
16
|
+
navigate: 'purple',
|
|
17
|
+
hover: 'warning',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function truncate(str: string | null, maxLen = 60): string {
|
|
21
|
+
if (!str) return '--'
|
|
22
|
+
return str.length > maxLen ? str.slice(0, maxLen) + '...' : str
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ExpandedRow: React.FC<{ record: InteractionEvent }> = ({ record }) => {
|
|
26
|
+
const { t } = useLocale()
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div style={{ padding: '6px 0', fontSize: 'var(--font-size-xs)', lineHeight: 1.6 }}>
|
|
30
|
+
{record.selector && (
|
|
31
|
+
<div style={{ marginBottom: 4 }}>
|
|
32
|
+
<span style={{ color: 'var(--text-muted)', marginRight: 8 }}>{t('interaction.selector')}:</span>
|
|
33
|
+
<code style={{ background: 'var(--color-surface)', padding: '1px 6px', borderRadius: 3, fontFamily: 'var(--font-mono)', fontSize: 'var(--font-size-xs)' }}>
|
|
34
|
+
{record.selector}
|
|
35
|
+
</code>
|
|
36
|
+
</div>
|
|
37
|
+
)}
|
|
38
|
+
{record.xpath && (
|
|
39
|
+
<div style={{ marginBottom: 4 }}>
|
|
40
|
+
<span style={{ color: 'var(--text-muted)', marginRight: 8 }}>XPath:</span>
|
|
41
|
+
<code style={{ background: 'var(--color-surface)', padding: '1px 6px', borderRadius: 3, fontFamily: 'var(--font-mono)', fontSize: 'var(--font-size-xs)' }}>
|
|
42
|
+
{record.xpath}
|
|
43
|
+
</code>
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
46
|
+
{record.attributes && (
|
|
47
|
+
<div style={{ marginBottom: 4 }}>
|
|
48
|
+
<span style={{ color: 'var(--text-muted)', marginRight: 8 }}>Attributes:</span>
|
|
49
|
+
<code style={{ background: 'var(--color-surface)', padding: '2px 6px', borderRadius: 3, fontFamily: 'var(--font-mono)', fontSize: 'var(--font-size-xs)', display: 'inline-block', maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
50
|
+
{record.attributes}
|
|
51
|
+
</code>
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
54
|
+
{record.input_value != null && (
|
|
55
|
+
<div style={{ marginBottom: 4 }}>
|
|
56
|
+
<span style={{ color: 'var(--text-muted)', marginRight: 8 }}>{t('interaction.value')}:</span>
|
|
57
|
+
<code style={{ background: 'var(--color-surface)', padding: '1px 6px', borderRadius: 3, fontFamily: 'var(--font-mono)', fontSize: 'var(--font-size-xs)' }}>
|
|
58
|
+
{record.input_value}
|
|
59
|
+
</code>
|
|
60
|
+
</div>
|
|
61
|
+
)}
|
|
62
|
+
{record.path && (
|
|
63
|
+
<div style={{ marginBottom: 4 }}>
|
|
64
|
+
<span style={{ color: 'var(--text-muted)', marginRight: 8 }}>{t('interaction.path')}:</span>
|
|
65
|
+
<span>{t('interaction.points', { count: JSON.parse(record.path).length })}</span>
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
{record.url && (
|
|
69
|
+
<div style={{ marginBottom: 4 }}>
|
|
70
|
+
<span style={{ color: 'var(--text-muted)', marginRight: 8 }}>{t('interaction.url')}:</span>
|
|
71
|
+
<span style={{ color: 'var(--text-secondary)' }}>{truncate(record.url, 100)}</span>
|
|
72
|
+
</div>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const InteractionLog: React.FC<InteractionLogProps> = ({ interactions }) => {
|
|
79
|
+
const { t } = useLocale()
|
|
80
|
+
|
|
81
|
+
const typeLabel = (type: InteractionType): string => {
|
|
82
|
+
const key = `interaction.${type}` as const
|
|
83
|
+
return t(key as Parameters<typeof t>[0])
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const columns: VTColumn<InteractionEvent>[] = useMemo(() => [
|
|
87
|
+
{
|
|
88
|
+
key: 'timestamp',
|
|
89
|
+
title: 'Time',
|
|
90
|
+
dataIndex: 'timestamp',
|
|
91
|
+
width: 90,
|
|
92
|
+
render: (val) => new Date(val as number).toLocaleTimeString(),
|
|
93
|
+
sorter: (a, b) => a.timestamp - b.timestamp,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
key: 'type',
|
|
97
|
+
title: 'Type',
|
|
98
|
+
dataIndex: 'type',
|
|
99
|
+
width: 90,
|
|
100
|
+
render: (val) => (
|
|
101
|
+
<Tag color={TYPE_COLORS[val as InteractionType] || 'default'}>
|
|
102
|
+
{typeLabel(val as InteractionType)}
|
|
103
|
+
</Tag>
|
|
104
|
+
),
|
|
105
|
+
filters: (['click', 'dblclick', 'input', 'scroll', 'navigate', 'hover'] as InteractionType[]).map(tp => ({
|
|
106
|
+
text: typeLabel(tp),
|
|
107
|
+
value: tp,
|
|
108
|
+
})),
|
|
109
|
+
onFilter: (value, record) => record.type === value,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: 'element',
|
|
113
|
+
title: t('interaction.element'),
|
|
114
|
+
width: 200,
|
|
115
|
+
render: (_val, record) => {
|
|
116
|
+
if (record.type === 'navigate') return truncate(record.url, 50)
|
|
117
|
+
if (record.type === 'hover') {
|
|
118
|
+
const points = record.path ? JSON.parse(record.path).length : 0
|
|
119
|
+
return <span style={{ color: 'var(--text-muted)' }}>{t('interaction.points', { count: points })}</span>
|
|
120
|
+
}
|
|
121
|
+
if (record.element_text) return truncate(record.element_text, 40)
|
|
122
|
+
if (record.tag_name) return `<${record.tag_name}>`
|
|
123
|
+
return '--'
|
|
124
|
+
},
|
|
125
|
+
ellipsis: true,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
key: 'position',
|
|
129
|
+
title: t('interaction.position'),
|
|
130
|
+
width: 100,
|
|
131
|
+
render: (_val, record) => {
|
|
132
|
+
if (record.viewport_x != null && record.viewport_y != null) {
|
|
133
|
+
return `(${Math.round(record.viewport_x)}, ${Math.round(record.viewport_y)})`
|
|
134
|
+
}
|
|
135
|
+
if (record.x != null && record.y != null) {
|
|
136
|
+
return `(${Math.round(record.x)}, ${Math.round(record.y)})`
|
|
137
|
+
}
|
|
138
|
+
return '--'
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
key: 'detail',
|
|
143
|
+
title: t('interaction.value'),
|
|
144
|
+
render: (_val, record) => {
|
|
145
|
+
if (record.type === 'input') return truncate(record.input_value, 30)
|
|
146
|
+
if (record.type === 'scroll') return `↕ ${record.scroll_y ?? 0}`
|
|
147
|
+
if (record.selector) return truncate(record.selector, 40)
|
|
148
|
+
return '--'
|
|
149
|
+
},
|
|
150
|
+
ellipsis: true,
|
|
151
|
+
},
|
|
152
|
+
], [t]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
153
|
+
|
|
154
|
+
if (interactions.length === 0) {
|
|
155
|
+
return (
|
|
156
|
+
<div style={{
|
|
157
|
+
display: 'flex',
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
justifyContent: 'center',
|
|
160
|
+
height: '100%',
|
|
161
|
+
color: 'var(--text-muted)',
|
|
162
|
+
fontSize: 'var(--font-size-sm)',
|
|
163
|
+
}}>
|
|
164
|
+
{t('interaction.noData')}
|
|
165
|
+
</div>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<VirtualTable<InteractionEvent>
|
|
171
|
+
columns={columns}
|
|
172
|
+
data={interactions}
|
|
173
|
+
rowKey="id"
|
|
174
|
+
rowHeight={34}
|
|
175
|
+
expandable={{
|
|
176
|
+
expandedRowRender: (record) => <ExpandedRow record={record} />,
|
|
177
|
+
rowExpandable: (record) => record.type !== 'scroll',
|
|
178
|
+
}}
|
|
179
|
+
/>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export default InteractionLog
|