@burdenoff/microfe-integrations 2026.1107.1 → 2026.1109.1

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