@h-ai/ui 0.1.0-alpha.68 → 0.1.0-alpha.69
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/README.en.md +8 -2
- package/README.ja.md +8 -2
- package/README.md +8 -2
- package/auto-import.d.ts +3 -0
- package/auto-import.js +3 -0
- package/dist/components/scenes/app/FeedbackDetail.svelte +215 -0
- package/dist/components/scenes/app/FeedbackDetail.svelte.d.ts +32 -0
- package/dist/components/scenes/app/FeedbackForm.svelte +271 -0
- package/dist/components/scenes/app/FeedbackForm.svelte.d.ts +61 -0
- package/dist/components/scenes/app/FeedbackList.svelte +147 -0
- package/dist/components/scenes/app/FeedbackList.svelte.d.ts +28 -0
- package/dist/components/scenes/app/FeedbackModal.svelte +20 -196
- package/dist/components/scenes/app/FeedbackModal.svelte.d.ts +6 -74
- package/dist/components/scenes/app/FeedbackScreenshot.svelte +106 -0
- package/dist/components/scenes/app/FeedbackScreenshot.svelte.d.ts +8 -0
- package/dist/components/scenes/app/feedback-functions.d.ts +41 -0
- package/dist/components/scenes/app/feedback-functions.js +75 -0
- package/dist/components/scenes/app/feedback-types.d.ts +224 -0
- package/dist/components/scenes/app/feedback-types.js +1 -0
- package/dist/components/scenes/app/index.d.ts +4 -0
- package/dist/components/scenes/app/index.js +3 -0
- package/dist/messages/en-US.json +74 -1
- package/dist/messages/ja-JP.json +74 -1
- package/dist/messages/zh-CN.json +74 -1
- package/package.json +3 -3
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<!-- 反馈截图的交互选区;由宿主回调实际遮挡/标注图像。 -->
|
|
2
|
+
<script lang='ts'>
|
|
3
|
+
import type { FeedbackAnnotation, FeedbackAttachmentView } from './feedback-types.js'
|
|
4
|
+
import { uiM } from '../../../messages.js'
|
|
5
|
+
import FormField from '../../compounds/FormField.svelte'
|
|
6
|
+
import FormLayout from '../../compounds/FormLayout.svelte'
|
|
7
|
+
import Button from '../../primitives/Button.svelte'
|
|
8
|
+
import Input from '../../primitives/Input.svelte'
|
|
9
|
+
import { imagePreviewUrl } from './feedback-functions.js'
|
|
10
|
+
|
|
11
|
+
const { attachment, onannotate }: {
|
|
12
|
+
attachment: FeedbackAttachmentView
|
|
13
|
+
onannotate?: (annotation: FeedbackAnnotation) => Promise<void>
|
|
14
|
+
} = $props()
|
|
15
|
+
|
|
16
|
+
let mode = $state<'mask' | 'outline'>('outline')
|
|
17
|
+
let left = $state('10')
|
|
18
|
+
let top = $state('10')
|
|
19
|
+
let width = $state('20')
|
|
20
|
+
let height = $state('20')
|
|
21
|
+
let start = $state<{ x: number, y: number } | null>(null)
|
|
22
|
+
let selected = $state(false)
|
|
23
|
+
let loading = $state(false)
|
|
24
|
+
let error = $state('')
|
|
25
|
+
let imageFailed = $state(false)
|
|
26
|
+
const url = $derived(imagePreviewUrl(attachment.url))
|
|
27
|
+
const rect = $derived({ x: Math.max(0, Math.min(1, Number(left) / 100)), y: Math.max(0, Math.min(1, Number(top) / 100)), width: Math.max(0, Math.min(1, Number(width) / 100)), height: Math.max(0, Math.min(1, Number(height) / 100)) })
|
|
28
|
+
|
|
29
|
+
function point(event: PointerEvent & { currentTarget: HTMLDivElement }) {
|
|
30
|
+
const bounds = event.currentTarget.getBoundingClientRect()
|
|
31
|
+
return { x: Math.max(0, Math.min(100, (event.clientX - bounds.left) / bounds.width * 100)), y: Math.max(0, Math.min(100, (event.clientY - bounds.top) / bounds.height * 100)) }
|
|
32
|
+
}
|
|
33
|
+
function begin(event: PointerEvent & { currentTarget: HTMLDivElement }) {
|
|
34
|
+
if (!onannotate || loading)
|
|
35
|
+
return
|
|
36
|
+
event.preventDefault()
|
|
37
|
+
start = point(event)
|
|
38
|
+
selected = true
|
|
39
|
+
event.currentTarget.setPointerCapture?.(event.pointerId)
|
|
40
|
+
}
|
|
41
|
+
function move(event: PointerEvent & { currentTarget: HTMLDivElement }) {
|
|
42
|
+
if (!start)
|
|
43
|
+
return
|
|
44
|
+
const end = point(event)
|
|
45
|
+
left = Math.min(start.x, end.x).toFixed(1)
|
|
46
|
+
top = Math.min(start.y, end.y).toFixed(1)
|
|
47
|
+
width = Math.abs(end.x - start.x).toFixed(1)
|
|
48
|
+
height = Math.abs(end.y - start.y).toFixed(1)
|
|
49
|
+
}
|
|
50
|
+
async function apply() {
|
|
51
|
+
if (!onannotate || loading || !Object.values(rect).every(Number.isFinite) || rect.width <= 0 || rect.height <= 0)
|
|
52
|
+
return
|
|
53
|
+
loading = true
|
|
54
|
+
error = ''
|
|
55
|
+
try {
|
|
56
|
+
await onannotate({ id: attachment.id, mode, rect: { ...rect, width: Math.min(rect.width, 1 - rect.x), height: Math.min(rect.height, 1 - rect.y) } })
|
|
57
|
+
selected = false
|
|
58
|
+
}
|
|
59
|
+
catch (cause) {
|
|
60
|
+
error = cause instanceof Error ? cause.message : uiM('feedback_action_failed')
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
loading = false
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
{#if url}
|
|
69
|
+
<div class='space-y-3 min-w-0'>
|
|
70
|
+
<div class='relative overflow-hidden rounded-lg border border-base-content/10 select-none' role='img' aria-label={attachment.name} style:touch-action={onannotate ? 'none' : 'auto'} onpointerdown={begin} onpointermove={move} onpointerup={() => start = null} onpointercancel={() => start = null}>
|
|
71
|
+
<img src={url} alt={attachment.name} class='block max-w-full h-auto' draggable='false' referrerpolicy='no-referrer' onerror={() => imageFailed = true} onload={() => imageFailed = false} />
|
|
72
|
+
{#if selected}
|
|
73
|
+
<div class:mask-preview={mode === 'mask'} class='pointer-events-none absolute border-2 border-error' style:left={`${rect.x * 100}%`} style:top={`${rect.y * 100}%`} style:width={`${rect.width * 100}%`} style:height={`${rect.height * 100}%`}></div>
|
|
74
|
+
{/if}
|
|
75
|
+
</div>
|
|
76
|
+
{#if imageFailed}<p class='text-warning text-sm' role='status'>{uiM('feedback_preview_failed')}</p>{/if}
|
|
77
|
+
{#if onannotate && !imageFailed}
|
|
78
|
+
<div class='flex flex-wrap gap-2'>
|
|
79
|
+
<Button size='xs' variant={mode === 'outline' ? 'primary' : 'ghost'} onclick={() => {
|
|
80
|
+
mode = 'outline'
|
|
81
|
+
selected = true
|
|
82
|
+
}}>{uiM('feedback_mark_outline')}</Button>
|
|
83
|
+
<Button size='xs' variant={mode === 'mask' ? 'primary' : 'ghost'} onclick={() => {
|
|
84
|
+
mode = 'mask'
|
|
85
|
+
selected = true
|
|
86
|
+
}}>{uiM('feedback_mark_mask')}</Button>
|
|
87
|
+
</div>
|
|
88
|
+
<p class='text-xs text-base-content/60'>{uiM('feedback_mark_hint')}</p>
|
|
89
|
+
<FormLayout columns={2}>
|
|
90
|
+
<FormField label={uiM('feedback_mark_x')}><Input type='number' min={0} max={100} bind:value={left} oninput={() => selected = true} /></FormField>
|
|
91
|
+
<FormField label={uiM('feedback_mark_y')}><Input type='number' min={0} max={100} bind:value={top} oninput={() => selected = true} /></FormField>
|
|
92
|
+
<FormField label={uiM('feedback_mark_width')}><Input type='number' min={1} max={100} bind:value={width} oninput={() => selected = true} /></FormField>
|
|
93
|
+
<FormField label={uiM('feedback_mark_height')}><Input type='number' min={1} max={100} bind:value={height} oninput={() => selected = true} /></FormField>
|
|
94
|
+
</FormLayout>
|
|
95
|
+
<div class='flex flex-wrap gap-2'>
|
|
96
|
+
<Button size='sm' {loading} disabled={!selected} onclick={apply}>{uiM('feedback_mark_apply')}</Button>
|
|
97
|
+
<Button size='sm' variant='ghost' onclick={() => selected = false}>{uiM('feedback_mark_clear')}</Button>
|
|
98
|
+
</div>
|
|
99
|
+
{/if}
|
|
100
|
+
{#if error}<p class='text-error text-sm break-words' role='alert'>{error}</p>{/if}
|
|
101
|
+
</div>
|
|
102
|
+
{/if}
|
|
103
|
+
|
|
104
|
+
<style>
|
|
105
|
+
.mask-preview { background: black; }
|
|
106
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FeedbackAnnotation, FeedbackAttachmentView } from './feedback-types.js';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
attachment: FeedbackAttachmentView;
|
|
4
|
+
onannotate?: (annotation: FeedbackAnnotation) => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
declare const FeedbackScreenshot: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type FeedbackScreenshot = ReturnType<typeof FeedbackScreenshot>;
|
|
8
|
+
export default FeedbackScreenshot;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { FeedbackReportView } from './feedback-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 解析材料状态,不把受理或邮件服务受理误作最终完成。
|
|
4
|
+
* @example 模块内部上下文
|
|
5
|
+
* ```ts
|
|
6
|
+
* const label = collectionLabel('collecting')
|
|
7
|
+
* ```
|
|
8
|
+
*/
|
|
9
|
+
export declare function collectionLabel(status: FeedbackReportView['collectionStatus']): string;
|
|
10
|
+
/**
|
|
11
|
+
* 解析通知状态。
|
|
12
|
+
* @example 模块内部上下文
|
|
13
|
+
* ```ts
|
|
14
|
+
* const label = notificationLabel('pending')
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function notificationLabel(status: FeedbackReportView['notificationStatus']): string;
|
|
18
|
+
/**
|
|
19
|
+
* 按当前语言显示时间,不改变原始时间戳。
|
|
20
|
+
* @example 模块内部上下文
|
|
21
|
+
* ```ts
|
|
22
|
+
* const time = feedbackTime(1_730_000_000_000)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function feedbackTime(timestamp: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* 以文本显示 JSON,不将诊断材料解释为 HTML。
|
|
28
|
+
* @example 模块内部上下文
|
|
29
|
+
* ```ts
|
|
30
|
+
* const text = evidenceText({ kind: 'log', message: '<script>' })
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function evidenceText(value: Record<string, unknown>): string;
|
|
34
|
+
/**
|
|
35
|
+
* 预览只允许图片 URL 使用的安全协议;宿主仍负责取得授权。
|
|
36
|
+
* @example 模块内部上下文
|
|
37
|
+
* ```ts
|
|
38
|
+
* const preview = imagePreviewUrl('/api/feedback/reports/f1/attachments/a1')
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function imagePreviewUrl(url?: string): string | undefined;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { getUILocale, uiM } from '../../../messages.js';
|
|
2
|
+
const collectionKeys = {
|
|
3
|
+
collecting: 'feedback_collecting',
|
|
4
|
+
complete: 'feedback_complete',
|
|
5
|
+
partial: 'feedback_partial',
|
|
6
|
+
failed: 'feedback_failed',
|
|
7
|
+
};
|
|
8
|
+
const notificationKeys = {
|
|
9
|
+
pending: 'feedback_notification_pending',
|
|
10
|
+
sending: 'feedback_notification_sending',
|
|
11
|
+
sent: 'feedback_notification_sent',
|
|
12
|
+
deferred: 'feedback_notification_deferred',
|
|
13
|
+
failed: 'feedback_notification_failed',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 解析材料状态,不把受理或邮件服务受理误作最终完成。
|
|
17
|
+
* @example 模块内部上下文
|
|
18
|
+
* ```ts
|
|
19
|
+
* const label = collectionLabel('collecting')
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function collectionLabel(status) {
|
|
23
|
+
return uiM(collectionKeys[status]);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 解析通知状态。
|
|
27
|
+
* @example 模块内部上下文
|
|
28
|
+
* ```ts
|
|
29
|
+
* const label = notificationLabel('pending')
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export function notificationLabel(status) {
|
|
33
|
+
return uiM(notificationKeys[status]);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 按当前语言显示时间,不改变原始时间戳。
|
|
37
|
+
* @example 模块内部上下文
|
|
38
|
+
* ```ts
|
|
39
|
+
* const time = feedbackTime(1_730_000_000_000)
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function feedbackTime(timestamp) {
|
|
43
|
+
return Number.isFinite(timestamp) ? new Date(timestamp).toLocaleString(getUILocale()) : '—';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 以文本显示 JSON,不将诊断材料解释为 HTML。
|
|
47
|
+
* @example 模块内部上下文
|
|
48
|
+
* ```ts
|
|
49
|
+
* const text = evidenceText({ kind: 'log', message: '<script>' })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export function evidenceText(value) {
|
|
53
|
+
try {
|
|
54
|
+
return JSON.stringify(value, null, 2);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return uiM('feedback_missing');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 预览只允许图片 URL 使用的安全协议;宿主仍负责取得授权。
|
|
62
|
+
* @example 模块内部上下文
|
|
63
|
+
* ```ts
|
|
64
|
+
* const preview = imagePreviewUrl('/api/feedback/reports/f1/attachments/a1')
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export function imagePreviewUrl(url) {
|
|
68
|
+
if (!url)
|
|
69
|
+
return undefined;
|
|
70
|
+
if (url.startsWith('/') && !url.startsWith('//'))
|
|
71
|
+
return url;
|
|
72
|
+
if (/^(?:blob:|https?:\/\/)/i.test(url))
|
|
73
|
+
return url;
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 反馈界面使用的可展示数据;由宿主负责鉴权、采集与传输。
|
|
3
|
+
* @module feedback-types
|
|
4
|
+
*/
|
|
5
|
+
import type { PaginatedResult } from '@h-ai/core';
|
|
6
|
+
/**
|
|
7
|
+
* 反馈的人工处理状态。
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import type { FeedbackStatus } from '@h-ai/ui'
|
|
11
|
+
* const status: FeedbackStatus = 'pending'
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export type FeedbackStatus = 'pending' | 'handled';
|
|
15
|
+
/**
|
|
16
|
+
* 反馈列表/详情的展示模型。
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import type { FeedbackReportView } from '@h-ai/ui'
|
|
20
|
+
* const row: Pick<FeedbackReportView, 'id' | 'status'> = { id: 'f1', status: 'pending' }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export interface FeedbackReportView {
|
|
24
|
+
id: string;
|
|
25
|
+
number: string;
|
|
26
|
+
appId: string;
|
|
27
|
+
userId?: string;
|
|
28
|
+
description: string;
|
|
29
|
+
/** 用户未填写说明时可展示的服务端事实摘要。 */
|
|
30
|
+
summary?: string;
|
|
31
|
+
appVersion: string;
|
|
32
|
+
buildId?: string;
|
|
33
|
+
commit?: string;
|
|
34
|
+
status: FeedbackStatus;
|
|
35
|
+
collectionStatus: 'collecting' | 'complete' | 'partial' | 'failed';
|
|
36
|
+
notificationStatus: 'pending' | 'sending' | 'sent' | 'deferred' | 'failed';
|
|
37
|
+
createdAt: number;
|
|
38
|
+
updatedAt: number;
|
|
39
|
+
version: number;
|
|
40
|
+
evidenceRevision: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 使用框架统一分页结果中的页面字段。
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import type { FeedbackPage } from '@h-ai/ui'
|
|
47
|
+
* const page: FeedbackPage<string> = { items: [], total: 0, page: 1, pageSize: 20 }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export type FeedbackPage<T> = Pick<PaginatedResult<T>, 'items' | 'total' | 'page' | 'pageSize'>;
|
|
51
|
+
/**
|
|
52
|
+
* 服务端分页与筛选条件。
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import type { FeedbackListQuery } from '@h-ai/ui'
|
|
56
|
+
* const query: FeedbackListQuery = { page: 1, pageSize: 20, status: 'pending' }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export interface FeedbackListQuery {
|
|
60
|
+
page: number;
|
|
61
|
+
pageSize: number;
|
|
62
|
+
search?: string;
|
|
63
|
+
status?: FeedbackStatus;
|
|
64
|
+
collectionStatus?: FeedbackReportView['collectionStatus'];
|
|
65
|
+
appId?: string;
|
|
66
|
+
appVersion?: string;
|
|
67
|
+
from?: number;
|
|
68
|
+
to?: number;
|
|
69
|
+
sortDirection?: 'asc' | 'desc';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 按宿主权限控制操作;服务端仍须重新鉴权。
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* import type { FeedbackPermissions } from '@h-ai/ui'
|
|
76
|
+
* const permissions: FeedbackPermissions = { read: true, process: true }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export interface FeedbackPermissions {
|
|
80
|
+
read?: boolean;
|
|
81
|
+
process?: boolean;
|
|
82
|
+
reopen?: boolean;
|
|
83
|
+
export?: boolean;
|
|
84
|
+
retry?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 处理/撤销操作传递的乐观版本。
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* import type { FeedbackStatusChange } from '@h-ai/ui'
|
|
91
|
+
* const change: FeedbackStatusChange = { id: 'f1', status: 'handled', expectedVersion: 1 }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export interface FeedbackStatusChange {
|
|
95
|
+
id: string;
|
|
96
|
+
status: FeedbackStatus;
|
|
97
|
+
expectedVersion: number;
|
|
98
|
+
note?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 采集证据的展示模型。
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* import type { FeedbackEvidenceView } from '@h-ai/ui'
|
|
105
|
+
* const event: FeedbackEvidenceView = { id: 'e1', source: 'browser', sequence: 1, kind: 'log', timestamp: 0, data: {} }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export interface FeedbackEvidenceView {
|
|
109
|
+
id: string;
|
|
110
|
+
source: string;
|
|
111
|
+
sequence: number;
|
|
112
|
+
kind: string;
|
|
113
|
+
timestamp: number;
|
|
114
|
+
requestId?: string;
|
|
115
|
+
errorId?: string;
|
|
116
|
+
data: Record<string, unknown>;
|
|
117
|
+
missingReason?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 详情证据的分页过滤。
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import type { FeedbackEvidenceQuery } from '@h-ai/ui'
|
|
124
|
+
* const query: FeedbackEvidenceQuery = { page: 1, pageSize: 20, kind: 'log' }
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export interface FeedbackEvidenceQuery {
|
|
128
|
+
page: number;
|
|
129
|
+
pageSize: number;
|
|
130
|
+
kind?: string;
|
|
131
|
+
requestId?: string;
|
|
132
|
+
errorId?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* 附件预览由宿主经授权取得,url 推荐为短期本地 Blob URL。
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* import type { FeedbackAttachmentView } from '@h-ai/ui'
|
|
139
|
+
* const item: FeedbackAttachmentView = { id: 'a1', name: 'screen.png', mimeType: 'image/png' }
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export interface FeedbackAttachmentView {
|
|
143
|
+
id: string;
|
|
144
|
+
name: string;
|
|
145
|
+
mimeType?: string;
|
|
146
|
+
size?: number;
|
|
147
|
+
url?: string;
|
|
148
|
+
missingReason?: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 已脱敏采集材料的可折叠摘要。
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* import type { FeedbackEvidenceSummary } from '@h-ai/ui'
|
|
155
|
+
* const item: FeedbackEvidenceSummary = { label: 'Logs', count: 12, status: 'complete' }
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export interface FeedbackEvidenceSummary {
|
|
159
|
+
label: string;
|
|
160
|
+
count?: number;
|
|
161
|
+
status?: 'complete' | 'missing' | 'partial' | 'not-applicable';
|
|
162
|
+
detail?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* 截图标注采用相对于原图的 0–1 坐标,图像修改由宿主采集服务完成。
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* import type { FeedbackAnnotation } from '@h-ai/ui'
|
|
169
|
+
* const mark: FeedbackAnnotation = { id: 'a1', rect: { x: 0.1, y: 0.1, width: 0.2, height: 0.2 }, mode: 'mask' }
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
export interface FeedbackAnnotation {
|
|
173
|
+
id: string;
|
|
174
|
+
rect: {
|
|
175
|
+
x: number;
|
|
176
|
+
y: number;
|
|
177
|
+
width: number;
|
|
178
|
+
height: number;
|
|
179
|
+
};
|
|
180
|
+
mode: 'mask' | 'outline';
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* 反馈收集表单值;所有文字项可留空。
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* import type { FeedbackFormData } from '@h-ai/ui'
|
|
187
|
+
* const input: FeedbackFormData = { description: '', files: [], removedAttachmentIds: [] }
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
export interface FeedbackFormData {
|
|
191
|
+
type?: 'bug' | 'feature' | 'question' | 'other';
|
|
192
|
+
description: string;
|
|
193
|
+
contact?: string;
|
|
194
|
+
files: File[];
|
|
195
|
+
removedAttachmentIds: string[];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* 服务端可靠受理后的回执;材料仍可能异步汇集。
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* import type { FeedbackReceipt } from '@h-ai/ui'
|
|
202
|
+
* const receipt: FeedbackReceipt = { number: 'FB-123', collectionStatus: 'collecting' }
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
export interface FeedbackReceipt {
|
|
206
|
+
number: string;
|
|
207
|
+
collectionStatus: FeedbackReportView['collectionStatus'];
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* 人工处理历史展示。
|
|
211
|
+
* @example
|
|
212
|
+
* ```ts
|
|
213
|
+
* import type { FeedbackHistoryView } from '@h-ai/ui'
|
|
214
|
+
* const change: FeedbackHistoryView = { id: 'h1', actorId: 'u1', fromStatus: 'pending', toStatus: 'handled', createdAt: 0 }
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
export interface FeedbackHistoryView {
|
|
218
|
+
id: string;
|
|
219
|
+
actorId: string;
|
|
220
|
+
fromStatus: FeedbackStatus;
|
|
221
|
+
toStatus: FeedbackStatus;
|
|
222
|
+
createdAt: number;
|
|
223
|
+
note?: string;
|
|
224
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
* 面向应用层的通用功能组件,包含设置、反馈、语言/主题切换等。 内置中英日文翻译,自动响应全局 locale。
|
|
5
5
|
* @module index
|
|
6
6
|
*/
|
|
7
|
+
export type { FeedbackAnnotation, FeedbackAttachmentView, FeedbackEvidenceQuery, FeedbackEvidenceSummary, FeedbackEvidenceView, FeedbackFormData, FeedbackHistoryView, FeedbackListQuery, FeedbackPage, FeedbackPermissions, FeedbackReceipt, FeedbackReportView, FeedbackStatus, FeedbackStatusChange } from './feedback-types.js';
|
|
8
|
+
export { default as FeedbackDetail } from './FeedbackDetail.svelte';
|
|
9
|
+
export { default as FeedbackForm } from './FeedbackForm.svelte';
|
|
10
|
+
export { default as FeedbackList } from './FeedbackList.svelte';
|
|
7
11
|
export { default as FeedbackModal } from './FeedbackModal.svelte';
|
|
8
12
|
export { default as LanguageSwitch } from './LanguageSwitch.svelte';
|
|
9
13
|
export { default as SettingsLayout } from './SettingsLayout.svelte';
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* 面向应用层的通用功能组件,包含设置、反馈、语言/主题切换等。 内置中英日文翻译,自动响应全局 locale。
|
|
5
5
|
* @module index
|
|
6
6
|
*/
|
|
7
|
+
export { default as FeedbackDetail } from './FeedbackDetail.svelte';
|
|
8
|
+
export { default as FeedbackForm } from './FeedbackForm.svelte';
|
|
9
|
+
export { default as FeedbackList } from './FeedbackList.svelte';
|
|
7
10
|
export { default as FeedbackModal } from './FeedbackModal.svelte';
|
|
8
11
|
export { default as LanguageSwitch } from './LanguageSwitch.svelte';
|
|
9
12
|
export { default as SettingsLayout } from './SettingsLayout.svelte';
|
package/dist/messages/en-US.json
CHANGED
|
@@ -385,5 +385,78 @@
|
|
|
385
385
|
"form_step": "Enter a value in increments of {step}.",
|
|
386
386
|
"form_pattern": "Enter a value in the required format.",
|
|
387
387
|
"select_clear": "Clear selection",
|
|
388
|
-
"select_no_match": "No matching options"
|
|
388
|
+
"select_no_match": "No matching options",
|
|
389
|
+
"feedback_optional_description": "A short description (optional)",
|
|
390
|
+
"feedback_quick_hint": "You can submit now. Allowed diagnostic materials will be included.",
|
|
391
|
+
"feedback_more": "More options",
|
|
392
|
+
"feedback_materials": "Automatically collected materials",
|
|
393
|
+
"feedback_screenshots": "Screenshots and annotations",
|
|
394
|
+
"feedback_attachments": "Attachments",
|
|
395
|
+
"feedback_add_files": "Add screenshots or attachments",
|
|
396
|
+
"feedback_remove": "Remove",
|
|
397
|
+
"feedback_local_export": "Save local diagnostic bundle",
|
|
398
|
+
"feedback_accepted": "Accepted: {number}",
|
|
399
|
+
"feedback_accepted_hint": "You can keep using the product while materials are collected in the background.",
|
|
400
|
+
"feedback_collecting": "Collecting materials",
|
|
401
|
+
"feedback_complete": "Materials collected",
|
|
402
|
+
"feedback_partial": "Some materials are missing",
|
|
403
|
+
"feedback_failed": "Collection failed",
|
|
404
|
+
"feedback_missing": "Missing",
|
|
405
|
+
"feedback_not_applicable": "Not applicable",
|
|
406
|
+
"feedback_pending": "Pending",
|
|
407
|
+
"feedback_handled": "Handled",
|
|
408
|
+
"feedback_handle": "Mark as handled",
|
|
409
|
+
"feedback_reopen": "Reopen",
|
|
410
|
+
"feedback_export": "Export diagnostic bundle",
|
|
411
|
+
"feedback_retry": "Retry",
|
|
412
|
+
"feedback_details": "View details",
|
|
413
|
+
"feedback_list_title": "Problem feedback",
|
|
414
|
+
"feedback_search": "Search number or description",
|
|
415
|
+
"feedback_number": "Feedback number",
|
|
416
|
+
"feedback_summary": "Description / factual summary",
|
|
417
|
+
"feedback_application": "Application",
|
|
418
|
+
"feedback_version": "Version",
|
|
419
|
+
"feedback_submitter": "Submitted by",
|
|
420
|
+
"feedback_created_at": "Submitted at",
|
|
421
|
+
"feedback_processing": "Processing status",
|
|
422
|
+
"feedback_collection": "Collection status",
|
|
423
|
+
"feedback_notification": "Notification status",
|
|
424
|
+
"feedback_notification_pending": "Notification pending",
|
|
425
|
+
"feedback_notification_sending": "Sending notification",
|
|
426
|
+
"feedback_notification_sent": "Accepted by mail service",
|
|
427
|
+
"feedback_notification_deferred": "Notification deferred",
|
|
428
|
+
"feedback_notification_failed": "Notification failed",
|
|
429
|
+
"feedback_date_range": "Submission date range",
|
|
430
|
+
"feedback_no_description": "No additional description",
|
|
431
|
+
"feedback_action_failed": "The action failed. Please retry.",
|
|
432
|
+
"feedback_overview": "Overview",
|
|
433
|
+
"feedback_scene": "Activity and attachments",
|
|
434
|
+
"feedback_logs": "Logs and requests",
|
|
435
|
+
"feedback_environment": "Environment",
|
|
436
|
+
"feedback_history": "Processing and delivery",
|
|
437
|
+
"feedback_note": "Processing note (optional)",
|
|
438
|
+
"feedback_source": "Source",
|
|
439
|
+
"feedback_kind": "Material type",
|
|
440
|
+
"feedback_request_id": "Request ID",
|
|
441
|
+
"feedback_error_id": "Error ID",
|
|
442
|
+
"feedback_evidence_empty": "No materials to show. Check the collection status for missing evidence.",
|
|
443
|
+
"feedback_permission_denied": "You do not have permission to view feedback.",
|
|
444
|
+
"feedback_loading": "Loading materials…",
|
|
445
|
+
"feedback_empty": "No feedback yet",
|
|
446
|
+
"feedback_revision": "Evidence revision",
|
|
447
|
+
"feedback_mark_outline": "Highlight problem area",
|
|
448
|
+
"feedback_mark_mask": "Mask sensitive area",
|
|
449
|
+
"feedback_mark_hint": "Drag over the image or enter percentage coordinates, then apply the annotation.",
|
|
450
|
+
"feedback_mark_apply": "Apply annotation",
|
|
451
|
+
"feedback_mark_clear": "Clear selection",
|
|
452
|
+
"feedback_mark_x": "Left (%)",
|
|
453
|
+
"feedback_mark_y": "Top (%)",
|
|
454
|
+
"feedback_mark_width": "Width (%)",
|
|
455
|
+
"feedback_mark_height": "Height (%)",
|
|
456
|
+
"feedback_download": "View / download",
|
|
457
|
+
"feedback_close": "Close",
|
|
458
|
+
"feedback_apply_filters": "Query materials",
|
|
459
|
+
"feedback_preview_failed": "The image preview is unavailable. Other materials can still be viewed or submitted.",
|
|
460
|
+
"feedback_build_id": "Build identifier",
|
|
461
|
+
"feedback_commit": "Source commit"
|
|
389
462
|
}
|
package/dist/messages/ja-JP.json
CHANGED
|
@@ -385,5 +385,78 @@
|
|
|
385
385
|
"form_step": "{step}刻みの値を入力してください。",
|
|
386
386
|
"form_pattern": "指定された形式で入力してください。",
|
|
387
387
|
"select_clear": "選択をクリア",
|
|
388
|
-
"select_no_match": "一致する選択肢がありません"
|
|
388
|
+
"select_no_match": "一致する選択肢がありません",
|
|
389
|
+
"feedback_optional_description": "簡単な説明(任意)",
|
|
390
|
+
"feedback_quick_hint": "そのまま送信できます。許可された診断資料が添付されます。",
|
|
391
|
+
"feedback_more": "その他のオプション",
|
|
392
|
+
"feedback_materials": "自動収集した資料",
|
|
393
|
+
"feedback_screenshots": "スクリーンショットと注釈",
|
|
394
|
+
"feedback_attachments": "添付ファイル",
|
|
395
|
+
"feedback_add_files": "画像やファイルを追加",
|
|
396
|
+
"feedback_remove": "削除",
|
|
397
|
+
"feedback_local_export": "診断パッケージをローカル保存",
|
|
398
|
+
"feedback_accepted": "受理しました:{number}",
|
|
399
|
+
"feedback_accepted_hint": "資料はバックグラウンドで収集されます。引き続き製品をご利用いただけます。",
|
|
400
|
+
"feedback_collecting": "資料を収集中",
|
|
401
|
+
"feedback_complete": "資料収集済み",
|
|
402
|
+
"feedback_partial": "一部の資料がありません",
|
|
403
|
+
"feedback_failed": "資料収集に失敗",
|
|
404
|
+
"feedback_missing": "欠落",
|
|
405
|
+
"feedback_not_applicable": "対象外",
|
|
406
|
+
"feedback_pending": "未処理",
|
|
407
|
+
"feedback_handled": "処理済み",
|
|
408
|
+
"feedback_handle": "処理済みにする",
|
|
409
|
+
"feedback_reopen": "処理を取り消す",
|
|
410
|
+
"feedback_export": "診断パッケージをエクスポート",
|
|
411
|
+
"feedback_retry": "再試行",
|
|
412
|
+
"feedback_details": "詳細を見る",
|
|
413
|
+
"feedback_list_title": "問題のフィードバック",
|
|
414
|
+
"feedback_search": "番号または説明を検索",
|
|
415
|
+
"feedback_number": "受付番号",
|
|
416
|
+
"feedback_summary": "説明 / 事実の要約",
|
|
417
|
+
"feedback_application": "アプリケーション",
|
|
418
|
+
"feedback_version": "バージョン",
|
|
419
|
+
"feedback_submitter": "投稿者",
|
|
420
|
+
"feedback_created_at": "投稿日時",
|
|
421
|
+
"feedback_processing": "処理状況",
|
|
422
|
+
"feedback_collection": "収集状況",
|
|
423
|
+
"feedback_notification": "通知状況",
|
|
424
|
+
"feedback_notification_pending": "通知待ち",
|
|
425
|
+
"feedback_notification_sending": "送信中",
|
|
426
|
+
"feedback_notification_sent": "メールサービスで受理済み",
|
|
427
|
+
"feedback_notification_deferred": "通知延期",
|
|
428
|
+
"feedback_notification_failed": "通知失敗",
|
|
429
|
+
"feedback_date_range": "投稿日時の範囲",
|
|
430
|
+
"feedback_no_description": "補足説明なし",
|
|
431
|
+
"feedback_action_failed": "操作に失敗しました。再試行してください。",
|
|
432
|
+
"feedback_overview": "概要",
|
|
433
|
+
"feedback_scene": "操作と添付ファイル",
|
|
434
|
+
"feedback_logs": "ログとリクエスト",
|
|
435
|
+
"feedback_environment": "環境",
|
|
436
|
+
"feedback_history": "処理と配信",
|
|
437
|
+
"feedback_note": "処理メモ(任意)",
|
|
438
|
+
"feedback_source": "取得元",
|
|
439
|
+
"feedback_kind": "資料の種類",
|
|
440
|
+
"feedback_request_id": "リクエスト ID",
|
|
441
|
+
"feedback_error_id": "エラー ID",
|
|
442
|
+
"feedback_evidence_empty": "表示できる資料がありません。収集状況で欠落理由をご確認ください。",
|
|
443
|
+
"feedback_permission_denied": "フィードバックを閲覧する権限がありません。",
|
|
444
|
+
"feedback_loading": "資料を読み込み中…",
|
|
445
|
+
"feedback_empty": "フィードバックはまだありません",
|
|
446
|
+
"feedback_revision": "資料リビジョン",
|
|
447
|
+
"feedback_mark_outline": "問題の範囲を指定",
|
|
448
|
+
"feedback_mark_mask": "機密情報を隠す",
|
|
449
|
+
"feedback_mark_hint": "画像をドラッグするか割合の座標を入力して、注釈を適用してください。",
|
|
450
|
+
"feedback_mark_apply": "注釈を適用",
|
|
451
|
+
"feedback_mark_clear": "選択を解除",
|
|
452
|
+
"feedback_mark_x": "左 (%)",
|
|
453
|
+
"feedback_mark_y": "上 (%)",
|
|
454
|
+
"feedback_mark_width": "幅 (%)",
|
|
455
|
+
"feedback_mark_height": "高さ (%)",
|
|
456
|
+
"feedback_download": "表示 / ダウンロード",
|
|
457
|
+
"feedback_close": "閉じる",
|
|
458
|
+
"feedback_apply_filters": "資料を検索",
|
|
459
|
+
"feedback_preview_failed": "画像を表示できません。他の資料は引き続き閲覧・送信できます。",
|
|
460
|
+
"feedback_build_id": "ビルド識別子",
|
|
461
|
+
"feedback_commit": "ソースコミット"
|
|
389
462
|
}
|