@remit/web-client 0.0.346 → 0.0.348

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.
Files changed (108) hide show
  1. package/dist/src/components/mail/BriefPane.js +3 -3
  2. package/dist/src/components/mail/CheckAgainProvider.d.ts +30 -0
  3. package/dist/src/components/mail/CheckAgainProvider.js +194 -0
  4. package/dist/src/components/mail/{FlaggedList.d.ts → CollectionList.d.ts} +7 -3
  5. package/dist/src/components/mail/{FlaggedList.js → CollectionList.js} +29 -24
  6. package/dist/src/components/mail/CollectionPane.d.ts +32 -0
  7. package/dist/src/components/mail/{FlaggedPane.js → CollectionPane.js} +35 -33
  8. package/dist/src/components/mail/ConversationView.d.ts +7 -8
  9. package/dist/src/components/mail/ConversationView.js +4 -4
  10. package/dist/src/components/mail/DailyBrief.js +6 -4
  11. package/dist/src/components/mail/IntelligencePane.d.ts +2 -2
  12. package/dist/src/components/mail/IntelligencePane.js +33 -4
  13. package/dist/src/components/mail/MailSidebarAdapter.js +29 -7
  14. package/dist/src/components/mail/MailboxPane.js +10 -12
  15. package/dist/src/components/mail/MessageActionMenu.d.ts +3 -1
  16. package/dist/src/components/mail/MessageActionMenu.js +3 -3
  17. package/dist/src/components/mail/MessageCard.js +9 -1
  18. package/dist/src/components/mail/MessageList.js +11 -2
  19. package/dist/src/components/mail/MessageListItem.d.ts +4 -2
  20. package/dist/src/components/mail/MessageListItem.js +4 -6
  21. package/dist/src/components/mail/SpamBannerSlot.d.ts +10 -0
  22. package/dist/src/components/mail/SpamBannerSlot.js +56 -0
  23. package/dist/src/components/mail/SwipeableMessageRow.d.ts +3 -2
  24. package/dist/src/components/mail/SwipeableMessageRow.js +6 -6
  25. package/dist/src/components/mail/ThreadListInteraction.d.ts +2 -0
  26. package/dist/src/components/mail/ThreadListInteraction.js +12 -2
  27. package/dist/src/components/settings/classification/FailureBanner.js +3 -4
  28. package/dist/src/components/settings/spam/SpamSettingsPanel.d.ts +6 -0
  29. package/dist/src/components/settings/spam/SpamSettingsPanel.js +176 -0
  30. package/dist/src/hooks/{useStarredThreads.d.ts → useCollectionThreads.d.ts} +10 -8
  31. package/dist/src/hooks/{useStarredThreads.js → useCollectionThreads.js} +16 -14
  32. package/dist/src/hooks/useCurrentMailboxName.d.ts +1 -0
  33. package/dist/src/hooks/useCurrentMailboxName.js +6 -1
  34. package/dist/src/hooks/useIntelligenceData.d.ts +2 -4
  35. package/dist/src/hooks/useIntelligenceData.js +1 -127
  36. package/dist/src/hooks/useJunkMailboxIds.d.ts +2 -0
  37. package/dist/src/hooks/useJunkMailboxIds.js +17 -0
  38. package/dist/src/hooks/useLabels.d.ts +10 -9
  39. package/dist/src/hooks/useLabels.js +25 -6
  40. package/dist/src/lib/brief.d.ts +1 -1
  41. package/dist/src/lib/brief.js +3 -3
  42. package/dist/src/lib/check-again.d.ts +33 -0
  43. package/dist/src/lib/check-again.js +66 -0
  44. package/dist/src/lib/{flagged-criteria.d.ts → collection-criteria.d.ts} +18 -6
  45. package/dist/src/lib/{flagged-criteria.js → collection-criteria.js} +4 -3
  46. package/dist/src/lib/conversation-target.d.ts +3 -2
  47. package/dist/src/lib/label-folders.d.ts +6 -0
  48. package/dist/src/lib/label-folders.js +10 -0
  49. package/dist/src/lib/mail-route.d.ts +10 -5
  50. package/dist/src/lib/mail-route.js +9 -1
  51. package/dist/src/lib/mail-search.d.ts +11 -0
  52. package/dist/src/lib/mail-search.js +4 -0
  53. package/dist/src/lib/search-scope.d.ts +2 -2
  54. package/dist/src/lib/search-scope.js +4 -4
  55. package/dist/src/lib/search-tokens.d.ts +1 -1
  56. package/dist/src/lib/search-tokens.js +2 -2
  57. package/dist/src/lib/spam-overview.d.ts +23 -0
  58. package/dist/src/lib/spam-overview.js +44 -0
  59. package/dist/src/lib/spam.d.ts +32 -0
  60. package/dist/src/lib/spam.js +38 -0
  61. package/dist/src/lib/thread-search-tokens.js +3 -1
  62. package/dist/src/routeTree.gen.d.ts +312 -5
  63. package/dist/src/routeTree.gen.js +72 -0
  64. package/dist/src/routes/__root.js +2 -1
  65. package/dist/src/routes/mail/flagged/$threadId/$messageId.js +2 -2
  66. package/dist/src/routes/mail/flagged/$threadId/index.js +2 -2
  67. package/dist/src/routes/mail/flagged/index.js +2 -2
  68. package/dist/src/routes/mail/flagged.js +3 -2
  69. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId/$mode.{-$outboxMessageId}.d.ts +18 -0
  70. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId/$mode.{-$outboxMessageId}.js +8 -0
  71. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId.d.ts +15 -0
  72. package/dist/src/routes/mail/label/$labelId/$threadId/$messageId.js +14 -0
  73. package/dist/src/routes/mail/label/$labelId/$threadId/index.d.ts +15 -0
  74. package/dist/src/routes/mail/label/$labelId/$threadId/index.js +9 -0
  75. package/dist/src/routes/mail/label/$labelId/$threadId.d.ts +15 -0
  76. package/dist/src/routes/mail/label/$labelId/$threadId.js +8 -0
  77. package/dist/src/routes/mail/label/$labelId/compose.{-$outboxMessageId}.d.ts +15 -0
  78. package/dist/src/routes/mail/label/$labelId/compose.{-$outboxMessageId}.js +10 -0
  79. package/dist/src/routes/mail/label/$labelId/index.d.ts +15 -0
  80. package/dist/src/routes/mail/label/$labelId/index.js +9 -0
  81. package/dist/src/routes/mail/label/$labelId.d.ts +15 -0
  82. package/dist/src/routes/mail/label/$labelId.js +30 -0
  83. package/dist/src/routes/mail/label/index.d.ts +29 -0
  84. package/dist/src/routes/mail/label/index.js +18 -0
  85. package/dist/src/routes/settings/filters.d.ts +6 -2
  86. package/dist/src/routes/settings/filters.js +10 -3
  87. package/dist/src/routes/settings/senders.d.ts +14 -2
  88. package/dist/src/routes/settings/senders.js +32 -15
  89. package/dist/src/routes/settings/spam.d.ts +1 -0
  90. package/dist/src/routes/settings/spam.js +15 -0
  91. package/dist/src/routes/settings.js +6 -1
  92. package/dist/src/routing/browsed-list.d.ts +1 -1
  93. package/dist/src/routing/browsed-list.js +15 -4
  94. package/dist/src/routing/compose.js +10 -6
  95. package/dist/src/routing/index.d.ts +1 -1
  96. package/dist/src/routing/index.js +1 -1
  97. package/dist/src/routing/nav-selection.d.ts +5 -0
  98. package/dist/src/routing/nav-selection.js +15 -0
  99. package/dist/src/routing/open-thread.js +23 -3
  100. package/dist/src/routing/reply.js +28 -11
  101. package/dist/src/routing/search-mirror.d.ts +5 -0
  102. package/dist/src/routing/search-mirror.js +20 -2
  103. package/dist/src/routing/spam-link.d.ts +3 -0
  104. package/dist/src/routing/spam-link.js +12 -0
  105. package/package.json +2 -2
  106. package/dist/src/components/mail/AuthenticityBanner.d.ts +0 -14
  107. package/dist/src/components/mail/AuthenticityBanner.js +0 -18
  108. package/dist/src/components/mail/FlaggedPane.d.ts +0 -29
