@awiki/dsh-plugin 0.3.7 → 0.3.11-rc.1
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.md +112 -73
- package/README.zh.md +91 -62
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/cordis.patch.yml +6 -5
- package/lib/builtin-tenants.json +22 -0
- package/lib/builtin-tenants.sha256 +1 -0
- package/lib/client.js +9281 -2379
- package/lib/client.js.map +1 -1
- package/lib/index.js +3553 -1138
- package/lib/model-proxy-contract.js +19 -11
- package/lib/provider.js +73 -17
- package/lib/{sdk-adapter--trNlr-T.mjs → sdk-adapter-CYcJH7sM.mjs} +374 -101
- package/lib/typert.host.js +1595 -168
- package/lib/typert.remote-client.d.ts +43 -7
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +1595 -168
- package/lib/types/builtin-tenant-config.d.ts +19 -0
- package/lib/types/builtin-tenant-config.d.ts.map +1 -0
- package/lib/types/builtin-tenant-config.js +57 -0
- package/lib/types/builtin-tenant-config.js.map +1 -0
- package/lib/types/client/AwikiDeviceJoinReminder.d.ts +15 -0
- package/lib/types/client/AwikiDeviceJoinReminder.d.ts.map +1 -0
- package/lib/types/client/AwikiDeviceJoinReminder.js +74 -0
- package/lib/types/client/AwikiDeviceJoinReminder.js.map +1 -0
- package/lib/types/client/AwikiDevices.d.ts +33 -0
- package/lib/types/client/AwikiDevices.d.ts.map +1 -0
- package/lib/types/client/AwikiDevices.js +141 -0
- package/lib/types/client/AwikiDevices.js.map +1 -0
- package/lib/types/client/AwikiGroupDetails.d.ts.map +1 -1
- package/lib/types/client/AwikiGroupDetails.js +16 -13
- package/lib/types/client/AwikiGroupDetails.js.map +1 -1
- package/lib/types/client/AwikiIdentityAccess.d.ts +17 -8
- package/lib/types/client/AwikiIdentityAccess.d.ts.map +1 -1
- package/lib/types/client/AwikiIdentityAccess.js +269 -37
- package/lib/types/client/AwikiIdentityAccess.js.map +1 -1
- package/lib/types/client/AwikiIntegrationSettings.d.ts +21 -0
- package/lib/types/client/AwikiIntegrationSettings.d.ts.map +1 -0
- package/lib/types/client/AwikiIntegrationSettings.js +105 -0
- package/lib/types/client/AwikiIntegrationSettings.js.map +1 -0
- package/lib/types/client/AwikiMail.d.ts +1 -1
- package/lib/types/client/AwikiMail.d.ts.map +1 -1
- package/lib/types/client/AwikiMail.js +17 -137
- package/lib/types/client/AwikiMail.js.map +1 -1
- package/lib/types/client/AwikiOverlay.d.ts +0 -1
- package/lib/types/client/AwikiOverlay.d.ts.map +1 -1
- package/lib/types/client/AwikiOverlay.js +26 -28
- package/lib/types/client/AwikiOverlay.js.map +1 -1
- package/lib/types/client/AwikiProfileCard.d.ts.map +1 -1
- package/lib/types/client/AwikiProfileCard.js +17 -18
- package/lib/types/client/AwikiProfileCard.js.map +1 -1
- package/lib/types/client/AwikiRecoveryForm.d.ts +6 -1
- package/lib/types/client/AwikiRecoveryForm.d.ts.map +1 -1
- package/lib/types/client/AwikiRecoveryForm.js +74 -30
- package/lib/types/client/AwikiRecoveryForm.js.map +1 -1
- package/lib/types/client/AwikiSettingsSection.d.ts +28 -13
- package/lib/types/client/AwikiSettingsSection.d.ts.map +1 -1
- package/lib/types/client/AwikiSettingsSection.js +93 -61
- package/lib/types/client/AwikiSettingsSection.js.map +1 -1
- package/lib/types/client/AwikiUpdates.d.ts +10 -0
- package/lib/types/client/AwikiUpdates.d.ts.map +1 -0
- package/lib/types/client/AwikiUpdates.js +57 -0
- package/lib/types/client/AwikiUpdates.js.map +1 -0
- package/lib/types/client/awiki-client-bridge.d.ts +2 -2
- package/lib/types/client/awiki-client-bridge.d.ts.map +1 -1
- package/lib/types/client/awiki-client-bridge.js +4 -1
- package/lib/types/client/awiki-client-bridge.js.map +1 -1
- package/lib/types/client/controller.d.ts +92 -44
- package/lib/types/client/controller.d.ts.map +1 -1
- package/lib/types/client/controller.js +761 -334
- package/lib/types/client/controller.js.map +1 -1
- package/lib/types/client/drafts.d.ts +31 -0
- package/lib/types/client/drafts.d.ts.map +1 -0
- package/lib/types/client/drafts.js +94 -0
- package/lib/types/client/drafts.js.map +1 -0
- package/lib/types/client/image-cache.d.ts +2 -2
- package/lib/types/client/image-cache.d.ts.map +1 -1
- package/lib/types/client/image-cache.js +15 -2
- package/lib/types/client/image-cache.js.map +1 -1
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +64 -19
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/integration-operation.d.ts +9 -0
- package/lib/types/client/integration-operation.d.ts.map +1 -0
- package/lib/types/client/integration-operation.js +54 -0
- package/lib/types/client/integration-operation.js.map +1 -0
- package/lib/types/client/mail-list-cache.d.ts +2 -0
- package/lib/types/client/mail-list-cache.d.ts.map +1 -1
- package/lib/types/client/mail-list-cache.js +18 -0
- package/lib/types/client/mail-list-cache.js.map +1 -1
- package/lib/types/client/otp-cooldown.d.ts +7 -0
- package/lib/types/client/otp-cooldown.d.ts.map +1 -0
- package/lib/types/client/otp-cooldown.js +29 -0
- package/lib/types/client/otp-cooldown.js.map +1 -0
- package/lib/types/client/settings-controller.d.ts +38 -2
- package/lib/types/client/settings-controller.d.ts.map +1 -1
- package/lib/types/client/settings-controller.js +206 -10
- package/lib/types/client/settings-controller.js.map +1 -1
- package/lib/types/client/settings-locales.d.ts +1 -1
- package/lib/types/client/settings-locales.d.ts.map +1 -1
- package/lib/types/client/settings-locales.js +192 -14
- package/lib/types/client/settings-locales.js.map +1 -1
- package/lib/types/client/slots.d.ts +21 -10
- package/lib/types/client/slots.d.ts.map +1 -1
- package/lib/types/client/slots.js +0 -1
- package/lib/types/client/slots.js.map +1 -1
- package/lib/types/client/store.d.ts +1 -1
- package/lib/types/client/store.d.ts.map +1 -1
- package/lib/types/client/store.js +1 -1
- package/lib/types/client/store.js.map +1 -1
- package/lib/types/conversation-preferences.d.ts.map +1 -1
- package/lib/types/conversation-preferences.js +0 -17
- package/lib/types/conversation-preferences.js.map +1 -1
- package/lib/types/desktop-distribution.d.ts +25 -0
- package/lib/types/desktop-distribution.d.ts.map +1 -0
- package/lib/types/desktop-distribution.js +57 -0
- package/lib/types/desktop-distribution.js.map +1 -0
- package/lib/types/domain.d.ts +1 -1
- package/lib/types/domain.d.ts.map +1 -1
- package/lib/types/domain.js +2 -1
- package/lib/types/domain.js.map +1 -1
- package/lib/types/index.d.ts +165 -41
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +1594 -535
- package/lib/types/index.js.map +1 -1
- package/lib/types/integration-client.d.ts +17 -0
- package/lib/types/integration-client.d.ts.map +1 -0
- package/lib/types/integration-client.js +233 -0
- package/lib/types/integration-client.js.map +1 -0
- package/lib/types/legacy-sent-mail-cache.d.ts +4 -0
- package/lib/types/legacy-sent-mail-cache.d.ts.map +1 -0
- package/lib/types/legacy-sent-mail-cache.js +29 -0
- package/lib/types/legacy-sent-mail-cache.js.map +1 -0
- package/lib/types/listener-state.d.ts +5 -3
- package/lib/types/listener-state.d.ts.map +1 -1
- package/lib/types/listener-state.js +28 -13
- package/lib/types/listener-state.js.map +1 -1
- package/lib/types/listener.d.ts +9 -32
- package/lib/types/listener.d.ts.map +1 -1
- package/lib/types/listener.js +13 -128
- package/lib/types/listener.js.map +1 -1
- package/lib/types/mail-list-client.d.ts +12 -0
- package/lib/types/mail-list-client.d.ts.map +1 -0
- package/lib/types/mail-list-client.js +254 -0
- package/lib/types/mail-list-client.js.map +1 -0
- package/lib/types/mail-recovery-observability.d.ts +8 -0
- package/lib/types/mail-recovery-observability.d.ts.map +1 -0
- package/lib/types/mail-recovery-observability.js +119 -0
- package/lib/types/mail-recovery-observability.js.map +1 -0
- package/lib/types/mail.d.ts +2 -28
- package/lib/types/mail.d.ts.map +1 -1
- package/lib/types/mail.js +2 -79
- package/lib/types/mail.js.map +1 -1
- package/lib/types/model-proxy-contract.d.ts +8 -8
- package/lib/types/model-proxy-contract.d.ts.map +1 -1
- package/lib/types/model-proxy-contract.js +15 -8
- package/lib/types/model-proxy-contract.js.map +1 -1
- package/lib/types/package-version.generated.d.ts +4 -0
- package/lib/types/package-version.generated.d.ts.map +1 -0
- package/lib/types/package-version.generated.js +4 -0
- package/lib/types/package-version.generated.js.map +1 -0
- package/lib/types/profile-state.d.ts +2 -13
- package/lib/types/profile-state.d.ts.map +1 -1
- package/lib/types/profile-state.js +3 -20
- package/lib/types/profile-state.js.map +1 -1
- package/lib/types/provider-api.d.ts +134 -43
- package/lib/types/provider-api.d.ts.map +1 -1
- package/lib/types/provider.d.ts +8 -2
- package/lib/types/provider.d.ts.map +1 -1
- package/lib/types/provider.js +76 -16
- package/lib/types/provider.js.map +1 -1
- package/lib/types/realtime-supervisor.d.ts +60 -0
- package/lib/types/realtime-supervisor.d.ts.map +1 -0
- package/lib/types/realtime-supervisor.js +255 -0
- package/lib/types/realtime-supervisor.js.map +1 -0
- package/lib/types/registration-policy.d.ts +7 -0
- package/lib/types/registration-policy.d.ts.map +1 -0
- package/lib/types/registration-policy.js +21 -0
- package/lib/types/registration-policy.js.map +1 -0
- package/lib/types/sdk-adapter.d.ts +62 -11
- package/lib/types/sdk-adapter.d.ts.map +1 -1
- package/lib/types/sdk-adapter.js +285 -123
- package/lib/types/sdk-adapter.js.map +1 -1
- package/lib/types/settings-rpc-contract.d.ts +63 -5
- package/lib/types/settings-rpc-contract.d.ts.map +1 -1
- package/lib/types/settings-rpc-contract.js +108 -5
- package/lib/types/settings-rpc-contract.js.map +1 -1
- package/lib/types/settings-rpc.d.ts +14 -1
- package/lib/types/settings-rpc.d.ts.map +1 -1
- package/lib/types/settings-rpc.js +132 -3
- package/lib/types/settings-rpc.js.map +1 -1
- package/lib/types/settings-transport.d.ts +7 -0
- package/lib/types/settings-transport.d.ts.map +1 -0
- package/lib/types/settings-transport.js +52 -0
- package/lib/types/settings-transport.js.map +1 -0
- package/lib/types/tenant-registry.d.ts +74 -0
- package/lib/types/tenant-registry.d.ts.map +1 -0
- package/lib/types/tenant-registry.js +440 -0
- package/lib/types/tenant-registry.js.map +1 -0
- package/lib/types/tools.d.ts +1 -1
- package/lib/types/tools.d.ts.map +1 -1
- package/lib/types/tools.js +4 -20
- package/lib/types/tools.js.map +1 -1
- package/lib/types/types.d.ts +249 -66
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/types/update-policy.d.ts +51 -0
- package/lib/types/update-policy.d.ts.map +1 -0
- package/lib/types/update-policy.js +379 -0
- package/lib/types/update-policy.js.map +1 -0
- package/lib/types/version.d.ts +4 -0
- package/lib/types/version.d.ts.map +1 -0
- package/lib/types/version.js +44 -0
- package/lib/types/version.js.map +1 -0
- package/package.json +88 -61
- package/lib/types/base64.d.ts +0 -4
- package/lib/types/base64.d.ts.map +0 -1
- package/lib/types/base64.js +0 -28
- package/lib/types/base64.js.map +0 -1
- package/lib/types/client/mail-attachment.d.ts +0 -40
- package/lib/types/client/mail-attachment.d.ts.map +0 -1
- package/lib/types/client/mail-attachment.js +0 -187
- package/lib/types/client/mail-attachment.js.map +0 -1
- package/lib/types/sent-mail-store.d.ts +0 -27
- package/lib/types/sent-mail-store.d.ts.map +0 -1
- package/lib/types/sent-mail-store.js +0 -348
- package/lib/types/sent-mail-store.js.map +0 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useDraftState } from "./drafts.js";
|
|
3
|
+
/** Isolated Integration management panel for the full AWiki plugin. */
|
|
4
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
5
|
+
import { Button } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
6
|
+
import css from './AwikiSettingsSection.module.css';
|
|
7
|
+
function emptyFields() {
|
|
8
|
+
return { productName: '', description: '', contactEnabled: true, contactDescription: '', groupTargets: [] };
|
|
9
|
+
}
|
|
10
|
+
function fieldsFrom(value) {
|
|
11
|
+
return {
|
|
12
|
+
productName: value.productName,
|
|
13
|
+
description: value.description,
|
|
14
|
+
contactEnabled: value.contactEnabled,
|
|
15
|
+
contactDescription: value.contactDescription,
|
|
16
|
+
groupTargets: value.groupTargets.map(target => ({ id: target.id, groupDid: target.groupDid, description: target.description })),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Render management independently so Gateway errors never disable ordinary AWiki settings. */
|
|
20
|
+
export function AwikiIntegrationSettings(props) {
|
|
21
|
+
const [current, setCurrent] = useState(null);
|
|
22
|
+
const [draft, setDraft] = useDraftState('settings:integration', null);
|
|
23
|
+
const fields = draft?.fields ?? (current === null ? emptyFields() : fieldsFrom(current));
|
|
24
|
+
const setFields = (next) => setDraft(previous => ({
|
|
25
|
+
base: previous === null ? current : previous.base,
|
|
26
|
+
fields: typeof next === 'function' ? next(previous?.fields ?? fields) : next,
|
|
27
|
+
}));
|
|
28
|
+
const [groups, setGroups] = useState([]);
|
|
29
|
+
const [groupsUnavailable, setGroupsUnavailable] = useState(false);
|
|
30
|
+
const [loading, setLoading] = useState(true);
|
|
31
|
+
const [pending, setPending] = useDraftState('settings:integration-pending', false, false);
|
|
32
|
+
const [error, setError] = useState(null);
|
|
33
|
+
const [saved, setSaved] = useState(false);
|
|
34
|
+
const reload = async () => {
|
|
35
|
+
setLoading(true);
|
|
36
|
+
setError(null);
|
|
37
|
+
setGroupsUnavailable(false);
|
|
38
|
+
try {
|
|
39
|
+
const [integration, ownedGroups] = await Promise.all([props.loadIntegration(), props.listOwnedGroups()]);
|
|
40
|
+
if (!integration.ok)
|
|
41
|
+
setError(integration.error);
|
|
42
|
+
else {
|
|
43
|
+
setCurrent(integration.value);
|
|
44
|
+
}
|
|
45
|
+
if (ownedGroups.ok)
|
|
46
|
+
setGroups(ownedGroups.value);
|
|
47
|
+
else
|
|
48
|
+
setGroupsUnavailable(true);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
setError(props.t('unavailable'));
|
|
52
|
+
setGroupsUnavailable(true);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
setLoading(false);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
useEffect(() => { void reload(); }, []);
|
|
59
|
+
const availableGroups = useMemo(() => groups.filter(group => (!fields.groupTargets.some(target => target.groupDid === group.groupDid))), [fields.groupTargets, groups]);
|
|
60
|
+
const closed = current?.status === 'closed';
|
|
61
|
+
const invalidDraft = fields.productName.trim() === '' || (!fields.contactEnabled && fields.groupTargets.length === 0);
|
|
62
|
+
const mutate = async (operation) => {
|
|
63
|
+
setPending(true);
|
|
64
|
+
setError(null);
|
|
65
|
+
setSaved(false);
|
|
66
|
+
try {
|
|
67
|
+
const result = await operation();
|
|
68
|
+
if (result.ok) {
|
|
69
|
+
setCurrent(result.value);
|
|
70
|
+
setDraft(null);
|
|
71
|
+
setSaved(true);
|
|
72
|
+
}
|
|
73
|
+
else
|
|
74
|
+
setError(result.error);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
setError(props.t('unavailable'));
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
setPending(false);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const addGroup = (groupDid) => {
|
|
84
|
+
const next = { groupDid, description: '' };
|
|
85
|
+
setFields(value => ({ ...value, groupTargets: [...value.groupTargets, next] }));
|
|
86
|
+
};
|
|
87
|
+
if (loading)
|
|
88
|
+
return _jsx("p", { className: css.status, children: props.t('integrationLoading') });
|
|
89
|
+
return (_jsxs("section", { className: css.integrationCard, "aria-labelledby": "awiki-integration-title", children: [_jsxs("div", { className: css.integrationHeader, children: [_jsxs("div", { children: [_jsx("h3", { id: "awiki-integration-title", className: css.dangerTitle, children: props.t('integrationTitle') }), _jsx("p", { className: css.description, children: props.t('integrationDescription') })] }), _jsx(Button, { type: "button", variant: "outline", onClick: props.openIntegrationGuide, children: props.t('integrationGuide') })] }), closed && _jsxs("div", { className: css.closedNotice, role: "status", children: [_jsx("strong", { children: props.t('integrationClosed') }), _jsx("span", { children: props.t('integrationClosedDescription') })] }), _jsx("label", { className: css.label, htmlFor: "awiki-integration-name", children: props.t('integrationName') }), _jsx("input", { id: "awiki-integration-name", className: css.input, placeholder: props.t('integrationNamePlaceholder'), maxLength: 80, disabled: pending, value: fields.productName, onChange: event => { setFields(value => ({ ...value, productName: event.target.value })); setSaved(false); } }), _jsx("label", { className: css.label, htmlFor: "awiki-integration-description", children: props.t('integrationIntroduction') }), _jsx("textarea", { id: "awiki-integration-description", className: css.textarea, placeholder: props.t('integrationIntroductionPlaceholder'), maxLength: 1000, disabled: pending, value: fields.description, onChange: event => { setFields(value => ({ ...value, description: event.target.value })); setSaved(false); } }), _jsxs("label", { className: css.checkLabel, children: [_jsx("input", { type: "checkbox", disabled: pending, checked: fields.contactEnabled, onChange: event => { setFields(value => ({ ...value, contactEnabled: event.target.checked })); setSaved(false); } }), props.t('integrationContactDeveloper')] }), fields.contactEnabled && _jsx("textarea", { className: css.textarea, "aria-label": props.t('integrationContactIntroduction'), placeholder: props.t('integrationContactIntroductionPlaceholder'), maxLength: 500, disabled: pending, value: fields.contactDescription, onChange: event => { setFields(value => ({ ...value, contactDescription: event.target.value })); setSaved(false); } }), _jsx("div", { className: css.groupHeader, children: _jsx("strong", { children: props.t('integrationGroups') }) }), fields.groupTargets.map((target, index) => {
|
|
90
|
+
const group = groups.find(candidate => candidate.groupDid === target.groupDid);
|
|
91
|
+
const stored = current?.groupTargets.find(candidate => candidate.groupDid === target.groupDid);
|
|
92
|
+
const displayName = group?.title ?? stored?.displayName ?? target.groupDid;
|
|
93
|
+
return _jsxs("div", { className: css.groupRow, children: [_jsxs("div", { className: css.groupSummary, children: [_jsxs("div", { className: css.groupIdentity, children: [_jsx("strong", { className: css.groupName, title: displayName, children: displayName }), _jsx("small", { className: css.groupDid, title: target.groupDid, children: target.groupDid })] }), _jsx(Button, { type: "button", variant: "outline", disabled: pending, onClick: () => setFields(value => ({ ...value, groupTargets: value.groupTargets.filter((_, itemIndex) => itemIndex !== index) })), children: props.t('integrationRemove') })] }), _jsx("input", { "aria-label": props.t('integrationGroupIntroduction'), placeholder: props.t('integrationGroupIntroductionPlaceholder'), className: css.input, maxLength: 500, disabled: pending, value: target.description, onChange: event => setFields(value => ({ ...value, groupTargets: value.groupTargets.map((item, itemIndex) => itemIndex === index ? { ...item, description: event.target.value } : item) })) })] }, target.groupDid);
|
|
94
|
+
}), groupsUnavailable
|
|
95
|
+
? _jsx("p", { className: `${css.status} ${css.error}`, children: props.t('integrationGroupsUnavailable') })
|
|
96
|
+
: availableGroups.length > 0
|
|
97
|
+
? _jsxs("select", { className: css.input, disabled: pending || fields.groupTargets.length >= 20, value: "", onChange: event => { if (event.target.value !== '')
|
|
98
|
+
addGroup(event.target.value); }, children: [_jsx("option", { value: "", children: props.t('integrationAddGroup') }), availableGroups.map(group => _jsx("option", { value: group.groupDid, children: group.title }, group.groupDid))] })
|
|
99
|
+
: _jsx("p", { className: css.status, children: props.t('integrationNoOwnedGroups') }), current?.integrationUrl !== null && current?.integrationUrl !== undefined && _jsxs("div", { className: css.integrationUrl, children: [_jsx("code", { children: current.integrationUrl }), _jsx(Button, { type: "button", variant: "outline", onClick: () => { void navigator.clipboard.writeText(current.integrationUrl ?? ''); }, children: props.t('integrationCopy') })] }), _jsxs("div", { className: css.actions, children: [closed && current !== null
|
|
100
|
+
? _jsx(Button, { type: "button", disabled: pending || invalidDraft, onClick: () => { void mutate(() => props.reopenIntegration(fields, draft?.base ?? current)); }, children: pending ? props.t('saving') : props.t('integrationReopen') })
|
|
101
|
+
: _jsx(Button, { type: "button", disabled: pending || invalidDraft, onClick: () => { void mutate(() => props.saveIntegration(fields, draft === null ? current : draft.base)); }, children: pending ? props.t('saving') : current === null ? props.t('integrationCreate') : props.t('save') }), current?.status === 'active' && _jsx(Button, { type: "button", variant: "outline", disabled: pending, onClick: () => { if (window.confirm(props.t('integrationRotateConfirm')))
|
|
102
|
+
void mutate(() => props.rotateIntegrationId(current)); }, children: props.t('integrationRotate') }), current?.status === 'active' && _jsx(Button, { type: "button", variant: "outline", disabled: pending, onClick: () => { if (window.confirm(props.t('integrationCloseConfirm')))
|
|
103
|
+
void mutate(() => props.closeIntegration(current)); }, children: props.t('integrationClose') })] }), saved && _jsx("p", { className: css.status, role: "status", children: props.t('saved') }), error !== null && _jsx("p", { className: `${css.status} ${css.error}`, role: "alert", children: error })] }));
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=AwikiIntegrationSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AwikiIntegrationSettings.js","sourceRoot":"","sources":["../../../src/client/AwikiIntegrationSettings.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAc,CAAA;AAC5C,uEAAuE;AAEvE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAuC,MAAM,OAAO,CAAA;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAA;AAS9D,OAAO,GAAG,MAAM,mCAAmC,CAAA;AAsBnD,SAAS,WAAW;IAClB,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,kBAAkB,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAA;AAC7G,CAAC;AAED,SAAS,UAAU,CAAC,KAA2B;IAC7C,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;QAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;KAChI,CAAA;AACH,C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CAAC,CAAC,CAAA,CAAC,CAAC,YAAG,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAU,EACrQ,OAAO,EAAE,MAAM,KAAK,QAAQ,IAAI,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC;4BAAE,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAA,CAAC,CAAC,YAAG,KAAK,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAU,IAC7P,EACL,KAAK,IAAI,YAAG,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAC,QAAQ,YAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAK,EACvE,KAAK,KAAK,IAAI,IAAI,YAAG,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAC,OAAO,YAAE,KAAK,GAAK,IAC/E,CACX,CAAA;AACH,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
3
|
import type { AwikiDid } from '@awiki/dsh-plugin/types';
|
|
4
4
|
import type { AwikiOverlayProps } from './slots.ts';
|
|
5
|
-
interface AwikiMailProps extends Pick<AwikiOverlayProps, '
|
|
5
|
+
interface AwikiMailProps extends Pick<AwikiOverlayProps, 'getMailAccount' | 'listMailInbox' | 'readMail' | 'markMailRead' | 'sendMail'> {
|
|
6
6
|
readonly active: boolean;
|
|
7
7
|
readonly cacheOwner: AwikiDid;
|
|
8
8
|
readonly identityCard: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AwikiMail.d.ts","sourceRoot":"","sources":["../../../src/client/AwikiMail.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AwikiMail.d.ts","sourceRoot":"","sources":["../../../src/client/AwikiMail.tsx"],"names":[],"mappings":"AACA,qFAAqF;AAErF,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAa5E,OAAO,KAAK,EACV,QAAQ,EAKT,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAUnD,UAAU,cAAe,SAAQ,IAAI,CAAC,iBAAiB,EACrD,gBAAgB,GAAG,eAAe,GAAG,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;IAC9E,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAA;IAC7B,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAA;IAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B,QAAQ,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACtD;AAqJD,2FAA2F;AAC3F,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAkc9C"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useDraftState } from "./drafts.js";
|
|
2
3
|
/** On-demand AWiki mailbox UI. Mail content is always rendered as untrusted text. */
|
|
3
4
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
5
|
import { Button, IconChevronLeftOutline14, IconEditOutline16, IconFolderOpenOutline16, IconLoadingOutline16, IconPaperclipOutline16, IconRefreshOutline14, IconSendOutline16, IconWarningOutline16, Modal, } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
5
6
|
import { readMailFolderCache, readMailListCache, writeMailFolderCache, writeMailListCache, } from "./mail-list-cache.js";
|
|
6
|
-
import { downloadableMailAttachment, downloadAndSaveMailAttachment, encodeMailAttachments, selectMailAttachments, } from "./mail-attachment.js";
|
|
7
7
|
import css from './AwikiMail.module.css';
|
|
8
8
|
const MAIL_NOTICE_AUTO_DISMISS_MS = 2_400;
|
|
9
9
|
const MAIL_FOLDER_COPY = {
|
|
@@ -33,13 +33,6 @@ function splitAddresses(raw) {
|
|
|
33
33
|
function utf8Bytes(value) {
|
|
34
34
|
return new TextEncoder().encode(value).byteLength;
|
|
35
35
|
}
|
|
36
|
-
function displayBytes(value) {
|
|
37
|
-
if (value < 1_024)
|
|
38
|
-
return `${value} bytes`;
|
|
39
|
-
if (value < 1_024 * 1_024)
|
|
40
|
-
return `${(value / 1_024).toFixed(value < 10 * 1_024 ? 1 : 0)} KiB`;
|
|
41
|
-
return `${(value / (1_024 * 1_024)).toFixed(value < 10 * 1_024 * 1_024 ? 1 : 0)} MiB`;
|
|
42
|
-
}
|
|
43
36
|
function browserLocalStorage() {
|
|
44
37
|
try {
|
|
45
38
|
return window.localStorage;
|
|
@@ -117,26 +110,24 @@ export function AwikiMail(props) {
|
|
|
117
110
|
const [detailError, setDetailError] = useState(null);
|
|
118
111
|
const [markingRead, setMarkingRead] = useState(false);
|
|
119
112
|
const [compose, setCompose] = useState(false);
|
|
120
|
-
const [to, setTo] =
|
|
121
|
-
const [cc, setCc] =
|
|
122
|
-
const [subject, setSubject] =
|
|
123
|
-
const [bodyText, setBodyText] =
|
|
124
|
-
const [
|
|
125
|
-
const [attachments, setAttachments] = useState([]);
|
|
126
|
-
const [attachmentError, setAttachmentError] = useState(null);
|
|
127
|
-
const [downloadStates, setDownloadStates] = useState({});
|
|
128
|
-
const [composeError, setComposeError] = useState(null);
|
|
113
|
+
const [to, setTo] = useDraftState('mail:to', '');
|
|
114
|
+
const [cc, setCc] = useDraftState('mail:cc', '');
|
|
115
|
+
const [subject, setSubject] = useDraftState('mail:subject', '');
|
|
116
|
+
const [bodyText, setBodyText] = useDraftState('mail:bodyText', '');
|
|
117
|
+
const [composeError, setComposeError] = useDraftState('mail:composeError', null, false);
|
|
129
118
|
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
130
119
|
const [discardOpen, setDiscardOpen] = useState(false);
|
|
131
|
-
const [sending, setSending] =
|
|
120
|
+
const [sending, setSending] = useDraftState('mail:sending', false, false);
|
|
132
121
|
const [notice, setNotice] = useState(null);
|
|
133
122
|
const [pane, setPane] = useState('folders');
|
|
134
123
|
const loaded = useRef(false);
|
|
135
124
|
const loadGeneration = useRef(0);
|
|
136
125
|
const detailGeneration = useRef(0);
|
|
137
126
|
const noticeRevision = useRef(0);
|
|
138
|
-
|
|
139
|
-
|
|
127
|
+
useEffect(() => () => {
|
|
128
|
+
loadGeneration.current += 1;
|
|
129
|
+
detailGeneration.current += 1;
|
|
130
|
+
}, [props.cacheOwner]);
|
|
140
131
|
const visibleUnreadCount = useMemo(() => items.reduce((total, item) => total + (item.unread ? 1 : 0), 0), [items]);
|
|
141
132
|
useEffect(() => { props.onUnreadCountChange(inboxUnreadCount); }, [props.onUnreadCountChange, inboxUnreadCount]);
|
|
142
133
|
const showNotice = (text) => {
|
|
@@ -184,17 +175,8 @@ export function AwikiMail(props) {
|
|
|
184
175
|
setListError(null);
|
|
185
176
|
setNotice(null);
|
|
186
177
|
const cacheVisible = hydrateListCache(requestedFolder);
|
|
187
|
-
const configRequest = props.getConfig();
|
|
188
178
|
const accountRequest = props.getMailAccount();
|
|
189
179
|
const inboxRequest = props.listMailInbox({ folder: requestedFolder, unreadOnly: false, limit: 20, offset: 0 });
|
|
190
|
-
const configResult = await configRequest;
|
|
191
|
-
if (generation !== loadGeneration.current)
|
|
192
|
-
return;
|
|
193
|
-
setAttachmentLimits(configResult.ok ? {
|
|
194
|
-
maxCount: configResult.value.mailAttachmentMaxCount,
|
|
195
|
-
maxBytes: configResult.value.mailAttachmentMaxBytes,
|
|
196
|
-
totalMaxBytes: configResult.value.mailAttachmentTotalMaxBytes,
|
|
197
|
-
} : null);
|
|
198
180
|
const accountResult = await accountRequest;
|
|
199
181
|
if (generation !== loadGeneration.current)
|
|
200
182
|
return;
|
|
@@ -225,7 +207,6 @@ export function AwikiMail(props) {
|
|
|
225
207
|
setCompose(true);
|
|
226
208
|
setSelectedId(null);
|
|
227
209
|
setMessage(null);
|
|
228
|
-
setComposeError(null);
|
|
229
210
|
setNotice(null);
|
|
230
211
|
setPane('detail');
|
|
231
212
|
};
|
|
@@ -246,7 +227,6 @@ export function AwikiMail(props) {
|
|
|
246
227
|
setSelectedId(null);
|
|
247
228
|
setMessage(null);
|
|
248
229
|
setDetailError(null);
|
|
249
|
-
setDownloadStates({});
|
|
250
230
|
const cached = hydrateListCache(nextFolder);
|
|
251
231
|
if (!cached)
|
|
252
232
|
applyListPage(nextFolder, { items: [], hasMore: false });
|
|
@@ -258,7 +238,6 @@ export function AwikiMail(props) {
|
|
|
258
238
|
setCompose(false);
|
|
259
239
|
setSelectedId(summary.id);
|
|
260
240
|
setMessage(null);
|
|
261
|
-
setDownloadStates({});
|
|
262
241
|
setDetailLoading(true);
|
|
263
242
|
setDetailError(null);
|
|
264
243
|
setNotice(null);
|
|
@@ -333,14 +312,6 @@ export function AwikiMail(props) {
|
|
|
333
312
|
showNotice(result.value.updated > 0 ? '已标为已读。' : '该邮件已经是已读状态。');
|
|
334
313
|
};
|
|
335
314
|
const requestSend = () => {
|
|
336
|
-
if (attachmentError !== null) {
|
|
337
|
-
setComposeError(attachmentError);
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
if (attachments.length > 0 && attachmentLimits === null) {
|
|
341
|
-
setComposeError('邮件附件限制暂不可用,请稍后刷新邮箱再试。');
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
315
|
const validated = validateDraft(to, cc, subject, bodyText);
|
|
345
316
|
if (!validated.ok) {
|
|
346
317
|
setComposeError(validated.error);
|
|
@@ -354,35 +325,6 @@ export function AwikiMail(props) {
|
|
|
354
325
|
setCc('');
|
|
355
326
|
setSubject('');
|
|
356
327
|
setBodyText('');
|
|
357
|
-
setAttachments([]);
|
|
358
|
-
setAttachmentError(null);
|
|
359
|
-
if (fileInput.current !== null)
|
|
360
|
-
fileInput.current.value = '';
|
|
361
|
-
setComposeError(null);
|
|
362
|
-
};
|
|
363
|
-
const chooseAttachments = (files) => {
|
|
364
|
-
if (files === null || files.length === 0)
|
|
365
|
-
return;
|
|
366
|
-
if (attachmentLimits === null) {
|
|
367
|
-
setAttachmentError('邮件附件限制暂不可用,请稍后刷新邮箱再试。');
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
try {
|
|
371
|
-
const next = selectMailAttachments(attachments, files, attachmentLimits, () => {
|
|
372
|
-
attachmentRevision.current += 1;
|
|
373
|
-
return `mail-attachment-${attachmentRevision.current}`;
|
|
374
|
-
});
|
|
375
|
-
setAttachments(next);
|
|
376
|
-
setAttachmentError(null);
|
|
377
|
-
setComposeError(null);
|
|
378
|
-
}
|
|
379
|
-
catch (error) {
|
|
380
|
-
setAttachmentError(error instanceof TypeError ? error.message : '无法选择这些附件。');
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
const removeAttachment = (id) => {
|
|
384
|
-
setAttachments(current => current.filter(attachment => attachment.id !== id));
|
|
385
|
-
setAttachmentError(null);
|
|
386
328
|
setComposeError(null);
|
|
387
329
|
};
|
|
388
330
|
const confirmSend = async () => {
|
|
@@ -392,30 +334,12 @@ export function AwikiMail(props) {
|
|
|
392
334
|
setComposeError(validated.error);
|
|
393
335
|
return;
|
|
394
336
|
}
|
|
395
|
-
if (attachmentError !== null || (attachments.length > 0 && attachmentLimits === null)) {
|
|
396
|
-
setConfirmOpen(false);
|
|
397
|
-
setComposeError(attachmentError ?? '邮件附件限制暂不可用,请稍后刷新邮箱再试。');
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
337
|
setSending(true);
|
|
401
|
-
let encodedAttachments = [];
|
|
402
|
-
try {
|
|
403
|
-
if (attachments.length > 0) {
|
|
404
|
-
encodedAttachments = await encodeMailAttachments(attachments, attachmentLimits);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
catch (error) {
|
|
408
|
-
setSending(false);
|
|
409
|
-
setConfirmOpen(false);
|
|
410
|
-
setComposeError(error instanceof TypeError ? error.message : '无法读取附件,请重新选择后再试。');
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
338
|
const request = {
|
|
414
339
|
to: validated.value.to,
|
|
415
340
|
cc: validated.value.cc,
|
|
416
341
|
subject: validated.value.subject,
|
|
417
342
|
bodyText: validated.value.bodyText,
|
|
418
|
-
...(encodedAttachments.length === 0 ? {} : { attachments: encodedAttachments }),
|
|
419
343
|
};
|
|
420
344
|
const result = await props.sendMail(request);
|
|
421
345
|
setSending(false);
|
|
@@ -428,7 +352,7 @@ export function AwikiMail(props) {
|
|
|
428
352
|
setComposeError('邮件服务没有接受本次发送,请检查内容后重试。');
|
|
429
353
|
return;
|
|
430
354
|
}
|
|
431
|
-
const
|
|
355
|
+
const warningText = result.value.warnings.length === 0 ? '' : `,服务返回 ${result.value.warnings.length} 条提示`;
|
|
432
356
|
clearDraft();
|
|
433
357
|
setFolder('sent');
|
|
434
358
|
const storage = browserLocalStorage();
|
|
@@ -442,11 +366,9 @@ export function AwikiMail(props) {
|
|
|
442
366
|
setCompose(false);
|
|
443
367
|
setPane('list');
|
|
444
368
|
void refresh('sent');
|
|
445
|
-
showNotice(
|
|
446
|
-
? `邮件已被服务接受,但返回 ${result.value.warnings.length} 条本地记录提示,请勿立即重复发送。`
|
|
447
|
-
: '邮件已发送。');
|
|
369
|
+
showNotice(`邮件已发送${warningText}。`);
|
|
448
370
|
};
|
|
449
|
-
const dirty = to.trim() !== '' || cc.trim() !== '' || subject.trim() !== '' || bodyText.trim() !== ''
|
|
371
|
+
const dirty = to.trim() !== '' || cc.trim() !== '' || subject.trim() !== '' || bodyText.trim() !== '';
|
|
450
372
|
const cancelCompose = () => {
|
|
451
373
|
if (dirty) {
|
|
452
374
|
setDiscardOpen(true);
|
|
@@ -456,53 +378,11 @@ export function AwikiMail(props) {
|
|
|
456
378
|
setPane('list');
|
|
457
379
|
};
|
|
458
380
|
const selectedSummary = items.find(item => item.id === selectedId);
|
|
459
|
-
|
|
460
|
-
const downloadAttachment = async (attachment) => {
|
|
461
|
-
if (message === null || attachmentLimits === null)
|
|
462
|
-
return;
|
|
463
|
-
const expected = downloadableMailAttachment(attachment, attachmentLimits.maxBytes);
|
|
464
|
-
if (expected === undefined || downloadStates[attachment.index]?.status === 'loading')
|
|
465
|
-
return;
|
|
466
|
-
const generation = detailGeneration.current;
|
|
467
|
-
const localMessageId = message.summary.id;
|
|
468
|
-
setDownloadStates(current => ({ ...current, [attachment.index]: { status: 'loading' } }));
|
|
469
|
-
try {
|
|
470
|
-
const saved = await downloadAndSaveMailAttachment(props.downloadMailAttachment, { localMessageId, attachmentIndex: attachment.index }, expected, attachmentLimits.maxBytes, () => generation === detailGeneration.current && message.summary.id === localMessageId);
|
|
471
|
-
if (!saved)
|
|
472
|
-
return;
|
|
473
|
-
setDownloadStates(current => {
|
|
474
|
-
const next = { ...current };
|
|
475
|
-
delete next[attachment.index];
|
|
476
|
-
return next;
|
|
477
|
-
});
|
|
478
|
-
showNotice(`已开始下载 ${expected.fileName}。`);
|
|
479
|
-
}
|
|
480
|
-
catch (error) {
|
|
481
|
-
if (generation !== detailGeneration.current || message.summary.id !== localMessageId)
|
|
482
|
-
return;
|
|
483
|
-
setDownloadStates(current => ({
|
|
484
|
-
...current,
|
|
485
|
-
[attachment.index]: {
|
|
486
|
-
status: 'error',
|
|
487
|
-
error: error instanceof TypeError ? error.message : '无法保存附件,请重试。',
|
|
488
|
-
},
|
|
489
|
-
}));
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
return (_jsxs("div", { className: css.mail, "data-pane": pane, "data-detail-active": compose || selectedId !== null || undefined, children: [_jsxs("aside", { className: css.sidebar, "aria-label": "\u90AE\u7BB1\u5BFC\u822A", children: [props.identityCard, props.modeTabs, _jsxs("div", { className: css.accountCard, children: [_jsx("small", { children: "\u90AE\u7BB1\u8D26\u53F7" }), _jsx("strong", { children: account?.displayName ?? account?.mailboxAddress ?? (listLoading ? '正在加载…' : '暂不可用') }), account?.mailboxAddress !== undefined && account.displayName !== undefined && _jsx("span", { children: account.mailboxAddress }), account?.status !== undefined && _jsx("span", { className: css.accountStatus, children: account.status })] }), _jsxs("nav", { className: css.folderNav, "aria-label": "\u90AE\u4EF6\u6587\u4EF6\u5939", children: [_jsxs("button", { type: "button", "data-active": folder === 'inbox' || undefined, onClick: () => { selectFolder('inbox'); }, children: [_jsx(IconFolderOpenOutline16, { size: 16 }), _jsx("span", { children: "\u6536\u4EF6\u7BB1" }), inboxUnreadCount > 0 && _jsx("small", { children: inboxUnreadCount > 99 ? '99+' : inboxUnreadCount })] }), _jsxs("div", { className: css.folderRow, "data-active": folder === 'sent' || undefined, children: [_jsxs("button", { type: "button", className: css.folderSelect, onClick: () => { selectFolder('sent'); }, children: [_jsx(IconSendOutline16, { size: 16 }), _jsx("span", { children: "\u53D1\u4EF6\u7BB1" })] }), _jsx("button", { type: "button", className: css.composeIconButton, "aria-label": "\u5199\u90AE\u4EF6", title: "\u5199\u90AE\u4EF6", onClick: startCompose, children: _jsx(IconEditOutline16, { size: 16 }) })] })] })] }), _jsxs("section", { className: css.mailList, "aria-label": MAIL_FOLDER_COPY[folder].title, children: [_jsxs("header", { className: css.listHeader, children: [_jsx("button", { type: "button", className: css.listBack, "aria-label": "\u8FD4\u56DE\u90AE\u7BB1\u5BFC\u822A", onClick: () => { setPane('folders'); }, children: _jsx(IconChevronLeftOutline14, { size: 14 }) }), _jsxs("div", { children: [_jsx("strong", { children: MAIL_FOLDER_COPY[folder].title }), _jsxs("small", { children: [items.length, " \u5C01\u90AE\u4EF6", folder === 'inbox' && visibleUnreadCount > 0 ? ` · ${visibleUnreadCount} 封未读` : ''] })] }), _jsx("button", { type: "button", "aria-label": `刷新${MAIL_FOLDER_COPY[folder].title}`, disabled: listLoading, onClick: () => { void refresh(); }, children: listLoading ? _jsx(IconLoadingOutline16, { size: 15 }) : _jsx(IconRefreshOutline14, { size: 15 }) })] }), listError !== null && _jsxs("div", { className: css.inlineError, role: "alert", children: [listError, _jsx("button", { type: "button", onClick: () => { void refresh(); }, children: "\u91CD\u8BD5" })] }), _jsxs("div", { className: css.rows, children: [items.map(item => (_jsx(MailRow, { summary: item, folder: folder, active: item.id === selectedId, onSelect: () => { void selectMail(item); } }, item.id))), items.length === 0 && !listLoading && listError === null && (_jsxs("div", { className: css.emptyState, children: [_jsx(IconFolderOpenOutline16, { size: 26 }), _jsx("p", { children: MAIL_FOLDER_COPY[folder].empty })] }))] }), listLoading && items.length === 0 && _jsxs("div", { className: css.loadingState, role: "status", children: [_jsx(IconLoadingOutline16, { size: 18 }), "\u6B63\u5728\u52A0\u8F7D\u90AE\u4EF6\u2026"] }), hasMore && _jsx("button", { type: "button", className: css.loadMore, disabled: listLoading, onClick: () => { void loadMore(); }, children: listLoading ? '正在加载…' : '加载更多邮件' })] }), _jsx("section", { className: css.mailDetail, "aria-label": compose ? '写邮件' : '邮件详情', children: compose ? (_jsxs("form", { className: css.composer, onSubmit: (event) => { event.preventDefault(); requestSend(); }, children: [_jsxs("header", { className: css.detailHeader, children: [_jsx("button", { type: "button", className: css.detailBack, "aria-label": `返回${MAIL_FOLDER_COPY[folder].title}`, onClick: cancelCompose, children: _jsx(IconChevronLeftOutline14, { size: 14 }) }), _jsxs("div", { children: [_jsx("strong", { children: "\u5199\u90AE\u4EF6" }), _jsx("small", { children: "\u53D1\u9001\u7EAF\u6587\u672C\u90AE\u4EF6\uFF0C\u53EF\u6DFB\u52A0\u9644\u4EF6" })] })] }), _jsxs("div", { className: css.composeFields, children: [_jsxs("label", { children: ["\u6536\u4EF6\u4EBA", _jsx("textarea", { value: to, rows: 1, disabled: sending, autoFocus: true, placeholder: "alice@example.com\uFF0C\u53EF\u7528\u9017\u53F7\u6216\u6362\u884C\u5206\u9694", onChange: (event) => { setTo(event.target.value); setComposeError(null); } })] }), _jsxs("label", { children: ["\u6284\u9001", _jsx("textarea", { value: cc, rows: 1, disabled: sending, placeholder: "\u9009\u586B", onChange: (event) => { setCc(event.target.value); setComposeError(null); } })] }), _jsxs("label", { children: ["\u4E3B\u9898", _jsx("input", { value: subject, disabled: sending, placeholder: "\u90AE\u4EF6\u4E3B\u9898", onChange: (event) => { setSubject(event.target.value); setComposeError(null); } })] }), _jsxs("label", { className: css.bodyField, children: ["\u6B63\u6587", _jsx("textarea", { value: bodyText, disabled: sending, placeholder: "\u8F93\u5165\u7EAF\u6587\u672C\u90AE\u4EF6\u6B63\u6587", onChange: (event) => { setBodyText(event.target.value); setComposeError(null); } })] }), _jsxs("section", { className: css.composeAttachments, "aria-label": "\u90AE\u4EF6\u9644\u4EF6", children: [_jsxs("div", { className: css.attachmentPickerRow, children: [_jsxs("button", { type: "button", className: css.attachmentPicker, disabled: sending || attachmentLimits === null || attachmentLimits.maxCount === 0, onClick: () => { fileInput.current?.click(); }, children: [_jsx(IconPaperclipOutline16, { size: 14 }), "\u6DFB\u52A0\u9644\u4EF6"] }), _jsx("input", { ref: fileInput, className: css.attachmentInput, type: "file", multiple: true, "aria-label": "\u9009\u62E9\u90AE\u4EF6\u9644\u4EF6", disabled: sending || attachmentLimits === null || attachmentLimits.maxCount === 0, onChange: (event) => {
|
|
493
|
-
chooseAttachments(event.currentTarget.files);
|
|
494
|
-
event.currentTarget.value = '';
|
|
495
|
-
} }), _jsx("small", { children: attachmentLimits === null
|
|
496
|
-
? '附件限制暂不可用'
|
|
497
|
-
: `最多 ${attachmentLimits.maxCount} 个 · 单个 ${displayBytes(attachmentLimits.maxBytes)} · 总计 ${displayBytes(attachmentLimits.totalMaxBytes)}` })] }), attachments.length > 0 && (_jsxs("div", { className: css.selectedAttachments, children: [attachments.map(attachment => (_jsxs("div", { children: [_jsx(IconPaperclipOutline16, { size: 15 }), _jsxs("span", { children: [_jsx("strong", { children: attachment.fileName }), _jsxs("small", { children: [attachment.contentType, " \u00B7 ", displayBytes(attachment.sizeBytes)] })] }), _jsx("button", { type: "button", disabled: sending, "aria-label": `移除附件 ${attachment.fileName}`, onClick: () => { removeAttachment(attachment.id); }, children: "\u79FB\u9664" })] }, attachment.id))), _jsxs("p", { children: [attachments.length, " \u4E2A\u9644\u4EF6 \u00B7 \u5171 ", displayBytes(attachmentTotalBytes)] })] }))] }), attachmentError !== null && _jsx("p", { className: css.composeError, role: "alert", children: attachmentError }), composeError !== null && _jsx("p", { className: css.composeError, role: "alert", children: composeError })] }), _jsxs("footer", { className: css.composeFooter, children: [_jsx("button", { type: "button", className: css.cancelButton, disabled: sending, onClick: cancelCompose, children: "\u53D6\u6D88" }), _jsxs("button", { type: "submit", className: css.sendButton, disabled: sending || attachmentError !== null, children: [_jsx(IconSendOutline16, { size: 15 }), "\u53D1\u9001"] })] })] })) : selectedId === null ? (_jsxs("div", { className: css.detailEmpty, children: [_jsx(IconFolderOpenOutline16, { size: 32 }), _jsx("p", { children: "\u9009\u62E9\u4E00\u5C01\u90AE\u4EF6\u67E5\u770B\u5185\u5BB9\u3002" }), _jsx("button", { type: "button", onClick: startCompose, children: "\u5199\u90AE\u4EF6" })] })) : (_jsxs(_Fragment, { children: [_jsxs("header", { className: css.detailHeader, children: [_jsx("button", { type: "button", className: css.detailBack, "aria-label": `返回${MAIL_FOLDER_COPY[folder].title}`, onClick: () => { detailGeneration.current += 1; setSelectedId(null); setMessage(null); setDownloadStates({}); setPane('list'); }, children: _jsx(IconChevronLeftOutline14, { size: 14 }) }), _jsxs("div", { children: [_jsx("strong", { children: selectedSummary?.subject ?? '邮件详情' }), _jsx("small", { children: selectedSummary === undefined ? '' : folder === 'inbox' ? participant(selectedSummary.from, '未知发件人') : participant(selectedSummary.to, '未知收件人') })] }), folder === 'inbox' && message?.summary.unread === true && _jsx("button", { type: "button", className: css.markReadButton, disabled: markingRead, onClick: () => { void markRead(); }, children: markingRead ? '处理中…' : '标为已读' })] }), detailLoading && _jsxs("div", { className: css.loadingState, role: "status", children: [_jsx(IconLoadingOutline16, { size: 18 }), "\u6B63\u5728\u8BFB\u53D6\u90AE\u4EF6\u2026"] }), detailError !== null && _jsx("div", { className: css.detailError, role: "alert", children: detailError }), message !== null && (_jsxs("article", { className: css.messageBody, children: [_jsxs("div", { className: css.messageMeta, children: [_jsx("h3", { children: message.summary.subject || '(无主题)' }), _jsx("time", { children: mailTime(folder === 'inbox'
|
|
381
|
+
return (_jsxs("div", { className: css.mail, "data-pane": pane, "data-detail-active": compose || selectedId !== null || undefined, children: [_jsxs("aside", { className: css.sidebar, "aria-label": "\u90AE\u7BB1\u5BFC\u822A", children: [props.identityCard, props.modeTabs, _jsxs("div", { className: css.accountCard, children: [_jsx("small", { children: "\u90AE\u7BB1\u8D26\u53F7" }), _jsx("strong", { children: account?.displayName ?? account?.mailboxAddress ?? (listLoading ? '正在加载…' : '暂不可用') }), account?.mailboxAddress !== undefined && account.displayName !== undefined && _jsx("span", { children: account.mailboxAddress }), account?.status !== undefined && _jsx("span", { className: css.accountStatus, children: account.status })] }), _jsxs("nav", { className: css.folderNav, "aria-label": "\u90AE\u4EF6\u6587\u4EF6\u5939", children: [_jsxs("button", { type: "button", "data-active": folder === 'inbox' || undefined, onClick: () => { selectFolder('inbox'); }, children: [_jsx(IconFolderOpenOutline16, { size: 16 }), _jsx("span", { children: "\u6536\u4EF6\u7BB1" }), inboxUnreadCount > 0 && _jsx("small", { children: inboxUnreadCount > 99 ? '99+' : inboxUnreadCount })] }), _jsxs("div", { className: css.folderRow, "data-active": folder === 'sent' || undefined, children: [_jsxs("button", { type: "button", className: css.folderSelect, onClick: () => { selectFolder('sent'); }, children: [_jsx(IconSendOutline16, { size: 16 }), _jsx("span", { children: "\u53D1\u4EF6\u7BB1" })] }), _jsx("button", { type: "button", className: css.composeIconButton, "aria-label": "\u5199\u90AE\u4EF6", title: "\u5199\u90AE\u4EF6", onClick: startCompose, children: _jsx(IconEditOutline16, { size: 16 }) })] })] })] }), _jsxs("section", { className: css.mailList, "aria-label": MAIL_FOLDER_COPY[folder].title, children: [_jsxs("header", { className: css.listHeader, children: [_jsxs("div", { children: [_jsx("strong", { children: MAIL_FOLDER_COPY[folder].title }), _jsxs("small", { children: [items.length, " \u5C01\u90AE\u4EF6", folder === 'inbox' && visibleUnreadCount > 0 ? ` · ${visibleUnreadCount} 封未读` : ''] })] }), _jsx("button", { type: "button", "aria-label": `刷新${MAIL_FOLDER_COPY[folder].title}`, disabled: listLoading, onClick: () => { void refresh(); }, children: listLoading ? _jsx(IconLoadingOutline16, { size: 15 }) : _jsx(IconRefreshOutline14, { size: 15 }) })] }), listError !== null && _jsxs("div", { className: css.inlineError, role: "alert", children: [listError, _jsx("button", { type: "button", onClick: () => { void refresh(); }, children: "\u91CD\u8BD5" })] }), _jsxs("div", { className: css.rows, children: [items.map(item => (_jsx(MailRow, { summary: item, folder: folder, active: item.id === selectedId, onSelect: () => { void selectMail(item); } }, item.id))), items.length === 0 && !listLoading && listError === null && (_jsxs("div", { className: css.emptyState, children: [_jsx(IconFolderOpenOutline16, { size: 26 }), _jsx("p", { children: MAIL_FOLDER_COPY[folder].empty })] }))] }), listLoading && items.length === 0 && _jsxs("div", { className: css.loadingState, role: "status", children: [_jsx(IconLoadingOutline16, { size: 18 }), "\u6B63\u5728\u52A0\u8F7D\u90AE\u4EF6\u2026"] }), hasMore && _jsx("button", { type: "button", className: css.loadMore, disabled: listLoading, onClick: () => { void loadMore(); }, children: listLoading ? '正在加载…' : '加载更多邮件' })] }), _jsx("section", { className: css.mailDetail, "aria-label": compose ? '写邮件' : '邮件详情', children: compose ? (_jsxs("form", { className: css.composer, onSubmit: (event) => { event.preventDefault(); requestSend(); }, children: [_jsxs("header", { className: css.detailHeader, children: [_jsx("button", { type: "button", className: css.detailBack, "aria-label": `返回${MAIL_FOLDER_COPY[folder].title}`, onClick: cancelCompose, children: _jsx(IconChevronLeftOutline14, { size: 14 }) }), _jsxs("div", { children: [_jsx("strong", { children: "\u5199\u90AE\u4EF6" }), _jsx("small", { children: "\u53D1\u9001\u7EAF\u6587\u672C\u90AE\u4EF6" })] })] }), _jsxs("div", { className: css.composeFields, children: [_jsxs("label", { children: ["\u6536\u4EF6\u4EBA", _jsx("textarea", { value: to, rows: 1, autoFocus: true, placeholder: "alice@example.com\uFF0C\u53EF\u7528\u9017\u53F7\u6216\u6362\u884C\u5206\u9694", onChange: (event) => { setTo(event.target.value); setComposeError(null); } })] }), _jsxs("label", { children: ["\u6284\u9001", _jsx("textarea", { value: cc, rows: 1, placeholder: "\u9009\u586B", onChange: (event) => { setCc(event.target.value); setComposeError(null); } })] }), _jsxs("label", { children: ["\u4E3B\u9898", _jsx("input", { value: subject, placeholder: "\u90AE\u4EF6\u4E3B\u9898", onChange: (event) => { setSubject(event.target.value); setComposeError(null); } })] }), _jsxs("label", { className: css.bodyField, children: ["\u6B63\u6587", _jsx("textarea", { value: bodyText, placeholder: "\u8F93\u5165\u7EAF\u6587\u672C\u90AE\u4EF6\u6B63\u6587", onChange: (event) => { setBodyText(event.target.value); setComposeError(null); } })] }), composeError !== null && _jsx("p", { className: css.composeError, role: "alert", children: composeError })] }), _jsxs("footer", { className: css.composeFooter, children: [_jsx("button", { type: "button", className: css.cancelButton, disabled: sending, onClick: cancelCompose, children: "\u53D6\u6D88" }), _jsxs("button", { type: "submit", className: css.sendButton, disabled: sending, children: [_jsx(IconSendOutline16, { size: 15 }), "\u53D1\u9001"] })] })] })) : selectedId === null ? (_jsxs("div", { className: css.detailEmpty, children: [_jsx(IconFolderOpenOutline16, { size: 32 }), _jsx("p", { children: "\u9009\u62E9\u4E00\u5C01\u90AE\u4EF6\u67E5\u770B\u5185\u5BB9\u3002" }), _jsx("button", { type: "button", onClick: startCompose, children: "\u5199\u90AE\u4EF6" })] })) : (_jsxs(_Fragment, { children: [_jsxs("header", { className: css.detailHeader, children: [_jsx("button", { type: "button", className: css.detailBack, "aria-label": `返回${MAIL_FOLDER_COPY[folder].title}`, onClick: () => { setSelectedId(null); setMessage(null); setPane('list'); }, children: _jsx(IconChevronLeftOutline14, { size: 14 }) }), _jsxs("div", { children: [_jsx("strong", { children: selectedSummary?.subject ?? '邮件详情' }), _jsx("small", { children: selectedSummary === undefined ? '' : folder === 'inbox' ? participant(selectedSummary.from, '未知发件人') : participant(selectedSummary.to, '未知收件人') })] }), folder === 'inbox' && message?.summary.unread === true && _jsx("button", { type: "button", className: css.markReadButton, disabled: markingRead, onClick: () => { void markRead(); }, children: markingRead ? '处理中…' : '标为已读' })] }), detailLoading && _jsxs("div", { className: css.loadingState, role: "status", children: [_jsx(IconLoadingOutline16, { size: 18 }), "\u6B63\u5728\u8BFB\u53D6\u90AE\u4EF6\u2026"] }), detailError !== null && _jsx("div", { className: css.detailError, role: "alert", children: detailError }), message !== null && (_jsxs("article", { className: css.messageBody, children: [_jsxs("div", { className: css.messageMeta, children: [_jsx("h3", { children: message.summary.subject || '(无主题)' }), _jsx("time", { children: mailTime(folder === 'inbox'
|
|
498
382
|
? message.summary.receivedAt ?? message.summary.sentAt
|
|
499
|
-
: message.summary.sentAt ?? message.summary.receivedAt) }), _jsxs("dl", { children: [_jsxs("div", { children: [_jsx("dt", { children: "\u53D1\u4EF6\u4EBA" }), _jsx("dd", { children: participant(message.summary.from, '未知发件人') })] }), _jsxs("div", { children: [_jsx("dt", { children: "\u6536\u4EF6\u4EBA" }), _jsx("dd", { children: recipient(message.summary, folder, account) })] }), message.summary.cc.length > 0 && _jsxs("div", { children: [_jsx("dt", { children: "\u6284\u9001" }), _jsx("dd", { children: participant(message.summary.cc, '') })] })] })] }), _jsxs("div", { className: css.untrustedNotice, children: [_jsx(IconWarningOutline16, { size: 15 }), folder === 'inbox' ? '邮件内容来自外部,仅按纯文本显示。' : '已发送邮件仅按纯文本显示。'] }), _jsx("div", { className: css.plainBody, children: message.bodyText ?? (message.hasHtmlBody ? '这封邮件仅包含 HTML 内容,出于安全原因未直接显示。' : '这封邮件没有可显示的纯文本正文。') }), message.bodyTruncated && _jsx("p", { className: css.truncatedNotice, children: "\u6B63\u6587\u5185\u5BB9\u5DF2\u7531\u670D\u52A1\u7AEF\u622A\u65AD\u3002" }), message.attachments.length > 0 && (_jsxs("section", { className: css.attachments, "aria-label": "\
|
|
500
|
-
const downloadable = attachmentLimits === null ? undefined : downloadableMailAttachment(attachment, attachmentLimits.maxBytes);
|
|
501
|
-
const state = downloadStates[attachment.index];
|
|
502
|
-
return (_jsxs("div", { children: [_jsx(IconPaperclipOutline16, { size: 15 }), _jsxs("span", { children: [_jsx("strong", { children: attachment.fileName ?? `附件 ${attachment.index + 1}` }), _jsx("small", { children: [attachment.contentType, attachment.sizeBytes === undefined ? undefined : `${attachment.sizeBytes} bytes`].filter(Boolean).join(' · ') || '暂无更多信息' }), downloadable === undefined && _jsx("small", { children: "\u5F53\u524D\u8BB0\u5F55\u7F3A\u5C11\u5B8C\u6574\u3001\u53EF\u9A8C\u8BC1\u7684\u4E0B\u8F7D\u5143\u6570\u636E\u3002" }), state?.status === 'error' && _jsx("small", { className: css.attachmentDownloadError, role: "alert", children: state.error })] }), downloadable !== undefined && (_jsx("button", { type: "button", disabled: state?.status === 'loading', "aria-label": `${state?.status === 'error' ? '重试下载' : '下载附件'} ${downloadable.fileName}`, onClick: () => { void downloadAttachment(attachment); }, children: state?.status === 'loading' ? '下载中…' : state?.status === 'error' ? '重试' : '下载' }))] }, attachment.index));
|
|
503
|
-
})] }))] }))] })) }), notice !== null && (_jsx("div", { className: css.notice, role: "status", "aria-live": "polite", "aria-atomic": "true", onAnimationEnd: () => {
|
|
383
|
+
: message.summary.sentAt ?? message.summary.receivedAt) }), _jsxs("dl", { children: [_jsxs("div", { children: [_jsx("dt", { children: "\u53D1\u4EF6\u4EBA" }), _jsx("dd", { children: participant(message.summary.from, '未知发件人') })] }), _jsxs("div", { children: [_jsx("dt", { children: "\u6536\u4EF6\u4EBA" }), _jsx("dd", { children: recipient(message.summary, folder, account) })] }), message.summary.cc.length > 0 && _jsxs("div", { children: [_jsx("dt", { children: "\u6284\u9001" }), _jsx("dd", { children: participant(message.summary.cc, '') })] })] })] }), _jsxs("div", { className: css.untrustedNotice, children: [_jsx(IconWarningOutline16, { size: 15 }), folder === 'inbox' ? '邮件内容来自外部,仅按纯文本显示。' : '已发送邮件仅按纯文本显示。'] }), _jsx("div", { className: css.plainBody, children: message.bodyText ?? (message.hasHtmlBody ? '这封邮件仅包含 HTML 内容,出于安全原因未直接显示。' : '这封邮件没有可显示的纯文本正文。') }), message.bodyTruncated && _jsx("p", { className: css.truncatedNotice, children: "\u6B63\u6587\u5185\u5BB9\u5DF2\u7531\u670D\u52A1\u7AEF\u622A\u65AD\u3002" }), message.attachments.length > 0 && (_jsxs("section", { className: css.attachments, "aria-label": "\u9644\u4EF6\u5143\u6570\u636E", children: [_jsx("h4", { children: "\u9644\u4EF6\uFF08\u4EC5\u5143\u6570\u636E\uFF09" }), message.attachments.map(attachment => (_jsxs("div", { children: [_jsx(IconPaperclipOutline16, { size: 15 }), _jsxs("span", { children: [_jsx("strong", { children: attachment.fileName ?? `附件 ${attachment.index + 1}` }), _jsx("small", { children: [attachment.contentType, attachment.sizeBytes === undefined ? undefined : `${attachment.sizeBytes} bytes`].filter(Boolean).join(' · ') || '暂无更多信息' })] })] }, attachment.index)))] }))] }))] })) }), notice !== null && (_jsx("div", { className: css.notice, role: "status", "aria-live": "polite", "aria-atomic": "true", onAnimationEnd: () => {
|
|
504
384
|
setNotice(current => current?.id === notice.id ? null : current);
|
|
505
385
|
}, children: notice.text }, notice.id)), _jsx(Modal, { open: confirmOpen, onClose: () => { if (!sending)
|
|
506
|
-
setConfirmOpen(false); }, title: "\u786E\u8BA4\u53D1\u9001\u90AE\u4EF6", closeLabel: "\u53D6\u6D88", description: "\u90AE\u4EF6\u5C06\u901A\u8FC7\u5F53\u524D AWiki \u8EAB\u4EFD\u53D1\u9001\u4E00\u6B21\uFF0C\u5931\u8D25\u540E\u4E0D\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002", footer: _jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "outline", disabled: sending, onClick: () => { setConfirmOpen(false); }, children: "\u8FD4\u56DE\u4FEE\u6539" }), _jsx(Button, { type: "button", disabled: sending, onClick: () => { void confirmSend(); }, children: sending ? '正在发送…' : '确认发送' })] }), children: _jsxs("div", { className: css.confirmSummary, children: [_jsxs("p", { children: ["\u6536\u4EF6\u4EBA\uFF1A", splitAddresses(to).length, " \u4EBA"] }), _jsxs("p", { children: ["\u6284\u9001\uFF1A", splitAddresses(cc).length, " \u4EBA"] }), _jsxs("p", { children: ["\u4E3B\u9898\uFF1A", subject.trim()] })
|
|
386
|
+
setConfirmOpen(false); }, title: "\u786E\u8BA4\u53D1\u9001\u90AE\u4EF6", closeLabel: "\u53D6\u6D88", description: "\u90AE\u4EF6\u5C06\u901A\u8FC7\u5F53\u524D AWiki \u8EAB\u4EFD\u53D1\u9001\u4E00\u6B21\uFF0C\u5931\u8D25\u540E\u4E0D\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002", footer: _jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "outline", disabled: sending, onClick: () => { setConfirmOpen(false); }, children: "\u8FD4\u56DE\u4FEE\u6539" }), _jsx(Button, { type: "button", disabled: sending, onClick: () => { void confirmSend(); }, children: sending ? '正在发送…' : '确认发送' })] }), children: _jsxs("div", { className: css.confirmSummary, children: [_jsxs("p", { children: ["\u6536\u4EF6\u4EBA\uFF1A", splitAddresses(to).length, " \u4EBA"] }), _jsxs("p", { children: ["\u6284\u9001\uFF1A", splitAddresses(cc).length, " \u4EBA"] }), _jsxs("p", { children: ["\u4E3B\u9898\uFF1A", subject.trim()] })] }) }), _jsx(Modal, { open: discardOpen, onClose: () => { setDiscardOpen(false); }, title: "\u653E\u5F03\u8FD9\u5C01\u90AE\u4EF6\uFF1F", closeLabel: "\u7EE7\u7EED\u7F16\u8F91", description: "\u653E\u5F03\u540E\u5F53\u524D\u5185\u5BB9\u5C06\u88AB\u6E05\u7A7A\u3002\u5173\u95ED\u9762\u677F\u4F1A\u6682\u5B58\u5185\u5BB9\uFF0C\u9000\u51FA\u5E94\u7528\u4E0D\u4F1A\u4FDD\u5B58\u3002", footer: _jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => { setDiscardOpen(false); }, children: "\u7EE7\u7EED\u7F16\u8F91" }), _jsx(Button, { type: "button", variant: "outline", onClick: () => { setDiscardOpen(false); clearDraft(); setCompose(false); setPane('list'); }, children: "\u786E\u8BA4\u653E\u5F03" })] }), children: _jsx("p", { className: css.discardText, children: "\u6536\u4EF6\u4EBA\u3001\u4E3B\u9898\u548C\u6B63\u6587\u4E2D\u7684\u672A\u53D1\u9001\u5185\u5BB9\u90FD\u4F1A\u4E22\u5931\u3002" }) })] }));
|
|
507
387
|
}
|
|
508
388
|
//# sourceMappingURL=AwikiMail.js.map
|