@agent-native/dispatch 0.35.0 → 0.35.1-nightly-20260908195301

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.
@@ -1 +1 @@
1
- {"version":3,"file":"transactional-email-send-log.d.ts","sourceRoot":"","sources":["../../src/components/transactional-email-send-log.tsx"],"names":[],"mappings":"AA+GA,wBAAgB,cAAc,CAAC,EAC7B,IAAI,GACL,EAAE;IACD,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACpD,0DA2NA"}
1
+ {"version":3,"file":"transactional-email-send-log.d.ts","sourceRoot":"","sources":["../../src/components/transactional-email-send-log.tsx"],"names":[],"mappings":"AA8PA,wBAAgB,cAAc,CAAC,EAC7B,IAAI,GACL,EAAE;IACD,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACpD,0DAoWA"}
@@ -1,14 +1,17 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useT } from "@agent-native/core/client/i18n";
3
3
  import { DateRangePicker, dateRangeToInterval, } from "@agent-native/toolkit/dashboard";
4
+ import { IconCheck, IconChevronDown, IconX } from "@tabler/icons-react";
4
5
  import { useQuery } from "@tanstack/react-query";
5
- import { useEffect, useState } from "react";
6
- import { callAppAction } from "../client/transactional-emails.js";
6
+ import { useEffect, useId, useState } from "react";
7
+ import { callAppAction, } from "../client/transactional-emails.js";
7
8
  import { ActionQueryError } from "./action-query-error.js";
8
9
  import { Badge } from "./ui/badge.js";
9
10
  import { Button } from "./ui/button.js";
11
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "./ui/command.js";
10
12
  import { Dialog, DialogContent, DialogHeader, DialogTitle } from "./ui/dialog.js";
11
13
  import { Input } from "./ui/input.js";
14
+ import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover.js";
12
15
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "./ui/select.js";
13
16
  import { Skeleton } from "./ui/skeleton.js";
14
17
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "./ui/table.js";
@@ -22,6 +25,36 @@ function useDebounced(value, delayMs = 300) {
22
25
  }, [value, delayMs]);
23
26
  return debounced;
24
27
  }