@@ -73,7 +73,7 @@ function BriefPaneProvider({ thread, children }) {
73
73
  mailboxId: selectedThread?.mailboxId ?? "",
74
74
  subject: selectedThread?.subject,
75
75
  messageId: selectedMessageId,
76
- authenticity: selectedThread?.authenticity,
76
+ row: selectedThread,
77
77
  };
78
78
  }, [threadId, selectedThread, selectedMessageId]);
79
79
  const handleOpenThread = useCallback((target, options) => {
@@ -214,7 +214,7 @@ function BriefReading() {
214
214
  currentMailboxId: actions.mailboxId,
215
215
  onMove: actions.moveThread,
216
216
  }
217
- : undefined }), _jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: conversation ? (_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, authenticity: conversation.authenticity, onOpenIntelligence: intelligence.open, listOnScreen: true })) : (_jsx(ReadingPaneEmpty, {})) })] }), _jsx(IntelligenceDrawer, { isOpen: intelligence.drawerOpen, onClose: intelligence.closeDrawer, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
217
+ : undefined }), _jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: conversation ? (_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, spamRow: conversation.row, onOpenIntelligence: intelligence.open, listOnScreen: true })) : (_jsx(ReadingPaneEmpty, {})) })] }), _jsx(IntelligenceDrawer, { isOpen: intelligence.drawerOpen, onClose: intelligence.closeDrawer, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
218
218
  }
219
219
  /**
220
220
  * Intelligence pane: IntelligencePane for the thread open in the brief.
@@ -234,7 +234,7 @@ function BriefPhone() {
234
234
  const { selectedThread, conversation, onOpenThread, onCloseThread, nextThread, previousThread, handleDeselectIfRemoved, } = useBriefPane();
235
235
  const drawer = useIntelligenceDrawer(conversation?.threadId ?? null);
236
236
  if (conversation) {
237
- return (_jsxs(_Fragment, { children: [_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, authenticity: conversation.authenticity, onBack: onCloseThread, onOpenIntelligence: drawer.toggle, onSwipeNext: nextThread ? () => onOpenThread(nextThread) : undefined, onSwipePrevious: previousThread ? () => onOpenThread(previousThread) : undefined, mobileIntelligenceOpen: drawer.isOpen }), _jsx(IntelligenceDrawer, { isOpen: drawer.isOpen, onClose: drawer.close, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
237
+ return (_jsxs(_Fragment, { children: [_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, spamRow: conversation.row, onBack: onCloseThread, onOpenIntelligence: drawer.toggle, onSwipeNext: nextThread ? () => onOpenThread(nextThread) : undefined, onSwipePrevious: previousThread ? () => onOpenThread(previousThread) : undefined, mobileIntelligenceOpen: drawer.isOpen }), _jsx(IntelligenceDrawer, { isOpen: drawer.isOpen, onClose: drawer.close, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
238
238
  }
239
239
  // The same list slot the multi-pane layout mounts, so the phone brief wires
240
240
  // the bulk verbs and the selection bar through `DailyBrief` exactly as the
@@ -0,0 +1,30 @@
1
+ import type { RemitImapRescanFailureCode, RemitImapThreadMessageResponse } from "@remit/api-http-client/types.gen.ts";
2
+ import { type ThreadRowData } from "@remit/ui";
3
+ import { type ReactNode } from "react";
4
+ import { type CheckAgainTarget } from "../../lib/check-again";
5
+ export type CheckAgainRequest = CheckAgainTarget;
6
+ export interface CheckAgainContextValue {
7
+ /**
8
+ * Checks the messages again. A list shows the progress panel; a single
9
+ * message shows its new verdict in its own banner instead.
10
+ */
11
+ checkAgain: (requests: readonly CheckAgainRequest[], options: {
12
+ panel: boolean;
13
+ }) => void;
14
+ /** Ids in the batch in flight. */
15
+ pendingIds: ReadonlySet<string>;
16
+ /** Why the last run left a message unchecked. */
17
+ failures: ReadonlyMap<string, RemitImapRescanFailureCode>;
18
+ }
19
+ /** Absent outside the app shell, where nothing can run a check. */
20
+ export declare const useCheckAgain: () => CheckAgainContextValue | undefined;
21
+ /**
22
+ * Owns every Check again run: it sends ten ids per call, one call at a time,
23
+ * so the panel can count each batch as it lands and Stop can end the run after
24
+ * the batch in flight. The run lives in memory and ends with the page.
25
+ */
26
+ export declare function CheckAgainProvider({ children }: {
27
+ children: ReactNode;
28
+ }): import("react").JSX.Element;
29
+ export declare const checkAgainRequestOfThread: (thread: RemitImapThreadMessageResponse, junkMailboxIds: ReadonlySet<string>) => CheckAgainRequest;
30
+ export declare const checkAgainRequestOfRow: (row: ThreadRowData) => CheckAgainRequest | undefined;
@@ -0,0 +1,194 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { threadDetailOperationsListThreadMessagesQueryKey } from "@remit/api-http-client/@tanstack/react-query.gen.ts";
3
+ import { accountMessageOperationsRescanMessages } from "@remit/api-http-client/sdk.gen.ts";
4
+ import { CHECK_AGAIN_FAILURE_SENTENCES, CheckAgainPanel, } from "@remit/ui";
5
+ import { useQueryClient } from "@tanstack/react-query";
6
+ import { createContext, useCallback, useContext, useMemo, useRef, useState, } from "react";
7
+ import { ApiError } from "../../lib/api";
8
+ import { applyRescanResult, EMPTY_SUMMARY, refusedBatch, rescanBatches, } from "../../lib/check-again";
9
+ import { escalate } from "../../lib/escalate";
10
+ import { reportSignedOut } from "../../lib/signed-out";
11
+ import { spamReportHref, spamRowMark } from "../../lib/spam";
12
+ import { invalidateThreadListQueries, threadListCacheKeys, } from "../../lib/thread-list-cache";
13
+ import { useErrorBanners } from "../ui/error-banner-context";
14
+ const CheckAgainContext = createContext(undefined);
15
+ /** Absent outside the app shell, where nothing can run a check. */
16
+ export const useCheckAgain = () => useContext(CheckAgainContext);
17
+ const sendBatch = async (batch) => {
18
+ const response = await accountMessageOperationsRescanMessages({
19
+ path: { accountId: batch.accountId },
20
+ body: { messageIds: batch.targets.map((target) => target.messageId) },
21
+ });
22
+ if (response.data)
23
+ return response.data;
24
+ if (!response.response)
25
+ throw response.error;
26
+ const status = response.response.status;
27
+ if (status === 401)
28
+ return "SignedOut";
29
+ if (status === 403)
30
+ return refusedBatch(batch, "NotPermitted");
31
+ if (status === 404)
32
+ return refusedBatch(batch, "NotFound");
33
+ throw new ApiError(`Check again failed with ${status}`, status, response.error);
34
+ };
35
+ /**
36
+ * Owns every Check again run: it sends ten ids per call, one call at a time,
37
+ * so the panel can count each batch as it lands and Stop can end the run after
38
+ * the batch in flight. The run lives in memory and ends with the page.
39
+ */
40
+ export function CheckAgainProvider({ children }) {
41
+ const queryClient = useQueryClient();
42
+ const { pushError } = useErrorBanners();
43
+ const [panel, setPanel] = useState(undefined);
44
+ const [pendingIds, setPendingIds] = useState(new Set());
45
+ const [failures, setFailures] = useState(new Map());
46
+ const runningRef = useRef(false);
47
+ const stopRef = useRef(false);
48
+ const settle = useCallback((targets) => {
49
+ invalidateThreadListQueries(queryClient, threadListCacheKeys(targets.map((target) => target.mailboxId)));
50
+ for (const threadId of new Set(targets.map((t) => t.threadId))) {
51
+ if (!threadId)
52
+ continue;
53
+ queryClient.invalidateQueries({
54
+ queryKey: threadDetailOperationsListThreadMessagesQueryKey({
55
+ path: { threadId },
56
+ }),
57
+ });
58
+ }
59
+ }, [queryClient]);
60
+ const run = useCallback(async (targets, showPanel) => {
61
+ const total = targets.length;
62
+ let outcome = {
63
+ summary: EMPTY_SUMMARY,
64
+ failures: [],
65
+ };
66
+ let checked = 0;
67
+ if (showPanel)
68
+ setPanel({ state: "Running", checked, total });
69
+ for (const batch of rescanBatches(targets)) {
70
+ if (stopRef.current)
71
+ break;
72
+ setPendingIds(new Set(batch.targets.map((t) => t.messageId)));
73
+ const result = await sendBatch(batch);
74
+ if (result === "SignedOut") {
75
+ reportSignedOut();
76
+ setPendingIds(new Set());
77
+ return;
78
+ }
79
+ outcome = applyRescanResult(outcome, batch, result);
80
+ checked += batch.targets.length;
81
+ setFailures((current) => {
82
+ const next = new Map(current);
83
+ for (const success of result.successful) {
84
+ next.delete(success.messageId);
85
+ }
86
+ for (const failure of result.failed) {
87
+ next.set(failure.messageId, failure.code);
88
+ }
89
+ return next;
90
+ });
91
+ if (showPanel)
92
+ setPanel({ state: "Running", checked, total });
93
+ }
94
+ setPendingIds(new Set());
95
+ settle(targets);
96
+ if (stopRef.current) {
97
+ setPanel(undefined);
98
+ return;
99
+ }
100
+ if (!showPanel) {
101
+ for (const failure of outcome.failures) {
102
+ pushError({
103
+ title: "Couldn't check this message again",
104
+ detail: `${failure.subject}: ${CHECK_AGAIN_FAILURE_SENTENCES[failure.code]}`,
105
+ });
106
+ }
107
+ return;
108
+ }
109
+ if (outcome.failures.length === 0) {
110
+ setPanel({ state: "Done", total, summary: outcome.summary });
111
+ return;
112
+ }
113
+ const retryIds = new Set(outcome.failures.filter((f) => f.retryable).map((f) => f.messageId));
114
+ setPanel({
115
+ state: "PartialFailure",
116
+ checked,
117
+ total,
118
+ failures: outcome.failures,
119
+ retry: targets.filter((target) => retryIds.has(target.messageId)),
120
+ });
121
+ }, [pushError, settle]);
122
+ const start = useCallback((targets, showPanel) => {
123
+ if (targets.length === 0)
124
+ return;
125
+ if (runningRef.current) {
126
+ pushError({
127
+ severity: "info",
128
+ title: "Check again is already running",
129
+ detail: "Wait for the run in progress to finish, or stop it.",
130
+ });
131
+ return;
132
+ }
133
+ runningRef.current = true;
134
+ stopRef.current = false;
135
+ void run(targets, showPanel)
136
+ .catch((error) => {
137
+ setPendingIds(new Set());
138
+ setPanel(undefined);
139
+ escalate(error);
140
+ })
141
+ .finally(() => {
142
+ runningRef.current = false;
143
+ });
144
+ }, [run, pushError]);
145
+ const checkAgain = useCallback((requests, options) => {
146
+ start([...requests], options.panel);
147
+ }, [start]);
148
+ const value = useMemo(() => ({ checkAgain, pendingIds, failures }), [checkAgain, pendingIds, failures]);
149
+ const panelProps = (() => {
150
+ if (!panel)
151
+ return undefined;
152
+ if (panel.state === "Running") {
153
+ return {
154
+ ...panel,
155
+ onStop: () => {
156
+ stopRef.current = true;
157
+ },
158
+ };
159
+ }
160
+ if (panel.state === "Done") {
161
+ return { ...panel, onDone: () => setPanel(undefined) };
162
+ }
163
+ return {
164
+ state: "PartialFailure",
165
+ checked: panel.checked,
166
+ total: panel.total,
167
+ failures: panel.failures,
168
+ reportIssueHref: spamReportHref("Check again left messages unchecked", panel.failures
169
+ .map((failure) => `${failure.messageId}: ${failure.code}`)
170
+ .join(", ")),
171
+ onRetry: () => start(panel.retry, true),
172
+ onClose: () => setPanel(undefined),
173
+ };
174
+ })();
175
+ return (_jsxs(CheckAgainContext.Provider, { value: value, children: [children, panelProps && (_jsx("div", { className: "pointer-events-none fixed inset-x-3 bottom-3 z-40 flex justify-center", children: _jsx("div", { className: "pointer-events-auto w-full max-w-md", children: _jsx(CheckAgainPanel, { ...panelProps }) }) }))] }));
176
+ }
177
+ export const checkAgainRequestOfThread = (thread, junkMailboxIds) => ({
178
+ messageId: thread.messageId,
179
+ accountId: thread.accountId,
180
+ mailboxId: thread.mailboxId,
181
+ threadId: thread.threadId,
182
+ subject: thread.subject ?? "(No subject)",
183
+ before: spamRowMark(thread, junkMailboxIds),
184
+ });
185
+ export const checkAgainRequestOfRow = (row) => row.mailboxId && row.accountId
186
+ ? {
187
+ messageId: row.id,
188
+ accountId: row.accountId,
189
+ mailboxId: row.mailboxId,
190
+ threadId: row.threadId,
191
+ subject: row.subject,
192
+ before: row.spam,
193
+ }
194
+ : undefined;
@@ -1,12 +1,16 @@
1
1
  import { type RefObject } from "react";
