@remit/web-client 0.0.326 → 0.0.328

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 (52) hide show
  1. package/dist/src/components/mail/MailboxPane.js +2 -9
  2. package/dist/src/components/settings/AccountFormPanel.js +1 -1
  3. package/dist/src/hooks/useDeleteFolder.js +1 -7
  4. package/dist/src/hooks/useDeleteMessages.d.ts +0 -9
  5. package/dist/src/hooks/useDeleteMessages.js +0 -9
  6. package/dist/src/lib/calendar-route.d.ts +2 -6
  7. package/dist/src/lib/calendar-route.js +4 -2
  8. package/dist/src/lib/mail-search.d.ts +32 -74
  9. package/dist/src/lib/mail-search.js +11 -0
  10. package/dist/src/routeTree.gen.d.ts +551 -814
  11. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId.d.ts +4 -12
  12. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/index.d.ts +4 -12
  13. package/dist/src/routes/calendar/$view.$date/$calendarObjectId.d.ts +4 -12
  14. package/dist/src/routes/calendar/$view.$date/index.d.ts +4 -12
  15. package/dist/src/routes/calendar/$view.$date/new.d.ts +4 -12
  16. package/dist/src/routes/calendar/$view.$date/suggestion.$suggestionId.d.ts +4 -12
  17. package/dist/src/routes/calendar/$view.$date.d.ts +4 -12
  18. package/dist/src/routes/calendar/index.d.ts +4 -12
  19. package/dist/src/routes/mail/$mailboxId/$threadId/$messageId/$mode.{-$outboxMessageId}.d.ts +13 -24
  20. package/dist/src/routes/mail/$mailboxId/$threadId/$messageId.d.ts +12 -16
  21. package/dist/src/routes/mail/$mailboxId/$threadId/index.d.ts +12 -16
  22. package/dist/src/routes/mail/$mailboxId/$threadId.d.ts +12 -16
  23. package/dist/src/routes/mail/$mailboxId/compose.{-$outboxMessageId}.d.ts +12 -16
  24. package/dist/src/routes/mail/$mailboxId/index.d.ts +12 -16
  25. package/dist/src/routes/mail/$mailboxId.d.ts +12 -16
  26. package/dist/src/routes/mail/brief/$threadId/$messageId/$mode.{-$outboxMessageId}.d.ts +13 -24
  27. package/dist/src/routes/mail/brief/$threadId/$messageId.d.ts +12 -16
  28. package/dist/src/routes/mail/brief/$threadId/index.d.ts +12 -16
  29. package/dist/src/routes/mail/brief/$threadId.d.ts +12 -16
  30. package/dist/src/routes/mail/brief/compose.{-$outboxMessageId}.d.ts +12 -16
  31. package/dist/src/routes/mail/brief/index.d.ts +12 -16
  32. package/dist/src/routes/mail/brief.d.ts +12 -16
  33. package/dist/src/routes/mail/flagged/$threadId/$messageId/$mode.{-$outboxMessageId}.d.ts +13 -24
  34. package/dist/src/routes/mail/flagged/$threadId/$messageId.d.ts +12 -16
  35. package/dist/src/routes/mail/flagged/$threadId/index.d.ts +12 -16
  36. package/dist/src/routes/mail/flagged/$threadId.d.ts +12 -16
  37. package/dist/src/routes/mail/flagged/compose.{-$outboxMessageId}.d.ts +12 -16
  38. package/dist/src/routes/mail/flagged/index.d.ts +12 -16
  39. package/dist/src/routes/mail/flagged.d.ts +12 -16
  40. package/dist/src/routes/mail/index.d.ts +24 -32
  41. package/dist/src/routes/mail/outbox/compose.{-$outboxMessageId}.d.ts +12 -16
  42. package/dist/src/routes/mail/outbox/draft/$outboxMessageId.d.ts +12 -16
  43. package/dist/src/routes/mail/outbox/index.d.ts +12 -16
  44. package/dist/src/routes/mail/outbox.d.ts +12 -16
  45. package/dist/src/routes/mail.d.ts +13 -14
  46. package/dist/src/routes/mail.js +2 -10
  47. package/dist/src/routes/settings/accounts.d.ts +1 -17
  48. package/dist/src/routing/index.d.ts +1 -1
  49. package/dist/src/routing/index.js +1 -1
  50. package/dist/src/routing/wizard-history.d.ts +10 -4
  51. package/dist/src/routing/wizard-history.js +2 -10
  52. package/package.json +2 -2
