@burdenoff/microfe-integrations 2026.1107.1 → 2026.1107.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 (32) hide show
  1. package/dist/generated/global-types.d.ts +208 -168
  2. package/dist/generated/global-types.d.ts.map +1 -1
  3. package/dist/generated/wspace-operations.d.ts +235 -0
  4. package/dist/generated/wspace-operations.d.ts.map +1 -1
  5. package/dist/generated/wspace-operations.js +206 -103
  6. package/dist/generated/wspace-operations.js.map +1 -1
  7. package/dist/generated/wspace-types.d.ts +8724 -352
  8. package/dist/generated/wspace-types.d.ts.map +1 -1
  9. package/dist/generated/wspace-types.js +5 -1
  10. package/dist/generated/wspace-types.js.map +1 -1
  11. package/dist/integrations/components/MailMessageBody.d.ts +7 -0
  12. package/dist/integrations/components/MailMessageBody.d.ts.map +1 -0
  13. package/dist/integrations/components/MailMessageBody.js +175 -0
  14. package/dist/integrations/components/MailMessageBody.js.map +1 -0
  15. package/dist/integrations/hooks/useMailbox.d.ts +65 -4
  16. package/dist/integrations/hooks/useMailbox.d.ts.map +1 -1
  17. package/dist/integrations/hooks/useMailbox.js +108 -29
  18. package/dist/integrations/hooks/useMailbox.js.map +1 -1
  19. package/dist/integrations/pages/MailboxInbox.d.ts.map +1 -1
  20. package/dist/integrations/pages/MailboxInbox.js +418 -251
  21. package/dist/integrations/pages/MailboxInbox.js.map +1 -1
  22. package/dist/integrations/store/mailboxStore.d.ts +3 -0
  23. package/dist/integrations/store/mailboxStore.d.ts.map +1 -1
  24. package/dist/integrations/store/mailboxStore.js +7 -0
  25. package/dist/integrations/store/mailboxStore.js.map +1 -1
  26. package/dist/integrations/utils/mailHtml.d.ts +33 -0
  27. package/dist/integrations/utils/mailHtml.d.ts.map +1 -0
  28. package/dist/integrations/utils/mailHtml.js +127 -0
  29. package/dist/integrations/utils/mailHtml.js.map +1 -0
  30. package/dist/node_modules/dompurify/dist/purify.es.js +894 -0
  31. package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -0
  32. package/package.json +5 -2
@@ -1,23 +1,26 @@
1
1
  import { useIntegrations as e } from "../providers/IntegrationsProvider.js";
2
2
  import { useTr as t } from "../hooks/useTr.js";
3
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";
4
+ import { MailboxFolder as r, MailboxKind as i, MailboxLabelKind as a } from "../../generated/wspace-types.js";
5
+ import { useFormatDate as o } from "../hooks/useFormatDate.js";
6
+ import { joinPath as s } from "../utils/paths.js";
7
+ import { ConfirmDialog as c } from "../components/ConfirmDialog.js";
8
+ import { MAILBOX_SEND_ATTACHMENT_BYTES as l, splitRecipients as u, useMailboxAccounts as d, useMailboxLabels as f, useMailboxMessages as p, useMailboxThread as m, useMailboxThreadActions as h, useSendMail as g, useSetMailRead as _, useUploadMailAttachment as v } from "../hooks/useMailbox.js";
9
+ import { useMailboxStore as y } from "../store/mailboxStore.js";
10
+ import { formatBytes as b } from "../utils/mailHtml.js";
11
+ import { MailMessageBody as x } from "../components/MailMessageBody.js";
12
+ import { useEffect as S, useId as C, useRef as w, useState as T } from "react";
13
+ import { Archive as E, ArrowLeft as D, Inbox as O, Loader2 as k, Mail as A, MailOpen as j, Paperclip as M, PenSquare as N, RefreshCw as P, Reply as F, Search as I, Send as L, Trash2 as R, X as z } from "lucide-react";
14
+ import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
15
+ import { Button as U, IllustratedEmptyState as W, PagePurpose as G } from "@burdenoff/fe-libs/ui";
13
16
  //#region src/integrations/pages/MailboxInbox.tsx