2
2
  import type { TriageContextUpdate } from "../../hooks/useTriageLayer";
3
+ import { type ThreadCollection } from "../../lib/collection-criteria";
3
4
  import type { OpenThreadTarget } from "../../routing";
4
5
  import type { MessageListCommands } from "./MessageList";
5
6
  import { type OpenMessageOptions } from "./ThreadListInteraction";
6
- interface FlaggedListProps {
7
+ interface CollectionListProps {
8
+ collection: ThreadCollection;
9
+ /** What the list header and the empty state call the collection. */
10
+ title: string;
7
11
  selectedMessageId?: string;
8
12
  /**
9
- * Opens a row. Every starred row names its thread, so a message filed outside
13
+ * Opens a row. Every row names its thread, so a message filed outside
10
14
  * the inbox opens by exactly the same route as one inside it.
11
15
  */
12
16
  onOpenThread?: (target: OpenThreadTarget, options?: OpenMessageOptions) => void;
@@ -16,5 +20,5 @@ interface FlaggedListProps {
16
20
  onTriageContextChange?: (context: TriageContextUpdate) => void;
17
21
  onDeleteMessages: (messageIds: string[]) => void;
18
22
  }
19
- export declare function FlaggedList({ selectedMessageId, onOpenThread, commandsRef, onTriageContextChange, onDeleteMessages, }: FlaggedListProps): import("react").JSX.Element;
23
+ export declare function CollectionList({ collection, title, selectedMessageId, onOpenThread, commandsRef, onTriageContextChange, onDeleteMessages, }: CollectionListProps): import("react").JSX.Element;
20
24
  export {};
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /**
3
- * FlaggedList — a FLAT, cross-account inbox of starred mail.
3
+ * CollectionList — a FLAT, cross-account inbox of starred mail, or of one
4
+ * label's mail.
4
5
  *
5
- * Reads the starred listing through `useStarredThreads` — GET /threads with
6
- * `starred=true`, served by the `byStarred` index — which returns every starred
7
- * thread in the config across all non-muted mailboxes, paged. Every row names
6
+ * Reads the collection listing through `useCollectionThreads` — GET /threads
7
+ * with `starred=true`, served by the `byStarred` index, or with `labelId`,
8
+ * which reads the label's folder in every non-muted account — paged. Every row names
8
9
  * its thread, which is the whole address a conversation opens by, so a starred
9
10
  * message filed outside the inbox opens like any other. Starredness is decided
10
11
  * server-side from `hasStars`; the client neither re-filters nor caps the set,
@@ -29,12 +30,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
30
  */
30
31
  import { flaggedFilterConfig, formatErrorMessage, MessageListPane, } from "@remit/ui";
31
32
  import { useCallback, useMemo, useState } from "react";
33
+ import { useCollectionThreads, useCollectionUnreadCount, } from "../../hooks/useCollectionThreads";
34
+ import { useJunkMailboxIds } from "../../hooks/useJunkMailboxIds";
32
35
  import { useIsDesktop } from "../../hooks/useMediaQuery";
33
36
  import { useSearchTokenContext } from "../../hooks/useSearchTokenContext";
34
- import { useStarredThreads, useStarredUnreadCount, } from "../../hooks/useStarredThreads";
35
37
  import { matchesSearchTokens, toThreadRowData } from "../../lib/brief";
36
38
  import { buildBugReportContext, buildGitHubIssueUrl, } from "../../lib/bug-report";
37
- import { flaggedCriteria } from "../../lib/flagged-criteria";
39
+ import { collectionCriteria, } from "../../lib/collection-criteria";
38
40
  import { useListHeaderChrome } from "../../lib/list-header-chrome";
39
41
  import { listNarrowing } from "../../lib/list-narrowing";
40
42
  import { useMailContext } from "../../lib/mail-context";
@@ -55,16 +57,16 @@ import { ThreadListInteraction, ThreadListSelectionBar, useThreadListSelection,
55
57
  * offers "make this a filter" wherever a search is active, and the step that
56
58
  * affordance pushes has to be answered on the view that offered it — an
57
59
  * affordance whose press lands on nothing is the dead button clause 1.7 exists
58
- * to prevent. Starred spans accounts and mailboxes, so a rule made from the
60
+ * to prevent. A collection spans accounts and mailboxes, so a rule made from the
59
61
  * ticked rows has no single account to belong to; a rule made from the query
60
62
  * belongs to the account the query names, which the host reads for itself.
61
63
  */
62
- function StarredWizardHost({ rows, verb, }) {
64
+ function CollectionWizardHost({ rows, verb, }) {
63
65
  const { selectedIds, exitSelection } = useThreadListSelection();
64
66
  const selection = useMemo(() => wizardSelectionFrom(rows, selectedIds), [rows, selectedIds]);
65
67
  return (_jsx(SelectionWizardHost, { verb: verb, selection: selection, selectionRestriction: "spansAccounts", onFinished: exitSelection }));
66
68
  }
67
- export function FlaggedList({ selectedMessageId, onOpenThread, commandsRef, onTriageContextChange, onDeleteMessages, }) {
69
+ export function CollectionList({ collection, title, selectedMessageId, onOpenThread, commandsRef, onTriageContextChange, onDeleteMessages, }) {
68
70
  const { searchQuery, resultFolderIndex, onSearchClearQuery } = useMailContext();
69
71
  const tokenContext = useSearchTokenContext();
70
72
  const isDesktop = useIsDesktop();
@@ -98,19 +100,20 @@ export function FlaggedList({ selectedMessageId, onOpenThread, commandsRef, onTr
98
100
  const typedFreeText = parseSearchTokens(searchQuery.trim(), tokenContext).freeText;
99
101
  // The chips and the tokens together, as query parameters: a category typed as
100
102
  // `category:personal` narrows the request exactly as the chip does.
101
- const { criteria, residual: residualTokens } = useMemo(() => flaggedCriteria({ category: selectedCategory, attributes: activeFilters }, queryTokens), [selectedCategory, activeFilters, queryTokens]);
103
+ const { criteria, residual: residualTokens } = useMemo(() => collectionCriteria(collection, { category: selectedCategory, attributes: activeFilters }, queryTokens), [collection, selectedCategory, activeFilters, queryTokens]);
102
104
  const textCriteria = useMemo(() => (sq ? { ...criteria, query: sq } : criteria), [criteria, sq]);
103
105
  // One request, free text included. The text is a parameter like every other
104
106
  // criterion, so a search is this listing narrowed rather than a second query
105
107
  // beside it — which is what gives a search the same error state, the same
106
108
  // pagination and the same loading state as the unsearched list.
107
- const { threads, isLoading, isError, error, refetch, fetchNextPage, hasNextPage, isFetchingNextPage, } = useStarredThreads(textCriteria);
109
+ const { threads, isLoading, isError, error, refetch, fetchNextPage, hasNextPage, isFetchingNextPage, } = useCollectionThreads(collection, textCriteria);
110
+ const junkMailboxIds = useJunkMailboxIds();
108
111
  const rows = useMemo(() =>
109
112
  // What is left is what no parameter can carry: `before:`, `after:`,
110
113
  // `in:`, `account:`, and a token the chips overruled.
111
114
  dedupeByThread(threads)
112
- .map(toThreadRowData)
113
- .filter((t) => matchesSearchTokens(t, residualTokens)), [threads, residualTokens]);
115
+ .map((thread) => toThreadRowData(thread, junkMailboxIds))
116
+ .filter((t) => matchesSearchTokens(t, residualTokens)), [threads, residualTokens, junkMailboxIds]);
114
117
  const openRow = useCallback((id, options) => {
115
118
  const threadId = rows.find((row) => row.id === id)?.threadId;
116
119
  if (!threadId)
@@ -129,15 +132,17 @@ export function FlaggedList({ selectedMessageId, onOpenThread, commandsRef, onTr
129
132
  // The server's count over the whole collection under the active criteria.
130
133
  // `null` while it is in flight and `null` when it cannot be had, and the
131
134
  // header then shows no number — never a page length dressed as a total.
132
- const unreadCount = useStarredUnreadCount(textCriteria) ?? null;
135
+ const unreadCount = useCollectionUnreadCount(collection, textCriteria) ?? null;
133
136
  // An empty list has to say how much was looked at, and the answer comes off
134
137
  // the request. Every chip, the free text and every carried token is a field
135
138
  // on the row, so the server answered each over the whole collection; only a
136
139
  // residual token — a date, a mailbox, an account — saw the loaded pages.
137
140
  //
138
- // `is:starred` is dropped: this view is starred mail, so the token restates
139
- // the collection rather than narrowing it.
140
- const narrowingTokens = useMemo(() => queryTokens.filter((token) => token.type !== "isStarred"), [queryTokens]);
141
+ // On Starred, `is:starred` is dropped: the token restates the collection
142
+ // rather than narrowing it.
143
+ const narrowingTokens = useMemo(() => "starred" in collection
144
+ ? queryTokens.filter((token) => token.type !== "isStarred")
145
+ : queryTokens, [collection, queryTokens]);
141
146
  const listFilter = listNarrowing({
142
147
  chips: { category: selectedCategory, attributes: activeFilters },
143
148
  tokens: narrowingTokens,
@@ -157,17 +162,17 @@ export function FlaggedList({ selectedMessageId, onOpenThread, commandsRef, onTr
157
162
  }, []);
158
163
  const chrome = useListHeaderChrome();
159
164
  const listBody = (_jsx("div", { className: "flex h-full min-h-0 flex-col", children: _jsxs("div", { className: "flex-1 overflow-y-auto", children: [_jsx("div", { className: "divide-y divide-line", children: rows.map((thread) => (_jsx(MessageRow, { thread: thread, active: thread.id === selectedMessageId, onClick: () => openRow(thread.id) }, thread.id))) }), hasNextPage ? (_jsx("button", { type: "button", className: "w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50", onClick: () => fetchNextPage(), disabled: isFetchingNextPage, children: isFetchingNextPage ? "Loading…" : "Load more" })) : null] }) }));
160
- return (_jsx(MailViewChrome, { title: "Starred", unreadCount: unreadCount, preset: preset, selectedCategory: selectedCategory, activeFilters: activeFilters, onSelectCategory: setSelectedCategory, onToggleFilter: toggleFilter, onClearFilters: clearFilters, searchResults: searchResults, searchLoading: isLoading, onSelectSearchResult: openResult,
165
+ return (_jsx(MailViewChrome, { title: title, unreadCount: unreadCount, preset: preset, selectedCategory: selectedCategory, activeFilters: activeFilters, onSelectCategory: setSelectedCategory, onToggleFilter: toggleFilter, onClearFilters: clearFilters, searchResults: searchResults, searchLoading: isLoading, onSelectSearchResult: openResult,
161
166
  // A committed search renders in this view's own rows (`rows` already
162
167
  // narrows to the query above), so the multi-select toolbar stays
163
168
  // reachable exactly as it does on the mailbox route (#212). The
164
169
  // results panel stays for the typing/uncommitted state only.
165
- searchResultsInBody: true, children: _jsxs(ThreadListInteraction, { selectedMessageId: selectedMessageId, rows: rows, onOpen: openRow, onDeleteMessages: onDeleteMessages, onSelectionVerb: wizard.start, commandsRef: commandsRef, onTriageContextChange: onTriageContextChange, children: [_jsx(MessageListPane, { listTitle: "Starred", sections: [{ id: "flagged", threads: rows }], flatList: true, hideHeader: true, listState: chrome.searchResults ? "ready" : listState, listFilter: listFilter,
166
- // Flagged spans accounts and folders, so it is a collection and
167
- // never "this mailbox". It names itself.
168
- listScopeLabel: "Starred",
170
+ searchResultsInBody: true, children: _jsxs(ThreadListInteraction, { selectedMessageId: selectedMessageId, rows: rows, onOpen: openRow, onDeleteMessages: onDeleteMessages, onSelectionVerb: wizard.start, commandsRef: commandsRef, onTriageContextChange: onTriageContextChange, children: [_jsx(MessageListPane, { listTitle: title, sections: [{ id: "collection", threads: rows }], flatList: true, hideHeader: true, listState: chrome.searchResults ? "ready" : listState, listFilter: listFilter,
171
+ // A collection spans accounts and folders, so it is never "this
172
+ // mailbox". It names itself.
173
+ listScopeLabel: title,
169
174
  // The typed tokens narrow the list too, but `listFilter` already
170
175
  // names them, and a headline saying one narrowing twice reads as two.
171
- searchQuery: typedFreeText || undefined, errorMessage: isError ? formatErrorMessage(error) : undefined, onRetry: () => refetch(), onReportError: handleReportError, selectedThreadId: selectedMessageId, onSelectThread: openRow, isDesktop: isDesktop, selectionBar: _jsx(ThreadListSelectionBar, { title: "Starred" }), listBody: chrome.searchResults ??
172
- (listState === "ready" ? listBody : undefined) }), _jsx(StarredWizardHost, { rows: rows, verb: wizard.verb })] }) }));
176
+ searchQuery: typedFreeText || undefined, errorMessage: isError ? formatErrorMessage(error) : undefined, onRetry: () => refetch(), onReportError: handleReportError, selectedThreadId: selectedMessageId, onSelectThread: openRow, isDesktop: isDesktop, selectionBar: _jsx(ThreadListSelectionBar, { title: title }), listBody: chrome.searchResults ??
177
+ (listState === "ready" ? listBody : undefined) }), _jsx(CollectionWizardHost, { rows: rows, verb: wizard.verb })] }) }));
173
178
  }
@@ -0,0 +1,32 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ThreadCollection } from "../../lib/collection-criteria";
3
+ import { type OpenThreadPath } from "../../routing";
4
+ interface CollectionPaneProps {
5
+ collection: ThreadCollection;
6
+ title: string;
7
+ /** The open conversation, as the address states it. */
8
+ thread: OpenThreadPath | undefined;
9
+ children: ReactNode;
10
+ }
11
+ declare function CollectionPaneProvider({ collection, title, thread, children, }: CollectionPaneProps): import("react").JSX.Element;
12
+ /** Flat collection list. Mount in the `list` slot of `AppShellSlotted`. */
13
+ declare function CollectionListSlot(): import("react").JSX.Element;
14
+ /**
15
+ * Reading pane: toolbar + ConversationView.
16
+ * Mount in the `reading` slot of `AppShellSlotted`. Only rendered ≥ 1024px.
17
+ */
18
+ declare function CollectionReading(): import("react").JSX.Element;
19
+ /**
20
+ * Intelligence pane: IntelligencePane for the open thread.
21
+ * Mount in the `intelligence` slot of `AppShellSlotted`. Only rendered ≥ 1280px.
22
+ */
23
+ declare function CollectionIntelligence(): import("react").JSX.Element;
24
+ /** Phone view: ConversationView when a thread is open, else the flat list. */
25
+ declare function CollectionPhone(): import("react").JSX.Element;
26
+ declare const CollectionPane: typeof CollectionPaneProvider & {
27
+ List: typeof CollectionListSlot;
28
+ Reading: typeof CollectionReading;
29
+ Intelligence: typeof CollectionIntelligence;
30
+ Phone: typeof CollectionPhone;
31
+ };
32
+ export { CollectionPane };
@@ -1,41 +1,41 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { ReadingPaneEmpty } from "@remit/ui";
3
3
  import { createContext, useCallback, useContext, useMemo, } from "react";
4
+ import { useCollectionThreads } from "../../hooks/useCollectionThreads";
4
5
  import { useDeleteMessages } from "../../hooks/useDeleteMessages";
5
6
  import { useIntelligenceDrawer } from "../../hooks/useIntelligenceDrawer";
6
7
  import { useIntelligenceSurface } from "../../hooks/useIntelligenceSurface";
7
8
  import { useToggleReadFor } from "../../hooks/useMarkAsRead";
8
- import { useStarredThreads } from "../../hooks/useStarredThreads";
9
9
  import { useThreadActions, } from "../../hooks/useThreadActions";
10
10
  import { useThreadRow } from "../../hooks/useThreadRow";
11
11
  import { useTriageContext, useTriageLayer, } from "../../hooks/useTriageLayer";
12
12
  import { useMailContext } from "../../lib/mail-context";
13
13
  import { replyToThread, useCloseThread, useGoToSection, useIsComposing, useIsReplying, useOpenReply, useOpenThread, } from "../../routing";
14
14
  import { useReplyWithText } from "../compose/reply-with-times";
15
+ import { CollectionList } from "./CollectionList";
15
16
  import { ConversationView } from "./ConversationView";
16
- import { FlaggedList } from "./FlaggedList";
17
17
  import { IntelligenceDrawer } from "./IntelligenceDrawer";
18
18
  import { IntelligencePane } from "./IntelligencePane";
19
19
  import { MessageToolbar } from "./MessageToolbar";
20
- const FlaggedPaneCtx = createContext(null);
21
- function useFlaggedPane() {
22
- const ctx = useContext(FlaggedPaneCtx);
20
+ const CollectionPaneCtx = createContext(null);
21
+ function useCollectionPane() {
22
+ const ctx = useContext(CollectionPaneCtx);
23
23
  if (!ctx)
24
- throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");
24
+ throw new Error("CollectionPane.* must be used inside <CollectionPane>");
25
25
  return ctx;
26
26
  }
27
- function FlaggedPaneProvider({ thread, children }) {
27
+ function CollectionPaneProvider({ collection, title, thread, children, }) {
28
28
  const openThread = useOpenThread();
29
29
  const closeThread = useCloseThread();
30
30
  const goToSection = useGoToSection();
31
31
  const { searchInput } = useMailContext();
32
32
  const threadId = thread?.threadId;
33
33
  const pointedAtMessageId = thread?.messageId;
34
- const { threads } = useStarredThreads();
35
- // The row the starred listing itself holds, preferred because a mutation
34
+ const { threads } = useCollectionThreads(collection);
35
+ // The row the collection listing itself holds, preferred because a mutation
36
36
  // patches it in place. A thread reached from a cold address is in no listing
37
37
  // here and answers for itself — the folder it is filed in is the thread's own
38
- // data, so Starred spanning folders costs the URL nothing.
38
+ // data, so a collection spanning folders costs the URL nothing.
39
39
  const listedThread = useMemo(() => {
40
40
  if (!threadId)
41
41
  return undefined;
@@ -53,7 +53,7 @@ function FlaggedPaneProvider({ thread, children }) {
53
53
  mailboxId: selectedThread?.mailboxId ?? "",
54
54
  subject: selectedThread?.subject,
55
55
  messageId: selectedMessageId,
56
- authenticity: selectedThread?.authenticity,
56
+ row: selectedThread,
57
57
  };
58
58
  }, [threadId, selectedThread, selectedMessageId]);
59
59
  const handleOpenThread = useCallback((target, options) => {
@@ -72,7 +72,7 @@ function FlaggedPaneProvider({ thread, children }) {
72
72
  onAfterOptimisticRemove: handleDeselectIfRemoved,
73
73
  });
74
74
  const triage = useTriageContext();
75
- // A Flagged selection spans accounts and mailboxes, so the listings these
75
+ // A collection selection spans accounts and mailboxes, so the listings these
76
76
  // patch are resolved from each message's own mailbox — the open thread's is
77
77
  // only the fallback.
78
78
  const { deleteMessages } = useDeleteMessages({
@@ -144,7 +144,7 @@ function FlaggedPaneProvider({ thread, children }) {
144
144
  },
145
145
  });
146
146
  // The swipe gestures open a whole conversation, so the adjacent row has to
147
- // name its thread. The starred listing is where that is looked up, so a row
147
+ // name its thread. The collection listing is where that is looked up, so a row
148
148
  // it does not hold offers no gesture rather than a tap that goes nowhere.
149
149
  const adjacentThread = useCallback((messageId) => {
150
150
  if (!messageId)
@@ -153,6 +153,8 @@ function FlaggedPaneProvider({ thread, children }) {
153
153
  return row ? { threadId: row.threadId, messageId } : undefined;
154
154
  }, [threads]);
155
155
  const ctx = {
156
+ collection,
157
+ title,
156
158
  selectedMessageId,
157
159
  selectedThread,
158
160
  conversation,
@@ -166,23 +168,23 @@ function FlaggedPaneProvider({ thread, children }) {
166
168
  onDeleteMessages: deleteMessages,
167
169
  handleDeselectIfRemoved,
168
170
  };
169
- return (_jsx(FlaggedPaneCtx.Provider, { value: ctx, children: children }));
171
+ return (_jsx(CollectionPaneCtx.Provider, { value: ctx, children: children }));
170
172
  }
171
173
  /* ------------------------------------------------------------------ */
172
174
  /* Sub-views */
173
175
  /* ------------------------------------------------------------------ */
174
- /** Flat starred list. Mount in the `list` slot of `AppShellSlotted`. */
175
- function FlaggedListSlot() {
176
- const { selectedMessageId, onOpenThread, triage, onDeleteMessages } = useFlaggedPane();
177
- return (_jsx(FlaggedList, { selectedMessageId: selectedMessageId, onOpenThread: onOpenThread, commandsRef: triage.listCommandsRef, onTriageContextChange: triage.onTriageContextChange, onDeleteMessages: onDeleteMessages }));
176
+ /** Flat collection list. Mount in the `list` slot of `AppShellSlotted`. */
177
+ function CollectionListSlot() {
178
+ const { collection, title, selectedMessageId, onOpenThread, triage, onDeleteMessages, } = useCollectionPane();
179
+ return (_jsx(CollectionList, { collection: collection, title: title, selectedMessageId: selectedMessageId, onOpenThread: onOpenThread, commandsRef: triage.listCommandsRef, onTriageContextChange: triage.onTriageContextChange, onDeleteMessages: onDeleteMessages }));
178
180
  }
179
181
  /**
180
182
  * Reading pane: toolbar + ConversationView.
181
183
  * Mount in the `reading` slot of `AppShellSlotted`. Only rendered ≥ 1024px.
182
184
  */
183
- function FlaggedReading() {
185
+ function CollectionReading() {
184
186
  const replyWithText = useReplyWithText();
185
- const { conversation, selectedThread, actions, onReply, handleDeselectIfRemoved, onOpenThread, } = useFlaggedPane();
187
+ const { conversation, selectedThread, actions, onReply, handleDeselectIfRemoved, onOpenThread, } = useCollectionPane();
186
188
  const hasThread = Boolean(conversation);
187
189
  const intelligence = useIntelligenceSurface(conversation?.threadId);
188
190
  return (_jsxs(_Fragment, { children: [_jsxs("section", { className: "flex h-full w-full min-w-0 flex-col bg-canvas", children: [_jsx(MessageToolbar, { hasThread: hasThread, intelligenceOpen: intelligence.isShowing, canToggleIntelligence: intelligence.canToggle, onToggleIntelligence: intelligence.toggle, onReply: onReply ? () => onReply("reply") : undefined, onReplyAll: onReply ? () => onReply("reply-all") : undefined, onForward: onReply ? () => onReply("forward") : undefined, onDelete: hasThread ? actions.deleteThread : undefined, onToggleStar: hasThread ? actions.toggleStar : undefined, isStarred: actions.isStarred, moveContext: hasThread && actions.accountId && actions.mailboxId
@@ -191,35 +193,35 @@ function FlaggedReading() {
191
193
  currentMailboxId: actions.mailboxId,
192
194
  onMove: actions.moveThread,
193
195
  }
194
- : undefined }), _jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: conversation ? (_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, authenticity: conversation.authenticity, onOpenIntelligence: intelligence.open, listOnScreen: true })) : (_jsx(ReadingPaneEmpty, {})) })] }), _jsx(IntelligenceDrawer, { isOpen: intelligence.drawerOpen, onClose: intelligence.closeDrawer, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
196
+ : undefined }), _jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: conversation ? (_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, spamRow: conversation.row, onOpenIntelligence: intelligence.open, listOnScreen: true })) : (_jsx(ReadingPaneEmpty, {})) })] }), _jsx(IntelligenceDrawer, { isOpen: intelligence.drawerOpen, onClose: intelligence.closeDrawer, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
195
197
  }
196
198
  /**
197
199
  * Intelligence pane: IntelligencePane for the open thread.
198
200
  * Mount in the `intelligence` slot of `AppShellSlotted`. Only rendered ≥ 1280px.
199
201
  */
200
- function FlaggedIntelligence() {
202
+ function CollectionIntelligence() {
201
203
  const replyWithText = useReplyWithText();
202
- const { selectedThread, handleDeselectIfRemoved, onOpenThread } = useFlaggedPane();
204
+ const { selectedThread, handleDeselectIfRemoved, onOpenThread } = useCollectionPane();
203
205
  const { onToggleIntelligence } = useMailContext();
204
206
  return (_jsx(IntelligencePane, { onClose: onToggleIntelligence, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread }));
205
207
  }
206
208
  /** Phone view: ConversationView when a thread is open, else the flat list. */
207
- function FlaggedPhone() {
209
+ function CollectionPhone() {
208
210
  const replyWithText = useReplyWithText();
209
- const { selectedThread, conversation, onCloseThread, onOpenThread, nextThread, previousThread, handleDeselectIfRemoved, } = useFlaggedPane();
211
+ const { selectedThread, conversation, onCloseThread, onOpenThread, nextThread, previousThread, handleDeselectIfRemoved, } = useCollectionPane();
210
212
  const drawer = useIntelligenceDrawer(conversation?.threadId ?? null);
211
213
  if (conversation) {
212
- return (_jsxs(_Fragment, { children: [_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, authenticity: conversation.authenticity, onBack: onCloseThread, onOpenIntelligence: drawer.toggle, onSwipeNext: nextThread ? () => onOpenThread(nextThread) : undefined, onSwipePrevious: previousThread ? () => onOpenThread(previousThread) : undefined, mobileIntelligenceOpen: drawer.isOpen }), _jsx(IntelligenceDrawer, { isOpen: drawer.isOpen, onClose: drawer.close, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
214
+ return (_jsxs(_Fragment, { children: [_jsx(ConversationView, { threadId: conversation.threadId, mailboxId: conversation.mailboxId, subject: conversation.subject, selectedMessageId: conversation.messageId, spamRow: conversation.row, onBack: onCloseThread, onOpenIntelligence: drawer.toggle, onSwipeNext: nextThread ? () => onOpenThread(nextThread) : undefined, onSwipePrevious: previousThread ? () => onOpenThread(previousThread) : undefined, mobileIntelligenceOpen: drawer.isOpen }), _jsx(IntelligenceDrawer, { isOpen: drawer.isOpen, onClose: drawer.close, thread: selectedThread, accountId: selectedThread?.accountId, onAfterOptimisticRemove: handleDeselectIfRemoved, onReplyWithText: replyWithText, onOpenThread: onOpenThread })] }));
213
215
  }
214
- return (_jsx("div", { className: "h-full", children: _jsx(FlaggedListSlot, {}) }));
216
+ return (_jsx("div", { className: "h-full", children: _jsx(CollectionListSlot, {}) }));
215
217
  }
216
218
  /* ------------------------------------------------------------------ */
217
219
  /* Compound component assembly */
218
220
  /* ------------------------------------------------------------------ */
219
- const FlaggedPane = Object.assign(FlaggedPaneProvider, {
220
- List: FlaggedListSlot,
221
- Reading: FlaggedReading,
222
- Intelligence: FlaggedIntelligence,
223
- Phone: FlaggedPhone,
221
+ const CollectionPane = Object.assign(CollectionPaneProvider, {
222
+ List: CollectionListSlot,
223
+ Reading: CollectionReading,
224
+ Intelligence: CollectionIntelligence,
225
+ Phone: CollectionPhone,
224
226
  });
225
- export { FlaggedPane };
227
+ export { CollectionPane };