@@ -23,7 +23,7 @@ import { useInfiniteQuery } from "@tanstack/react-query";
23
23
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
24
24
  import { useArchiveMailbox, useDraftsMailbox, useJunkMailbox, useTrashByAccount, useTrashMailbox, } from "../../hooks/useArchiveMailbox";
25
25
  import { useCurrentMailboxMessageCount, useCurrentMailboxName, useCurrentMailboxUnseenCount, } from "../../hooks/useCurrentMailboxName";
26
- import { dropDeletedThreads, useDeleteMessages, } from "../../hooks/useDeleteMessages";
26
+ import { useDeleteMessages } from "../../hooks/useDeleteMessages";
27
27
  import { useEmptyTrash } from "../../hooks/useEmptyTrash";
28
28
  import { useIntelligenceData } from "../../hooks/useIntelligenceData";
29
29
  import { useIntelligenceDrawer } from "../../hooks/useIntelligenceDrawer";
@@ -191,14 +191,7 @@ function MailboxPaneProvider({ mailboxId, thread, children, }) {
191
191
  });
192
192
  const { accountId: mailboxAccountId, isLoading: mailboxAccountLoading } = useMailboxAccount(mailboxId);
193
193
  const mailboxName = useCurrentMailboxName({ accounts });
194
- // The server answered the active predicate, so these rows are the list: the
195
- // dedupe spans pages and the deleted drop repeats the server's own
196
- // `excludeDeleted`, and neither result changes when another page loads.
197
- // Residual tokens are the exception — the request could not carry them, so
198
- // they are applied here over what came back. That thins a page rather than
199
- // answering over the whole mailbox, which is why the empty state stops
200
- // claiming the folder was read and the escalation predicate is withheld.
201
- const threads = applyResidualTokens(dropDeletedThreads(dedupeThreadMessages(threadsData?.pages.flatMap((page) => page.items ?? []) ?? [])), residualTokens, mailboxAccountId);
194
+ const threads = applyResidualTokens(dedupeThreadMessages(threadsData?.pages.flatMap((page) => page.items ?? []) ?? []), residualTokens, mailboxAccountId);
202
195
  const onSelectFilterCategory = useCallback((id) => {
203
196
  setFilterCategory(id);
204
197
  }, []);
@@ -35,7 +35,7 @@ export const deriveUseDifferentSmtpCreds = (account) => {
35
35
  return smtpUsername !== account.username;
36
36
  };