28
+ function AddressFilterControl({ dimension, contains, exclude, onContainsChange, onExcludeChange, }) {
29
+ const t = useT();
30
+ const containsId = useId();
31
+ const excludeId = useId();
32
+ const dimensionLabel = t(dimension === "to"
33
+ ? "dispatch.transactionalEmail.sendLogTo"
34
+ : "dispatch.transactionalEmail.sendLogFrom");
35
+ const filters = [
36
+ {
37
+ operator: t("dispatch.transactionalEmail.sendLogContainsOperator"),
38
+ value: contains,
39
+ clear: () => onContainsChange(""),
40
+ },
41
+ {
42
+ operator: t("dispatch.transactionalEmail.sendLogExcludeOperator"),
43
+ value: exclude,
44
+ clear: () => onExcludeChange(""),
45
+ },
46
+ ].filter((filter) => filter.value);
47
+ return (_jsxs(Popover, { children: [_jsxs("div", { className: "flex min-h-10 max-w-full flex-wrap items-center gap-1 rounded-md border border-input bg-background p-1", children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-8 shrink-0 gap-1 px-2", "aria-label": dimensionLabel, children: [dimensionLabel, _jsx(IconChevronDown, { "aria-hidden": "true", className: "size-3.5" })] }) }), filters.map((filter) => {
48
+ const label = `${filter.operator} ${filter.value}`;
49
+ return (_jsxs(Badge, { variant: "secondary", className: "min-w-0 max-w-full gap-1 pe-1 font-normal", children: [_jsx("span", { className: "max-w-44 truncate", children: label }), _jsx("button", { type: "button", className: "inline-flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "aria-label": t("dispatch.transactionalEmail.sendLogRemoveAddressFilter", { filter: label }), onClick: filter.clear, children: _jsx(IconX, { "aria-hidden": "true", className: "size-3" }) })] }, filter.operator));
50
+ })] }), _jsx(PopoverContent, { align: "start", className: "w-72 max-w-[calc(100vw-2rem)] p-3", children: _jsxs("div", { className: "grid gap-3", children: [_jsxs("label", { className: "grid gap-1.5 text-xs font-medium", htmlFor: containsId, children: [t("dispatch.transactionalEmail.sendLogContainsOperator"), _jsx(Input, { id: containsId, value: contains, placeholder: t("dispatch.transactionalEmail.sendLogContainsPlaceholder"), onChange: (event) => onContainsChange(event.target.value), "aria-label": t("dispatch.transactionalEmail.sendLogAddressFilterLabel", {
51
+ dimension: dimensionLabel,
52
+ operator: t("dispatch.transactionalEmail.sendLogContainsOperator"),
53
+ }) })] }), _jsxs("label", { className: "grid gap-1.5 text-xs font-medium", htmlFor: excludeId, children: [t("dispatch.transactionalEmail.sendLogExcludeOperator"), _jsx(Input, { id: excludeId, value: exclude, placeholder: t("dispatch.transactionalEmail.sendLogExcludePlaceholder"), onChange: (event) => onExcludeChange(event.target.value), "aria-label": t("dispatch.transactionalEmail.sendLogAddressFilterLabel", {
54
+ dimension: dimensionLabel,
55
+ operator: t("dispatch.transactionalEmail.sendLogExcludeOperator"),
56
+ }) })] })] }) })] }));
57
+ }
25
58
  function SendLogDetailDialog({ entry, open, onOpenChange, }) {
26
59
  const t = useT();
27
60
  if (!entry)
@@ -32,33 +65,68 @@ export function SendLogSection({ apps, }) {
32
65
  const t = useT();
33
66
  const [appId, setAppId] = useState(apps[0]?.id);
34
67
  const [dateRange, setDateRange] = useState("7d");
68
+ const [templateId, setTemplateId] = useState("all");
69
+ const [templatePopoverOpen, setTemplatePopoverOpen] = useState(false);
35
70
  const [to, setTo] = useState("");
71
+ const [excludeTo, setExcludeTo] = useState("");
36
72
  const [from, setFrom] = useState("");
73
+ const [excludeFrom, setExcludeFrom] = useState("");
37
74
  const [status, setStatus] = useState("all");
38
75
  const [provider, setProvider] = useState("all");
39
76
  const [offset, setOffset] = useState(0);
40
77
  const [selected, setSelected] = useState(null);
41
78
  const debouncedTo = useDebounced(to);
79
+ const debouncedExcludeTo = useDebounced(excludeTo);
42
80
  const debouncedFrom = useDebounced(from);
81
+ const debouncedExcludeFrom = useDebounced(excludeFrom);
43
82
  const selectedApp = apps.find((app) => app.id === appId) ?? apps[0];
83
+ useEffect(() => {
84
+ setTemplateId("all");
85
+ }, [selectedApp?.path]);
44
86
  useEffect(() => {
45
87
  setOffset(0);
46
- }, [appId, dateRange, debouncedTo, debouncedFrom, status, provider]);
88
+ }, [
89
+ appId,
90
+ dateRange,
91
+ templateId,
92
+ debouncedTo,
93
+ debouncedExcludeTo,
94
+ debouncedFrom,
95
+ debouncedExcludeFrom,
96
+ status,
97
+ provider,
98
+ ]);
99
+ const catalogQuery = useQuery({
100
+ queryKey: ["send-log-email-catalog", selectedApp?.path],
101
+ queryFn: () => callAppAction(selectedApp.path, "list-transactional-emails", { windowDays: 30 }, "GET"),
102
+ enabled: Boolean(selectedApp),
103
+ staleTime: Infinity,
104
+ });
105
+ const templates = [...(catalogQuery.data?.emails ?? [])].sort((a, b) => a.name.localeCompare(b.name) || a.id.localeCompare(b.id));
106
+ const selectedTemplate = templates.find((email) => email.id === templateId);
47
107
  const query = useQuery({
48
108
  queryKey: [
49
109
  "list-email-log",
50
110
  selectedApp?.path,
51
111
  dateRange,
112
+ templateId,
52
113
  debouncedTo,
114
+ debouncedExcludeTo,
53
115
  debouncedFrom,
116
+ debouncedExcludeFrom,
54
117
  status,
55
118
  provider,
56
119
  offset,
57
120
  ],
58
121
  queryFn: () => callAppAction(selectedApp.path, "list-email-log", {
59
122
  sinceMs: Date.now() - dateRangeToInterval(dateRange) * 86_400_000,
123
+ ...(templateId !== "all" ? { templateId } : {}),
60
124
  ...(debouncedTo ? { to: debouncedTo } : {}),
125
+ ...(debouncedExcludeTo ? { excludeTo: debouncedExcludeTo } : {}),
61
126
  ...(debouncedFrom ? { from: debouncedFrom } : {}),
127
+ ...(debouncedExcludeFrom
128
+ ? { excludeFrom: debouncedExcludeFrom }
129
+ : {}),
62
130
  ...(status !== "all" ? { status } : {}),
63
131
  ...(provider !== "all" ? { provider } : {}),
64
132
  limit: PAGE_SIZE + 1,
@@ -70,9 +138,30 @@ export function SendLogSection({ apps, }) {
70
138
  const hasMore = (query.data?.entries.length ?? 0) > PAGE_SIZE;
71
139
  if (apps.length === 0)
72
140
  return null;
73
- return (_jsxs("div", { children: [_jsxs("div", { className: "mb-4 flex flex-wrap items-center gap-2", children: [_jsxs(Select, { value: selectedApp?.id, onValueChange: setAppId, children: [_jsx(SelectTrigger, { className: "w-48", children: _jsx(SelectValue, { placeholder: t("dispatch.transactionalEmail.app") }) }), _jsx(SelectContent, { children: apps.map((app) => (_jsx(SelectItem, { value: app.id, children: app.name }, app.id))) })] }), _jsx(DateRangePicker, { value: dateRange, onChange: setDateRange }), _jsx(Input, { placeholder: t("dispatch.transactionalEmail.sendLogToFilter"), value: to, onChange: (event) => setTo(event.target.value), className: "w-44" }), _jsx(Input, { placeholder: t("dispatch.transactionalEmail.sendLogFromFilter"), value: from, onChange: (event) => setFrom(event.target.value), className: "w-44" }), _jsxs(Select, { value: status, onValueChange: setStatus, children: [_jsx(SelectTrigger, { className: "w-32", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "all", children: t("dispatch.transactionalEmail.sendLogAllStatuses") }), _jsx(SelectItem, { value: "sent", children: t("dispatch.transactionalEmail.sendLogSent") }), _jsx(SelectItem, { value: "failed", children: t("dispatch.transactionalEmail.sendLogFailed") })] })] }), _jsxs(Select, { value: provider, onValueChange: setProvider, children: [_jsx(SelectTrigger, { className: "w-36", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "all", children: t("dispatch.transactionalEmail.sendLogAllProviders") }), _jsx(SelectItem, { value: "resend", children: "Resend" }), _jsx(SelectItem, { value: "sendgrid", children: "SendGrid" }), _jsx(SelectItem, { value: "dev", children: "Dev" })] })] }), (to || from || status !== "all" || provider !== "all") && (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => {
141
+ return (_jsxs("div", { children: [_jsxs("div", { className: "mb-4 flex flex-wrap items-center gap-2", children: [_jsxs(Select, { value: selectedApp?.id, onValueChange: setAppId, children: [_jsx(SelectTrigger, { className: "w-48", children: _jsx(SelectValue, { placeholder: t("dispatch.transactionalEmail.app") }) }), _jsx(SelectContent, { children: apps.map((app) => (_jsx(SelectItem, { value: app.id, children: app.name }, app.id))) })] }), _jsx(DateRangePicker, { value: dateRange, onChange: setDateRange }), _jsxs(Popover, { open: templatePopoverOpen, onOpenChange: setTemplatePopoverOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "outline", role: "combobox", "aria-expanded": templatePopoverOpen, "aria-label": t("dispatch.transactionalEmail.sendLogTemplate"), className: "w-64 justify-between", children: _jsx("span", { className: "truncate", children: selectedTemplate
142
+ ? `${selectedTemplate.name} · ${selectedTemplate.id}`
143
+ : t("dispatch.transactionalEmail.sendLogAllTemplates") }) }) }), _jsx(PopoverContent, { align: "start", className: "w-80 p-0", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: t("dispatch.transactionalEmail.sendLogSearchTemplates") }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: t("dispatch.transactionalEmail.sendLogNoTemplatesFound") }), _jsx(CommandGroup, { forceMount: true, children: _jsxs(CommandItem, { forceMount: true, value: "all", onSelect: () => {
144
+ setTemplateId("all");
145
+ setTemplatePopoverOpen(false);
146
+ }, children: [_jsx(IconCheck, { "aria-hidden": "true", className: templateId === "all"
147
+ ? "me-2 size-4"
148
+ : "me-2 size-4 opacity-0" }), t("dispatch.transactionalEmail.sendLogAllTemplates")] }) }), _jsx(CommandGroup, { children: templates.map((email) => (_jsxs(CommandItem, { value: email.id, keywords: [email.name], onSelect: () => {
149
+ setTemplateId(email.id);
150
+ setTemplatePopoverOpen(false);
151
+ }, children: [_jsx(IconCheck, { "aria-hidden": "true", className: templateId === email.id
152
+ ? "me-2 size-4"
153
+ : "me-2 size-4 opacity-0" }), _jsxs("span", { className: "truncate", children: [email.name, " \u00B7 ", email.id] })] }, email.id))) })] })] }) })] }), _jsx(AddressFilterControl, { dimension: "to", contains: to, exclude: excludeTo, onContainsChange: setTo, onExcludeChange: setExcludeTo }), _jsx(AddressFilterControl, { dimension: "from", contains: from, exclude: excludeFrom, onContainsChange: setFrom, onExcludeChange: setExcludeFrom }), _jsxs(Select, { value: status, onValueChange: setStatus, children: [_jsx(SelectTrigger, { className: "w-32", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "all", children: t("dispatch.transactionalEmail.sendLogAllStatuses") }), _jsx(SelectItem, { value: "sent", children: t("dispatch.transactionalEmail.sendLogSent") }), _jsx(SelectItem, { value: "failed", children: t("dispatch.transactionalEmail.sendLogFailed") })] })] }), _jsxs(Select, { value: provider, onValueChange: setProvider, children: [_jsx(SelectTrigger, { className: "w-36", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "all", children: t("dispatch.transactionalEmail.sendLogAllProviders") }), _jsx(SelectItem, { value: "resend", children: "Resend" }), _jsx(SelectItem, { value: "sendgrid", children: "SendGrid" }), _jsx(SelectItem, { value: "dev", children: "Dev" })] })] }), (templateId !== "all" ||
154
+ to ||
155
+ excludeTo ||
156
+ from ||
157
+ excludeFrom ||
158
+ status !== "all" ||
159
+ provider !== "all") && (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => {
160
+ setTemplateId("all");
74
161
  setTo("");
162
+ setExcludeTo("");
75
163
  setFrom("");
164
+ setExcludeFrom("");
76
165
  setStatus("all");
77
166
  setProvider("all");
78
167
  }, children: t("dispatch.transactionalEmail.sendLogClearFilters") }))] }), query.isError ? (_jsx(ActionQueryError, { error: query.error, onRetry: () => void query.refetch() })) : query.isLoading ? (_jsx(Skeleton, { className: "h-40 w-full" })) : entries.length === 0 ? (_jsx("div", { className: "rounded-xl border border-dashed px-4 py-8 text-center text-sm text-muted-foreground", children: t("dispatch.transactionalEmail.sendLogEmpty") })) : (_jsxs(_Fragment, { children: [_jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t("dispatch.transactionalEmail.sendLogTimestamp") }), _jsx(TableHead, { children: t("dispatch.transactionalEmail.recipient") }), _jsx(TableHead, { children: t("dispatch.transactionalEmail.sender") }), _jsx(TableHead, { children: t("dispatch.transactionalEmail.sendLogTemplate") }), _jsx(TableHead, { children: t("dispatch.transactionalEmail.status") }), _jsx(TableHead, { children: t("dispatch.transactionalEmail.sendLogProvider") })] }) }), _jsx(TableBody, { children: entries.map((entry) => (_jsxs(TableRow, { className: "cursor-pointer", onClick: () => setSelected(entry), children: [_jsx(TableCell, { className: "text-xs text-muted-foreground", children: new Date(entry.createdAt).toLocaleString() }), _jsx(TableCell, { className: "text-xs", children: entry.recipient }), _jsx(TableCell, { className: "text-xs", children: entry.sender }), _jsx(TableCell, { className: "font-mono text-xs", children: entry.templateId ?? "—" }), _jsx(TableCell, { children: _jsx(Badge, { variant: entry.status === "failed" ? "destructive" : "secondary", children: entry.status }) }), _jsx(TableCell, { className: "text-xs", children: entry.provider })] }, entry.id))) })] }), _jsxs("div", { className: "mt-3 flex justify-end gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", disabled: offset === 0, onClick: () => setOffset((current) => Math.max(0, current - PAGE_SIZE)), children: t("dispatch.transactionalEmail.sendLogPrevious") }), _jsx(Button, { variant: "outline", size: "sm", disabled: !hasMore, onClick: () => setOffset((current) => current + PAGE_SIZE), children: t("dispatch.transactionalEmail.sendLogNext") })] })] })), _jsx(SendLogDetailDialog, { entry: selected, open: selected !== null, onOpenChange: (next) => {
@@ -1 +1 @@
1
- {"version":3,"file":"transactional-email-send-log.js","sourceRoot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AC,CAAC,WAAW,YAGxD,KAAK,CAAC,MAAM,GACP,GACE,EACZ,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,YAAE,KAAK,CAAC,QAAQ,GAAa,KArBtD,KAAK,CAAC,EAAE,CAsBJ,CACZ,CAAC,GACQ,IACN,EACR,eAAK,SAAS,EAAC,6BAA6B,aAC1C,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,IAAI,EACT,QAAQ,EAAE,MAAM,KAAK,CAAC,EACtB,OAAO,EAAE,GAAG,EAAE,CACZ,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC,YAGzD,CAAC,CAAC,6CAA6C,CAAC,GAC1C,EACT,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,IAAI,EACT,QAAQ,EAAE,CAAC,OAAO,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,SAAS,CAAC,YAEzD,CAAC,CAAC,yCAAyC,CAAC,GACtC,IACL,IACL,CACJ,EAED,KAAC,mBAAmB,IAClB,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,QAAQ,KAAK,IAAI,EACvB,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;oBACrB,IAAI,CAAC,IAAI;wBAAE,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC/B,CAAC,GACD,IACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport {\n DateRangePicker,\n dateRangeToInterval,\n type DateRange,\n} from \"@agent-native/toolkit/dashboard\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useEffect, useState } from \"react\";\n\nimport { callAppAction } from \"../client/transactional-emails\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { Badge } from \"./ui/badge\";\nimport { Button } from \"./ui/button\";\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from \"./ui/dialog\";\nimport { Input } from \"./ui/input\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"./ui/select\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"./ui/table\";\n\ninterface SendLogEntry {\n id: string;\n templateId: string | null;\n app: string | null;\n recipient: string;\n sender: string;\n subject: string;\n status: string;\n error: string | null;\n provider: string;\n responseStatus: number | null;\n createdAt: number;\n}\n\n/** One page of `list-email-log`, fetched at `PAGE_SIZE + 1` to detect \"has more\". */\nconst PAGE_SIZE = 50;\n\nfunction useDebounced(value: string, delayMs = 300): string {\n const [debounced, setDebounced] = useState(value);\n useEffect(() => {\n const timer = setTimeout(() => setDebounced(value), delayMs);\n return () => clearTimeout(timer);\n }, [value, delayMs]);\n return debounced;\n}\n\nfunction SendLogDetailDialog({\n entry,\n open,\n onOpenChange,\n}: {\n entry: SendLogEntry | null;\n open: boolean;\n onOpenChange: (next: boolean) => void;\n}) {\n const t = useT();\n if (!entry) return null;\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent className=\"max-w-3xl\">\n <DialogHeader>\n <DialogTitle>{entry.subject}</DialogTitle>\n </DialogHeader>\n <div className=\"grid grid-cols-2 gap-x-6 gap-y-1 text-xs\">\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.recipient\")}\n </div>\n <div className=\"font-mono\">{entry.recipient}</div>\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sender\")}\n </div>\n <div className=\"font-mono\">{entry.sender}</div>\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sendLogTemplate\")}\n </div>\n <div className=\"font-mono\">{entry.templateId ?? \"—\"}</div>\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sendLogProvider\")}\n </div>\n <div>{entry.provider}</div>\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sendLogResponseStatus\")}\n </div>\n <div>{entry.responseStatus ?? \"—\"}</div>\n {entry.error ? (\n <>\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sendLogError\")}\n </div>\n <div className=\"text-destructive\">{entry.error}</div>\n </>\n ) : null}\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n\nexport function SendLogSection({\n apps,\n}: {\n apps: { id: string; name: string; path: string }[];\n}) {\n const t = useT();\n const [appId, setAppId] = useState<string | undefined>(apps[0]?.id);\n const [dateRange, setDateRange] = useState<DateRange>(\"7d\");\n const [to, setTo] = useState(\"\");\n const [from, setFrom] = useState(\"\");\n const [status, setStatus] = useState<string>(\"all\");\n const [provider, setProvider] = useState<string>(\"all\");\n const [offset, setOffset] = useState(0);\n const [selected, setSelected] = useState<SendLogEntry | null>(null);\n\n const debouncedTo = useDebounced(to);\n const debouncedFrom = useDebounced(from);\n const selectedApp = apps.find((app) => app.id === appId) ?? apps[0];\n\n useEffect(() => {\n setOffset(0);\n }, [appId, dateRange, debouncedTo, debouncedFrom, status, provider]);\n\n const query = useQuery({\n queryKey: [\n \"list-email-log\",\n selectedApp?.path,\n dateRange,\n debouncedTo,\n debouncedFrom,\n status,\n provider,\n offset,\n ],\n queryFn: () =>\n callAppAction<{ entries: SendLogEntry[] }>(\n selectedApp!.path,\n \"list-email-log\",\n {\n sinceMs: Date.now() - dateRangeToInterval(dateRange) * 86_400_000,\n ...(debouncedTo ? { to: debouncedTo } : {}),\n ...(debouncedFrom ? { from: debouncedFrom } : {}),\n ...(status !== \"all\" ? { status } : {}),\n ...(provider !== \"all\" ? { provider } : {}),\n limit: PAGE_SIZE + 1,\n offset,\n },\n \"GET\",\n ),\n enabled: Boolean(selectedApp),\n });\n\n const entries = (query.data?.entries ?? []).slice(0, PAGE_SIZE);\n const hasMore = (query.data?.entries.length ?? 0) > PAGE_SIZE;\n\n if (apps.length === 0) return null;\n\n return (\n <div>\n <div className=\"mb-4 flex flex-wrap items-center gap-2\">\n <Select value={selectedApp?.id} onValueChange={setAppId}>\n <SelectTrigger className=\"w-48\">\n <SelectValue placeholder={t(\"dispatch.transactionalEmail.app\")} />\n </SelectTrigger>\n <SelectContent>\n {apps.map((app) => (\n <SelectItem key={app.id} value={app.id}>\n {app.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <DateRangePicker value={dateRange} onChange={setDateRange} />\n <Input\n placeholder={t(\"dispatch.transactionalEmail.sendLogToFilter\")}\n value={to}\n onChange={(event) => setTo(event.target.value)}\n className=\"w-44\"\n />\n <Input\n placeholder={t(\"dispatch.transactionalEmail.sendLogFromFilter\")}\n value={from}\n onChange={(event) => setFrom(event.target.value)}\n className=\"w-44\"\n />\n <Select value={status} onValueChange={setStatus}>\n <SelectTrigger className=\"w-32\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"all\">\n {t(\"dispatch.transactionalEmail.sendLogAllStatuses\")}\n </SelectItem>\n <SelectItem value=\"sent\">\n {t(\"dispatch.transactionalEmail.sendLogSent\")}\n </SelectItem>\n <SelectItem value=\"failed\">\n {t(\"dispatch.transactionalEmail.sendLogFailed\")}\n </SelectItem>\n </SelectContent>\n </Select>\n <Select value={provider} onValueChange={setProvider}>\n <SelectTrigger className=\"w-36\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"all\">\n {t(\"dispatch.transactionalEmail.sendLogAllProviders\")}\n </SelectItem>\n <SelectItem value=\"resend\">Resend</SelectItem>\n <SelectItem value=\"sendgrid\">SendGrid</SelectItem>\n <SelectItem value=\"dev\">Dev</SelectItem>\n </SelectContent>\n </Select>\n {(to || from || status !== \"all\" || provider !== \"all\") && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n setTo(\"\");\n setFrom(\"\");\n setStatus(\"all\");\n setProvider(\"all\");\n }}\n >\n {t(\"dispatch.transactionalEmail.sendLogClearFilters\")}\n </Button>\n )}\n </div>\n\n {query.isError ? (\n <ActionQueryError\n error={query.error}\n onRetry={() => void query.refetch()}\n />\n ) : query.isLoading ? (\n <Skeleton className=\"h-40 w-full\" />\n ) : entries.length === 0 ? (\n <div className=\"rounded-xl border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sendLogEmpty\")}\n </div>\n ) : (\n <>\n <Table>\n <TableHeader>\n <TableRow>\n <TableHead>\n {t(\"dispatch.transactionalEmail.sendLogTimestamp\")}\n </TableHead>\n <TableHead>\n {t(\"dispatch.transactionalEmail.recipient\")}\n </TableHead>\n <TableHead>{t(\"dispatch.transactionalEmail.sender\")}</TableHead>\n <TableHead>\n {t(\"dispatch.transactionalEmail.sendLogTemplate\")}\n </TableHead>\n <TableHead>{t(\"dispatch.transactionalEmail.status\")}</TableHead>\n <TableHead>\n {t(\"dispatch.transactionalEmail.sendLogProvider\")}\n </TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {entries.map((entry) => (\n <TableRow\n key={entry.id}\n className=\"cursor-pointer\"\n onClick={() => setSelected(entry)}\n >\n <TableCell className=\"text-xs text-muted-foreground\">\n {new Date(entry.createdAt).toLocaleString()}\n </TableCell>\n <TableCell className=\"text-xs\">{entry.recipient}</TableCell>\n <TableCell className=\"text-xs\">{entry.sender}</TableCell>\n <TableCell className=\"font-mono text-xs\">\n {entry.templateId ?? \"—\"}\n </TableCell>\n <TableCell>\n <Badge\n variant={\n entry.status === \"failed\" ? \"destructive\" : \"secondary\"\n }\n >\n {entry.status}\n </Badge>\n </TableCell>\n <TableCell className=\"text-xs\">{entry.provider}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <div className=\"mt-3 flex justify-end gap-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={offset === 0}\n onClick={() =>\n setOffset((current) => Math.max(0, current - PAGE_SIZE))\n }\n >\n {t(\"dispatch.transactionalEmail.sendLogPrevious\")}\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={!hasMore}\n onClick={() => setOffset((current) => current + PAGE_SIZE)}\n >\n {t(\"dispatch.transactionalEmail.sendLogNext\")}\n </Button>\n </div>\n </>\n )}\n\n <SendLogDetailDialog\n entry={selected}\n open={selected !== null}\n onOpenChange={(next) => {\n if (!next) setSelected(null);\n }}\n />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"transactional-email-send-log.js","sourceRoot":"","sources":["../../src/components/transactional-email-send-log.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EACL,aAAa,GAEd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,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C,IAAI;wBAAE,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC/B,CAAC,GACD,IACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport {\n DateRangePicker,\n dateRangeToInterval,\n type DateRange,\n} from \"@agent-native/toolkit/dashboard\";\nimport { IconCheck, IconChevronDown, IconX } from \"@tabler/icons-react\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useEffect, useId, useState } from \"react\";\n\nimport {\n callAppAction,\n type LocalTransactionalEmailCatalog,\n} from \"../client/transactional-emails\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { Badge } from \"./ui/badge\";\nimport { Button } from \"./ui/button\";\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n} from \"./ui/command\";\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from \"./ui/dialog\";\nimport { Input } from \"./ui/input\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./ui/popover\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"./ui/select\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"./ui/table\";\n\ninterface SendLogEntry {\n id: string;\n templateId: string | null;\n app: string | null;\n recipient: string;\n sender: string;\n subject: string;\n status: string;\n error: string | null;\n provider: string;\n responseStatus: number | null;\n createdAt: number;\n}\n\n/** One page of `list-email-log`, fetched at `PAGE_SIZE + 1` to detect \"has more\". */\nconst PAGE_SIZE = 50;\n\nfunction useDebounced(value: string, delayMs = 300): string {\n const [debounced, setDebounced] = useState(value);\n useEffect(() => {\n const timer = setTimeout(() => setDebounced(value), delayMs);\n return () => clearTimeout(timer);\n }, [value, delayMs]);\n return debounced;\n}\n\nfunction AddressFilterControl({\n dimension,\n contains,\n exclude,\n onContainsChange,\n onExcludeChange,\n}: {\n dimension: \"to\" | \"from\";\n contains: string;\n exclude: string;\n onContainsChange: (value: string) => void;\n onExcludeChange: (value: string) => void;\n}) {\n const t = useT();\n const containsId = useId();\n const excludeId = useId();\n const dimensionLabel = t(\n dimension === \"to\"\n ? \"dispatch.transactionalEmail.sendLogTo\"\n : \"dispatch.transactionalEmail.sendLogFrom\",\n );\n const filters = [\n {\n operator: t(\"dispatch.transactionalEmail.sendLogContainsOperator\"),\n value: contains,\n clear: () => onContainsChange(\"\"),\n },\n {\n operator: t(\"dispatch.transactionalEmail.sendLogExcludeOperator\"),\n value: exclude,\n clear: () => onExcludeChange(\"\"),\n },\n ].filter((filter) => filter.value);\n\n return (\n <Popover>\n <div className=\"flex min-h-10 max-w-full flex-wrap items-center gap-1 rounded-md border border-input bg-background p-1\">\n <PopoverTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-8 shrink-0 gap-1 px-2\"\n aria-label={dimensionLabel}\n >\n {dimensionLabel}\n <IconChevronDown aria-hidden=\"true\" className=\"size-3.5\" />\n </Button>\n </PopoverTrigger>\n {filters.map((filter) => {\n const label = `${filter.operator} ${filter.value}`;\n return (\n <Badge\n key={filter.operator}\n variant=\"secondary\"\n className=\"min-w-0 max-w-full gap-1 pe-1 font-normal\"\n >\n <span className=\"max-w-44 truncate\">{label}</span>\n <button\n type=\"button\"\n className=\"inline-flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n aria-label={t(\n \"dispatch.transactionalEmail.sendLogRemoveAddressFilter\",\n { filter: label },\n )}\n onClick={filter.clear}\n >\n <IconX aria-hidden=\"true\" className=\"size-3\" />\n </button>\n </Badge>\n );\n })}\n </div>\n <PopoverContent\n align=\"start\"\n className=\"w-72 max-w-[calc(100vw-2rem)] p-3\"\n >\n <div className=\"grid gap-3\">\n <label\n className=\"grid gap-1.5 text-xs font-medium\"\n htmlFor={containsId}\n >\n {t(\"dispatch.transactionalEmail.sendLogContainsOperator\")}\n <Input\n id={containsId}\n value={contains}\n placeholder={t(\n \"dispatch.transactionalEmail.sendLogContainsPlaceholder\",\n )}\n onChange={(event) => onContainsChange(event.target.value)}\n aria-label={t(\n \"dispatch.transactionalEmail.sendLogAddressFilterLabel\",\n {\n dimension: dimensionLabel,\n operator: t(\n \"dispatch.transactionalEmail.sendLogContainsOperator\",\n ),\n },\n )}\n />\n </label>\n <label\n className=\"grid gap-1.5 text-xs font-medium\"\n htmlFor={excludeId}\n >\n {t(\"dispatch.transactionalEmail.sendLogExcludeOperator\")}\n <Input\n id={excludeId}\n value={exclude}\n placeholder={t(\n \"dispatch.transactionalEmail.sendLogExcludePlaceholder\",\n )}\n onChange={(event) => onExcludeChange(event.target.value)}\n aria-label={t(\n \"dispatch.transactionalEmail.sendLogAddressFilterLabel\",\n {\n dimension: dimensionLabel,\n operator: t(\n \"dispatch.transactionalEmail.sendLogExcludeOperator\",\n ),\n },\n )}\n />\n </label>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\nfunction SendLogDetailDialog({\n entry,\n open,\n onOpenChange,\n}: {\n entry: SendLogEntry | null;\n open: boolean;\n onOpenChange: (next: boolean) => void;\n}) {\n const t = useT();\n if (!entry) return null;\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent className=\"max-w-3xl\">\n <DialogHeader>\n <DialogTitle>{entry.subject}</DialogTitle>\n </DialogHeader>\n <div className=\"grid grid-cols-2 gap-x-6 gap-y-1 text-xs\">\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.recipient\")}\n </div>\n <div className=\"font-mono\">{entry.recipient}</div>\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sender\")}\n </div>\n <div className=\"font-mono\">{entry.sender}</div>\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sendLogTemplate\")}\n </div>\n <div className=\"font-mono\">{entry.templateId ?? \"—\"}</div>\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sendLogProvider\")}\n </div>\n <div>{entry.provider}</div>\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sendLogResponseStatus\")}\n </div>\n <div>{entry.responseStatus ?? \"—\"}</div>\n {entry.error ? (\n <>\n <div className=\"text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sendLogError\")}\n </div>\n <div className=\"text-destructive\">{entry.error}</div>\n </>\n ) : null}\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n\nexport function SendLogSection({\n apps,\n}: {\n apps: { id: string; name: string; path: string }[];\n}) {\n const t = useT();\n const [appId, setAppId] = useState<string | undefined>(apps[0]?.id);\n const [dateRange, setDateRange] = useState<DateRange>(\"7d\");\n const [templateId, setTemplateId] = useState(\"all\");\n const [templatePopoverOpen, setTemplatePopoverOpen] = useState(false);\n const [to, setTo] = useState(\"\");\n const [excludeTo, setExcludeTo] = useState(\"\");\n const [from, setFrom] = useState(\"\");\n const [excludeFrom, setExcludeFrom] = useState(\"\");\n const [status, setStatus] = useState<string>(\"all\");\n const [provider, setProvider] = useState<string>(\"all\");\n const [offset, setOffset] = useState(0);\n const [selected, setSelected] = useState<SendLogEntry | null>(null);\n\n const debouncedTo = useDebounced(to);\n const debouncedExcludeTo = useDebounced(excludeTo);\n const debouncedFrom = useDebounced(from);\n const debouncedExcludeFrom = useDebounced(excludeFrom);\n const selectedApp = apps.find((app) => app.id === appId) ?? apps[0];\n\n useEffect(() => {\n setTemplateId(\"all\");\n }, [selectedApp?.path]);\n\n useEffect(() => {\n setOffset(0);\n }, [\n appId,\n dateRange,\n templateId,\n debouncedTo,\n debouncedExcludeTo,\n debouncedFrom,\n debouncedExcludeFrom,\n status,\n provider,\n ]);\n\n const catalogQuery = useQuery({\n queryKey: [\"send-log-email-catalog\", selectedApp?.path],\n queryFn: () =>\n callAppAction<LocalTransactionalEmailCatalog>(\n selectedApp!.path,\n \"list-transactional-emails\",\n { windowDays: 30 },\n \"GET\",\n ),\n enabled: Boolean(selectedApp),\n staleTime: Infinity,\n });\n\n const templates = [...(catalogQuery.data?.emails ?? [])].sort(\n (a, b) => a.name.localeCompare(b.name) || a.id.localeCompare(b.id),\n );\n const selectedTemplate = templates.find((email) => email.id === templateId);\n\n const query = useQuery({\n queryKey: [\n \"list-email-log\",\n selectedApp?.path,\n dateRange,\n templateId,\n debouncedTo,\n debouncedExcludeTo,\n debouncedFrom,\n debouncedExcludeFrom,\n status,\n provider,\n offset,\n ],\n queryFn: () =>\n callAppAction<{ entries: SendLogEntry[] }>(\n selectedApp!.path,\n \"list-email-log\",\n {\n sinceMs: Date.now() - dateRangeToInterval(dateRange) * 86_400_000,\n ...(templateId !== \"all\" ? { templateId } : {}),\n ...(debouncedTo ? { to: debouncedTo } : {}),\n ...(debouncedExcludeTo ? { excludeTo: debouncedExcludeTo } : {}),\n ...(debouncedFrom ? { from: debouncedFrom } : {}),\n ...(debouncedExcludeFrom\n ? { excludeFrom: debouncedExcludeFrom }\n : {}),\n ...(status !== \"all\" ? { status } : {}),\n ...(provider !== \"all\" ? { provider } : {}),\n limit: PAGE_SIZE + 1,\n offset,\n },\n \"GET\",\n ),\n enabled: Boolean(selectedApp),\n });\n\n const entries = (query.data?.entries ?? []).slice(0, PAGE_SIZE);\n const hasMore = (query.data?.entries.length ?? 0) > PAGE_SIZE;\n\n if (apps.length === 0) return null;\n\n return (\n <div>\n <div className=\"mb-4 flex flex-wrap items-center gap-2\">\n <Select value={selectedApp?.id} onValueChange={setAppId}>\n <SelectTrigger className=\"w-48\">\n <SelectValue placeholder={t(\"dispatch.transactionalEmail.app\")} />\n </SelectTrigger>\n <SelectContent>\n {apps.map((app) => (\n <SelectItem key={app.id} value={app.id}>\n {app.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <DateRangePicker value={dateRange} onChange={setDateRange} />\n <Popover\n open={templatePopoverOpen}\n onOpenChange={setTemplatePopoverOpen}\n >\n <PopoverTrigger asChild>\n <Button\n type=\"button\"\n variant=\"outline\"\n role=\"combobox\"\n aria-expanded={templatePopoverOpen}\n aria-label={t(\"dispatch.transactionalEmail.sendLogTemplate\")}\n className=\"w-64 justify-between\"\n >\n <span className=\"truncate\">\n {selectedTemplate\n ? `${selectedTemplate.name} · ${selectedTemplate.id}`\n : t(\"dispatch.transactionalEmail.sendLogAllTemplates\")}\n </span>\n </Button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-80 p-0\">\n <Command>\n <CommandInput\n placeholder={t(\n \"dispatch.transactionalEmail.sendLogSearchTemplates\",\n )}\n />\n <CommandList>\n <CommandEmpty>\n {t(\"dispatch.transactionalEmail.sendLogNoTemplatesFound\")}\n </CommandEmpty>\n <CommandGroup forceMount>\n <CommandItem\n forceMount\n value=\"all\"\n onSelect={() => {\n setTemplateId(\"all\");\n setTemplatePopoverOpen(false);\n }}\n >\n <IconCheck\n aria-hidden=\"true\"\n className={\n templateId === \"all\"\n ? \"me-2 size-4\"\n : \"me-2 size-4 opacity-0\"\n }\n />\n {t(\"dispatch.transactionalEmail.sendLogAllTemplates\")}\n </CommandItem>\n </CommandGroup>\n <CommandGroup>\n {templates.map((email) => (\n <CommandItem\n key={email.id}\n value={email.id}\n keywords={[email.name]}\n onSelect={() => {\n setTemplateId(email.id);\n setTemplatePopoverOpen(false);\n }}\n >\n <IconCheck\n aria-hidden=\"true\"\n className={\n templateId === email.id\n ? \"me-2 size-4\"\n : \"me-2 size-4 opacity-0\"\n }\n />\n <span className=\"truncate\">\n {email.name} · {email.id}\n </span>\n </CommandItem>\n ))}\n </CommandGroup>\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n <AddressFilterControl\n dimension=\"to\"\n contains={to}\n exclude={excludeTo}\n onContainsChange={setTo}\n onExcludeChange={setExcludeTo}\n />\n <AddressFilterControl\n dimension=\"from\"\n contains={from}\n exclude={excludeFrom}\n onContainsChange={setFrom}\n onExcludeChange={setExcludeFrom}\n />\n <Select value={status} onValueChange={setStatus}>\n <SelectTrigger className=\"w-32\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"all\">\n {t(\"dispatch.transactionalEmail.sendLogAllStatuses\")}\n </SelectItem>\n <SelectItem value=\"sent\">\n {t(\"dispatch.transactionalEmail.sendLogSent\")}\n </SelectItem>\n <SelectItem value=\"failed\">\n {t(\"dispatch.transactionalEmail.sendLogFailed\")}\n </SelectItem>\n </SelectContent>\n </Select>\n <Select value={provider} onValueChange={setProvider}>\n <SelectTrigger className=\"w-36\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"all\">\n {t(\"dispatch.transactionalEmail.sendLogAllProviders\")}\n </SelectItem>\n <SelectItem value=\"resend\">Resend</SelectItem>\n <SelectItem value=\"sendgrid\">SendGrid</SelectItem>\n <SelectItem value=\"dev\">Dev</SelectItem>\n </SelectContent>\n </Select>\n {(templateId !== \"all\" ||\n to ||\n excludeTo ||\n from ||\n excludeFrom ||\n status !== \"all\" ||\n provider !== \"all\") && (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n setTemplateId(\"all\");\n setTo(\"\");\n setExcludeTo(\"\");\n setFrom(\"\");\n setExcludeFrom(\"\");\n setStatus(\"all\");\n setProvider(\"all\");\n }}\n >\n {t(\"dispatch.transactionalEmail.sendLogClearFilters\")}\n </Button>\n )}\n </div>\n\n {query.isError ? (\n <ActionQueryError\n error={query.error}\n onRetry={() => void query.refetch()}\n />\n ) : query.isLoading ? (\n <Skeleton className=\"h-40 w-full\" />\n ) : entries.length === 0 ? (\n <div className=\"rounded-xl border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n {t(\"dispatch.transactionalEmail.sendLogEmpty\")}\n </div>\n ) : (\n <>\n <Table>\n <TableHeader>\n <TableRow>\n <TableHead>\n {t(\"dispatch.transactionalEmail.sendLogTimestamp\")}\n </TableHead>\n <TableHead>\n {t(\"dispatch.transactionalEmail.recipient\")}\n </TableHead>\n <TableHead>{t(\"dispatch.transactionalEmail.sender\")}</TableHead>\n <TableHead>\n {t(\"dispatch.transactionalEmail.sendLogTemplate\")}\n </TableHead>\n <TableHead>{t(\"dispatch.transactionalEmail.status\")}</TableHead>\n <TableHead>\n {t(\"dispatch.transactionalEmail.sendLogProvider\")}\n </TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {entries.map((entry) => (\n <TableRow\n key={entry.id}\n className=\"cursor-pointer\"\n onClick={() => setSelected(entry)}\n >\n <TableCell className=\"text-xs text-muted-foreground\">\n {new Date(entry.createdAt).toLocaleString()}\n </TableCell>\n <TableCell className=\"text-xs\">{entry.recipient}</TableCell>\n <TableCell className=\"text-xs\">{entry.sender}</TableCell>\n <TableCell className=\"font-mono text-xs\">\n {entry.templateId ?? \"—\"}\n </TableCell>\n <TableCell>\n <Badge\n variant={\n entry.status === \"failed\" ? \"destructive\" : \"secondary\"\n }\n >\n {entry.status}\n </Badge>\n </TableCell>\n <TableCell className=\"text-xs\">{entry.provider}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <div className=\"mt-3 flex justify-end gap-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={offset === 0}\n onClick={() =>\n setOffset((current) => Math.max(0, current - PAGE_SIZE))\n }\n >\n {t(\"dispatch.transactionalEmail.sendLogPrevious\")}\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={!hasMore}\n onClick={() => setOffset((current) => current + PAGE_SIZE)}\n >\n {t(\"dispatch.transactionalEmail.sendLogNext\")}\n </Button>\n </div>\n </>\n )}\n\n <SendLogDetailDialog\n entry={selected}\n open={selected !== null}\n onOpenChange={(next) => {\n if (!next) setSelected(null);\n }}\n />\n </div>\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/dispatch",
3
- "version": "0.35.0",
3
+ "version": "0.35.1-nightly-20260908195301",
4
4
  "description": "Dispatch — workspace control plane for agent-native apps. Vault, integrations, destinations, scheduled jobs, and cross-app delegation, shipped as a single drop-in package.",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -102,10 +102,10 @@
102
102
  "typescript-7": "npm:typescript@^7.0.2",
103
103
  "vite": "8.1.0",
104
104
  "vitest": "^4.1.5",
105
- "@agent-native/core": "0.177.1"
105
+ "@agent-native/core": "0.177.2-nightly-20260908195301"
106
106
  },
107
107
  "peerDependencies": {
108
- "@agent-native/core": ">=0.8.0",
108
+ "@agent-native/core": "0.177.2-nightly-20260908195301",
109
109
  "react": ">=19.2.7",
110
110
  "react-dom": ">=19.2.7",
111
111
  "react-router": ">=8"
@@ -4,15 +4,28 @@ import {
4
4
  dateRangeToInterval,
5
5
  type DateRange,
6
6
  } from "@agent-native/toolkit/dashboard";
7
+ import { IconCheck, IconChevronDown, IconX } from "@tabler/icons-react";
7
8
  import { useQuery } from "@tanstack/react-query";
8
- import { useEffect, useState } from "react";
9
+ import { useEffect, useId, useState } from "react";
9
10
 
10
- import { callAppAction } from "../client/transactional-emails";
11
+ import {
12
+ callAppAction,
13
+ type LocalTransactionalEmailCatalog,
14
+ } from "../client/transactional-emails";
11
15
  import { ActionQueryError } from "./action-query-error";
12
16
  import { Badge } from "./ui/badge";
13
17
  import { Button } from "./ui/button";
18
+ import {
19
+ Command,
20
+ CommandEmpty,
21
+ CommandGroup,
22
+ CommandInput,
23
+ CommandItem,
24
+ CommandList,
25
+ } from "./ui/command";
14
26
  import { Dialog, DialogContent, DialogHeader, DialogTitle } from "./ui/dialog";
15
27
  import { Input } from "./ui/input";
28
+ import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
16
29
  import {
17
30
  Select,
18
31
  SelectContent,
@@ -56,6 +69,136 @@ function useDebounced(value: string, delayMs = 300): string {
56
69
  return debounced;
57
70
  }
58
71
 
72
+ function AddressFilterControl({
73
+ dimension,
74
+ contains,
75
+ exclude,
76
+ onContainsChange,
77
+ onExcludeChange,
78
+ }: {
79
+ dimension: "to" | "from";
80
+ contains: string;
81
+ exclude: string;
82
+ onContainsChange: (value: string) => void;
83
+ onExcludeChange: (value: string) => void;
84
+ }) {
85
+ const t = useT();
86
+ const containsId = useId();
87
+ const excludeId = useId();
88
+ const dimensionLabel = t(
89
+ dimension === "to"
90
+ ? "dispatch.transactionalEmail.sendLogTo"
91
+ : "dispatch.transactionalEmail.sendLogFrom",
92
+ );
93
+ const filters = [
94
+ {
95
+ operator: t("dispatch.transactionalEmail.sendLogContainsOperator"),
96
+ value: contains,
97
+ clear: () => onContainsChange(""),
98
+ },
99
+ {
100
+ operator: t("dispatch.transactionalEmail.sendLogExcludeOperator"),
101
+ value: exclude,
102
+ clear: () => onExcludeChange(""),
103
+ },
104
+ ].filter((filter) => filter.value);
105
+
106
+ return (
107
+ <Popover>
108
+ <div className="flex min-h-10 max-w-full flex-wrap items-center gap-1 rounded-md border border-input bg-background p-1">
109
+ <PopoverTrigger asChild>
110
+ <Button
111
+ type="button"
112
+ variant="ghost"
113
+ size="sm"
114
+ className="h-8 shrink-0 gap-1 px-2"
115
+ aria-label={dimensionLabel}
116
+ >
117
+ {dimensionLabel}
118
+ <IconChevronDown aria-hidden="true" className="size-3.5" />
119
+ </Button>
120
+ </PopoverTrigger>
121
+ {filters.map((filter) => {
122
+ const label = `${filter.operator} ${filter.value}`;
123
+ return (
124
+ <Badge
125
+ key={filter.operator}
126
+ variant="secondary"
127
+ className="min-w-0 max-w-full gap-1 pe-1 font-normal"
128
+ >
129
+ <span className="max-w-44 truncate">{label}</span>
130
+ <button
131
+ type="button"
132
+ className="inline-flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
133
+ aria-label={t(
134
+ "dispatch.transactionalEmail.sendLogRemoveAddressFilter",
135
+ { filter: label },
136
+ )}
137
+ onClick={filter.clear}
138
+ >
139
+ <IconX aria-hidden="true" className="size-3" />
140
+ </button>
141
+ </Badge>
142
+ );
143
+ })}
144
+ </div>
145
+ <PopoverContent
146
+ align="start"
147
+ className="w-72 max-w-[calc(100vw-2rem)] p-3"
148
+ >
149
+ <div className="grid gap-3">
150
+ <label
151
+ className="grid gap-1.5 text-xs font-medium"
152
+ htmlFor={containsId}
153
+ >
154
+ {t("dispatch.transactionalEmail.sendLogContainsOperator")}
155
+ <Input
156
+ id={containsId}
157
+ value={contains}
158
+ placeholder={t(
159
+ "dispatch.transactionalEmail.sendLogContainsPlaceholder",
160
+ )}
161
+ onChange={(event) => onContainsChange(event.target.value)}
162
+ aria-label={t(
163
+ "dispatch.transactionalEmail.sendLogAddressFilterLabel",
164
+ {
165
+ dimension: dimensionLabel,
166
+ operator: t(
167
+ "dispatch.transactionalEmail.sendLogContainsOperator",
168
+ ),
169
+ },
170
+ )}
171
+ />
172
+ </label>
173
+ <label
174
+ className="grid gap-1.5 text-xs font-medium"
175
+ htmlFor={excludeId}
176
+ >
177
+ {t("dispatch.transactionalEmail.sendLogExcludeOperator")}
178
+ <Input
179
+ id={excludeId}
180
+ value={exclude}
181
+ placeholder={t(
182
+ "dispatch.transactionalEmail.sendLogExcludePlaceholder",
183
+ )}
184
+ onChange={(event) => onExcludeChange(event.target.value)}
185
+ aria-label={t(
186
+ "dispatch.transactionalEmail.sendLogAddressFilterLabel",
187
+ {
188
+ dimension: dimensionLabel,
189
+ operator: t(
190
+ "dispatch.transactionalEmail.sendLogExcludeOperator",
191
+ ),
192
+ },
193
+ )}
194
+ />
195
+ </label>
196
+ </div>
197
+ </PopoverContent>
198
+ </Popover>
199
+ );
200
+ }
201
+
59
202
  function SendLogDetailDialog({
60
203
  entry,
61
204
  open,
@@ -117,28 +260,69 @@ export function SendLogSection({
117
260
  const t = useT();
118
261
  const [appId, setAppId] = useState<string | undefined>(apps[0]?.id);
119
262
  const [dateRange, setDateRange] = useState<DateRange>("7d");
263
+ const [templateId, setTemplateId] = useState("all");
264
+ const [templatePopoverOpen, setTemplatePopoverOpen] = useState(false);
120
265
  const [to, setTo] = useState("");
266
+ const [excludeTo, setExcludeTo] = useState("");
121
267
  const [from, setFrom] = useState("");
268
+ const [excludeFrom, setExcludeFrom] = useState("");
122
269
  const [status, setStatus] = useState<string>("all");
123
270
  const [provider, setProvider] = useState<string>("all");
124
271
  const [offset, setOffset] = useState(0);
125
272
  const [selected, setSelected] = useState<SendLogEntry | null>(null);
126
273
 
127
274
  const debouncedTo = useDebounced(to);
275
+ const debouncedExcludeTo = useDebounced(excludeTo);
128
276
  const debouncedFrom = useDebounced(from);
277
+ const debouncedExcludeFrom = useDebounced(excludeFrom);
129
278
  const selectedApp = apps.find((app) => app.id === appId) ?? apps[0];
130
279
 
280
+ useEffect(() => {
281
+ setTemplateId("all");
282
+ }, [selectedApp?.path]);
283
+
131
284
  useEffect(() => {
132
285
  setOffset(0);
133
- }, [appId, dateRange, debouncedTo, debouncedFrom, status, provider]);
286
+ }, [
287
+ appId,
288
+ dateRange,
289
+ templateId,
290
+ debouncedTo,
291
+ debouncedExcludeTo,
292
+ debouncedFrom,
293
+ debouncedExcludeFrom,
294
+ status,
295
+ provider,
296
+ ]);
297
+
298
+ const catalogQuery = useQuery({
299
+ queryKey: ["send-log-email-catalog", selectedApp?.path],
300
+ queryFn: () =>
301
+ callAppAction<LocalTransactionalEmailCatalog>(
302
+ selectedApp!.path,
303
+ "list-transactional-emails",
304
+ { windowDays: 30 },
305
+ "GET",
306
+ ),
307
+ enabled: Boolean(selectedApp),
308
+ staleTime: Infinity,
309
+ });
310
+
311
+ const templates = [...(catalogQuery.data?.emails ?? [])].sort(
312
+ (a, b) => a.name.localeCompare(b.name) || a.id.localeCompare(b.id),
313
+ );
314
+ const selectedTemplate = templates.find((email) => email.id === templateId);
134
315
 
135
316
  const query = useQuery({
136
317
  queryKey: [
137
318
  "list-email-log",
138
319
  selectedApp?.path,
139
320
  dateRange,
321
+ templateId,
140
322
  debouncedTo,
323
+ debouncedExcludeTo,
141
324
  debouncedFrom,
325
+ debouncedExcludeFrom,
142
326
  status,
143
327
  provider,
144
328
  offset,
@@ -149,8 +333,13 @@ export function SendLogSection({
149
333
  "list-email-log",
150
334
  {
151
335
  sinceMs: Date.now() - dateRangeToInterval(dateRange) * 86_400_000,
336
+ ...(templateId !== "all" ? { templateId } : {}),
152
337
  ...(debouncedTo ? { to: debouncedTo } : {}),
338
+ ...(debouncedExcludeTo ? { excludeTo: debouncedExcludeTo } : {}),
153
339
  ...(debouncedFrom ? { from: debouncedFrom } : {}),
340
+ ...(debouncedExcludeFrom
341
+ ? { excludeFrom: debouncedExcludeFrom }
342
+ : {}),
154
343
  ...(status !== "all" ? { status } : {}),
155
344
  ...(provider !== "all" ? { provider } : {}),
156
345
  limit: PAGE_SIZE + 1,
@@ -182,17 +371,99 @@ export function SendLogSection({
182
371
  </SelectContent>
183
372
  </Select>
184
373
  <DateRangePicker value={dateRange} onChange={setDateRange} />
185
- <Input
186
- placeholder={t("dispatch.transactionalEmail.sendLogToFilter")}
187
- value={to}
188
- onChange={(event) => setTo(event.target.value)}
189
- className="w-44"
374
+ <Popover
375
+ open={templatePopoverOpen}
376
+ onOpenChange={setTemplatePopoverOpen}
377
+ >
378
+ <PopoverTrigger asChild>
379
+ <Button
380
+ type="button"
381
+ variant="outline"
382
+ role="combobox"
383
+ aria-expanded={templatePopoverOpen}
384
+ aria-label={t("dispatch.transactionalEmail.sendLogTemplate")}
385
+ className="w-64 justify-between"
386
+ >
387
+ <span className="truncate">
388
+ {selectedTemplate
389
+ ? `${selectedTemplate.name} · ${selectedTemplate.id}`
390
+ : t("dispatch.transactionalEmail.sendLogAllTemplates")}
391
+ </span>
392
+ </Button>
393
+ </PopoverTrigger>
394
+ <PopoverContent align="start" className="w-80 p-0">
395
+ <Command>
396
+ <CommandInput
397
+ placeholder={t(
398
+ "dispatch.transactionalEmail.sendLogSearchTemplates",
399
+ )}
400
+ />
401
+ <CommandList>
402
+ <CommandEmpty>
403
+ {t("dispatch.transactionalEmail.sendLogNoTemplatesFound")}
404
+ </CommandEmpty>
405
+ <CommandGroup forceMount>
406
+ <CommandItem
407
+ forceMount
408
+ value="all"
409
+ onSelect={() => {
410
+ setTemplateId("all");
411
+ setTemplatePopoverOpen(false);
412
+ }}
413
+ >
414
+ <IconCheck
415
+ aria-hidden="true"
416
+ className={
417
+ templateId === "all"
418
+ ? "me-2 size-4"
419
+ : "me-2 size-4 opacity-0"
420
+ }
421
+ />
422
+ {t("dispatch.transactionalEmail.sendLogAllTemplates")}
423
+ </CommandItem>
424
+ </CommandGroup>
425
+ <CommandGroup>
426
+ {templates.map((email) => (
427
+ <CommandItem
428
+ key={email.id}
429
+ value={email.id}
430
+ keywords={[email.name]}
431
+ onSelect={() => {
432
+ setTemplateId(email.id);
433
+ setTemplatePopoverOpen(false);
434
+ }}
435
+ >
436
+ <IconCheck
437
+ aria-hidden="true"
438
+ className={
439
+ templateId === email.id
440
+ ? "me-2 size-4"
441
+ : "me-2 size-4 opacity-0"
442
+ }
443
+ />
444
+ <span className="truncate">
445
+ {email.name} · {email.id}
446
+ </span>
447
+ </CommandItem>
448
+ ))}
449
+ </CommandGroup>
450
+ </CommandList>
451
+ </Command>
452
+ </PopoverContent>
453
+ </Popover>
454
+ <AddressFilterControl
455
+ dimension="to"
456
+ contains={to}
457
+ exclude={excludeTo}
458
+ onContainsChange={setTo}
459
+ onExcludeChange={setExcludeTo}
190
460
  />
191
- <Input
192
- placeholder={t("dispatch.transactionalEmail.sendLogFromFilter")}
193
- value={from}
194
- onChange={(event) => setFrom(event.target.value)}
195
- className="w-44"
461
+ <AddressFilterControl
462
+ dimension="from"
463
+ contains={from}
464
+ exclude={excludeFrom}
465
+ onContainsChange={setFrom}
466
+ onExcludeChange={setExcludeFrom}
196
467
  />
197
468
  <Select value={status} onValueChange={setStatus}>
198
469
  <SelectTrigger className="w-32">
@@ -223,13 +494,22 @@ export function SendLogSection({
223
494
  <SelectItem value="dev">Dev</SelectItem>
224
495
  </SelectContent>
225
496
  </Select>
226
- {(to || from || status !== "all" || provider !== "all") && (
497
+ {(templateId !== "all" ||
498
+ to ||
499
+ excludeTo ||
500
+ from ||
501
+ excludeFrom ||
502
+ status !== "all" ||
503
+ provider !== "all") && (
227
504
  <Button
228
505
  variant="ghost"
229
506
  size="sm"
230
507
  onClick={() => {
508
+ setTemplateId("all");
231
509
  setTo("");
510
+ setExcludeTo("");
232
511
  setFrom("");
512
+ setExcludeFrom("");
233
513
  setStatus("all");
234
514
  setProvider("all");
235
515
  }}