@burdenoff/microfe-integrations 2026.1102.1 → 2026.1102.2

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 (27) hide show
  1. package/dist/generated/wspace-operations.d.ts +235 -0
  2. package/dist/generated/wspace-operations.d.ts.map +1 -1
  3. package/dist/generated/wspace-operations.js +228 -111
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/generated/wspace-types.js +3 -1
  6. package/dist/generated/wspace-types.js.map +1 -1
  7. package/dist/integrations/IntegrationsRoot.d.ts.map +1 -1
  8. package/dist/integrations/IntegrationsRoot.js +43 -36
  9. package/dist/integrations/IntegrationsRoot.js.map +1 -1
  10. package/dist/integrations/IntegrationsUserRoutes.d.ts.map +1 -1
  11. package/dist/integrations/IntegrationsUserRoutes.js +16 -12
  12. package/dist/integrations/IntegrationsUserRoutes.js.map +1 -1
  13. package/dist/integrations/hooks/useMailbox.d.ts +123 -0
  14. package/dist/integrations/hooks/useMailbox.d.ts.map +1 -0
  15. package/dist/integrations/hooks/useMailbox.js +87 -0
  16. package/dist/integrations/hooks/useMailbox.js.map +1 -0
  17. package/dist/integrations/pages/MailboxInbox.d.ts +7 -0
  18. package/dist/integrations/pages/MailboxInbox.d.ts.map +1 -0
  19. package/dist/integrations/pages/MailboxInbox.js +550 -0
  20. package/dist/integrations/pages/MailboxInbox.js.map +1 -0
  21. package/dist/integrations/store/mailboxStore.d.ts +26 -0
  22. package/dist/integrations/store/mailboxStore.d.ts.map +1 -0
  23. package/dist/integrations/store/mailboxStore.js +52 -0
  24. package/dist/integrations/store/mailboxStore.js.map +1 -0
  25. package/dist/integrations/translations/en.d.ts +1 -0
  26. package/dist/integrations/translations/en.d.ts.map +1 -1
  27. package/package.json +1 -1