37
37
  const accountFormSchema = z.object({
38
- email: z.string().email().min(1, "Email is required"),
38
+ email: z.email(),
39
39
  displayName: z.string().optional(),
40
40
  username: z.string().optional(),
41
41
  password: z.string().optional(),
@@ -30,8 +30,6 @@ const collectMovableIds = async (mailboxId, alreadyMoved, limit, signal) => {
30
30
  throwOnError: true,
31
31
  });
32
32
  for (const item of data.items) {
33
- if (item.isDeleted)
34
- continue;
35
33
  if (alreadyMoved.has(item.messageId))
36
34
  continue;
37
35
  if (ids.includes(item.messageId))
@@ -63,11 +61,7 @@ const liveMessageCount = async (mailboxId, signal) => {
63
61
  query: { order: "desc", continuationToken },
64
62
  throwOnError: true,
65
63
  });
66
- for (const item of data.items) {
67
- if (item.isDeleted)
68
- continue;
69
- count += 1;
70
- }
64
+ count += data.items.length;
71
65
  if (!data.continuationToken)
72
66
  break;
73
67
  continuationToken = data.continuationToken;
@@ -25,15 +25,6 @@ interface UseDeleteMessagesOptions {
25
25
  * the set are removed.
26
26
  */
27
27
  export declare const removeMessagesFromItems: (items: RemitImapThreadMessageResponse[], messageIds: Set<string>) => RemitImapThreadMessageResponse[];
28
- /**
29
- * Pure helper: drop soft-deleted rows from a flattened thread list.
30
- *
31
- * Belt-and-braces guard against #212. The backend already excludes
32
- * `isDeleted: true` rows from the inbox listing, but if a regression slips
33
- * back in (or an eventual-consistency window briefly returns a soft-deleted
34
- * row) the UI must not show it.
35
- */
36
- export declare const dropDeletedThreads: (items: RemitImapThreadMessageResponse[]) => RemitImapThreadMessageResponse[];
37
28
  export declare const useDeleteMessages: ({ mailboxId, threadId, accountId, messages, onAfterOptimisticRemove, }: UseDeleteMessagesOptions) => {
38
29
  deleteMessages: (messageIds: string[]) => void;
39
30
  isPending: boolean;
@@ -18,15 +18,6 @@ import { resolveMailboxesForMessages } from "./useMarkAsRead";
18
18
  * the set are removed.
19
19
  */
20
20
  export const removeMessagesFromItems = (items, messageIds) => items.filter((item) => !messageIds.has(item.messageId));
21
- /**
22
- * Pure helper: drop soft-deleted rows from a flattened thread list.
23
- *
24
- * Belt-and-braces guard against #212. The backend already excludes
25
- * `isDeleted: true` rows from the inbox listing, but if a regression slips
26
- * back in (or an eventual-consistency window briefly returns a soft-deleted
27
- * row) the UI must not show it.
28
- */
29
- export const dropDeletedThreads = (items) => items.filter((item) => item.isDeleted !== true);
30
21
  export const useDeleteMessages = ({ mailboxId, threadId, accountId, messages, onAfterOptimisticRemove, }) => {
31
22
  const queryClient = useQueryClient();
32
23
  const { pushError } = useErrorBanners();
@@ -84,10 +84,6 @@ export declare function readCalendarIds(value: unknown): string[];
84
84
  * rather than a fact about the view, so it belongs to no tier of the address.
85
85
  */
86
86
  export declare const calendarSearchSchema: z.ZodObject<{
87
- calendarId: z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], unknown>, string[] | undefined, unknown>;
88
- }, "strip", z.ZodTypeAny, {
89
- calendarId?: string[] | undefined;
90
- }, {
91
- calendarId?: unknown;
92
- }>;
87
+ calendarId: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnknown, z.ZodTransform<string[], unknown>>, z.ZodTransform<string[] | undefined, string[]>>>;
88
+ }, z.core.$strip>;
93
89
  export type CalendarSearch = z.infer<typeof calendarSearchSchema>;
@@ -140,6 +140,8 @@ export function readCalendarIds(value) {
140
140
  */
141
141
  export const calendarSearchSchema = z.object({
142
142
  calendarId: z
143
- .preprocess(readCalendarIds, z.array(calendarIdSchema))
144
- .transform((ids) => (ids.length === 0 ? undefined : ids)),
143
+ .unknown()
144
+ .transform(readCalendarIds)
145
+ .transform((ids) => (ids.length === 0 ? undefined : ids))
146
+ .optional(),
145
147
  });
@@ -16,19 +16,11 @@ import { z } from "zod";
16
16
  */
17
17
  export declare const briefSearchSchema: z.ZodObject<{
18
18
  q: z.ZodOptional<z.ZodString>;
19
- }, "strip", z.ZodTypeAny, {
20
- q?: string | undefined;
21
- }, {
22
- q?: string | undefined;
23
- }>;
19
+ }, z.core.$strip>;
24
20
  /** The same, for `/mail/flagged/<thread>/<message>`. */
25
21
  export declare const flaggedSearchSchema: z.ZodObject<{
26
22
  q: z.ZodOptional<z.ZodString>;
27
- }, "strip", z.ZodTypeAny, {
28
- q?: string | undefined;
29
- }, {
30
- q?: string | undefined;
31
- }>;
23
+ }, z.core.$strip>;
32
24
  /**
33
25
  * The outbox's open message is a path segment
34
26
  * (`/mail/outbox/draft/<outboxMessageId>`), so the query carries nothing but
@@ -36,11 +28,7 @@ export declare const flaggedSearchSchema: z.ZodObject<{
36
28
  */
37
29
  export declare const outboxSearchSchema: z.ZodObject<{
38
30
  q: z.ZodOptional<z.ZodString>;
39
- }, "strip", z.ZodTypeAny, {
40
- q?: string | undefined;
41
- }, {
42
- q?: string | undefined;
43
- }>;
31
+ }, z.core.$strip>;
44
32
  /**
45
33
  * A folder's open thread and the message inside it are path segments
46
34
  * (`/mail/<mailbox>/<thread>/<message>`), so the query carries nothing but the
@@ -48,94 +36,64 @@ export declare const outboxSearchSchema: z.ZodObject<{
48
36
  */