14
- function P(e) {
17
+ function K(e) {
15
18
  return e ? e.name ? `${e.name} <${e.email}>` : e.email : "";
16
19
  }
17
- function F(e) {
20
+ function q(e) {
18
21
  return e ? e.name || e.email : "";
19
22
  }
20
- var I = [
23
+ var J = [
21
24
  {
22
25
  value: r.Inbox,
23
26
  key: "inbox",
@@ -34,333 +37,464 @@ var I = [
34
37
  label: "All mail"
35
38
  }
36
39
  ];
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
+ function Y(e) {
41
+ let { connectionId: r, kind: i, replyTo: a, onClose: o, onSent: s } = e, c = t(), d = C(), { send: f, sending: p } = g(), m = v(), h = w(null), [_, y] = T([]), [x, S] = T(!1), E = l[i], D = Math.round(E / (1024 * 1024) * 10) / 10, O = async (e) => {
42
+ let t = Array.from(e ?? []);
43
+ if (h.current && (h.current.value = ""), t.length !== 0) {
44
+ if (G(null), _.length + t.length > 10) {
45
+ G(c("integrations.mailbox.compose.tooManyFiles", "A message can have at most {{max}} attachments", { max: 10 }));
46
+ return;
47
+ }
48
+ if ([..._, ...t].reduce((e, t) => e + t.size, 0) > E) {
49
+ G(c("integrations.mailbox.compose.filesTooLarge", "Attachments on one message can total at most {{max}} MB with this mailbox", { max: D }));
50
+ return;
51
+ }
52
+ S(!0);
53
+ try {
54
+ for (let e of t) {
55
+ let t = await m(e);
56
+ y((e) => [...e, t]);
57
+ }
58
+ } catch (e) {
59
+ G(e instanceof Error ? e.message : c("integrations.mailbox.compose.uploadFailed", "Could not upload the file"));
60
+ } finally {
61
+ S(!1);
62
+ }
63
+ }
64
+ }, [A, j] = T(a?.to ?? ""), [N, P] = T(""), [F, I] = T(a?.subject ?? ""), [R, B] = T(""), [W, G] = T(null), K = async (e) => {
65
+ e.preventDefault(), G(null);
40
66
  try {
41
- await d({
67
+ await f({
42
68
  connectionId: r,
43
- to: o(p),
44
- cc: o(_),
45
- subject: b,
46
- bodyText: S,
47
- replyToMessageId: i?.messageId
69
+ to: u(A),
70
+ cc: u(N),
71
+ subject: F,
72
+ bodyText: R,
73
+ replyToMessageId: a?.messageId,
74
+ attachmentFileIds: _.map((e) => e.fileId)
48
75
  }), s();
49
76
  } catch (e) {
50
- T(e instanceof Error ? e.message : c("integrations.mailbox.compose.failed", "Could not send"));
77
+ G(e instanceof Error ? e.message : c("integrations.mailbox.compose.failed", "Could not send"));
51
78
  }
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,
79
+ }, q = "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";
80
+ return /* @__PURE__ */ H("form", {
81
+ onSubmit: K,
55
82
  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"),
83
+ "aria-label": a ? c("integrations.mailbox.compose.replyTitle", "Reply") : c("integrations.mailbox.compose.title", "New message"),
57
84
  children: [
58
- /* @__PURE__ */ A("div", {
85
+ /* @__PURE__ */ H("div", {
59
86
  className: "flex items-center justify-between",
60
- children: [/* @__PURE__ */ k("h2", {
87
+ children: [/* @__PURE__ */ V("h2", {
61
88
  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, {
89
+ children: a ? c("integrations.mailbox.compose.replyTitle", "Reply") : c("integrations.mailbox.compose.title", "New message")
90
+ }), /* @__PURE__ */ V(U, {
64
91
  type: "button",
65
92
  variant: "ghost",
66
93
  size: "icon",
67
- onClick: a,
68
- disabled: f,
94
+ onClick: o,
95
+ disabled: p,
69
96
  "aria-label": c("integrations.common.close", "Close"),
70
- children: /* @__PURE__ */ k(D, { size: 16 })
97
+ children: /* @__PURE__ */ V(z, { size: 16 })
71
98
  })]
72
99
  }),
73
- /* @__PURE__ */ A("div", {
100
+ /* @__PURE__ */ H("div", {
74
101
  className: "space-y-1",
75
- children: [/* @__PURE__ */ k("label", {
76
- htmlFor: `${l}-to`,
102
+ children: [/* @__PURE__ */ V("label", {
103
+ htmlFor: `${d}-to`,
77
104
  className: "text-xs font-medium text-text-secondary",
78
105
  children: c("integrations.mailbox.compose.to", "To")
79
- }), /* @__PURE__ */ k("input", {
80
- id: `${l}-to`,
106
+ }), /* @__PURE__ */ V("input", {
107
+ id: `${d}-to`,
81
108
  type: "text",
82
- value: p,
83
- onChange: (e) => g(e.target.value),
109
+ value: A,
110
+ onChange: (e) => j(e.target.value),
84
111
  placeholder: c("integrations.mailbox.compose.toPlaceholder", "name@example.com, another@example.com"),
85
- className: M,
112
+ className: q,
86
113
  required: !0
87
114
  })]
88
115
  }),
89
- /* @__PURE__ */ A("div", {
116
+ /* @__PURE__ */ H("div", {
90
117
  className: "space-y-1",
91
- children: [/* @__PURE__ */ k("label", {
92
- htmlFor: `${l}-cc`,
118
+ children: [/* @__PURE__ */ V("label", {
119
+ htmlFor: `${d}-cc`,
93
120
  className: "text-xs font-medium text-text-secondary",
94
121
  children: c("integrations.mailbox.compose.cc", "Cc")
95
- }), /* @__PURE__ */ k("input", {
96
- id: `${l}-cc`,
122
+ }), /* @__PURE__ */ V("input", {
123
+ id: `${d}-cc`,
97
124
  type: "text",
98
- value: _,
99
- onChange: (e) => y(e.target.value),
100
- className: M
125
+ value: N,
126
+ onChange: (e) => P(e.target.value),
127
+ className: q
101
128
  })]
102
129
  }),
103
- !i && /* @__PURE__ */ A("div", {
130
+ !a && /* @__PURE__ */ H("div", {
104
131
  className: "space-y-1",
105
- children: [/* @__PURE__ */ k("label", {
106
- htmlFor: `${l}-subject`,
132
+ children: [/* @__PURE__ */ V("label", {
133
+ htmlFor: `${d}-subject`,
107
134
  className: "text-xs font-medium text-text-secondary",
108
135
  children: c("integrations.mailbox.compose.subject", "Subject")
109
- }), /* @__PURE__ */ k("input", {
110
- id: `${l}-subject`,
136
+ }), /* @__PURE__ */ V("input", {
137
+ id: `${d}-subject`,
111
138
  type: "text",
112
- value: b,
113
- onChange: (e) => x(e.target.value),
139
+ value: F,
140
+ onChange: (e) => I(e.target.value),
114
141
  maxLength: 998,
115
- className: M
142
+ className: q
116
143
  })]
117
144
  }),
118
- /* @__PURE__ */ A("div", {
145
+ /* @__PURE__ */ H("div", {
119
146
  className: "space-y-1",
120
- children: [/* @__PURE__ */ k("label", {
121
- htmlFor: `${l}-body`,
147
+ children: [/* @__PURE__ */ V("label", {
148
+ htmlFor: `${d}-body`,
122
149
  className: "text-xs font-medium text-text-secondary",
123
150
  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),
151
+ }), /* @__PURE__ */ V("textarea", {
152
+ id: `${d}-body`,
153
+ value: R,
154
+ onChange: (e) => B(e.target.value),
128
155
  rows: 8,
129
- className: n(M, "resize-y"),
156
+ className: n(q, "resize-y"),
130
157
  required: !0
131
158
  })]
132
159
  }),
133
- w && /* @__PURE__ */ k("p", {
160
+ /* @__PURE__ */ H("div", {
161
+ className: "space-y-2",
162
+ children: [
163
+ /* @__PURE__ */ V("input", {
164
+ ref: h,
165
+ id: `${d}-files`,
166
+ type: "file",
167
+ multiple: !0,
168
+ "aria-label": c("integrations.mailbox.compose.attach", "Attach files"),
169
+ tabIndex: -1,
170
+ className: "sr-only",
171
+ onChange: (e) => void O(e.target.files),
172
+ disabled: p || x
173
+ }),
174
+ /* @__PURE__ */ H(U, {
175
+ type: "button",
176
+ variant: "outline",
177
+ size: "sm",
178
+ disabled: p || x || _.length >= 10,
179
+ onClick: () => h.current?.click(),
180
+ children: [x ? /* @__PURE__ */ V(k, {
181
+ size: 14,
182
+ className: "animate-spin"
183
+ }) : /* @__PURE__ */ V(M, { size: 14 }), x ? c("integrations.mailbox.compose.uploading", "Uploading…") : c("integrations.mailbox.compose.attach", "Attach files")]
184
+ }),
185
+ /* @__PURE__ */ V("p", {
186
+ className: "text-xs text-text-tertiary",
187
+ children: c("integrations.mailbox.compose.attachHint", "Up to {{count}} files, {{max}} MB in total. A copy is kept in your Files.", {
188
+ count: 10,
189
+ max: D
190
+ })
191
+ }),
192
+ _.length > 0 && /* @__PURE__ */ V("ul", {
193
+ className: "flex flex-wrap gap-2",
194
+ "data-testid": "mailbox-compose-attachments",
195
+ children: _.map((e) => /* @__PURE__ */ H("li", {
196
+ className: "flex items-center gap-1 rounded-full border border-border-subtle px-3 py-1 text-xs text-text-primary",
197
+ children: [
198
+ /* @__PURE__ */ V(M, { size: 12 }),
199
+ /* @__PURE__ */ V("span", {
200
+ className: "max-w-48 truncate",
201
+ children: e.name
202
+ }),
203
+ /* @__PURE__ */ V("span", {
204
+ className: "text-text-tertiary",
205
+ children: b(e.size)
206
+ }),
207
+ /* @__PURE__ */ V("button", {
208
+ type: "button",
209
+ className: "ml-1 rounded-full p-0.5 hover:bg-accent",
210
+ disabled: p,
211
+ "aria-label": c("integrations.mailbox.compose.removeFile", "Remove {{name}}", { name: e.name }),
212
+ onClick: () => y((t) => t.filter((t) => t.fileId !== e.fileId)),
213
+ children: /* @__PURE__ */ V(z, { size: 12 })
214
+ })
215
+ ]
216
+ }, e.fileId))
217
+ })
218
+ ]
219
+ }),
220
+ W && /* @__PURE__ */ V("p", {
134
221
  role: "alert",
135
222
  className: "text-sm text-status-error-text",
136
- children: w
223
+ children: W
137
224
  }),
138
- /* @__PURE__ */ A("div", {
225
+ /* @__PURE__ */ H("div", {
139
226
  className: "flex justify-end gap-2",
140
- children: [/* @__PURE__ */ k(j, {
227
+ children: [/* @__PURE__ */ V(U, {
141
228
  type: "button",
142
229
  variant: "outline",
143
- onClick: a,
144
- disabled: f,
230
+ onClick: o,
231
+ disabled: p,
145
232
  children: c("integrations.common.cancel", "Cancel")
146
- }), /* @__PURE__ */ A(j, {
233
+ }), /* @__PURE__ */ H(U, {
147
234
  type: "submit",
148
- disabled: f || !S.trim() || !p.trim(),
149
- children: [f ? /* @__PURE__ */ k(v, {
235
+ disabled: p || x || !R.trim() || !A.trim(),
236
+ children: [p ? /* @__PURE__ */ V(k, {
150
237
  size: 16,
151
238
  className: "animate-spin"
152
- }) : /* @__PURE__ */ k(E, { size: 16 }), c("integrations.mailbox.compose.send", "Send")]
239
+ }) : /* @__PURE__ */ V(L, { size: 16 }), c("integrations.mailbox.compose.send", "Send")]
153
240
  })]
154
241
  })
155
242
  ]
156
243
  });
157
244
  }
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", {
245
+ function X(e) {
246
+ let { connectionId: n, kind: r, threadId: a, accountEmail: s, onBack: l, onRemoved: u } = e, d = t(), f = o(), { thread: p, loading: g, error: _, refetch: v } = m(n, a), { archiveThread: y, trashThread: b, busy: S } = h(), [C, w] = T(!1), [O, A] = T(null), j = async (e) => {
247
+ A(null);
248
+ try {
249
+ e === "archived" ? await y(n, a) : await b(n, a), w(!1), u(e);
250
+ } catch (e) {
251
+ w(!1), A(e instanceof Error ? e.message : d("integrations.mailbox.actions.failed", "That did not work. Try again."));
252
+ }
253
+ }, [N, I] = T(!1), [L, z] = T(!1);
254
+ if (g && !p) return /* @__PURE__ */ V("div", {
161
255
  className: "flex items-center justify-center py-16",
162
- children: /* @__PURE__ */ k(v, { className: "size-6 animate-spin text-primary" })
256
+ children: /* @__PURE__ */ V(k, { className: "size-6 animate-spin text-primary" })
163
257
  });
164
- if (f || !u) return /* @__PURE__ */ A("div", {
258
+ if (_ || !p) return /* @__PURE__ */ H("div", {
165
259
  className: "p-6 space-y-3 text-center",
166
- children: [/* @__PURE__ */ k("p", {
260
+ children: [/* @__PURE__ */ V("p", {
167
261
  role: "alert",
168
262
  className: "text-sm text-status-error-text",
169
- children: f?.message ?? s("integrations.mailbox.thread.notFound", "Conversation not found")
170
- }), /* @__PURE__ */ A("div", {
263
+ children: _?.message ?? d("integrations.mailbox.thread.notFound", "Conversation not found")
264
+ }), /* @__PURE__ */ H("div", {
171
265
  className: "flex flex-wrap justify-center gap-2",
172
- children: [/* @__PURE__ */ A(j, {
266
+ children: [/* @__PURE__ */ H(U, {
173
267
  variant: "ghost",
174
- onClick: o,
268
+ onClick: l,
175
269
  children: [
176
- /* @__PURE__ */ k(g, { size: 16 }),
270
+ /* @__PURE__ */ V(D, { size: 16 }),
177
271
  " ",
178
- s("integrations.common.back", "Back")
272
+ d("integrations.common.back", "Back")
179
273
  ]
180
- }), /* @__PURE__ */ A(j, {
274
+ }), /* @__PURE__ */ H(U, {
181
275
  variant: "outline",
182
- onClick: () => p(),
276
+ onClick: () => v(),
183
277
  children: [
184
- /* @__PURE__ */ k(C, { size: 16 }),
278
+ /* @__PURE__ */ V(P, { size: 16 }),
185
279
  " ",
186
- s("integrations.mailbox.actions.retry", "Try again")
280
+ d("integrations.mailbox.actions.retry", "Try again")
187
281
  ]
188
282
  })]
189
283
  })]
190
284
  });
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", {
285
+ let B = p.messages[p.messages.length - 1], W = s?.trim().toLowerCase() ?? null, G = B ? W && B.from?.email.toLowerCase() === W ? B.to.map((e) => e.email).filter((e) => e.toLowerCase() !== W) : [B.from?.email ?? ""] : [];
286
+ return /* @__PURE__ */ H("div", {
193
287
  className: "space-y-4",
194
288
  "data-testid": "mailbox-thread",
195
289
  children: [
196
- /* @__PURE__ */ A("div", {
290
+ /* @__PURE__ */ H("div", {
197
291
  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
- })]
292
+ children: [
293
+ /* @__PURE__ */ V(U, {
294
+ variant: "ghost",
295
+ size: "icon",
296
+ className: "lg:hidden",
297
+ onClick: l,
298
+ "aria-label": d("integrations.common.back", "Back"),
299
+ children: /* @__PURE__ */ V(D, { size: 18 })
300
+ }),
301
+ /* @__PURE__ */ V("h2", {
302
+ className: "min-w-0 flex-1 text-lg font-semibold text-text-primary break-words",
303
+ children: p.subject || d("integrations.mailbox.noSubject", "(no subject)")
304
+ }),
305
+ /* @__PURE__ */ H("div", {
306
+ className: "flex shrink-0 gap-1",
307
+ children: [/* @__PURE__ */ V(U, {
308
+ variant: "ghost",
309
+ size: "icon",
310
+ disabled: S,
311
+ onClick: () => void j("archived"),
312
+ "aria-label": d("integrations.mailbox.actions.archive", "Archive"),
313
+ title: d("integrations.mailbox.actions.archive", "Archive"),
314
+ children: /* @__PURE__ */ V(E, { size: 18 })
315
+ }), /* @__PURE__ */ V(U, {
316
+ variant: "ghost",
317
+ size: "icon",
318
+ disabled: S,
319
+ onClick: () => w(!0),
320
+ "aria-label": d("integrations.mailbox.actions.trash", "Delete"),
321
+ title: d("integrations.mailbox.actions.trash", "Delete"),
322
+ children: /* @__PURE__ */ V(R, { size: 18 })
323
+ })]
324
+ })
325
+ ]
209
326
  }),
210
- u.messages.map((e) => /* @__PURE__ */ A("article", {
327
+ O && /* @__PURE__ */ V("p", {
328
+ role: "alert",
329
+ className: "text-sm text-status-error-text",
330
+ children: O
331
+ }),
332
+ /* @__PURE__ */ V(c, {
333
+ open: C,
334
+ title: d("integrations.mailbox.trash.title", "Delete this conversation?"),
335
+ description: r === i.Outlook ? d("integrations.mailbox.trash.descriptionOutlook", "It moves to Deleted Items in Outlook, where you can restore it.") : d("integrations.mailbox.trash.descriptionGmail", "It moves to Trash in Gmail, where you can restore it for 30 days."),
336
+ confirmLabel: d("integrations.mailbox.actions.trash", "Delete"),
337
+ cancelLabel: d("integrations.common.cancel", "Cancel"),
338
+ loading: S,
339
+ destructive: !0,
340
+ onConfirm: () => void j("trashed"),
341
+ onCancel: () => w(!1)
342
+ }),
343
+ p.messages.map((e) => /* @__PURE__ */ H("article", {
211
344
  className: "rounded-xl border border-border-subtle bg-bg-surface p-4 space-y-2",
212
- children: [/* @__PURE__ */ A("header", {
345
+ children: [/* @__PURE__ */ H("header", {
213
346
  className: "flex flex-wrap items-baseline justify-between gap-2",
214
- children: [/* @__PURE__ */ A("div", {
347
+ children: [/* @__PURE__ */ H("div", {
215
348
  className: "min-w-0",
216
- children: [/* @__PURE__ */ k("p", {
349
+ children: [/* @__PURE__ */ V("p", {
217
350
  className: "text-sm font-medium text-text-primary break-all",
218
- children: P(e.from)
219
- }), /* @__PURE__ */ A("p", {
351
+ children: K(e.from)
352
+ }), /* @__PURE__ */ H("p", {
220
353
  className: "text-xs text-text-secondary break-all",
221
354
  children: [
222
- s("integrations.mailbox.thread.to", "To"),
355
+ d("integrations.mailbox.thread.to", "To"),
223
356
  ":",
224
357
  " ",
225
- e.to.map(P).join(", "),
226
- e.cc.length > 0 && ` · ${s("integrations.mailbox.thread.cc", "Cc")}: ${e.cc.map(P).join(", ")}`
358
+ e.to.map(K).join(", "),
359
+ e.cc.length > 0 && ` · ${d("integrations.mailbox.thread.cc", "Cc")}: ${e.cc.map(K).join(", ")}`
227
360
  ]
228
361
  })]
229
- }), /* @__PURE__ */ A("div", {
362
+ }), /* @__PURE__ */ H("div", {
230
363
  className: "flex items-center gap-2 text-xs text-text-tertiary",
231
- children: [e.hasAttachments && /* @__PURE__ */ k(x, {
364
+ children: [e.hasAttachments && /* @__PURE__ */ V(M, {
232
365
  size: 14,
233
- "aria-label": s("integrations.mailbox.attachments", "Has attachments")
234
- }), e.receivedAt && /* @__PURE__ */ k("time", {
366
+ "aria-label": d("integrations.mailbox.attachments", "Has attachments")
367
+ }), e.receivedAt && /* @__PURE__ */ V("time", {
235
368
  dateTime: e.receivedAt,
236
- children: c(e.receivedAt)
369
+ children: f(e.receivedAt)
237
370
  })]
238
371
  })]
239
- }), /* @__PURE__ */ k("div", {
240
- className: "whitespace-pre-wrap break-words text-sm text-text-primary",
241
- children: e.bodyText
372
+ }), /* @__PURE__ */ V(x, {
373
+ connectionId: n,
374
+ message: e
242
375
  })]
243
376
  }, e.id)),
244
- y && /* @__PURE__ */ k("p", {
377
+ L && /* @__PURE__ */ V("p", {
245
378
  role: "status",
246
379
  className: "text-sm text-status-success-text",
247
- children: s("integrations.mailbox.compose.sent", "Message sent")
380
+ children: d("integrations.mailbox.compose.sent", "Message sent")
248
381
  }),
249
- S && (m ? /* @__PURE__ */ k(L, {
382
+ B && (N ? /* @__PURE__ */ V(Y, {
250
383
  connectionId: n,
384
+ kind: r,
251
385
  replyTo: {
252
- messageId: S.id,
253
- to: E.filter(Boolean).join(", "),
254
- subject: u.subject
386
+ messageId: B.id,
387
+ to: G.filter(Boolean).join(", "),
388
+ subject: p.subject
255
389
  },
256
- onClose: () => _(!1),
390
+ onClose: () => I(!1),
257
391
  onSent: () => {
258
- _(!1), b(!0), p();
392
+ I(!1), z(!0), v();
259
393
  }
260
- }) : /* @__PURE__ */ A(j, {
394
+ }) : /* @__PURE__ */ H(U, {
261
395
  variant: "outline",
262
- onClick: () => _(!0),
396
+ onClick: () => I(!0),
263
397
  children: [
264
- /* @__PURE__ */ k(w, { size: 16 }),
398
+ /* @__PURE__ */ V(F, { size: 16 }),
265
399
  " ",
266
- s("integrations.mailbox.actions.reply", "Reply")
400
+ d("integrations.mailbox.actions.reply", "Reply")
267
401
  ]
268
402
  }))
269
403
  ]
270
404
  });
271
405
  }
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", {
406
+ function Z(e) {
407
+ let { messages: i, loading: a, error: s, refetch: c, folder: l, threadId: u, hasPrevious: d, nextPageToken: f, onOpen: p, onPrevious: m, onNext: h } = e, g = t(), _ = o();
408
+ return /* @__PURE__ */ H(B, { children: [s ? /* @__PURE__ */ H("div", {
275
409
  className: "p-6 text-center space-y-3",
276
- children: [/* @__PURE__ */ k("p", {
410
+ children: [/* @__PURE__ */ V("p", {
277
411
  role: "alert",
278
412
  className: "text-sm text-status-error-text",
279
413
  children: s.message
280
- }), /* @__PURE__ */ A(j, {
414
+ }), /* @__PURE__ */ H(U, {
281
415
  variant: "outline",
282
416
  onClick: () => c(),
283
417
  children: [
284
- /* @__PURE__ */ k(C, { size: 16 }),
418
+ /* @__PURE__ */ V(P, { size: 16 }),
285
419
  " ",
286
420
  g("integrations.mailbox.actions.retry", "Try again")
287
421
  ]
288
422
  })]
289
- }) : o && a.length === 0 ? /* @__PURE__ */ k("div", {
423
+ }) : a && i.length === 0 ? /* @__PURE__ */ V("div", {
290
424
  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", {
425
+ children: /* @__PURE__ */ V(k, { className: "size-6 animate-spin text-primary" })
426
+ }) : i.length === 0 ? /* @__PURE__ */ V("p", {
293
427
  className: "p-6 text-sm text-text-secondary text-center",
294
428
  children: g("integrations.mailbox.list.empty", "No messages here")
295
- }) : /* @__PURE__ */ k("ul", {
429
+ }) : /* @__PURE__ */ V("ul", {
296
430
  className: "divide-y divide-border-subtle",
297
431
  "data-testid": "mailbox-message-list",
298
- children: a.map((e) => /* @__PURE__ */ k("li", { children: /* @__PURE__ */ A("button", {
432
+ children: i.map((e) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H("button", {
299
433
  type: "button",
300
434
  onClick: () => p(e.threadId, e.id, e.isUnread),
301
435
  "aria-current": u === e.threadId ? "true" : void 0,
302
436
  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
437
  children: [
304
- /* @__PURE__ */ A("div", {
438
+ /* @__PURE__ */ H("div", {
305
439
  className: "flex items-center justify-between gap-2",
306
- children: [/* @__PURE__ */ k("span", {
440
+ children: [/* @__PURE__ */ V("span", {
307
441
  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", {
442
+ children: l === r.Sent ? e.to.map(q).join(", ") : q(e.from)
443
+ }), /* @__PURE__ */ H("span", {
310
444
  className: "flex shrink-0 items-center gap-1 text-xs text-text-tertiary",
311
445
  children: [
312
- e.hasAttachments && /* @__PURE__ */ k(x, { size: 12 }),
313
- e.isUnread ? /* @__PURE__ */ k(y, { size: 12 }) : /* @__PURE__ */ k(b, { size: 12 }),
446
+ e.hasAttachments && /* @__PURE__ */ V(M, { size: 12 }),
447
+ e.isUnread ? /* @__PURE__ */ V(A, { size: 12 }) : /* @__PURE__ */ V(j, { size: 12 }),
314
448
  e.receivedAt ? _(e.receivedAt) : ""
315
449
  ]
316
450
  })]
317
451
  }),
318
- /* @__PURE__ */ k("p", {
452
+ /* @__PURE__ */ V("p", {
319
453
  className: n("truncate text-sm", e.isUnread ? "font-medium text-text-primary" : "text-text-primary"),
320
454
  children: e.subject || g("integrations.mailbox.noSubject", "(no subject)")
321
455
  }),
322
- /* @__PURE__ */ k("p", {
456
+ /* @__PURE__ */ V("p", {
323
457
  className: "truncate text-xs text-text-secondary",
324
458
  children: e.snippet
325
459
  })
326
460
  ]
327
461
  }) }, e.id))
328
- }), (d || f) && /* @__PURE__ */ A("div", {
462
+ }), (d || f) && /* @__PURE__ */ H("div", {
329
463
  className: "flex justify-between gap-2 border-t border-border-subtle p-3",
330
- children: [/* @__PURE__ */ k(j, {
464
+ children: [/* @__PURE__ */ V(U, {
331
465
  variant: "outline",
332
466
  size: "sm",
333
- disabled: !d || o,
467
+ disabled: !d || a,
334
468
  onClick: m,
335
469
  children: g("integrations.common.previous", "Previous")
336
- }), /* @__PURE__ */ k(j, {
470
+ }), /* @__PURE__ */ V(U, {
337
471
  variant: "outline",
338
472
  size: "sm",
339
- disabled: !f || o,
473
+ disabled: !f || a,
340
474
  onClick: () => f && h(f),
341
475
  children: g("integrations.common.next", "Next")
342
476
  })]
343
477
  })] });
344
478
  }
345
- function B(n) {
346
- let r = t(), { basePath: i = "/", navigate: o } = e(), s = a(i, "providers");
347
- return /* @__PURE__ */ A("div", {
479
+ function Q(n) {
480
+ let r = t(), { basePath: i = "/", navigate: a } = e(), o = s(i, "providers");
481
+ return /* @__PURE__ */ H("div", {
348
482
  className: "space-y-6 p-6 max-w-5xl mx-auto",
349
- children: [/* @__PURE__ */ k(N, {
350
- icon: /* @__PURE__ */ k(y, { size: 16 }),
483
+ children: [/* @__PURE__ */ V(G, {
484
+ icon: /* @__PURE__ */ V(A, { size: 16 }),
351
485
  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", {
486
+ }), n.errorMessage ? /* @__PURE__ */ V("p", {
353
487
  role: "alert",
354
488
  className: "text-sm text-status-error-text text-center",
355
489
  children: n.errorMessage
356
- }) : /* @__PURE__ */ k(M, {
490
+ }) : /* @__PURE__ */ V(W, {
357
491
  illustration: "empty-data",
358
492
  title: r("integrations.mailbox.empty.title", "Connect a mailbox"),
359
493
  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),
494
+ action: /* @__PURE__ */ H(U, {
495
+ onClick: () => a?.(o),
362
496
  children: [
363
- /* @__PURE__ */ k(y, { size: 16 }),
497
+ /* @__PURE__ */ V(A, { size: 16 }),
364
498
  " ",
365
499
  r("integrations.mailbox.empty.action", "Connect Gmail or Outlook")
366
500
  ]
@@ -368,47 +502,47 @@ function B(n) {
368
502
  })]
369
503
  });
370
504
  }
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", {
505
+ function $(e) {
506
+ let { accounts: n, connectionId: r } = e, i = t(), a = C(), o = y((e) => e.composing), s = y((e) => e.selectConnection), c = y((e) => e.startCompose), l = n.find((e) => e.connectionId === r) ?? null;
507
+ return /* @__PURE__ */ V("div", {
374
508
  className: "rounded-xl border border-border-seam bg-accent-wash p-4 sm:p-6",
375
- children: /* @__PURE__ */ A("div", {
509
+ children: /* @__PURE__ */ H("div", {
376
510
  className: "flex flex-wrap items-center justify-between gap-4",
377
- children: [/* @__PURE__ */ A("div", {
511
+ children: [/* @__PURE__ */ H("div", {
378
512
  className: "flex items-center gap-3",
379
- children: [/* @__PURE__ */ k("div", {
513
+ children: [/* @__PURE__ */ V("div", {
380
514
  className: "p-2.5 rounded-lg bg-action-primary-bg/10",
381
- children: /* @__PURE__ */ k(_, {
515
+ children: /* @__PURE__ */ V(O, {
382
516
  size: 24,
383
517
  className: "text-primary"
384
518
  })
385
- }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("h1", {
519
+ }), /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("h1", {
386
520
  className: "text-2xl font-bold text-text-primary",
387
521
  children: i("integrations.mailbox.title", "Inbox")
388
- }), /* @__PURE__ */ k("p", {
522
+ }), /* @__PURE__ */ V("p", {
389
523
  className: "text-sm text-text-secondary",
390
524
  children: l?.emailAddress ?? l?.name ?? i("integrations.mailbox.subtitle", "Your connected mail")
391
525
  })] })]
392
- }), /* @__PURE__ */ A("div", {
526
+ }), /* @__PURE__ */ H("div", {
393
527
  className: "flex flex-wrap items-center gap-2",
394
- children: [n.length > 1 && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("label", {
528
+ children: [n.length > 1 && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("label", {
395
529
  htmlFor: `${a}-account`,
396
530
  className: "sr-only",
397
531
  children: i("integrations.mailbox.account", "Mailbox")
398
- }), /* @__PURE__ */ k("select", {
532
+ }), /* @__PURE__ */ V("select", {
399
533
  id: `${a}-account`,
400
534
  value: r ?? "",
401
535
  disabled: o,
402
536
  onChange: (e) => s(e.target.value),
403
537
  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", {
538
+ children: n.map((e) => /* @__PURE__ */ V("option", {
405
539
  value: e.connectionId,
406
540
  children: e.emailAddress ?? e.name
407
541
  }, e.connectionId))
408
- })] }), /* @__PURE__ */ A(j, {
542
+ })] }), /* @__PURE__ */ H(U, {
409
543
  onClick: c,
410
544
  children: [
411
- /* @__PURE__ */ k(S, { size: 16 }),
545
+ /* @__PURE__ */ V(N, { size: 16 }),
412
546
  " ",
413
547
  i("integrations.mailbox.actions.compose", "Compose")
414
548
  ]
@@ -417,47 +551,68 @@ function V(e) {
417
551
  })
418
552
  });
419
553
  }
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", {
554
+ var ee = new Set(["INBOX", "SENT"]);
555
+ function te(e) {
556
+ let r = t(), i = C(), o = y((e) => e.folder), s = y((e) => e.folderId), c = y((e) => e.query), l = y((e) => e.selectFolder), u = y((e) => e.selectLabel), d = y((e) => e.search), { labels: p } = f(e.connectionId), m = p.filter((e) => !(e.kind === a.System && ee.has(e.id))), [h, g] = T(c);
557
+ return /* @__PURE__ */ H("div", {
423
558
  className: "flex flex-col sm:flex-row gap-3",
424
559
  children: [
425
- /* @__PURE__ */ k("div", {
560
+ /* @__PURE__ */ V("div", {
426
561
  className: "flex gap-1 rounded-lg border border-border-subtle bg-bg-surface p-1",
427
562
  role: "group",
428
563
  "aria-label": r("integrations.mailbox.folders.ariaLabel", "Folders"),
429
- children: I.map((e) => /* @__PURE__ */ k("button", {
564
+ children: J.map((e) => /* @__PURE__ */ V("button", {
430
565
  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"),
566
+ "aria-pressed": !s && o === e.value,
567
+ onClick: () => l(e.value),
568
+ className: n("px-3 py-1.5 text-sm rounded-md transition-colors", !s && o === e.value ? "bg-action-primary-bg text-action-primary-text" : "text-text-secondary hover:bg-accent"),
434
569
  children: r(`integrations.mailbox.folders.${e.key}`, e.label)
435
570
  }, e.value))
436
571
  }),
437
- /* @__PURE__ */ A("form", {
572
+ m.length > 0 && /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("label", {
573
+ htmlFor: `${i}-label`,
574
+ className: "sr-only",
575
+ children: r("integrations.mailbox.labels.ariaLabel", "Labels and folders")
576
+ }), /* @__PURE__ */ H("select", {
577
+ id: `${i}-label`,
578
+ value: s ?? "",
579
+ onChange: (e) => {
580
+ e.target.value ? u(e.target.value) : l(o);
581
+ },
582
+ className: "w-full sm:w-48 px-3 py-2 border border-border-subtle rounded-lg bg-bg-surface text-sm text-text-primary",
583
+ "data-testid": "mailbox-label-select",
584
+ children: [/* @__PURE__ */ V("option", {
585
+ value: "",
586
+ children: r("integrations.mailbox.labels.placeholder", "More folders…")
587
+ }), m.map((e) => /* @__PURE__ */ V("option", {
588
+ value: e.id,
589
+ children: e.unreadCount ? `${e.name} (${e.unreadCount})` : e.name
590
+ }, e.id))]
591
+ })] }),
592
+ /* @__PURE__ */ H("form", {
438
593
  className: "flex-1 relative",
439
594
  onSubmit: (e) => {
440
- e.preventDefault(), s(c);
595
+ e.preventDefault(), d(h);
441
596
  },
442
- children: [/* @__PURE__ */ k(T, {
597
+ children: [/* @__PURE__ */ V(I, {
443
598
  size: 16,
444
599
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary"
445
- }), /* @__PURE__ */ k("input", {
600
+ }), /* @__PURE__ */ V("input", {
446
601
  type: "search",
447
- value: c,
448
- onChange: (e) => l(e.target.value),
602
+ value: h,
603
+ onChange: (e) => g(e.target.value),
449
604
  maxLength: 500,
450
605
  "aria-label": r("integrations.mailbox.search.ariaLabel", "Search mail"),
451
606
  placeholder: r("integrations.mailbox.search.placeholder", "Search mail"),
452
607
  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
608
  })]
454
609
  }),
455
- /* @__PURE__ */ A(j, {
610
+ /* @__PURE__ */ H(U, {
456
611
  variant: "outline",
457
612
  onClick: e.onRefresh,
458
613
  disabled: e.loading,
459
614
  children: [
460
- /* @__PURE__ */ k(C, {
615
+ /* @__PURE__ */ V(P, {
461
616
  size: 16,
462
617
  className: n(e.loading && "animate-spin")
463
618
  }),
@@ -468,83 +623,95 @@ function H(e) {
468
623
  ]
469
624
  });
470
625
  }
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", {
626
+ function ne(e) {
627
+ let { accounts: a } = e, o = t(), s = y(), c = y((e) => e.reset), l = _();
628
+ S(() => c, [c]);
629
+ let u = a.find((e) => e.connectionId === s.selectedConnectionId) ?? a[0] ?? null, d = u?.connectionId ?? null, [f, m] = T(null), { messages: h, nextPageToken: g, loading: v, error: b, refetch: x } = p({
630
+ connectionId: d,
631
+ folder: s.folder,
632
+ folderId: s.folderId,
633
+ query: s.query,
634
+ pageToken: s.pageTokens[s.pageTokens.length - 1] ?? null
635
+ }), C = (e, t, n) => {
636
+ m(null), s.openThread(e), n && d && l(d, t, !0).then(() => x(), () => void 0);
637
+ }, w = !!(s.threadId || s.composing);
638
+ return /* @__PURE__ */ H("div", {
483
639
  className: "space-y-4 p-4 sm:p-6 max-w-7xl mx-auto",
484
640
  "data-testid": "mailbox-inbox",
485
641
  children: [
486
- /* @__PURE__ */ k(V, {
487
- accounts: i,
488
- connectionId: m
642
+ /* @__PURE__ */ V($, {
643
+ accounts: a,
644
+ connectionId: d
489
645
  }),
490
- /* @__PURE__ */ k(H, {
491
- loading: _,
492
- onRefresh: () => void y()
646
+ /* @__PURE__ */ V(te, {
647
+ connectionId: d,
648
+ loading: v,
649
+ onRefresh: () => void x()
650
+ }, d ?? "none"),
651
+ f && !s.threadId && /* @__PURE__ */ V("p", {
652
+ role: "status",
653
+ className: "text-sm text-status-success-text",
654
+ children: f
493
655
  }),
494
- o.sentNotice && /* @__PURE__ */ k("p", {
656
+ s.sentNotice && /* @__PURE__ */ V("p", {
495
657
  role: "status",
496
658
  className: "text-sm text-status-success-text",
497
- children: a("integrations.mailbox.compose.sent", "Message sent")
659
+ children: o("integrations.mailbox.compose.sent", "Message sent")
498
660
  }),
499
- /* @__PURE__ */ A("div", {
661
+ /* @__PURE__ */ H("div", {
500
662
  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, {
663
+ children: [/* @__PURE__ */ V("section", {
664
+ "aria-label": o("integrations.mailbox.list.ariaLabel", "Messages"),
665
+ className: n("rounded-xl border border-border-subtle bg-bg-surface overflow-hidden", w && "hidden lg:block"),
666
+ children: /* @__PURE__ */ V(Z, {
505
667
  messages: h,
506
- loading: _,
507
- error: v,
508
- refetch: y,
509
- folder: o.folder,
510
- threadId: o.threadId,
511
- hasPrevious: o.pageTokens.length > 1,
668
+ loading: v,
669
+ error: b,
670
+ refetch: x,
671
+ folder: s.folder,
672
+ threadId: s.threadId,
673
+ hasPrevious: s.pageTokens.length > 1,
512
674
  nextPageToken: g,
513
- onOpen: b,
514
- onPrevious: o.previousPage,
515
- onNext: o.nextPage
675
+ onOpen: C,
676
+ onPrevious: s.previousPage,
677
+ onNext: s.nextPage
516
678
  })
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,
679
+ }), /* @__PURE__ */ V("section", {
680
+ className: n(!w && "hidden lg:block"),
681
+ children: s.composing && d ? /* @__PURE__ */ V(Y, {
682
+ connectionId: d,
683
+ kind: u?.kind ?? i.Gmail,
684
+ onClose: s.closeCompose,
522
685
  onSent: () => {
523
- o.composeSent(), o.folder === r.Sent && y();
686
+ s.composeSent(), s.folder === r.Sent && x();
524
687
  }
525
- }) : o.threadId && m ? /* @__PURE__ */ k(R, {
526
- connectionId: m,
527
- threadId: o.threadId,
688
+ }) : s.threadId && d ? /* @__PURE__ */ V(X, {
689
+ connectionId: d,
690
+ kind: u?.kind ?? i.Gmail,
691
+ threadId: s.threadId,
528
692
  accountEmail: u?.emailAddress ?? null,
529
- onBack: o.closeThread
530
- }, `${m}:${o.threadId}`) : /* @__PURE__ */ k("div", {
693
+ onBack: s.closeThread,
694
+ onRemoved: (e) => {
695
+ s.closeThread(), m(e === "archived" ? o("integrations.mailbox.notice.archived", "Conversation archived") : o("integrations.mailbox.notice.trashed", "Conversation moved to the trash")), x();
696
+ }
697
+ }, `${d}:${s.threadId}`) : /* @__PURE__ */ V("div", {
531
698
  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")
699
+ children: o("integrations.mailbox.thread.placeholder", "Select a message to read it")
533
700
  })
534
701
  })]
535
702
  })
536
703
  ]
537
704
  });
538
705
  }
539
- function W() {
540
- let { accounts: e, answered: t, error: n } = s();
541
- return !t && !n ? /* @__PURE__ */ k("div", {
706
+ function re() {
707
+ let { accounts: e, answered: t, error: n } = d();
708
+ return !t && !n ? /* @__PURE__ */ V("div", {
542
709
  className: "flex items-center justify-center py-24",
543
710
  "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 });
711
+ children: /* @__PURE__ */ V(k, { className: "size-6 animate-spin text-primary" })
712
+ }) : e.length === 0 ? /* @__PURE__ */ V(Q, { errorMessage: n?.message ?? null }) : /* @__PURE__ */ V(ne, { accounts: e });
546
713
  }
547
714
  //#endregion
548
- export { W as MailboxInbox };
715
+ export { re as MailboxInbox };
549
716
 
550
717
  //# sourceMappingURL=MailboxInbox.js.map