@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.
- package/dist/generated/global-types.d.ts +208 -168
- package/dist/generated/global-types.d.ts.map +1 -1
- package/dist/generated/wspace-operations.d.ts +235 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +206 -103
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +8724 -352
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js +5 -1
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/integrations/components/MailMessageBody.d.ts +7 -0
- package/dist/integrations/components/MailMessageBody.d.ts.map +1 -0
- package/dist/integrations/components/MailMessageBody.js +175 -0
- package/dist/integrations/components/MailMessageBody.js.map +1 -0
- package/dist/integrations/hooks/useMailbox.d.ts +65 -4
- package/dist/integrations/hooks/useMailbox.d.ts.map +1 -1
- package/dist/integrations/hooks/useMailbox.js +108 -29
- package/dist/integrations/hooks/useMailbox.js.map +1 -1
- package/dist/integrations/pages/MailboxInbox.d.ts.map +1 -1
- package/dist/integrations/pages/MailboxInbox.js +418 -251
- package/dist/integrations/pages/MailboxInbox.js.map +1 -1
- package/dist/integrations/store/mailboxStore.d.ts +3 -0
- package/dist/integrations/store/mailboxStore.d.ts.map +1 -1
- package/dist/integrations/store/mailboxStore.js +7 -0
- package/dist/integrations/store/mailboxStore.js.map +1 -1
- package/dist/integrations/utils/mailHtml.d.ts +33 -0
- package/dist/integrations/utils/mailHtml.d.ts.map +1 -0
- package/dist/integrations/utils/mailHtml.js +127 -0
- package/dist/integrations/utils/mailHtml.js.map +1 -0
- package/dist/node_modules/dompurify/dist/purify.es.js +894 -0
- package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -0
- 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
|
|
6
|
-
import { joinPath as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
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
|
|
17
|
+
function K(e) {
|
|
15
18
|
return e ? e.name ? `${e.name} <${e.email}>` : e.email : "";
|
|
16
19
|
}
|
|
17
|
-
function
|
|
20
|
+
function q(e) {
|
|
18
21
|
return e ? e.name || e.email : "";
|
|
19
22
|
}
|
|
20
|
-
var
|
|
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
|
|
38
|
-
let { connectionId: r,
|
|
39
|
-
|
|
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
|
|
67
|
+
await f({
|
|
42
68
|
connectionId: r,
|
|
43
|
-
to:
|
|
44
|
-
cc:
|
|
45
|
-
subject:
|
|
46
|
-
bodyText:
|
|
47
|
-
replyToMessageId:
|
|
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
|
-
|
|
77
|
+
G(e instanceof Error ? e.message : c("integrations.mailbox.compose.failed", "Could not send"));
|
|
51
78
|
}
|
|
52
|
-
},
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
onSubmit:
|
|
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":
|
|
83
|
+
"aria-label": a ? c("integrations.mailbox.compose.replyTitle", "Reply") : c("integrations.mailbox.compose.title", "New message"),
|
|
57
84
|
children: [
|
|
58
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ H("div", {
|
|
59
86
|
className: "flex items-center justify-between",
|
|
60
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ V("h2", {
|
|
61
88
|
className: "text-sm font-semibold text-text-primary",
|
|
62
|
-
children:
|
|
63
|
-
}), /* @__PURE__ */
|
|
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:
|
|
68
|
-
disabled:
|
|
94
|
+
onClick: o,
|
|
95
|
+
disabled: p,
|
|
69
96
|
"aria-label": c("integrations.common.close", "Close"),
|
|
70
|
-
children: /* @__PURE__ */
|
|
97
|
+
children: /* @__PURE__ */ V(z, { size: 16 })
|
|
71
98
|
})]
|
|
72
99
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ H("div", {
|
|
74
101
|
className: "space-y-1",
|
|
75
|
-
children: [/* @__PURE__ */
|
|
76
|
-
htmlFor: `${
|
|
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__ */
|
|
80
|
-
id: `${
|
|
106
|
+
}), /* @__PURE__ */ V("input", {
|
|
107
|
+
id: `${d}-to`,
|
|
81
108
|
type: "text",
|
|
82
|
-
value:
|
|
83
|
-
onChange: (e) =>
|
|
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:
|
|
112
|
+
className: q,
|
|
86
113
|
required: !0
|
|
87
114
|
})]
|
|
88
115
|
}),
|
|
89
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ H("div", {
|
|
90
117
|
className: "space-y-1",
|
|
91
|
-
children: [/* @__PURE__ */
|
|
92
|
-
htmlFor: `${
|
|
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__ */
|
|
96
|
-
id: `${
|
|
122
|
+
}), /* @__PURE__ */ V("input", {
|
|
123
|
+
id: `${d}-cc`,
|
|
97
124
|
type: "text",
|
|
98
|
-
value:
|
|
99
|
-
onChange: (e) =>
|
|
100
|
-
className:
|
|
125
|
+
value: N,
|
|
126
|
+
onChange: (e) => P(e.target.value),
|
|
127
|
+
className: q
|
|
101
128
|
})]
|
|
102
129
|
}),
|
|
103
|
-
!
|
|
130
|
+
!a && /* @__PURE__ */ H("div", {
|
|
104
131
|
className: "space-y-1",
|
|
105
|
-
children: [/* @__PURE__ */
|
|
106
|
-
htmlFor: `${
|
|
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__ */
|
|
110
|
-
id: `${
|
|
136
|
+
}), /* @__PURE__ */ V("input", {
|
|
137
|
+
id: `${d}-subject`,
|
|
111
138
|
type: "text",
|
|
112
|
-
value:
|
|
113
|
-
onChange: (e) =>
|
|
139
|
+
value: F,
|
|
140
|
+
onChange: (e) => I(e.target.value),
|
|
114
141
|
maxLength: 998,
|
|
115
|
-
className:
|
|
142
|
+
className: q
|
|
116
143
|
})]
|
|
117
144
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ H("div", {
|
|
119
146
|
className: "space-y-1",
|
|
120
|
-
children: [/* @__PURE__ */
|
|
121
|
-
htmlFor: `${
|
|
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__ */
|
|
125
|
-
id: `${
|
|
126
|
-
value:
|
|
127
|
-
onChange: (e) =>
|
|
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(
|
|
156
|
+
className: n(q, "resize-y"),
|
|
130
157
|
required: !0
|
|
131
158
|
})]
|
|
132
159
|
}),
|
|
133
|
-
|
|
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:
|
|
223
|
+
children: W
|
|
137
224
|
}),
|
|
138
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ H("div", {
|
|
139
226
|
className: "flex justify-end gap-2",
|
|
140
|
-
children: [/* @__PURE__ */
|
|
227
|
+
children: [/* @__PURE__ */ V(U, {
|
|
141
228
|
type: "button",
|
|
142
229
|
variant: "outline",
|
|
143
|
-
onClick:
|
|
144
|
-
disabled:
|
|
230
|
+
onClick: o,
|
|
231
|
+
disabled: p,
|
|
145
232
|
children: c("integrations.common.cancel", "Cancel")
|
|
146
|
-
}), /* @__PURE__ */
|
|
233
|
+
}), /* @__PURE__ */ H(U, {
|
|
147
234
|
type: "submit",
|
|
148
|
-
disabled:
|
|
149
|
-
children: [
|
|
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__ */
|
|
239
|
+
}) : /* @__PURE__ */ V(L, { size: 16 }), c("integrations.mailbox.compose.send", "Send")]
|
|
153
240
|
})]
|
|
154
241
|
})
|
|
155
242
|
]
|
|
156
243
|
});
|
|
157
244
|
}
|
|
158
|
-
function
|
|
159
|
-
let { connectionId: n,
|
|
160
|
-
|
|
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
|
|
256
|
+
children: /* @__PURE__ */ V(k, { className: "size-6 animate-spin text-primary" })
|
|
163
257
|
});
|
|
164
|
-
if (
|
|
258
|
+
if (_ || !p) return /* @__PURE__ */ H("div", {
|
|
165
259
|
className: "p-6 space-y-3 text-center",
|
|
166
|
-
children: [/* @__PURE__ */
|
|
260
|
+
children: [/* @__PURE__ */ V("p", {
|
|
167
261
|
role: "alert",
|
|
168
262
|
className: "text-sm text-status-error-text",
|
|
169
|
-
children:
|
|
170
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
266
|
+
children: [/* @__PURE__ */ H(U, {
|
|
173
267
|
variant: "ghost",
|
|
174
|
-
onClick:
|
|
268
|
+
onClick: l,
|
|
175
269
|
children: [
|
|
176
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ V(D, { size: 16 }),
|
|
177
271
|
" ",
|
|
178
|
-
|
|
272
|
+
d("integrations.common.back", "Back")
|
|
179
273
|
]
|
|
180
|
-
}), /* @__PURE__ */
|
|
274
|
+
}), /* @__PURE__ */ H(U, {
|
|
181
275
|
variant: "outline",
|
|
182
|
-
onClick: () =>
|
|
276
|
+
onClick: () => v(),
|
|
183
277
|
children: [
|
|
184
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ V(P, { size: 16 }),
|
|
185
279
|
" ",
|
|
186
|
-
|
|
280
|
+
d("integrations.mailbox.actions.retry", "Try again")
|
|
187
281
|
]
|
|
188
282
|
})]
|
|
189
283
|
})]
|
|
190
284
|
});
|
|
191
|
-
let
|
|
192
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
290
|
+
/* @__PURE__ */ H("div", {
|
|
197
291
|
className: "flex items-start gap-2",
|
|
198
|
-
children: [
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
|
|
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__ */
|
|
345
|
+
children: [/* @__PURE__ */ H("header", {
|
|
213
346
|
className: "flex flex-wrap items-baseline justify-between gap-2",
|
|
214
|
-
children: [/* @__PURE__ */
|
|
347
|
+
children: [/* @__PURE__ */ H("div", {
|
|
215
348
|
className: "min-w-0",
|
|
216
|
-
children: [/* @__PURE__ */
|
|
349
|
+
children: [/* @__PURE__ */ V("p", {
|
|
217
350
|
className: "text-sm font-medium text-text-primary break-all",
|
|
218
|
-
children:
|
|
219
|
-
}), /* @__PURE__ */
|
|
351
|
+
children: K(e.from)
|
|
352
|
+
}), /* @__PURE__ */ H("p", {
|
|
220
353
|
className: "text-xs text-text-secondary break-all",
|
|
221
354
|
children: [
|
|
222
|
-
|
|
355
|
+
d("integrations.mailbox.thread.to", "To"),
|
|
223
356
|
":",
|
|
224
357
|
" ",
|
|
225
|
-
e.to.map(
|
|
226
|
-
e.cc.length > 0 && ` · ${
|
|
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__ */
|
|
362
|
+
}), /* @__PURE__ */ H("div", {
|
|
230
363
|
className: "flex items-center gap-2 text-xs text-text-tertiary",
|
|
231
|
-
children: [e.hasAttachments && /* @__PURE__ */
|
|
364
|
+
children: [e.hasAttachments && /* @__PURE__ */ V(M, {
|
|
232
365
|
size: 14,
|
|
233
|
-
"aria-label":
|
|
234
|
-
}), e.receivedAt && /* @__PURE__ */
|
|
366
|
+
"aria-label": d("integrations.mailbox.attachments", "Has attachments")
|
|
367
|
+
}), e.receivedAt && /* @__PURE__ */ V("time", {
|
|
235
368
|
dateTime: e.receivedAt,
|
|
236
|
-
children:
|
|
369
|
+
children: f(e.receivedAt)
|
|
237
370
|
})]
|
|
238
371
|
})]
|
|
239
|
-
}), /* @__PURE__ */
|
|
240
|
-
|
|
241
|
-
|
|
372
|
+
}), /* @__PURE__ */ V(x, {
|
|
373
|
+
connectionId: n,
|
|
374
|
+
message: e
|
|
242
375
|
})]
|
|
243
376
|
}, e.id)),
|
|
244
|
-
|
|
377
|
+
L && /* @__PURE__ */ V("p", {
|
|
245
378
|
role: "status",
|
|
246
379
|
className: "text-sm text-status-success-text",
|
|
247
|
-
children:
|
|
380
|
+
children: d("integrations.mailbox.compose.sent", "Message sent")
|
|
248
381
|
}),
|
|
249
|
-
|
|
382
|
+
B && (N ? /* @__PURE__ */ V(Y, {
|
|
250
383
|
connectionId: n,
|
|
384
|
+
kind: r,
|
|
251
385
|
replyTo: {
|
|
252
|
-
messageId:
|
|
253
|
-
to:
|
|
254
|
-
subject:
|
|
386
|
+
messageId: B.id,
|
|
387
|
+
to: G.filter(Boolean).join(", "),
|
|
388
|
+
subject: p.subject
|
|
255
389
|
},
|
|
256
|
-
onClose: () =>
|
|
390
|
+
onClose: () => I(!1),
|
|
257
391
|
onSent: () => {
|
|
258
|
-
|
|
392
|
+
I(!1), z(!0), v();
|
|
259
393
|
}
|
|
260
|
-
}) : /* @__PURE__ */
|
|
394
|
+
}) : /* @__PURE__ */ H(U, {
|
|
261
395
|
variant: "outline",
|
|
262
|
-
onClick: () =>
|
|
396
|
+
onClick: () => I(!0),
|
|
263
397
|
children: [
|
|
264
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ V(F, { size: 16 }),
|
|
265
399
|
" ",
|
|
266
|
-
|
|
400
|
+
d("integrations.mailbox.actions.reply", "Reply")
|
|
267
401
|
]
|
|
268
402
|
}))
|
|
269
403
|
]
|
|
270
404
|
});
|
|
271
405
|
}
|
|
272
|
-
function
|
|
273
|
-
let { messages:
|
|
274
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
414
|
+
}), /* @__PURE__ */ H(U, {
|
|
281
415
|
variant: "outline",
|
|
282
416
|
onClick: () => c(),
|
|
283
417
|
children: [
|
|
284
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ V(P, { size: 16 }),
|
|
285
419
|
" ",
|
|
286
420
|
g("integrations.mailbox.actions.retry", "Try again")
|
|
287
421
|
]
|
|
288
422
|
})]
|
|
289
|
-
}) :
|
|
423
|
+
}) : a && i.length === 0 ? /* @__PURE__ */ V("div", {
|
|
290
424
|
className: "flex items-center justify-center py-16",
|
|
291
|
-
children: /* @__PURE__ */ k
|
|
292
|
-
}) :
|
|
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__ */
|
|
429
|
+
}) : /* @__PURE__ */ V("ul", {
|
|
296
430
|
className: "divide-y divide-border-subtle",
|
|
297
431
|
"data-testid": "mailbox-message-list",
|
|
298
|
-
children:
|
|
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__ */
|
|
438
|
+
/* @__PURE__ */ H("div", {
|
|
305
439
|
className: "flex items-center justify-between gap-2",
|
|
306
|
-
children: [/* @__PURE__ */
|
|
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(
|
|
309
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
313
|
-
e.isUnread ? /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
462
|
+
}), (d || f) && /* @__PURE__ */ H("div", {
|
|
329
463
|
className: "flex justify-between gap-2 border-t border-border-subtle p-3",
|
|
330
|
-
children: [/* @__PURE__ */
|
|
464
|
+
children: [/* @__PURE__ */ V(U, {
|
|
331
465
|
variant: "outline",
|
|
332
466
|
size: "sm",
|
|
333
|
-
disabled: !d ||
|
|
467
|
+
disabled: !d || a,
|
|
334
468
|
onClick: m,
|
|
335
469
|
children: g("integrations.common.previous", "Previous")
|
|
336
|
-
}), /* @__PURE__ */
|
|
470
|
+
}), /* @__PURE__ */ V(U, {
|
|
337
471
|
variant: "outline",
|
|
338
472
|
size: "sm",
|
|
339
|
-
disabled: !f ||
|
|
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
|
|
346
|
-
let r = t(), { basePath: i = "/", navigate:
|
|
347
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
350
|
-
icon: /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
361
|
-
onClick: () =>
|
|
494
|
+
action: /* @__PURE__ */ H(U, {
|
|
495
|
+
onClick: () => a?.(o),
|
|
362
496
|
children: [
|
|
363
|
-
/* @__PURE__ */
|
|
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
|
|
372
|
-
let { accounts: n, connectionId: r } = e, i = t(), a =
|
|
373
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
509
|
+
children: /* @__PURE__ */ H("div", {
|
|
376
510
|
className: "flex flex-wrap items-center justify-between gap-4",
|
|
377
|
-
children: [/* @__PURE__ */
|
|
511
|
+
children: [/* @__PURE__ */ H("div", {
|
|
378
512
|
className: "flex items-center gap-3",
|
|
379
|
-
children: [/* @__PURE__ */
|
|
513
|
+
children: [/* @__PURE__ */ V("div", {
|
|
380
514
|
className: "p-2.5 rounded-lg bg-action-primary-bg/10",
|
|
381
|
-
children: /* @__PURE__ */
|
|
515
|
+
children: /* @__PURE__ */ V(O, {
|
|
382
516
|
size: 24,
|
|
383
517
|
className: "text-primary"
|
|
384
518
|
})
|
|
385
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
526
|
+
}), /* @__PURE__ */ H("div", {
|
|
393
527
|
className: "flex flex-wrap items-center gap-2",
|
|
394
|
-
children: [n.length > 1 && /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
542
|
+
})] }), /* @__PURE__ */ H(U, {
|
|
409
543
|
onClick: c,
|
|
410
544
|
children: [
|
|
411
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
421
|
-
|
|
422
|
-
|
|
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__ */
|
|
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:
|
|
564
|
+
children: J.map((e) => /* @__PURE__ */ V("button", {
|
|
430
565
|
type: "button",
|
|
431
|
-
"aria-pressed":
|
|
432
|
-
onClick: () =>
|
|
433
|
-
className: n("px-3 py-1.5 text-sm rounded-md transition-colors",
|
|
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__ */
|
|
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(),
|
|
595
|
+
e.preventDefault(), d(h);
|
|
441
596
|
},
|
|
442
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
600
|
+
}), /* @__PURE__ */ V("input", {
|
|
446
601
|
type: "search",
|
|
447
|
-
value:
|
|
448
|
-
onChange: (e) =>
|
|
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__ */
|
|
610
|
+
/* @__PURE__ */ H(U, {
|
|
456
611
|
variant: "outline",
|
|
457
612
|
onClick: e.onRefresh,
|
|
458
613
|
disabled: e.loading,
|
|
459
614
|
children: [
|
|
460
|
-
/* @__PURE__ */
|
|
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
|
|
472
|
-
let { accounts:
|
|
473
|
-
|
|
474
|
-
let u =
|
|
475
|
-
connectionId:
|
|
476
|
-
folder:
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
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__ */
|
|
487
|
-
accounts:
|
|
488
|
-
connectionId:
|
|
642
|
+
/* @__PURE__ */ V($, {
|
|
643
|
+
accounts: a,
|
|
644
|
+
connectionId: d
|
|
489
645
|
}),
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
|
|
492
|
-
|
|
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
|
-
|
|
656
|
+
s.sentNotice && /* @__PURE__ */ V("p", {
|
|
495
657
|
role: "status",
|
|
496
658
|
className: "text-sm text-status-success-text",
|
|
497
|
-
children:
|
|
659
|
+
children: o("integrations.mailbox.compose.sent", "Message sent")
|
|
498
660
|
}),
|
|
499
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ H("div", {
|
|
500
662
|
className: "grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]",
|
|
501
|
-
children: [/* @__PURE__ */
|
|
502
|
-
"aria-label":
|
|
503
|
-
className: n("rounded-xl border border-border-subtle bg-bg-surface overflow-hidden",
|
|
504
|
-
children: /* @__PURE__ */
|
|
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:
|
|
508
|
-
refetch:
|
|
509
|
-
folder:
|
|
510
|
-
threadId:
|
|
511
|
-
hasPrevious:
|
|
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:
|
|
514
|
-
onPrevious:
|
|
515
|
-
onNext:
|
|
675
|
+
onOpen: C,
|
|
676
|
+
onPrevious: s.previousPage,
|
|
677
|
+
onNext: s.nextPage
|
|
516
678
|
})
|
|
517
|
-
}), /* @__PURE__ */
|
|
518
|
-
className: n(!
|
|
519
|
-
children:
|
|
520
|
-
connectionId:
|
|
521
|
-
|
|
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
|
-
|
|
686
|
+
s.composeSent(), s.folder === r.Sent && x();
|
|
524
687
|
}
|
|
525
|
-
}) :
|
|
526
|
-
connectionId:
|
|
527
|
-
|
|
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:
|
|
530
|
-
|
|
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:
|
|
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
|
|
540
|
-
let { accounts: e, answered: t, error: n } =
|
|
541
|
-
return !t && !n ? /* @__PURE__ */
|
|
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
|
|
545
|
-
}) : e.length === 0 ? /* @__PURE__ */
|
|
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 {
|
|
715
|
+
export { re as MailboxInbox };
|
|
549
716
|
|
|
550
717
|
//# sourceMappingURL=MailboxInbox.js.map
|