49
37
  export declare const mailboxSearchSchema: z.ZodObject<{
50
38
  q: z.ZodOptional<z.ZodString>;
51
- }, "strip", z.ZodTypeAny, {
52
- q?: string | undefined;
53
- }, {
54
- q?: string | undefined;
55
- }>;
39
+ }, z.core.$strip>;
56
40
  /**
57
41
  * `/mail` itself only redirects to the brief, so it accepts what the brief
58
42
  * accepts and hands it straight on.
59
43
  */
60
44
  export declare const mailIndexSearchSchema: z.ZodObject<{
61
45
  q: z.ZodOptional<z.ZodString>;
62
- }, "strip", z.ZodTypeAny, {
63
- q?: string | undefined;
64
- }, {
65
- q?: string | undefined;
66
- }>;
46
+ }, z.core.$strip>;
47
+ /**
48
+ * The `/mail` layout's own search: the query, plus the selection wizard's step
49
+ * (#477 clause 1.6) and the affordance that opened it, so a reload lands back on
50
+ * the walk it was in. The router owns history, so the step is a validated
51
+ * search param rather than a raw pushState entry.
52
+ */
53
+ export declare const mailSearchSchema: z.ZodObject<{
54
+ q: z.ZodOptional<z.ZodString>;
55
+ wizard: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
56
+ name: "name";
57
+ match: "match";
58
+ run: "run";
59
+ folder: "folder";
60
+ rule: "rule";
61
+ review: "review";
62
+ properties: "properties";
63
+ }>>>;
64
+ wizardFrom: z.ZodCatch<z.ZodOptional<z.ZodLiteral<"search">>>;
65
+ }, z.core.$strip>;
67
66
  /** Every list's schema, by the path it validates. */
68
67
  export declare const mailListSearchSchemas: {
69
68
  readonly "/mail/brief": z.ZodObject<{
70
69
  q: z.ZodOptional<z.ZodString>;
71
- }, "strip", z.ZodTypeAny, {
72
- q?: string | undefined;
73
- }, {
74
- q?: string | undefined;
75
- }>;
70
+ }, z.core.$strip>;
76
71
  readonly "/mail/flagged": z.ZodObject<{
77
72
  q: z.ZodOptional<z.ZodString>;
78
- }, "strip", z.ZodTypeAny, {
79
- q?: string | undefined;
80
- }, {
81
- q?: string | undefined;
82
- }>;
73
+ }, z.core.$strip>;
83
74
  readonly "/mail/outbox": z.ZodObject<{
84
75
  q: z.ZodOptional<z.ZodString>;
85
- }, "strip", z.ZodTypeAny, {
86
- q?: string | undefined;
87
- }, {
88
- q?: string | undefined;
89
- }>;
76
+ }, z.core.$strip>;
90
77
  readonly "/mail/$mailboxId": z.ZodObject<{
91
78
  q: z.ZodOptional<z.ZodString>;
92
- }, "strip", z.ZodTypeAny, {
93
- q?: string | undefined;
94
- }, {
95
- q?: string | undefined;
96
- }>;
79
+ }, z.core.$strip>;
97
80
  };
