@nocobase/app-plugin-mail 1.0.0-beta.11 → 1.0.0-beta.12
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/CHANGELOG.md +21 -0
- package/README.md +10 -2
- package/dist/client/components/mail-account-connector.d.ts +1 -0
- package/dist/client/components/mail-account-connector.d.ts.map +1 -1
- package/dist/client/components/mail-account-connector.js +4 -3
- package/dist/client/components/mail-account-connector.js.map +1 -1
- package/dist/client/components/mail-navigation-icon.d.ts.map +1 -1
- package/dist/client/components/mail-navigation-icon.js +3 -50
- package/dist/client/components/mail-navigation-icon.js.map +1 -1
- package/dist/client/components/public.d.ts +1 -1
- package/dist/client/components/public.d.ts.map +1 -1
- package/dist/client/components/public.js.map +1 -1
- package/dist/client/contracts/composer.d.ts +29 -2
- package/dist/client/contracts/composer.d.ts.map +1 -1
- package/dist/client/contracts/composer.js.map +1 -1
- package/dist/client/hooks/use-mail-composer.d.ts +1 -1
- package/dist/client/hooks/use-mail-composer.d.ts.map +1 -1
- package/dist/client/hooks/use-mail-composer.js +54 -10
- package/dist/client/hooks/use-mail-composer.js.map +1 -1
- package/dist/client/hooks/use-mail-unread-count.d.ts +13 -0
- package/dist/client/hooks/use-mail-unread-count.d.ts.map +1 -0
- package/dist/client/hooks/use-mail-unread-count.js +106 -0
- package/dist/client/hooks/use-mail-unread-count.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/lib/mail-composer-completion.d.ts +5 -0
- package/dist/client/lib/mail-composer-completion.d.ts.map +1 -0
- package/dist/client/lib/mail-composer-completion.js +28 -0
- package/dist/client/lib/mail-composer-completion.js.map +1 -0
- package/dist/client/locales/en-US.d.ts +1 -0
- package/dist/client/locales/en-US.d.ts.map +1 -1
- package/dist/client/locales/en-US.js +4 -3
- package/dist/client/locales/en-US.js.map +1 -1
- package/dist/client/locales/zh-CN.d.ts.map +1 -1
- package/dist/client/locales/zh-CN.js +3 -2
- package/dist/client/locales/zh-CN.js.map +1 -1
- package/dist/client/pages/mail-accounts-page.d.ts.map +1 -1
- package/dist/client/pages/mail-accounts-page.js +4 -1
- package/dist/client/pages/mail-accounts-page.js.map +1 -1
- package/dist/client/pages/mail-workspace-page.d.ts +4 -2
- package/dist/client/pages/mail-workspace-page.d.ts.map +1 -1
- package/dist/client/pages/mail-workspace-page.js +222 -171
- package/dist/client/pages/mail-workspace-page.js.map +1 -1
- package/dist/client/prepare-mail-reply.d.ts +9 -0
- package/dist/client/prepare-mail-reply.d.ts.map +1 -0
- package/dist/client/prepare-mail-reply.js +28 -0
- package/dist/client/prepare-mail-reply.js.map +1 -0
- package/dist/server/config.d.ts +1 -1
- package/dist/server/config.d.ts.map +1 -1
- package/dist/server/config.js +17 -9
- package/dist/server/config.js.map +1 -1
- package/dist/server/locales/en-US.d.ts +1 -0
- package/dist/server/locales/en-US.d.ts.map +1 -1
- package/dist/server/locales/en-US.js +1 -0
- package/dist/server/locales/en-US.js.map +1 -1
- package/dist/server/locales/zh-CN.d.ts.map +1 -1
- package/dist/server/locales/zh-CN.js +1 -0
- package/dist/server/locales/zh-CN.js.map +1 -1
- package/dist/server/providers/mail-core.d.ts +2 -0
- package/dist/server/providers/mail-core.d.ts.map +1 -1
- package/dist/server/providers/mail-core.js +39 -1
- package/dist/server/providers/mail-core.js.map +1 -1
- package/dist/server/routes/api.js +3 -1
- package/dist/server/routes/api.js.map +1 -1
- package/dist/server/services/authorization.js +1 -1
- package/dist/server/services/authorization.js.map +1 -1
- package/dist/shared/mail.d.ts +1 -1
- package/dist/shared/mail.d.ts.map +1 -1
- package/package.json +8 -5
- package/skills/nocobase-app-plugin-mail/references/client-integration.md +106 -0
- package/skills/nocobase-app-plugin-mail/references/configuration-and-accounts.md +10 -4
- package/skills/nocobase-app-plugin-mail/references/public-api.md +25 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @nocobase/app-plugin-mail
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2a54505: Add optional fourth-argument completion details to MailComposer and MailWorkspaceComposer, preserving existing callback arguments. Details include every submission returned by that operation and a detached snapshot of the actual client request, or a separate saved-draft reference. Preserve pending, scheduled, failed and unknown statuses; a transport failure without a response has no submission IDs. Support asynchronous completion callbacks and isolate integration errors through optional onCompletionError without delaying closing, changing the send outcome or retrying mail. Business integrations should associate and deduplicate by submission ID rather than querying the latest sending record; this client callback is not a durable delivery event.
|
|
8
|
+
- 2a54505: Align the email address and optional login name inputs in the IMAP/SMTP account connection form. Keep helper text beneath the login name without stretching neighboring field grids, while preserving the stacked narrow-screen layout.
|
|
9
|
+
|
|
10
|
+
Use consistent Chinese optional-field wording for the login name and sender name in the account connection form.
|
|
11
|
+
|
|
12
|
+
- 2a54505: Show specific English and Chinese guidance when a mail provider rejects account credentials, including checking the login name, password or authorization code, IMAP/SMTP access, and app-password requirements. Preserve the existing error reason and field violations without changing the connection form.
|
|
13
|
+
- 2a54505: Clarify the IMAP/SMTP Username as an optional login name with persistent help text in English and Chinese. Default omitted or blank login names to the mailbox address on the server, and trim explicit names without changing their case.
|
|
14
|
+
- 2a54505: Expose the application's resolved `NODE_ENV` to server providers without inheriting an embedded application's host process environment. Mail now warns once during production startup when its effective OAuth return URL still points to the legacy `/dev/mail/accounts` destination. The current root (`/`) default does not trigger the warning or register an account route: applications must register their own authenticated personal account page and configure `mail.oauthReturnUrl` to that page. This warning does not block startup, change configuration, or verify arbitrary client routes.
|
|
15
|
+
- 2a54505: Expose `prepareMailReply` and `MailComposerRequest` from the public client entry so custom pages can share the workspace's complete reply preparation, including incomplete-content loading and referenced inline-image uploads. Preserve existing recipient, subject, reply association and draft behavior. The browser-only helper does not open, save or send mail; callers retain loading, error and composer-session guards.
|
|
16
|
+
- 2a54505: Expose `useMailUnreadCount` and `MailUnreadCountState` from the public client entry for custom menus, and reuse the Hook in the navigation icon. Preserve current-user count semantics, local/realtime/reconnect/focus refresh, polling, debounce and serialized requests. The Hook distinguishes an unknown initial count from zero, retains the last successful count on refresh failure, and exposes loading/error state. Consumers must remount with session changes; separate Hook instances fetch independently without a global cache.
|
|
17
|
+
- 2a54505: Adapt the mail workspace to its available width: retain the three-column desktop view, show the message list or conversation on narrow screens, and provide mailbox navigation in a keyboard-accessible drawer. Returning to the list preserves its page and scroll position and ignores stale conversation responses.
|
|
18
|
+
- 2a54505: Compose all seven MAIL_* environment mappings with the Mail configuration section and preserve them in the examples application. Keep the legacy fully prefixed application-level mappings compatible. Deployment environment values now override configuration files and code defaults automatically: review existing OAuth, sync, webhook and jobs variables before upgrading, including empty or invalid integers. Applications with custom parsers must retain or override the section rules explicitly; calling the defaults factory alone does not inherit them. Mail server configuration and webhook secrets remain outside public browser configuration.
|
|
19
|
+
- 2a54505: Add optional accountsHref and headerActions to MailWorkspacePage. Applications can link the empty and populated workspace to their own personal account page and append actions without replacing Compose or Sync. The public MailAccountsPage remains available for application-owned personal account routes; the plugin registers no built-in Dev, settings or management pages or routes. Applications must register and authorize their account page and configure mail.oauthReturnUrl separately to their account page; the current default returns to the application's root.
|
|
20
|
+
- Updated dependencies [2a54505]
|
|
21
|
+
- @nocobase/app-server@2.0.0-beta.5
|
|
22
|
+
- @nocobase/app-plugin-authentication@2.0.0-beta.7
|
|
23
|
+
|
|
3
24
|
## 1.0.0-beta.11
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -24,16 +24,24 @@ import mail from './mail.js';
|
|
|
24
24
|
// Add `mail: ReturnType<typeof mail>;` to the default config type and `mail,` to defaultAppConfigs({ ... }).
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
The plugin
|
|
27
|
+
Register that factory under the `mail` key in the application's `defaultAppConfigs()` composition. The plugin uses built-in defaults when the namespace is absent, but no external Mail provider is available until the application configures one. Keep provider credentials in private server configuration. `mailConfig` declares all seven `MAIL_*` overrides as section-relative environment rules; composing it makes them effective and discoverable with `pnpm nocobase config env`. The legacy `mailEnvironmentMappings` export retains fully prefixed paths for application-level environment providers; do not pass it as a section's `env`.
|
|
28
28
|
|
|
29
29
|
For Gmail, `mail.providers.<name>.quota` can override per-user and per-project quota pacing using the allocation shown in Google Cloud; otherwise the plugin uses conservative defaults with headroom. Account creation requires an initial-sync date, and the account screen defaults it to one calendar month ago. Direct initial-sync requests must also provide a date boundary. See the Mail Skill references for configuration and quota details.
|
|
30
30
|
|
|
31
31
|
## Supported integration surface
|
|
32
32
|
|
|
33
|
-
Import the server plugin and service contracts from `@nocobase/app-plugin-mail/server`, the client plugin and `
|
|
33
|
+
Import the server plugin and service contracts from `@nocobase/app-plugin-mail/server`, the client plugin, `MailWorkspacePage` and `MailAccountsPage` from `@nocobase/app-plugin-mail/client`, and reusable UI from `@nocobase/app-plugin-mail/client/components`. The package root is a Server alias; new application code should use the explicit `/server` path. `MailClient` and `mailClientToken` are the supported Client data access layer; `mailServiceToken` is the supported in-process Server facade. Do not import implementation files, persistence contracts, internal service tokens, or route contribution modules. See the [public API inventory](skills/nocobase-app-plugin-mail/references/public-api.md) for the exported names and responsibility of each entry.
|
|
34
34
|
|
|
35
35
|
The supported reusable UI exports `MailAccountCard`, `MailAccountConnector`, `MailConversationView`, `MailMessageList`, `MailProviderCard`, `MailRichTextEditor`, `MailNavigationIcon`, `MailLabelManager`, `MailLabelTag`, `MailLabelColorDot`, `MailSignatureManager`, `MailStatusBadge`, `MailSyncPolicyFields`, `MailTemplateManager`, `MailboxSidebar`, `MailComposer`, and `MailWorkspaceComposer`, together with their exported props and state types. `MailComposer` renders one supplied compose request; `MailWorkspaceComposer` additionally coordinates sendable identities across accounts. Register the Mail Client plugin before rendering components that use `useMailClient()`.
|
|
36
36
|
|
|
37
|
+
Custom menus can use `useMailUnreadCount()` and `MailUnreadCountState` from `/client` to share the navigation icon's current-user fetching, invalidation and polling logic. Unknown counts stay `undefined`, background failures retain the last successful count, and the Hook exposes loading/error state without changing the built-in badge appearance. Mount consumers in a session-owned scope that remounts on user changes; instances fetch independently rather than using a global cache. See [custom unread menus](skills/nocobase-app-plugin-mail/references/client-integration.md#unread-counts-on-custom-menus) for host-context prerequisites, refresh semantics and lifecycle boundaries.
|
|
38
|
+
|
|
39
|
+
Composer completion preserves its existing three arguments and adds optional `MailComposerCompletionDetails` as the fourth: exact per-operation submissions and a detached client-request snapshot, or a separate draft reference. Associate business activity by submission ID, not the latest history row, and preserve each record's real status. Async completion errors are isolated and may be handled with `onCompletionError`; the composer does not wait for business persistence to close. See [client integration](skills/nocobase-app-plugin-mail/references/client-integration.md#associate-composer-completion-with-business-records) for unknown outcomes, drafts, bulk sends and reliability limits.
|
|
40
|
+
|
|
41
|
+
For a production workspace, register an application-owned personal account route rendering the public `MailAccountsPage`, pass its path (without the deployment prefix) as `MailWorkspacePage.accountsHref`, and configure `mail.oauthReturnUrl` separately to the same page. The empty workspace shows a connection link and the populated workspace keeps an account-management link; without `accountsHref` it invents no route. Optional `headerActions` append application actions without replacing Compose or Sync. See the [client integration guide](skills/nocobase-app-plugin-mail/references/client-integration.md) for authentication and permission wiring.
|
|
42
|
+
|
|
43
|
+
The plugin registers no built-in Dev, settings or management pages or routes; applications own their Mail pages. `mail.oauthReturnUrl` defaults to the application's root (`/`), not an account page. Register an application-owned, authenticated personal account page with `page / mail.workspace / access` permission and configure the return URL to that page. Production startup warns once only when the effective return URL targets the legacy `/dev/mail/accounts` destination, including prefixed and absolute forms; the current default does not trigger that warning. The warning does not block startup, change configuration or verify arbitrary application routes. An application-owned administrator overview using the read-only all-user APIs is not a substitute for personal connection. Application runtime environment checks use `app.nodeEnv`, including embedded apps with an environment distinct from their host.
|
|
44
|
+
|
|
37
45
|
Other Server plugins may register custom providers through `mailProviderRegistryToken` and `MailProviderDefinition`. `createMailProviderRegistry()` creates a standalone registry for tests or isolated integrations; applications should extend the registry supplied by Mail Core. Provider capability records may contain capabilities unknown to this Mail version; Mail does not use unknown keys to enable built-in operations, and treats missing known capabilities as unsupported. Client UIs should tolerate unknown capability keys. A custom `MailCredentialVault` may be registered through `mailCredentialVaultToken` before Mail Core initializes when an application needs its own credential storage.
|
|
38
46
|
|
|
39
47
|
`MailClient` is the preferred integration with Mail's HTTP API. The [HTTP API reference](skills/nocobase-app-plugin-mail/references/http-api.md) lists the `/api/mail` paths, request and response shapes, error codes, permission resources, realtime event, OAuth callback, and Provider webhook contracts. OAuth callbacks and Provider webhooks are protocol endpoints rather than general application APIs. A running application also serves the `/api/mail` routes in its OpenAPI document, at `/api/swagger/docs` (Swagger UI) and `/api/swagger` (JSON), for a signed-in user or an API key.
|
|
@@ -10,6 +10,7 @@ export interface MailAccountConnectorLabels {
|
|
|
10
10
|
readonly configurationRequired: string;
|
|
11
11
|
readonly emailAddress?: string;
|
|
12
12
|
readonly username?: string;
|
|
13
|
+
readonly usernameDescription?: string;
|
|
13
14
|
readonly password?: string;
|
|
14
15
|
readonly displayName?: string;
|
|
15
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mail-account-connector.d.ts","sourceRoot":"","sources":["../../../client/components/mail-account-connector.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAK1D,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACtD,QAAQ,CAAC,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,K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QAAQ,CAAC,qBAAqB,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,MAAM,CAAC;IACvE,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAC9B,QAAQ,EAAE,gBAAgB,EAC1B,WAAW,EAAE,sBAAsB,KAChC,IAAI,CAAC;CACX;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,MAAM,EACN,SAAS,EACT,oBAAoB,GACrB,EAAE,yBAAyB,GAAG,YAAY,CA6J1C"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Link2 } from 'lucide-react';
|
|
3
|
-
import { useMemo, useState } from 'react';
|
|
3
|
+
import { useId, useMemo, useState } from 'react';
|
|
4
4
|
import { Button } from './ui/button.js';
|
|
5
5
|
import { Input } from './ui/input.js';
|
|
6
6
|
import { NativeSelect } from './ui/native-select.js';
|
|
7
7
|
export function MailAccountConnector({ providers, credentialDefaults, connectedAccountCount, connectingProviderName, labels, onConnect, onConnectCredentials, }) {
|
|
8
|
+
const usernameDescriptionId = useId();
|
|
8
9
|
const [selectedKey, setSelectedKey] = useState('');
|
|
9
10
|
const [address, setAddress] = useState('');
|
|
10
11
|
const [username, setUsername] = useState(credentialDefaults?.username ?? '');
|
|
@@ -21,7 +22,6 @@ export function MailAccountConnector({ providers, credentialDefaults, connectedA
|
|
|
21
22
|
: [];
|
|
22
23
|
const usesCredentials = selectedProvider?.connection === 'credentials';
|
|
23
24
|
const credentialsReady = address.trim().length > 0 &&
|
|
24
|
-
username.trim().length > 0 &&
|
|
25
25
|
password.length > 0 &&
|
|
26
26
|
onConnectCredentials !== undefined;
|
|
27
27
|
return (_jsxs("div", { className: 'space-y-4', children: [_jsxs("div", { className: 'grid gap-3 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end', children: [_jsxs("label", { className: 'grid gap-2 text-sm font-medium', children: [_jsx("span", { children: labels.accountType }), _jsxs(NativeSelect, { onChange: (event) => {
|
|
@@ -49,7 +49,8 @@ export function MailAccountConnector({ providers, credentialDefaults, connectedA
|
|
|
49
49
|
else {
|
|
50
50
|
onConnect(selectedProvider);
|
|
51
51
|
}
|
|
52
|
-
}, children: [_jsx(Link2, { "aria-hidden": 'true', className: 'size-4' }), connecting ? labels.connecting : labels.connect] })] }), usesCredentials && providerConfigured ? (_jsxs("div", { className: 'grid gap-3 sm:grid-cols-2', children: [_jsxs("label", { className: 'grid gap-2 text-sm font-medium', children: [_jsx("span", { children: labels.emailAddress ?? 'Email address' }), _jsx(Input, { autoComplete: 'email', onChange: (event) => setAddress(event.target.value), value: address })] }), _jsxs("
|
|
52
|
+
}, children: [_jsx(Link2, { "aria-hidden": 'true', className: 'size-4' }), connecting ? labels.connecting : labels.connect] })] }), usesCredentials && providerConfigured ? (_jsxs("div", { className: 'grid items-start gap-3 sm:grid-cols-2', children: [_jsxs("label", { className: 'grid gap-2 text-sm font-medium', children: [_jsx("span", { children: labels.emailAddress ?? 'Email address' }), _jsx(Input, { autoComplete: 'email', onChange: (event) => setAddress(event.target.value), value: address })] }), _jsxs("div", { className: 'grid gap-2', children: [_jsxs("label", { className: 'grid gap-2 text-sm font-medium', children: [_jsx("span", { children: labels.username ?? 'Username (optional)' }), _jsx(Input, { "aria-describedby": usernameDescriptionId, autoComplete: 'username', onChange: (event) => setUsername(event.target.value), value: username })] }), _jsx("p", { className: 'text-xs text-muted-foreground', id: usernameDescriptionId, children: labels.usernameDescription ??
|
|
53
|
+
'Usually your email address. Leave blank to use the email address you entered.' })] }), _jsxs("label", { className: 'grid gap-2 text-sm font-medium', children: [_jsx("span", { children: labels.password ?? 'Password' }), _jsx(Input, { autoComplete: 'current-password', onChange: (event) => setPassword(event.target.value), type: 'password', value: password })] }), _jsxs("label", { className: 'grid gap-2 text-sm font-medium', children: [_jsx("span", { children: labels.displayName ?? 'Sender name (optional)' }), _jsx(Input, { autoComplete: 'name', onChange: (event) => setDisplayName(event.target.value), value: displayName })] })] })) : null, selectedProvider ? (_jsx("div", { className: 'rounded-lg border bg-muted/20 p-4', children: _jsxs("div", { className: 'flex flex-wrap items-center justify-between gap-2', children: [_jsxs("div", { children: [_jsx("p", { className: 'font-medium', children: selectedProvider.label }), _jsx("p", { className: 'text-xs text-muted-foreground', children: providerConfigured
|
|
53
54
|
? labels.connectedAccounts(connectedAccountCount(selectedProvider))
|
|
54
55
|
: labels.configurationRequired })] }), providerConfigured ? (_jsx("div", { className: 'flex flex-wrap justify-end gap-1.5', children: capabilities.map((capability) => (_jsx("span", { className: 'rounded-md border bg-background px-2 py-1 text-xs text-muted-foreground', children: labels.capability(capability) }, capability))) })) : null] }) })) : null] }));
|
|
55
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mail-account-connector.js","sourceRoot":"","sources":["../../../client/components/mail-account-connector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"mail-account-connector.js","sourceRoot":"","sources":["../../../client/components/mail-account-connector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,u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AK,SAAS,EAAC,oCAAoC,YAChD,YAAY,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAChC,eACE,SAAS,EAAC,yEAAyE,YAGlF,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAFzB,UAAU,CAGV,CACR,CAAC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,GACF,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,QAA0B;IAC7C,OAAO,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mail-navigation-icon.d.ts","sourceRoot":"","sources":["../../../client/components/mail-navigation-icon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mail-navigation-icon.d.ts","sourceRoot":"","sources":["../../../client/components/mail-navigation-icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAM1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,yDAAyD;AACzD,wBAAgB,kBAAkB,IAAI,YAAY,CAoBjD"}
|
|
@@ -1,61 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Mail } from 'lucide-react';
|
|
3
|
-
import { realtimeClientToken, useService } from '@nocobase/app-client';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
3
|
import { useTranslation } from '@nocobase/i18n/client';
|
|
6
|
-
import {
|
|
4
|
+
import { useMailUnreadCount } from '../hooks/use-mail-unread-count.js';
|
|
7
5
|
import { MAIL_PLUGIN_NS } from '../namespace.js';
|
|
8
|
-
import { subscribeToMailInvalidations } from '../subscription.js';
|
|
9
|
-
const REFRESH_INTERVAL_MS = 60_000;
|
|
10
6
|
export { MAIL_UNREAD_COUNT_CHANGED_EVENT } from '../subscription.js';
|
|
11
|
-
import { MAIL_UNREAD_COUNT_CHANGED_EVENT } from '../subscription.js';
|
|
12
7
|
/** Mail center icon with a current-user unread badge. */
|
|
13
8
|
export function MailNavigationIcon() {
|
|
14
9
|
const { t } = useTranslation(MAIL_PLUGIN_NS);
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const [unread, setUnread] = useState(0);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
let active = true;
|
|
20
|
-
let pending = false;
|
|
21
|
-
let inFlight = false;
|
|
22
|
-
let debounce;
|
|
23
|
-
const refresh = () => {
|
|
24
|
-
if (!active || inFlight)
|
|
25
|
-
return;
|
|
26
|
-
pending = false;
|
|
27
|
-
inFlight = true;
|
|
28
|
-
void mail
|
|
29
|
-
.getUnreadCount()
|
|
30
|
-
.then((count) => {
|
|
31
|
-
if (active && !pending)
|
|
32
|
-
setUnread(count);
|
|
33
|
-
})
|
|
34
|
-
.catch(() => undefined)
|
|
35
|
-
.finally(() => {
|
|
36
|
-
inFlight = false;
|
|
37
|
-
if (active && pending)
|
|
38
|
-
schedule();
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
const schedule = () => {
|
|
42
|
-
pending = true;
|
|
43
|
-
window.clearTimeout(debounce);
|
|
44
|
-
debounce = window.setTimeout(refresh, 100);
|
|
45
|
-
};
|
|
46
|
-
refresh();
|
|
47
|
-
const unsubscribeRealtime = subscribeToMailInvalidations(realtime, window, schedule);
|
|
48
|
-
const timer = window.setInterval(schedule, REFRESH_INTERVAL_MS);
|
|
49
|
-
window.addEventListener(MAIL_UNREAD_COUNT_CHANGED_EVENT, schedule);
|
|
50
|
-
return () => {
|
|
51
|
-
active = false;
|
|
52
|
-
window.clearInterval(timer);
|
|
53
|
-
window.clearTimeout(debounce);
|
|
54
|
-
unsubscribeRealtime();
|
|
55
|
-
window.removeEventListener(MAIL_UNREAD_COUNT_CHANGED_EVENT, schedule);
|
|
56
|
-
};
|
|
57
|
-
}, [mail, realtime]);
|
|
58
|
-
return (_jsxs("span", { className: 'relative inline-flex size-4 items-center justify-center', children: [_jsx(Mail, { "aria-hidden": 'true', className: 'size-4' }), unread > 0 ? (_jsx("span", { "aria-label": t('nav.unread', {
|
|
10
|
+
const { unreadCount: unread } = useMailUnreadCount();
|
|
11
|
+
return (_jsxs("span", { className: 'relative inline-flex size-4 items-center justify-center', children: [_jsx(Mail, { "aria-hidden": 'true', className: 'size-4' }), unread !== undefined && unread > 0 ? (_jsx("span", { "aria-label": t('nav.unread', {
|
|
59
12
|
count: unread,
|
|
60
13
|
defaultValue: '{{count}} unread messages',
|
|
61
14
|
}), className: 'absolute -top-2 -right-2 min-w-4 rounded-full bg-primary px-1 text-center text-[9px] leading-4 font-semibold text-primary-foreground', children: unread > 99 ? '99+' : unread })) : null] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mail-navigation-icon.js","sourceRoot":"","sources":["../../../client/components/mail-navigation-icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"mail-navigation-icon.js","sourceRoot":"","sources":["../../../client/components/mail-navigation-icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,yDAAyD;AACzD,MAAM,UAAU,kBAAkB;IAChC,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;IAC7C,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAErD,OAAO,CACL,gBAAM,SAAS,EAAC,yDAAyD,aACvE,KAAC,IAAI,mBAAa,MAAM,EAAC,SAAS,EAAC,QAAQ,GAAG,EAC7C,MAAM,KAAK,SAAS,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACpC,6BACc,CAAC,CAAC,YAAY,EAAE;oBAC1B,KAAK,EAAE,MAAM;oBACb,YAAY,EAAE,2BAA2B;iBAC1C,CAAC,EACF,SAAS,EAAC,sIAAsI,YAE/I,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,GACxB,CACR,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -15,5 +15,5 @@ export * from './mailbox-sidebar.js';
|
|
|
15
15
|
export { MailComposer } from './mail-composer.js';
|
|
16
16
|
export { MailWorkspaceComposer } from './mail-workspace-composer.js';
|
|
17
17
|
export type { MailPublicError } from '../../shared/mail.js';
|
|
18
|
-
export { EMPTY_MAIL_COMPOSER, type ComposerState, type MailComposerCompletionResult, type MailComposerComponentProps, type MailComposerProps, type MailComposerRequest, type MailComposerState, type MailForwardQuote, type MailTemplateVariables, type MailWorkspaceComposerProps, } from '../contracts/composer.js';
|
|
18
|
+
export { EMPTY_MAIL_COMPOSER, type ComposerState, type MailComposerCompletionResult, type MailComposerCompletionDetails, type MailComposerCompletionCallback, type MailComposerSubmissionSnapshot, type MailComposerComponentProps, type MailComposerProps, type MailComposerRequest, type MailComposerState, type MailForwardQuote, type MailTemplateVariables, type MailWorkspaceComposerProps, } from '../contracts/composer.js';
|
|
19
19
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../client/components/public.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;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AO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACL,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,GAChC,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../client/components/public.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EACL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../client/components/public.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EACL,mBAAmB,GAapB,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MailAccountView, MailIdentity, MailMessage, MailOutboundAttachmentView, MailProviderView, MailPublicError } from '../../shared/mail.js';
|
|
1
|
+
import type { MailAccountView, MailBulkComposeInput, MailComposeInput, MailIdentity, MailMessage, MailOutboundAttachmentView, MailProviderView, MailPublicError, MailSubmissionView } from '../../shared/mail.js';
|
|
2
2
|
/** Safe variables available when a saved mail template is applied. */
|
|
3
3
|
export type MailTemplateVariables = Readonly<Record<string, unknown>>;
|
|
4
4
|
export interface MailForwardQuote {
|
|
@@ -40,6 +40,30 @@ export interface MailComposerRequest {
|
|
|
40
40
|
readonly uploads?: readonly MailOutboundAttachmentView[];
|
|
41
41
|
}
|
|
42
42
|
export type MailComposerCompletionResult = 'accepted' | 'scheduled' | 'draft' | 'unknown' | 'failed' | 'partial' | (string & {});
|
|
43
|
+
/** Client-submitted content, not final MIME, server-prepared content or delivery proof. */
|
|
44
|
+
export type MailComposerSubmissionSnapshot = {
|
|
45
|
+
readonly kind: 'normal';
|
|
46
|
+
readonly input: Omit<MailComposeInput, 'deliverySnapshot' | 'deliveryContext' | 'sourceDraft'>;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: 'bulk';
|
|
49
|
+
readonly input: Omit<MailBulkComposeInput, 'deliverySnapshot' | 'deliveryContext' | 'sourceDraft'>;
|
|
50
|
+
};
|
|
51
|
+
/** Records returned for this operation; an unknown transport outcome may have no records. */
|
|
52
|
+
export type MailComposerCompletionDetails = (MailComposerSubmissionSnapshot & {
|
|
53
|
+
readonly submissions: readonly MailSubmissionView[];
|
|
54
|
+
}) | {
|
|
55
|
+
readonly kind: 'draft';
|
|
56
|
+
readonly submissions: readonly [];
|
|
57
|
+
readonly draft: Pick<MailMessage, 'id' | 'accountId'>;
|
|
58
|
+
};
|
|
59
|
+
type MailComposerCompletionArguments = [
|
|
60
|
+
result: MailComposerCompletionResult,
|
|
61
|
+
rejectedRecipients?: readonly string[],
|
|
62
|
+
error?: MailPublicError,
|
|
63
|
+
details?: MailComposerCompletionDetails
|
|
64
|
+
];
|
|
65
|
+
/** Observe async completion while retaining legacy callbacks whose return values are discarded. */
|
|
66
|
+
export type MailComposerCompletionCallback = ((...args: MailComposerCompletionArguments) => void) | ((...args: MailComposerCompletionArguments) => Promise<void>);
|
|
43
67
|
/** Inputs shared by the embedded and account-aware workspace composers. */
|
|
44
68
|
export interface MailComposerProps {
|
|
45
69
|
readonly allowBulkSend?: boolean;
|
|
@@ -56,7 +80,9 @@ export interface MailComposerProps {
|
|
|
56
80
|
readonly providers: readonly MailProviderView[];
|
|
57
81
|
readonly templateVariables?: MailTemplateVariables;
|
|
58
82
|
readonly onClose: () => void;
|
|
59
|
-
readonly onComplete:
|
|
83
|
+
readonly onComplete: MailComposerCompletionCallback;
|
|
84
|
+
/** Integration failures do not change the mail result or delay closing the composer. */
|
|
85
|
+
readonly onCompletionError?: (error: unknown) => void | Promise<void>;
|
|
60
86
|
}
|
|
61
87
|
export interface MailComposerComponentProps extends MailComposerProps {
|
|
62
88
|
readonly inline?: boolean;
|
|
@@ -65,4 +91,5 @@ export interface MailComposerComponentProps extends MailComposerProps {
|
|
|
65
91
|
export interface MailWorkspaceComposerProps extends MailComposerProps {
|
|
66
92
|
readonly onSelectAccount: (accountId: string) => void;
|
|
67
93
|
}
|
|
94
|
+
export {};
|
|
68
95
|
//# sourceMappingURL=composer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../../../client/contracts/composer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACX,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,
|
|
1
|
+
{"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../../../client/contracts/composer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,sEAAsE;AACtE,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACpD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IACz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YAC3B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;SACjC,EAAE,CAAC;QACJ,QAAQ,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;KACpE,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAChD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,8BAA8B,CAAC;IACpD,wFAAwF;IACxF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE;AAED,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,QAAQ,CAAC,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composer.js","sourceRoot":"","sources":["../../../client/contracts/composer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"composer.js","sourceRoot":"","sources":["../../../client/contracts/composer.ts"],"names":[],"mappings":"AAgDA,uCAAuC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAsB,MAAM,CAAC,MAAM,CAAC;IAClE,IAAI,EAAE,KAAK;IACX,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,GAAG,EAAE,EAAE;IACP,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,WAAW,EAAE,EAAE;CAChB,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { useTranslation } from '@nocobase/i18n/client';
|
|
|
3
3
|
import { type ComposerRecoverySnapshot } from '../lib/mail-composer-state.js';
|
|
4
4
|
import type { ComposerState, MailComposerProps } from '../contracts/composer.js';
|
|
5
5
|
import { type MailIdentity, type MailMessage, type MailOutboundAttachmentView, type MailSignature, type MailTemplate } from '../mail-client.js';
|
|
6
|
-
export declare function useMailComposer({ request, allowBulkSend, senderSelection, accounts, providers, onClose, onComplete, }: MailComposerProps): MailComposerController;
|
|
6
|
+
export declare function useMailComposer({ request, allowBulkSend, senderSelection, accounts, providers, onClose, onComplete, onCompletionError, }: MailComposerProps): MailComposerController;
|
|
7
7
|
export interface MailComposerController {
|
|
8
8
|
readonly restoreDraft: () => void;
|
|
9
9
|
readonly discardRecovery: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mail-composer.d.ts","sourceRoot":"","sources":["../../../client/hooks/use-mail-composer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-mail-composer.d.ts","sourceRoot":"","sources":["../../../client/hooks/use-mail-composer.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAUL,KAAK,wBAAwB,EAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,0BAA0B,EAC/B,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAK3B,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Q,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,KAAK,IAAI,CAAC;IAC1D,QAAQ,CAAC,iBAAiB,EAAE,CAC1B,IAAI,EAAE,IAAI,KACP,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,QAAQ,CAAC,yBAAyB,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;IACrE,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;IAC7C,QAAQ,CAAC,yBAAyB,EAAE,OAAO,CAAC;CAC7C"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { notifyComposerCompletion, reportComposerCompletionError, } from '../lib/mail-composer-completion.js';
|
|
1
2
|
import { writePendingDelivery, clearPendingDelivery, } from '../lib/mail-pending-delivery.js';
|
|
2
3
|
import { ApiClientError, resolveAppUrl } from '@nocobase/app-client';
|
|
3
4
|
import { uploadedImageContentId } from '../../shared/inline-images.js';
|
|
@@ -9,9 +10,12 @@ import { MAIL_PLUGIN_NS } from '../namespace.js';
|
|
|
9
10
|
import { useMailClient } from '../runtime.js';
|
|
10
11
|
const AUTO_SAVE_DELAY_MS = 2_000;
|
|
11
12
|
const AUTO_SAVE_MAX_WAIT_MS = 10_000;
|
|
12
|
-
export function useMailComposer({ request, allowBulkSend = false, senderSelection, accounts, providers, onClose, onComplete, }) {
|
|
13
|
+
export function useMailComposer({ request, allowBulkSend = false, senderSelection, accounts, providers, onClose, onComplete, onCompletionError, }) {
|
|
13
14
|
const { t } = useTranslation(MAIL_PLUGIN_NS);
|
|
14
15
|
const mail = useMailClient();
|
|
16
|
+
const complete = useCallback((...args) => {
|
|
17
|
+
notifyComposerCompletion(onComplete, onCompletionError, ...args);
|
|
18
|
+
}, [onComplete, onCompletionError]);
|
|
15
19
|
const [error, setError] = useState();
|
|
16
20
|
const [initialRecovery] = useState(() => request.value.mode === 'new'
|
|
17
21
|
? readComposerRecovery(request.accountId)
|
|
@@ -248,6 +252,11 @@ export function useMailComposer({ request, allowBulkSend = false, senderSelectio
|
|
|
248
252
|
setError(undefined);
|
|
249
253
|
let input = buildComposerInput(composerAccountId, identityId, signatureId, composer, composeAttachments, retainedAttachments);
|
|
250
254
|
let submitted = false;
|
|
255
|
+
let completion = {
|
|
256
|
+
kind: 'normal',
|
|
257
|
+
input: structuredClone(input),
|
|
258
|
+
submissions: [],
|
|
259
|
+
};
|
|
251
260
|
const sendBulk = async () => {
|
|
252
261
|
// Each recipient must own its delivery; sending the shared provider draft
|
|
253
262
|
// would consume it on the first message and break the rest of the batch.
|
|
@@ -284,6 +293,11 @@ export function useMailComposer({ request, allowBulkSend = false, senderSelectio
|
|
|
284
293
|
forwardBodyIncluded: input.forwardBodyIncluded,
|
|
285
294
|
};
|
|
286
295
|
const wire = { ...bulkInput, idempotencyKey: input.idempotencyKey };
|
|
296
|
+
completion = {
|
|
297
|
+
kind: 'bulk',
|
|
298
|
+
input: structuredClone(wire),
|
|
299
|
+
submissions: [],
|
|
300
|
+
};
|
|
287
301
|
writePendingDelivery({
|
|
288
302
|
accountId: composerAccountId,
|
|
289
303
|
mode: 'bulk',
|
|
@@ -293,6 +307,11 @@ export function useMailComposer({ request, allowBulkSend = false, senderSelectio
|
|
|
293
307
|
return mail.sendBulk(wire);
|
|
294
308
|
};
|
|
295
309
|
const sendSingle = () => {
|
|
310
|
+
completion = {
|
|
311
|
+
kind: 'normal',
|
|
312
|
+
input: structuredClone(input),
|
|
313
|
+
submissions: [],
|
|
314
|
+
};
|
|
296
315
|
writePendingDelivery({
|
|
297
316
|
accountId: composerAccountId,
|
|
298
317
|
mode: 'normal',
|
|
@@ -323,10 +342,19 @@ export function useMailComposer({ request, allowBulkSend = false, senderSelectio
|
|
|
323
342
|
? 'partial'
|
|
324
343
|
: 'accepted';
|
|
325
344
|
clearPendingDelivery(composerAccountId, input.idempotencyKey);
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
345
|
+
const details = {
|
|
346
|
+
...completion,
|
|
347
|
+
submissions: structuredClone(results),
|
|
348
|
+
};
|
|
349
|
+
try {
|
|
350
|
+
closeComposer(true);
|
|
351
|
+
}
|
|
352
|
+
finally {
|
|
353
|
+
complete(outcome === 'accepted' && input.scheduledAt
|
|
354
|
+
? 'scheduled'
|
|
355
|
+
: outcome, rejectedRecipients, operationError, details);
|
|
356
|
+
}
|
|
357
|
+
}, (error) => {
|
|
330
358
|
if (!submitted ||
|
|
331
359
|
(error instanceof ApiClientError &&
|
|
332
360
|
[400, 401, 403, 404, 422].includes(error.status))) {
|
|
@@ -337,9 +365,14 @@ export function useMailComposer({ request, allowBulkSend = false, senderSelectio
|
|
|
337
365
|
}
|
|
338
366
|
// A transport failure is not evidence of non-delivery. Keep the outgoing
|
|
339
367
|
// snapshot in sending records, never restore it as an editable draft.
|
|
340
|
-
|
|
341
|
-
|
|
368
|
+
try {
|
|
369
|
+
closeComposer(true);
|
|
370
|
+
}
|
|
371
|
+
finally {
|
|
372
|
+
complete('unknown', undefined, undefined, completion);
|
|
373
|
+
}
|
|
342
374
|
})
|
|
375
|
+
.catch((error) => reportComposerCompletionError(onCompletionError, error))
|
|
343
376
|
.finally(() => setSending(false));
|
|
344
377
|
};
|
|
345
378
|
const uploadInlineImage = async (file) => {
|
|
@@ -473,12 +506,22 @@ export function useMailComposer({ request, allowBulkSend = false, senderSelectio
|
|
|
473
506
|
setDraftSaveStatus('saved');
|
|
474
507
|
if (closeAfterSave &&
|
|
475
508
|
latestComposerFingerprintRef.current === fingerprint) {
|
|
509
|
+
const details = {
|
|
510
|
+
kind: 'draft',
|
|
511
|
+
submissions: [],
|
|
512
|
+
draft: { id: draft.id, accountId: draft.accountId },
|
|
513
|
+
};
|
|
476
514
|
endingRef.current = true;
|
|
477
515
|
clearComposerRecovery(composerAccountId);
|
|
478
516
|
composerSessionRef.current += 1;
|
|
479
517
|
setComposer(undefined);
|
|
480
|
-
|
|
481
|
-
|
|
518
|
+
try {
|
|
519
|
+
onClose();
|
|
520
|
+
}
|
|
521
|
+
catch (error) {
|
|
522
|
+
reportComposerCompletionError(onCompletionError, error);
|
|
523
|
+
}
|
|
524
|
+
complete('draft', undefined, undefined, details);
|
|
482
525
|
}
|
|
483
526
|
})
|
|
484
527
|
.catch(() => {
|
|
@@ -493,7 +536,8 @@ export function useMailComposer({ request, allowBulkSend = false, senderSelectio
|
|
|
493
536
|
});
|
|
494
537
|
}, [
|
|
495
538
|
onClose,
|
|
496
|
-
|
|
539
|
+
onCompletionError,
|
|
540
|
+
complete,
|
|
497
541
|
composer,
|
|
498
542
|
composerAccountId,
|
|
499
543
|
identityId,
|