@@ -0,0 +1,550 @@
1
+ import { useIntegrations as e } from "../providers/IntegrationsProvider.js";
2
+ import { useTr as t } from "../hooks/useTr.js";
3
+ import { cn as n } from "../utils/cn.js";
4
+ import { MailboxFolder as r } from "../../generated/wspace-types.js";
5
+ import { useFormatDate as i } from "../hooks/useFormatDate.js";
6
+ import { joinPath as a } from "../utils/paths.js";
7
+ import { splitRecipients as o, useMailboxAccounts as s, useMailboxMessages as c, useMailboxThread as l, useSendMail as u, useSetMailRead as d } from "../hooks/useMailbox.js";
8
+ import { useMailboxStore as f } from "../store/mailboxStore.js";
9
+ import { useEffect as p, useId as m, useState as h } from "react";
10
+ import { ArrowLeft as g, Inbox as _, Loader2 as v, Mail as y, MailOpen as b, Paperclip as x, PenSquare as S, RefreshCw as C, Reply as w, Search as T, Send as E, X as D } from "lucide-react";
11
+ import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
12
+ import { Button as j, IllustratedEmptyState as M, PagePurpose as N } from "@burdenoff/fe-libs/ui";
13
+ //#region src/integrations/pages/MailboxInbox.tsx
14
+ function P(e) {
15
+ return e ? e.name ? `${e.name} <${e.email}>` : e.email : "";
16
+ }
17
+ function F(e) {
18
+ return e ? e.name || e.email : "";
19
+ }
20
+ var I = [
21
+ {
22
+ value: r.Inbox,
23
+ key: "inbox",
24
+ label: "Inbox"
25
+ },
26
+ {
27
+ value: r.Sent,
28
+ key: "sent",
29
+ label: "Sent"
30
+ },
31
+ {
32
+ value: r.All,
33
+ key: "all",
34
+ label: "All mail"
35
+ }
36
+ ];
37
+ function L(e) {
38
+ let { connectionId: r, replyTo: i, onClose: a, onSent: s } = e, c = t(), l = m(), { send: d, sending: f } = u(), [p, g] = h(i?.to ?? ""), [_, y] = h(""), [b, x] = h(i?.subject ?? ""), [S, C] = h(""), [w, T] = h(null), O = async (e) => {
39
+ e.preventDefault(), T(null);
40
+ try {
41
+ await d({
42
+ connectionId: r,
43
+ to: o(p),
44
+ cc: o(_),
45
+ subject: b,
46
+ bodyText: S,
47
+ replyToMessageId: i?.messageId
48
+ }), s();
49
+ } catch (e) {
50
+ T(e instanceof Error ? e.message : c("integrations.mailbox.compose.failed", "Could not send"));
51
+ }
52
+ }, M = "w-full px-3 py-2 border border-border-subtle rounded-lg bg-bg-surface text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary";
53
+ return /* @__PURE__ */ A("form", {
54
+ onSubmit: O,
55
+ className: "rounded-xl border border-border-seam bg-bg-surface p-4 space-y-3",
56
+ "aria-label": i ? c("integrations.mailbox.compose.replyTitle", "Reply") : c("integrations.mailbox.compose.title", "New message"),
57
+ children: [
58
+ /* @__PURE__ */ A("div", {
59
+ className: "flex items-center justify-between",
60
+ children: [/* @__PURE__ */ k("h2", {
61
+ className: "text-sm font-semibold text-text-primary",
62
+ children: i ? c("integrations.mailbox.compose.replyTitle", "Reply") : c("integrations.mailbox.compose.title", "New message")
63
+ }), /* @__PURE__ */ k(j, {
64
+ type: "button",
65
+ variant: "ghost",
66
+ size: "icon",
67
+ onClick: a,
68
+ disabled: f,
69
+ "aria-label": c("integrations.common.close", "Close"),
70
+ children: /* @__PURE__ */ k(D, { size: 16 })
71
+ })]
72
+ }),
73
+ /* @__PURE__ */ A("div", {
74
+ className: "space-y-1",
75
+ children: [/* @__PURE__ */ k("label", {
76
+ htmlFor: `${l}-to`,
77
+ className: "text-xs font-medium text-text-secondary",
78
+ children: c("integrations.mailbox.compose.to", "To")
79
+ }), /* @__PURE__ */ k("input", {
80
+ id: `${l}-to`,
81
+ type: "text",
82
+ value: p,
83
+ onChange: (e) => g(e.target.value),
84
+ placeholder: c("integrations.mailbox.compose.toPlaceholder", "name@example.com, another@example.com"),
85
+ className: M,
86
+ required: !0
87
+ })]
88
+ }),
89
+ /* @__PURE__ */ A("div", {
90
+ className: "space-y-1",
91
+ children: [/* @__PURE__ */ k("label", {
92
+ htmlFor: `${l}-cc`,
93
+ className: "text-xs font-medium text-text-secondary",
94
+ children: c("integrations.mailbox.compose.cc", "Cc")
95
+ }), /* @__PURE__ */ k("input", {
96
+ id: `${l}-cc`,
97
+ type: "text",
98
+ value: _,
99
+ onChange: (e) => y(e.target.value),
100
+ className: M
101
+ })]
102
+ }),
103
+ !i && /* @__PURE__ */ A("div", {
104
+ className: "space-y-1",
105
+ children: [/* @__PURE__ */ k("label", {
106
+ htmlFor: `${l}-subject`,
107
+ className: "text-xs font-medium text-text-secondary",
108
+ children: c("integrations.mailbox.compose.subject", "Subject")
109
+ }), /* @__PURE__ */ k("input", {
110
+ id: `${l}-subject`,
111
+ type: "text",
112
+ value: b,
113
+ onChange: (e) => x(e.target.value),
114
+ maxLength: 998,
115
+ className: M
116
+ })]
117
+ }),
118
+ /* @__PURE__ */ A("div", {
119
+ className: "space-y-1",
120
+ children: [/* @__PURE__ */ k("label", {
121
+ htmlFor: `${l}-body`,
122
+ className: "text-xs font-medium text-text-secondary",
123
+ children: c("integrations.mailbox.compose.body", "Message")
124
+ }), /* @__PURE__ */ k("textarea", {
125
+ id: `${l}-body`,
126
+ value: S,
127
+ onChange: (e) => C(e.target.value),
128
+ rows: 8,
129
+ className: n(M, "resize-y"),
130
+ required: !0
131
+ })]
132
+ }),
133
+ w && /* @__PURE__ */ k("p", {
134
+ role: "alert",
135
+ className: "text-sm text-status-error-text",
136
+ children: w
137
+ }),
138
+ /* @__PURE__ */ A("div", {
139
+ className: "flex justify-end gap-2",
140
+ children: [/* @__PURE__ */ k(j, {
141
+ type: "button",
142
+ variant: "outline",
143
+ onClick: a,
144
+ disabled: f,
145
+ children: c("integrations.common.cancel", "Cancel")
146
+ }), /* @__PURE__ */ A(j, {
147
+ type: "submit",
148
+ disabled: f || !S.trim() || !p.trim(),
149
+ children: [f ? /* @__PURE__ */ k(v, {
150
+ size: 16,
151
+ className: "animate-spin"
152
+ }) : /* @__PURE__ */ k(E, { size: 16 }), c("integrations.mailbox.compose.send", "Send")]
153
+ })]
154
+ })
155
+ ]
156
+ });
157
+ }
158
+ function R(e) {
159
+ let { connectionId: n, threadId: r, accountEmail: a, onBack: o } = e, s = t(), c = i(), { thread: u, loading: d, error: f, refetch: p } = l(n, r), [m, _] = h(!1), [y, b] = h(!1);
160
+ if (d && !u) return /* @__PURE__ */ k("div", {
161
+ className: "flex items-center justify-center py-16",
162
+ children: /* @__PURE__ */ k(v, { className: "size-6 animate-spin text-primary" })
163
+ });
164
+ if (f || !u) return /* @__PURE__ */ A("div", {
165
+ className: "p-6 space-y-3 text-center",
166
+ children: [/* @__PURE__ */ k("p", {
167
+ role: "alert",
168
+ className: "text-sm text-status-error-text",
169
+ children: f?.message ?? s("integrations.mailbox.thread.notFound", "Conversation not found")
170
+ }), /* @__PURE__ */ A("div", {
171
+ className: "flex flex-wrap justify-center gap-2",
172
+ children: [/* @__PURE__ */ A(j, {
173
+ variant: "ghost",
174
+ onClick: o,
175
+ children: [
176
+ /* @__PURE__ */ k(g, { size: 16 }),
177
+ " ",
178
+ s("integrations.common.back", "Back")
179
+ ]
180
+ }), /* @__PURE__ */ A(j, {
181
+ variant: "outline",
182
+ onClick: () => p(),
183
+ children: [
184
+ /* @__PURE__ */ k(C, { size: 16 }),
185
+ " ",
186
+ s("integrations.mailbox.actions.retry", "Try again")
187
+ ]
188
+ })]
189
+ })]
190
+ });
191
+ let S = u.messages[u.messages.length - 1], T = a?.trim().toLowerCase() ?? null, E = S ? T && S.from?.email.toLowerCase() === T ? S.to.map((e) => e.email).filter((e) => e.toLowerCase() !== T) : [S.from?.email ?? ""] : [];
192
+ return /* @__PURE__ */ A("div", {
193
+ className: "space-y-4",
194
+ "data-testid": "mailbox-thread",
195
+ children: [
196
+ /* @__PURE__ */ A("div", {
197
+ className: "flex items-start gap-2",
198
+ children: [/* @__PURE__ */ k(j, {
199
+ variant: "ghost",
200
+ size: "icon",
201
+ className: "lg:hidden",
202
+ onClick: o,
203
+ "aria-label": s("integrations.common.back", "Back"),
204
+ children: /* @__PURE__ */ k(g, { size: 18 })
205
+ }), /* @__PURE__ */ k("h2", {
206
+ className: "text-lg font-semibold text-text-primary break-words",
207
+ children: u.subject || s("integrations.mailbox.noSubject", "(no subject)")
208
+ })]
209
+ }),
210
+ u.messages.map((e) => /* @__PURE__ */ A("article", {
211
+ className: "rounded-xl border border-border-subtle bg-bg-surface p-4 space-y-2",
212
+ children: [/* @__PURE__ */ A("header", {
213
+ className: "flex flex-wrap items-baseline justify-between gap-2",
214
+ children: [/* @__PURE__ */ A("div", {
215
+ className: "min-w-0",
216
+ children: [/* @__PURE__ */ k("p", {
217
+ className: "text-sm font-medium text-text-primary break-all",
218
+ children: P(e.from)
219
+ }), /* @__PURE__ */ A("p", {
220
+ className: "text-xs text-text-secondary break-all",
221
+ children: [
222
+ s("integrations.mailbox.thread.to", "To"),
223
+ ":",
224
+ " ",
225
+ e.to.map(P).join(", "),
226
+ e.cc.length > 0 && ` · ${s("integrations.mailbox.thread.cc", "Cc")}: ${e.cc.map(P).join(", ")}`
227
+ ]
228
+ })]
229
+ }), /* @__PURE__ */ A("div", {
230
+ className: "flex items-center gap-2 text-xs text-text-tertiary",
231
+ children: [e.hasAttachments && /* @__PURE__ */ k(x, {
232
+ size: 14,
233
+ "aria-label": s("integrations.mailbox.attachments", "Has attachments")
234
+ }), e.receivedAt && /* @__PURE__ */ k("time", {
235
+ dateTime: e.receivedAt,
236
+ children: c(e.receivedAt)
237
+ })]
238
+ })]
239
+ }), /* @__PURE__ */ k("div", {
240
+ className: "whitespace-pre-wrap break-words text-sm text-text-primary",
241
+ children: e.bodyText
242
+ })]
243
+ }, e.id)),
244
+ y && /* @__PURE__ */ k("p", {
245
+ role: "status",
246
+ className: "text-sm text-status-success-text",
247
+ children: s("integrations.mailbox.compose.sent", "Message sent")
248
+ }),
249
+ S && (m ? /* @__PURE__ */ k(L, {
250
+ connectionId: n,
251
+ replyTo: {
252
+ messageId: S.id,
253
+ to: E.filter(Boolean).join(", "),
254
+ subject: u.subject
255
+ },
256
+ onClose: () => _(!1),
257
+ onSent: () => {
258
+ _(!1), b(!0), p();
259
+ }
260
+ }) : /* @__PURE__ */ A(j, {
261
+ variant: "outline",
262
+ onClick: () => _(!0),
263
+ children: [
264
+ /* @__PURE__ */ k(w, { size: 16 }),
265
+ " ",
266
+ s("integrations.mailbox.actions.reply", "Reply")
267
+ ]
268
+ }))
269
+ ]
270
+ });
271
+ }
272
+ function z(e) {
273
+ let { messages: a, loading: o, error: s, refetch: c, folder: l, threadId: u, hasPrevious: d, nextPageToken: f, onOpen: p, onPrevious: m, onNext: h } = e, g = t(), _ = i();
274
+ return /* @__PURE__ */ A(O, { children: [s ? /* @__PURE__ */ A("div", {
275
+ className: "p-6 text-center space-y-3",
276
+ children: [/* @__PURE__ */ k("p", {
277
+ role: "alert",
278
+ className: "text-sm text-status-error-text",
279
+ children: s.message
280
+ }), /* @__PURE__ */ A(j, {
281
+ variant: "outline",
282
+ onClick: () => c(),
283
+ children: [
284
+ /* @__PURE__ */ k(C, { size: 16 }),
285
+ " ",
286
+ g("integrations.mailbox.actions.retry", "Try again")
287
+ ]
288
+ })]
289
+ }) : o && a.length === 0 ? /* @__PURE__ */ k("div", {
290
+ className: "flex items-center justify-center py-16",
291
+ children: /* @__PURE__ */ k(v, { className: "size-6 animate-spin text-primary" })
292
+ }) : a.length === 0 ? /* @__PURE__ */ k("p", {
293
+ className: "p-6 text-sm text-text-secondary text-center",
294
+ children: g("integrations.mailbox.list.empty", "No messages here")
295
+ }) : /* @__PURE__ */ k("ul", {
296
+ className: "divide-y divide-border-subtle",
297
+ "data-testid": "mailbox-message-list",
298
+ children: a.map((e) => /* @__PURE__ */ k("li", { children: /* @__PURE__ */ A("button", {
299
+ type: "button",
300
+ onClick: () => p(e.threadId, e.id, e.isUnread),
301
+ "aria-current": u === e.threadId ? "true" : void 0,
302
+ className: n("w-full text-left px-4 py-3 transition-colors hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/30", u === e.threadId && "bg-accent"),
303
+ children: [
304
+ /* @__PURE__ */ A("div", {
305
+ className: "flex items-center justify-between gap-2",
306
+ children: [/* @__PURE__ */ k("span", {
307
+ className: n("truncate text-sm", e.isUnread ? "font-semibold text-text-primary" : "text-text-secondary"),
308
+ children: l === r.Sent ? e.to.map(F).join(", ") : F(e.from)
309
+ }), /* @__PURE__ */ A("span", {
310
+ className: "flex shrink-0 items-center gap-1 text-xs text-text-tertiary",
311
+ children: [
312
+ e.hasAttachments && /* @__PURE__ */ k(x, { size: 12 }),
313
+ e.isUnread ? /* @__PURE__ */ k(y, { size: 12 }) : /* @__PURE__ */ k(b, { size: 12 }),
314
+ e.receivedAt ? _(e.receivedAt) : ""
315
+ ]
316
+ })]
317
+ }),
318
+ /* @__PURE__ */ k("p", {
319
+ className: n("truncate text-sm", e.isUnread ? "font-medium text-text-primary" : "text-text-primary"),
320
+ children: e.subject || g("integrations.mailbox.noSubject", "(no subject)")
321
+ }),
322
+ /* @__PURE__ */ k("p", {
323
+ className: "truncate text-xs text-text-secondary",
324
+ children: e.snippet
325
+ })
326
+ ]
327
+ }) }, e.id))
328
+ }), (d || f) && /* @__PURE__ */ A("div", {
329
+ className: "flex justify-between gap-2 border-t border-border-subtle p-3",
330
+ children: [/* @__PURE__ */ k(j, {
331
+ variant: "outline",
332
+ size: "sm",
333
+ disabled: !d || o,
334
+ onClick: m,
335
+ children: g("integrations.common.previous", "Previous")
336
+ }), /* @__PURE__ */ k(j, {
337
+ variant: "outline",
338
+ size: "sm",
339
+ disabled: !f || o,
340
+ onClick: () => f && h(f),
341
+ children: g("integrations.common.next", "Next")
342
+ })]
343
+ })] });
344
+ }
345
+ function B(n) {
346
+ let r = t(), { basePath: i = "/", navigate: o } = e(), s = a(i, "providers");
347
+ return /* @__PURE__ */ A("div", {
348
+ className: "space-y-6 p-6 max-w-5xl mx-auto",
349
+ children: [/* @__PURE__ */ k(N, {
350
+ icon: /* @__PURE__ */ k(y, { size: 16 }),
351
+ children: r("integrations.mailbox.purpose", "Read and send mail from your own Gmail or Outlook account without leaving Workspaces. Only you can open your mailbox; sharing a connection never shares your mail.")
352
+ }), n.errorMessage ? /* @__PURE__ */ k("p", {
353
+ role: "alert",
354
+ className: "text-sm text-status-error-text text-center",
355
+ children: n.errorMessage
356
+ }) : /* @__PURE__ */ k(M, {
357
+ illustration: "empty-data",
358
+ title: r("integrations.mailbox.empty.title", "Connect a mailbox"),
359
+ description: r("integrations.mailbox.empty.description", "Connect Google Gmail or Microsoft Outlook from Providers, then come back here to read and send mail."),
360
+ action: /* @__PURE__ */ A(j, {
361
+ onClick: () => o?.(s),
362
+ children: [
363
+ /* @__PURE__ */ k(y, { size: 16 }),
364
+ " ",
365
+ r("integrations.mailbox.empty.action", "Connect Gmail or Outlook")
366
+ ]
367
+ })
368
+ })]
369
+ });
370
+ }
371
+ function V(e) {
372
+ let { accounts: n, connectionId: r } = e, i = t(), a = m(), o = f((e) => e.composing), s = f((e) => e.selectConnection), c = f((e) => e.startCompose), l = n.find((e) => e.connectionId === r) ?? null;
373
+ return /* @__PURE__ */ k("div", {
374
+ className: "rounded-xl border border-border-seam bg-accent-wash p-4 sm:p-6",
375
+ children: /* @__PURE__ */ A("div", {
376
+ className: "flex flex-wrap items-center justify-between gap-4",
377
+ children: [/* @__PURE__ */ A("div", {
378
+ className: "flex items-center gap-3",
379
+ children: [/* @__PURE__ */ k("div", {
380
+ className: "p-2.5 rounded-lg bg-action-primary-bg/10",
381
+ children: /* @__PURE__ */ k(_, {
382
+ size: 24,
383
+ className: "text-primary"
384
+ })
385
+ }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("h1", {
386
+ className: "text-2xl font-bold text-text-primary",
387
+ children: i("integrations.mailbox.title", "Inbox")
388
+ }), /* @__PURE__ */ k("p", {
389
+ className: "text-sm text-text-secondary",
390
+ children: l?.emailAddress ?? l?.name ?? i("integrations.mailbox.subtitle", "Your connected mail")
391
+ })] })]
392
+ }), /* @__PURE__ */ A("div", {
393
+ className: "flex flex-wrap items-center gap-2",
394
+ children: [n.length > 1 && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("label", {
395
+ htmlFor: `${a}-account`,
396
+ className: "sr-only",
397
+ children: i("integrations.mailbox.account", "Mailbox")
398
+ }), /* @__PURE__ */ k("select", {
399
+ id: `${a}-account`,
400
+ value: r ?? "",
401
+ disabled: o,
402
+ onChange: (e) => s(e.target.value),
403
+ className: "px-3 py-2 border border-border-subtle rounded-lg bg-bg-surface text-sm text-text-primary",
404
+ children: n.map((e) => /* @__PURE__ */ k("option", {
405
+ value: e.connectionId,
406
+ children: e.emailAddress ?? e.name
407
+ }, e.connectionId))
408
+ })] }), /* @__PURE__ */ A(j, {
409
+ onClick: c,
410
+ children: [
411
+ /* @__PURE__ */ k(S, { size: 16 }),
412
+ " ",
413
+ i("integrations.mailbox.actions.compose", "Compose")
414
+ ]
415
+ })]
416
+ })]
417
+ })
418
+ });
419
+ }
420
+ function H(e) {
421
+ let r = t(), i = f((e) => e.folder), a = f((e) => e.query), o = f((e) => e.selectFolder), s = f((e) => e.search), [c, l] = h(a);
422
+ return /* @__PURE__ */ A("div", {
423
+ className: "flex flex-col sm:flex-row gap-3",
424
+ children: [
425
+ /* @__PURE__ */ k("div", {
426
+ className: "flex gap-1 rounded-lg border border-border-subtle bg-bg-surface p-1",
427
+ role: "group",
428
+ "aria-label": r("integrations.mailbox.folders.ariaLabel", "Folders"),
429
+ children: I.map((e) => /* @__PURE__ */ k("button", {
430
+ type: "button",
431
+ "aria-pressed": i === e.value,
432
+ onClick: () => o(e.value),
433
+ className: n("px-3 py-1.5 text-sm rounded-md transition-colors", i === e.value ? "bg-action-primary-bg text-action-primary-text" : "text-text-secondary hover:bg-accent"),
434
+ children: r(`integrations.mailbox.folders.${e.key}`, e.label)
435
+ }, e.value))
436
+ }),
437
+ /* @__PURE__ */ A("form", {
438
+ className: "flex-1 relative",
439
+ onSubmit: (e) => {
440
+ e.preventDefault(), s(c);
441
+ },
442
+ children: [/* @__PURE__ */ k(T, {
443
+ size: 16,
444
+ className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary"
445
+ }), /* @__PURE__ */ k("input", {
446
+ type: "search",
447
+ value: c,
448
+ onChange: (e) => l(e.target.value),
449
+ maxLength: 500,
450
+ "aria-label": r("integrations.mailbox.search.ariaLabel", "Search mail"),
451
+ placeholder: r("integrations.mailbox.search.placeholder", "Search mail"),
452
+ className: "w-full pl-9 pr-3 py-2 border border-border-subtle rounded-lg bg-bg-surface text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary"
453
+ })]
454
+ }),
455
+ /* @__PURE__ */ A(j, {
456
+ variant: "outline",
457
+ onClick: e.onRefresh,
458
+ disabled: e.loading,
459
+ children: [
460
+ /* @__PURE__ */ k(C, {
461
+ size: 16,
462
+ className: n(e.loading && "animate-spin")
463
+ }),
464
+ " ",
465
+ r("integrations.mailbox.actions.refresh", "Refresh")
466
+ ]
467
+ })
468
+ ]
469
+ });
470
+ }
471
+ function U(e) {
472
+ let { accounts: i } = e, a = t(), o = f(), s = f((e) => e.reset), l = d();
473
+ p(() => s, [s]);
474
+ let u = i.find((e) => e.connectionId === o.selectedConnectionId) ?? i[0] ?? null, m = u?.connectionId ?? null, { messages: h, nextPageToken: g, loading: _, error: v, refetch: y } = c({
475
+ connectionId: m,
476
+ folder: o.folder,
477
+ query: o.query,
478
+ pageToken: o.pageTokens[o.pageTokens.length - 1] ?? null
479
+ }), b = (e, t, n) => {
480
+ o.openThread(e), n && m && l(m, t, !0).then(() => y(), () => void 0);
481
+ }, x = !!(o.threadId || o.composing);
482
+ return /* @__PURE__ */ A("div", {
483
+ className: "space-y-4 p-4 sm:p-6 max-w-7xl mx-auto",
484
+ "data-testid": "mailbox-inbox",
485
+ children: [
486
+ /* @__PURE__ */ k(V, {
487
+ accounts: i,
488
+ connectionId: m
489
+ }),
490
+ /* @__PURE__ */ k(H, {
491
+ loading: _,
492
+ onRefresh: () => void y()
493
+ }),
494
+ o.sentNotice && /* @__PURE__ */ k("p", {
495
+ role: "status",
496
+ className: "text-sm text-status-success-text",
497
+ children: a("integrations.mailbox.compose.sent", "Message sent")
498
+ }),
499
+ /* @__PURE__ */ A("div", {
500
+ className: "grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]",
501
+ children: [/* @__PURE__ */ k("section", {
502
+ "aria-label": a("integrations.mailbox.list.ariaLabel", "Messages"),
503
+ className: n("rounded-xl border border-border-subtle bg-bg-surface overflow-hidden", x && "hidden lg:block"),
504
+ children: /* @__PURE__ */ k(z, {
505
+ messages: h,
506
+ loading: _,
507
+ error: v,
508
+ refetch: y,
509
+ folder: o.folder,
510
+ threadId: o.threadId,
511
+ hasPrevious: o.pageTokens.length > 1,
512
+ nextPageToken: g,
513
+ onOpen: b,
514
+ onPrevious: o.previousPage,
515
+ onNext: o.nextPage
516
+ })
517
+ }), /* @__PURE__ */ k("section", {
518
+ className: n(!x && "hidden lg:block"),
519
+ children: o.composing && m ? /* @__PURE__ */ k(L, {
520
+ connectionId: m,
521
+ onClose: o.closeCompose,
522
+ onSent: () => {
523
+ o.composeSent(), o.folder === r.Sent && y();
524
+ }
525
+ }) : o.threadId && m ? /* @__PURE__ */ k(R, {
526
+ connectionId: m,
527
+ threadId: o.threadId,
528
+ accountEmail: u?.emailAddress ?? null,
529
+ onBack: o.closeThread
530
+ }, `${m}:${o.threadId}`) : /* @__PURE__ */ k("div", {
531
+ className: "rounded-xl border border-dashed border-border-subtle p-10 text-center text-sm text-text-secondary",
532
+ children: a("integrations.mailbox.thread.placeholder", "Select a message to read it")
533
+ })
534
+ })]
535
+ })
536
+ ]
537
+ });
538
+ }
539
+ function W() {
540
+ let { accounts: e, answered: t, error: n } = s();
541
+ return !t && !n ? /* @__PURE__ */ k("div", {
542
+ className: "flex items-center justify-center py-24",
543
+ "data-testid": "mailbox-loading",
544
+ children: /* @__PURE__ */ k(v, { className: "size-6 animate-spin text-primary" })
545
+ }) : e.length === 0 ? /* @__PURE__ */ k(B, { errorMessage: n?.message ?? null }) : /* @__PURE__ */ k(U, { accounts: e });
546
+ }
547
+ //#endregion
548
+ export { W as MailboxInbox };
549
+
550
+ //# sourceMappingURL=MailboxInbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MailboxInbox.js","names":[],"sources":["../../../src/integrations/pages/MailboxInbox.tsx"],"sourcesContent":["import { useEffect, useId, useState, type FormEvent } from 'react';\nimport {\n ArrowLeft,\n Inbox,\n Loader2,\n Mail,\n MailOpen,\n Paperclip,\n PenSquare,\n RefreshCw,\n Reply,\n Search,\n Send,\n X,\n} from 'lucide-react';\nimport { Button, IllustratedEmptyState, PagePurpose } from '@burdenoff/fe-libs/ui';\n\nimport { cn } from '../utils/cn';\nimport { joinPath } from '../utils/paths';\nimport { useTr } from '../hooks/useTr';\nimport { useFormatDate } from '../hooks/useFormatDate';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport {\n MailboxFolder,\n splitRecipients,\n useMailboxAccounts,\n useMailboxMessages,\n useMailboxThread,\n useSendMail,\n useSetMailRead,\n} from '../hooks/useMailbox';\nimport type { MailboxAccount, MailboxMessageSummary } from '../hooks/useMailbox';\nimport { useMailboxStore } from '../store/mailboxStore';\n\ninterface Address {\n name?: string | null;\n email: string;\n}\n\nfunction displayAddress(address: Address | null | undefined): string {\n if (!address) return '';\n return address.name ? `${address.name} <${address.email}>` : address.email;\n}\n\nfunction shortAddress(address: Address | null | undefined): string {\n if (!address) return '';\n return address.name || address.email;\n}\n\nconst FOLDERS: Array<{ value: MailboxFolder; key: string; label: string }> = [\n { value: MailboxFolder.Inbox, key: 'inbox', label: 'Inbox' },\n { value: MailboxFolder.Sent, key: 'sent', label: 'Sent' },\n { value: MailboxFolder.All, key: 'all', label: 'All mail' },\n];\n\n/** Compose a new message or a reply. */\nfunction ComposePanel(props: {\n connectionId: string;\n replyTo?: { messageId: string; to: string; subject: string } | null;\n onClose: () => void;\n onSent: () => void;\n}) {\n const { connectionId, replyTo, onClose, onSent } = props;\n const tr = useTr();\n const ids = useId();\n const { send, sending } = useSendMail();\n const [to, setTo] = useState(replyTo?.to ?? '');\n const [cc, setCc] = useState('');\n const [subject, setSubject] = useState(replyTo?.subject ?? '');\n const [body, setBody] = useState('');\n const [error, setError] = useState<string | null>(null);\n\n const handleSubmit = async (event: FormEvent) => {\n event.preventDefault();\n setError(null);\n try {\n await send({\n connectionId,\n to: splitRecipients(to),\n cc: splitRecipients(cc),\n subject,\n bodyText: body,\n replyToMessageId: replyTo?.messageId,\n });\n onSent();\n } catch (err) {\n setError(\n err instanceof Error\n ? err.message\n : tr('integrations.mailbox.compose.failed', 'Could not send')\n );\n }\n };\n\n const inputClass =\n 'w-full px-3 py-2 border border-border-subtle rounded-lg bg-bg-surface text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary';\n\n return (\n <form\n onSubmit={handleSubmit}\n className=\"rounded-xl border border-border-seam bg-bg-surface p-4 space-y-3\"\n aria-label={\n replyTo\n ? tr('integrations.mailbox.compose.replyTitle', 'Reply')\n : tr('integrations.mailbox.compose.title', 'New message')\n }\n >\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-sm font-semibold text-text-primary\">\n {replyTo\n ? tr('integrations.mailbox.compose.replyTitle', 'Reply')\n : tr('integrations.mailbox.compose.title', 'New message')}\n </h2>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={onClose}\n // A pending send must finish before its draft can be dismissed, so it\n // can never close a newer draft when it completes.\n disabled={sending}\n aria-label={tr('integrations.common.close', 'Close')}\n >\n <X size={16} />\n </Button>\n </div>\n <div className=\"space-y-1\">\n <label htmlFor={`${ids}-to`} className=\"text-xs font-medium text-text-secondary\">\n {tr('integrations.mailbox.compose.to', 'To')}\n </label>\n <input\n id={`${ids}-to`}\n type=\"text\"\n value={to}\n onChange={(e) => setTo(e.target.value)}\n placeholder={tr(\n 'integrations.mailbox.compose.toPlaceholder',\n 'name@example.com, another@example.com'\n )}\n className={inputClass}\n required\n />\n </div>\n <div className=\"space-y-1\">\n <label htmlFor={`${ids}-cc`} className=\"text-xs font-medium text-text-secondary\">\n {tr('integrations.mailbox.compose.cc', 'Cc')}\n </label>\n <input\n id={`${ids}-cc`}\n type=\"text\"\n value={cc}\n onChange={(e) => setCc(e.target.value)}\n className={inputClass}\n />\n </div>\n {!replyTo && (\n <div className=\"space-y-1\">\n <label htmlFor={`${ids}-subject`} className=\"text-xs font-medium text-text-secondary\">\n {tr('integrations.mailbox.compose.subject', 'Subject')}\n </label>\n <input\n id={`${ids}-subject`}\n type=\"text\"\n value={subject}\n onChange={(e) => setSubject(e.target.value)}\n maxLength={998}\n className={inputClass}\n />\n </div>\n )}\n <div className=\"space-y-1\">\n <label htmlFor={`${ids}-body`} className=\"text-xs font-medium text-text-secondary\">\n {tr('integrations.mailbox.compose.body', 'Message')}\n </label>\n <textarea\n id={`${ids}-body`}\n value={body}\n onChange={(e) => setBody(e.target.value)}\n rows={8}\n className={cn(inputClass, 'resize-y')}\n required\n />\n </div>\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n <div className=\"flex justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" onClick={onClose} disabled={sending}>\n {tr('integrations.common.cancel', 'Cancel')}\n </Button>\n <Button type=\"submit\" disabled={sending || !body.trim() || !to.trim()}>\n {sending ? <Loader2 size={16} className=\"animate-spin\" /> : <Send size={16} />}\n {tr('integrations.mailbox.compose.send', 'Send')}\n </Button>\n </div>\n </form>\n );\n}\n\n/** One conversation, oldest message first, with a reply box. */\nfunction ThreadView(props: {\n connectionId: string;\n threadId: string;\n /** The connected account's own address, used to pick the reply recipient. */\n accountEmail: string | null;\n onBack: () => void;\n}) {\n const { connectionId, threadId, accountEmail, onBack } = props;\n const tr = useTr();\n const formatDate = useFormatDate();\n const { thread, loading, error, refetch } = useMailboxThread(connectionId, threadId);\n // The parent keys this view by thread id, so reply / notice state starts\n // fresh for every conversation without resetting it in an effect.\n const [replyOpen, setReplyOpen] = useState(false);\n const [sentNotice, setSentNotice] = useState(false);\n\n if (loading && !thread) {\n return (\n <div className=\"flex items-center justify-center py-16\">\n <Loader2 className=\"size-6 animate-spin text-primary\" />\n </div>\n );\n }\n if (error || !thread) {\n return (\n <div className=\"p-6 space-y-3 text-center\">\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error?.message ?? tr('integrations.mailbox.thread.notFound', 'Conversation not found')}\n </p>\n <div className=\"flex flex-wrap justify-center gap-2\">\n <Button variant=\"ghost\" onClick={onBack}>\n <ArrowLeft size={16} /> {tr('integrations.common.back', 'Back')}\n </Button>\n <Button variant=\"outline\" onClick={() => refetch()}>\n <RefreshCw size={16} /> {tr('integrations.mailbox.actions.retry', 'Try again')}\n </Button>\n </div>\n </div>\n );\n }\n\n const last = thread.messages[thread.messages.length - 1];\n const ownAddress = accountEmail?.trim().toLowerCase() ?? null;\n // Replying to a message the connected account sent itself (from Sent, or a\n // follow-up) goes to that message's recipients, never back to the account.\n const replyRecipients = last\n ? ownAddress && last.from?.email.toLowerCase() === ownAddress\n ? last.to\n .map((address) => address.email)\n .filter((email) => email.toLowerCase() !== ownAddress)\n : [last.from?.email ?? '']\n : [];\n return (\n <div className=\"space-y-4\" data-testid=\"mailbox-thread\">\n <div className=\"flex items-start gap-2\">\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"lg:hidden\"\n onClick={onBack}\n aria-label={tr('integrations.common.back', 'Back')}\n >\n <ArrowLeft size={18} />\n </Button>\n <h2 className=\"text-lg font-semibold text-text-primary break-words\">\n {thread.subject || tr('integrations.mailbox.noSubject', '(no subject)')}\n </h2>\n </div>\n {thread.messages.map((message) => (\n <article\n key={message.id}\n className=\"rounded-xl border border-border-subtle bg-bg-surface p-4 space-y-2\"\n >\n <header className=\"flex flex-wrap items-baseline justify-between gap-2\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-medium text-text-primary break-all\">\n {displayAddress(message.from)}\n </p>\n <p className=\"text-xs text-text-secondary break-all\">\n {tr('integrations.mailbox.thread.to', 'To')}:{' '}\n {message.to.map(displayAddress).join(', ')}\n {message.cc.length > 0 &&\n ` · ${tr('integrations.mailbox.thread.cc', 'Cc')}: ${message.cc.map(displayAddress).join(', ')}`}\n </p>\n </div>\n <div className=\"flex items-center gap-2 text-xs text-text-tertiary\">\n {message.hasAttachments && (\n <Paperclip\n size={14}\n aria-label={tr('integrations.mailbox.attachments', 'Has attachments')}\n />\n )}\n {message.receivedAt && (\n <time dateTime={message.receivedAt}>{formatDate(message.receivedAt)}</time>\n )}\n </div>\n </header>\n <div className=\"whitespace-pre-wrap break-words text-sm text-text-primary\">\n {message.bodyText}\n </div>\n </article>\n ))}\n {sentNotice && (\n <p role=\"status\" className=\"text-sm text-status-success-text\">\n {tr('integrations.mailbox.compose.sent', 'Message sent')}\n </p>\n )}\n {last &&\n (replyOpen ? (\n <ComposePanel\n connectionId={connectionId}\n replyTo={{\n messageId: last.id,\n to: replyRecipients.filter(Boolean).join(', '),\n subject: thread.subject,\n }}\n onClose={() => setReplyOpen(false)}\n onSent={() => {\n setReplyOpen(false);\n setSentNotice(true);\n void refetch();\n }}\n />\n ) : (\n <Button variant=\"outline\" onClick={() => setReplyOpen(true)}>\n <Reply size={16} /> {tr('integrations.mailbox.actions.reply', 'Reply')}\n </Button>\n ))}\n </div>\n );\n}\n\n/** One page of messages in the selected folder, with paging. */\nfunction MessageList(props: {\n messages: MailboxMessageSummary[];\n loading: boolean;\n error: { message: string } | undefined;\n refetch: () => unknown;\n folder: MailboxFolder;\n threadId: string | null;\n hasPrevious: boolean;\n nextPageToken: string | null;\n onOpen: (threadId: string, messageId: string, unread: boolean) => void;\n onPrevious: () => void;\n onNext: (token: string) => void;\n}) {\n const {\n messages,\n loading,\n error,\n refetch,\n folder,\n threadId,\n hasPrevious,\n nextPageToken,\n onOpen,\n onPrevious,\n onNext,\n } = props;\n const tr = useTr();\n const formatDate = useFormatDate();\n return (\n <>\n {error ? (\n <div className=\"p-6 text-center space-y-3\">\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error.message}\n </p>\n <Button variant=\"outline\" onClick={() => refetch()}>\n <RefreshCw size={16} /> {tr('integrations.mailbox.actions.retry', 'Try again')}\n </Button>\n </div>\n ) : loading && messages.length === 0 ? (\n <div className=\"flex items-center justify-center py-16\">\n <Loader2 className=\"size-6 animate-spin text-primary\" />\n </div>\n ) : messages.length === 0 ? (\n <p className=\"p-6 text-sm text-text-secondary text-center\">\n {tr('integrations.mailbox.list.empty', 'No messages here')}\n </p>\n ) : (\n <ul className=\"divide-y divide-border-subtle\" data-testid=\"mailbox-message-list\">\n {messages.map((message) => (\n <li key={message.id}>\n <button\n type=\"button\"\n onClick={() => onOpen(message.threadId, message.id, message.isUnread)}\n aria-current={threadId === message.threadId ? 'true' : undefined}\n className={cn(\n 'w-full text-left px-4 py-3 transition-colors hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/30',\n threadId === message.threadId && 'bg-accent'\n )}\n >\n <div className=\"flex items-center justify-between gap-2\">\n <span\n className={cn(\n 'truncate text-sm',\n message.isUnread ? 'font-semibold text-text-primary' : 'text-text-secondary'\n )}\n >\n {folder === MailboxFolder.Sent\n ? message.to.map(shortAddress).join(', ')\n : shortAddress(message.from)}\n </span>\n <span className=\"flex shrink-0 items-center gap-1 text-xs text-text-tertiary\">\n {message.hasAttachments && <Paperclip size={12} />}\n {message.isUnread ? <Mail size={12} /> : <MailOpen size={12} />}\n {message.receivedAt ? formatDate(message.receivedAt) : ''}\n </span>\n </div>\n <p\n className={cn(\n 'truncate text-sm',\n message.isUnread ? 'font-medium text-text-primary' : 'text-text-primary'\n )}\n >\n {message.subject || tr('integrations.mailbox.noSubject', '(no subject)')}\n </p>\n <p className=\"truncate text-xs text-text-secondary\">{message.snippet}</p>\n </button>\n </li>\n ))}\n </ul>\n )}\n {(hasPrevious || nextPageToken) && (\n <div className=\"flex justify-between gap-2 border-t border-border-subtle p-3\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={!hasPrevious || loading}\n onClick={onPrevious}\n >\n {tr('integrations.common.previous', 'Previous')}\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={!nextPageToken || loading}\n onClick={() => nextPageToken && onNext(nextPageToken)}\n >\n {tr('integrations.common.next', 'Next')}\n </Button>\n </div>\n )}\n </>\n );\n}\n\n/** Shown until a Gmail or Outlook connection exists (or when listing them failed). */\nfunction MailboxEmptyState(props: { errorMessage: string | null }) {\n const tr = useTr();\n const { basePath = '/', navigate } = useIntegrations();\n const connectPath = joinPath(basePath, 'providers');\n return (\n <div className=\"space-y-6 p-6 max-w-5xl mx-auto\">\n <PagePurpose icon={<Mail size={16} />}>\n {tr(\n 'integrations.mailbox.purpose',\n 'Read and send mail from your own Gmail or Outlook account without leaving Workspaces. Only you can open your mailbox; sharing a connection never shares your mail.'\n )}\n </PagePurpose>\n {props.errorMessage ? (\n <p role=\"alert\" className=\"text-sm text-status-error-text text-center\">\n {props.errorMessage}\n </p>\n ) : (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('integrations.mailbox.empty.title', 'Connect a mailbox')}\n description={tr(\n 'integrations.mailbox.empty.description',\n 'Connect Google Gmail or Microsoft Outlook from Providers, then come back here to read and send mail.'\n )}\n action={\n <Button onClick={() => navigate?.(connectPath)}>\n <Mail size={16} />{' '}\n {tr('integrations.mailbox.empty.action', 'Connect Gmail or Outlook')}\n </Button>\n }\n />\n )}\n </div>\n );\n}\n\n/** Title, mailbox switcher and the Compose action. */\nfunction MailboxHeader(props: { accounts: MailboxAccount[]; connectionId: string | null }) {\n const { accounts, connectionId } = props;\n const tr = useTr();\n const ids = useId();\n const composing = useMailboxStore((s) => s.composing);\n const selectConnection = useMailboxStore((s) => s.selectConnection);\n const startCompose = useMailboxStore((s) => s.startCompose);\n const account = accounts.find((a) => a.connectionId === connectionId) ?? null;\n return (\n <div className=\"rounded-xl border border-border-seam bg-accent-wash p-4 sm:p-6\">\n <div className=\"flex flex-wrap items-center justify-between gap-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2.5 rounded-lg bg-action-primary-bg/10\">\n <Inbox size={24} className=\"text-primary\" />\n </div>\n <div>\n <h1 className=\"text-2xl font-bold text-text-primary\">\n {tr('integrations.mailbox.title', 'Inbox')}\n </h1>\n <p className=\"text-sm text-text-secondary\">\n {account?.emailAddress ??\n account?.name ??\n tr('integrations.mailbox.subtitle', 'Your connected mail')}\n </p>\n </div>\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n {accounts.length > 1 && (\n <>\n <label htmlFor={`${ids}-account`} className=\"sr-only\">\n {tr('integrations.mailbox.account', 'Mailbox')}\n </label>\n <select\n id={`${ids}-account`}\n value={connectionId ?? ''}\n // An open draft stays bound to the mailbox it was started in.\n disabled={composing}\n onChange={(e) => selectConnection(e.target.value)}\n className=\"px-3 py-2 border border-border-subtle rounded-lg bg-bg-surface text-sm text-text-primary\"\n >\n {accounts.map((a) => (\n <option key={a.connectionId} value={a.connectionId}>\n {a.emailAddress ?? a.name}\n </option>\n ))}\n </select>\n </>\n )}\n <Button onClick={startCompose}>\n <PenSquare size={16} /> {tr('integrations.mailbox.actions.compose', 'Compose')}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/** Folder switcher, search box and refresh. */\nfunction MailboxToolbar(props: { loading: boolean; onRefresh: () => void }) {\n const tr = useTr();\n const folder = useMailboxStore((s) => s.folder);\n const query = useMailboxStore((s) => s.query);\n const selectFolder = useMailboxStore((s) => s.selectFolder);\n const search = useMailboxStore((s) => s.search);\n // The text being typed is a form draft; it becomes the query on submit.\n const [searchInput, setSearchInput] = useState(query);\n return (\n <div className=\"flex flex-col sm:flex-row gap-3\">\n <div\n className=\"flex gap-1 rounded-lg border border-border-subtle bg-bg-surface p-1\"\n role=\"group\"\n aria-label={tr('integrations.mailbox.folders.ariaLabel', 'Folders')}\n >\n {FOLDERS.map((f) => (\n <button\n key={f.value}\n type=\"button\"\n aria-pressed={folder === f.value}\n onClick={() => selectFolder(f.value)}\n className={cn(\n 'px-3 py-1.5 text-sm rounded-md transition-colors',\n folder === f.value\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'text-text-secondary hover:bg-accent'\n )}\n >\n {tr(`integrations.mailbox.folders.${f.key}`, f.label)}\n </button>\n ))}\n </div>\n <form\n className=\"flex-1 relative\"\n onSubmit={(e) => {\n e.preventDefault();\n search(searchInput);\n }}\n >\n <Search\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n type=\"search\"\n value={searchInput}\n onChange={(e) => setSearchInput(e.target.value)}\n maxLength={500}\n aria-label={tr('integrations.mailbox.search.ariaLabel', 'Search mail')}\n placeholder={tr('integrations.mailbox.search.placeholder', 'Search mail')}\n className=\"w-full pl-9 pr-3 py-2 border border-border-subtle rounded-lg bg-bg-surface text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </form>\n <Button variant=\"outline\" onClick={props.onRefresh} disabled={props.loading}>\n <RefreshCw size={16} className={cn(props.loading && 'animate-spin')} />{' '}\n {tr('integrations.mailbox.actions.refresh', 'Refresh')}\n </Button>\n </div>\n );\n}\n\n/** Message list and the reading / compose pane for one connected mailbox. */\nfunction MailboxWorkspace(props: { accounts: MailboxAccount[] }) {\n const { accounts } = props;\n const tr = useTr();\n const state = useMailboxStore();\n const resetMailbox = useMailboxStore((s) => s.reset);\n const setRead = useSetMailRead();\n\n // Leaving the Inbox (or switching workspace) starts the next visit clean.\n useEffect(() => resetMailbox, [resetMailbox]);\n\n // Default to the first connected mailbox until the person picks another one;\n // a selection that is no longer connected falls back the same way.\n const account =\n accounts.find((a) => a.connectionId === state.selectedConnectionId) ?? accounts[0] ?? null;\n const connectionId = account?.connectionId ?? null;\n\n const { messages, nextPageToken, loading, error, refetch } = useMailboxMessages({\n connectionId,\n folder: state.folder,\n query: state.query,\n pageToken: state.pageTokens[state.pageTokens.length - 1] ?? null,\n });\n\n const openThread = (id: string, messageId: string, unread: boolean) => {\n state.openThread(id);\n if (unread && connectionId) {\n // Best effort: a failed mark-read must not block reading.\n setRead(connectionId, messageId, true).then(\n () => refetch(),\n () => undefined\n );\n }\n };\n\n const detailOpen = Boolean(state.threadId || state.composing);\n\n return (\n <div className=\"space-y-4 p-4 sm:p-6 max-w-7xl mx-auto\" data-testid=\"mailbox-inbox\">\n <MailboxHeader accounts={accounts} connectionId={connectionId} />\n <MailboxToolbar loading={loading} onRefresh={() => void refetch()} />\n\n {state.sentNotice && (\n <p role=\"status\" className=\"text-sm text-status-success-text\">\n {tr('integrations.mailbox.compose.sent', 'Message sent')}\n </p>\n )}\n\n <div className=\"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]\">\n <section\n aria-label={tr('integrations.mailbox.list.ariaLabel', 'Messages')}\n className={cn(\n 'rounded-xl border border-border-subtle bg-bg-surface overflow-hidden',\n detailOpen && 'hidden lg:block'\n )}\n >\n <MessageList\n messages={messages}\n loading={loading}\n error={error}\n refetch={refetch}\n folder={state.folder}\n threadId={state.threadId}\n hasPrevious={state.pageTokens.length > 1}\n nextPageToken={nextPageToken}\n onOpen={openThread}\n onPrevious={state.previousPage}\n onNext={state.nextPage}\n />\n </section>\n\n <section className={cn(!detailOpen && 'hidden lg:block')}>\n {state.composing && connectionId ? (\n <ComposePanel\n connectionId={connectionId}\n onClose={state.closeCompose}\n onSent={() => {\n state.composeSent();\n if (state.folder === MailboxFolder.Sent) void refetch();\n }}\n />\n ) : state.threadId && connectionId ? (\n <ThreadView\n key={`${connectionId}:${state.threadId}`}\n connectionId={connectionId}\n threadId={state.threadId}\n accountEmail={account?.emailAddress ?? null}\n onBack={state.closeThread}\n />\n ) : (\n <div className=\"rounded-xl border border-dashed border-border-subtle p-10 text-center text-sm text-text-secondary\">\n {tr('integrations.mailbox.thread.placeholder', 'Select a message to read it')}\n </div>\n )}\n </section>\n </div>\n </div>\n );\n}\n\n/**\n * Inbox — read, search, reply to and send mail from the caller's own Gmail or\n * Outlook account, connected as an integration (BOFF-4422). Workspaces does not\n * host mail; only the connection owner can open a mailbox.\n */\nexport function MailboxInbox() {\n const { accounts, answered, error } = useMailboxAccounts();\n\n // Until the accounts query has actually answered (it waits for the\n // workspace context), an empty list means \"not asked yet\", not \"none\".\n if (!answered && !error) {\n return (\n <div className=\"flex items-center justify-center py-24\" data-testid=\"mailbox-loading\">\n <Loader2 className=\"size-6 animate-spin text-primary\" />\n </div>\n );\n }\n if (accounts.length === 0) {\n return <MailboxEmptyState errorMessage={error?.message ?? null} />;\n }\n return <MailboxWorkspace accounts={accounts} />;\n}\n"],"mappings":";;;;;;;;;;;;;AAuCA,SAAS,EAAe,GAA6C;AAEnE,QADK,IACE,EAAQ,OAAO,GAAG,EAAQ,KAAK,IAAI,EAAQ,MAAM,KAAK,EAAQ,QADhD;;AAIvB,SAAS,EAAa,GAA6C;AAEjE,QADK,IACE,EAAQ,QAAQ,EAAQ,QADV;;AAIvB,IAAM,IAAuE;CAC3E;EAAE,OAAO,EAAc;EAAO,KAAK;EAAS,OAAO;EAAS;CAC5D;EAAE,OAAO,EAAc;EAAM,KAAK;EAAQ,OAAO;EAAQ;CACzD;EAAE,OAAO,EAAc;EAAK,KAAK;EAAO,OAAO;EAAY;CAC5D;AAGD,SAAS,EAAa,GAKnB;CACD,IAAM,EAAE,iBAAc,YAAS,YAAS,cAAW,GAC7C,IAAK,GAAO,EACZ,IAAM,GAAO,EACb,EAAE,SAAM,eAAY,GAAa,EACjC,CAAC,GAAI,KAAS,EAAS,GAAS,MAAM,GAAG,EACzC,CAAC,GAAI,KAAS,EAAS,GAAG,EAC1B,CAAC,GAAS,KAAc,EAAS,GAAS,WAAW,GAAG,EACxD,CAAC,GAAM,KAAW,EAAS,GAAG,EAC9B,CAAC,GAAO,KAAY,EAAwB,KAAK,EAEjD,IAAe,OAAO,MAAqB;AAE/C,EADA,EAAM,gBAAgB,EACtB,EAAS,KAAK;AACd,MAAI;AASF,GARA,MAAM,EAAK;IACT;IACA,IAAI,EAAgB,EAAG;IACvB,IAAI,EAAgB,EAAG;IACvB;IACA,UAAU;IACV,kBAAkB,GAAS;IAC5B,CAAC,EACF,GAAQ;WACD,GAAK;AACZ,KACE,aAAe,QACX,EAAI,UACJ,EA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