98
81
  export declare const composeSeedSearch: z.ZodObject<{
99
82
  body: z.ZodOptional<z.ZodString>;
100
- }, "strip", z.ZodTypeAny, {
101
- body?: string | undefined;
102
- }, {
103
- body?: string | undefined;
104
- }>;
83
+ }, z.core.$strip>;
105
84
  export type ComposeSeed = Required<z.infer<typeof composeSeedSearch>>;
106
85
  export declare const withoutComposeSeed: (prev: Record<string, unknown>) => Record<string, unknown>;
107
86
  export declare const replySearchSchemas: {
108
87
  readonly brief: z.ZodObject<{
109
88
  q: z.ZodOptional<z.ZodString>;
110
- } & {
111
89
  body: z.ZodOptional<z.ZodString>;
112
- }, "strip", z.ZodTypeAny, {
113
- body?: string | undefined;
114
- q?: string | undefined;
115
- }, {
116
- body?: string | undefined;
117
- q?: string | undefined;
118
- }>;
90
+ }, z.core.$strip>;
119
91
  readonly flagged: z.ZodObject<{
120
92
  q: z.ZodOptional<z.ZodString>;
121
- } & {
122
93
  body: z.ZodOptional<z.ZodString>;
123
- }, "strip", z.ZodTypeAny, {
124
- body?: string | undefined;
125
- q?: string | undefined;
126
- }, {
127
- body?: string | undefined;
128
- q?: string | undefined;
129
- }>;
94
+ }, z.core.$strip>;
130
95
  readonly mailbox: z.ZodObject<{
131
96
  q: z.ZodOptional<z.ZodString>;
132
- } & {
133
97
  body: z.ZodOptional<z.ZodString>;
134
- }, "strip", z.ZodTypeAny, {
135
- body?: string | undefined;
136
- q?: string | undefined;
137
- }, {
138
- body?: string | undefined;
139
- q?: string | undefined;
140
- }>;
98
+ }, z.core.$strip>;
141
99
  };
@@ -8,6 +8,7 @@
8
8
  * is one place for it to be right.
9
9
  */
10
10
  import { z } from "zod";
11
+ import { wizardEntryValue, wizardStepValue } from "../routing/wizard-history";
11
12
  /** What every list carries, whatever else it carries. */
12
13
  const listSearch = z.object({ q: z.string().optional() });
13
14
  /**
@@ -36,6 +37,16 @@ export const mailboxSearchSchema = listSearch.extend({});
36
37
  * accepts and hands it straight on.
37
38
  */
38
39
  export const mailIndexSearchSchema = briefSearchSchema;
40
+ /**
41
+ * The `/mail` layout's own search: the query, plus the selection wizard's step
42
+ * (#477 clause 1.6) and the affordance that opened it, so a reload lands back on
43
+ * the walk it was in. The router owns history, so the step is a validated
44
+ * search param rather than a raw pushState entry.
45
+ */
46
+ export const mailSearchSchema = listSearch.extend({
47
+ wizard: wizardStepValue,
48
+ wizardFrom: wizardEntryValue,
49
+ });
39
50
  /** Every list's schema, by the path it validates. */
40
51
  export const mailListSearchSchemas = {
41
52
  "/mail/brief": briefSearchSchema,