@prenta/admin 2.14.3 → 2.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/__tests__/lib/fetch-all-pages.test.d.ts +2 -0
  3. package/dist/__tests__/lib/fetch-all-pages.test.d.ts.map +1 -0
  4. package/dist/__tests__/lib/fetch-all-pages.test.js +42 -0
  5. package/dist/__tests__/lib/fetch-all-pages.test.js.map +1 -0
  6. package/dist/__tests__/views/audit-entries.test.d.ts +2 -0
  7. package/dist/__tests__/views/audit-entries.test.d.ts.map +1 -0
  8. package/dist/__tests__/views/audit-entries.test.js +164 -0
  9. package/dist/__tests__/views/audit-entries.test.js.map +1 -0
  10. package/dist/__tests__/views/audit-media.test.d.ts +2 -0
  11. package/dist/__tests__/views/audit-media.test.d.ts.map +1 -0
  12. package/dist/__tests__/views/audit-media.test.js +73 -0
  13. package/dist/__tests__/views/audit-media.test.js.map +1 -0
  14. package/dist/__tests__/views/audit-navigation.test.d.ts +2 -0
  15. package/dist/__tests__/views/audit-navigation.test.d.ts.map +1 -0
  16. package/dist/__tests__/views/audit-navigation.test.js +54 -0
  17. package/dist/__tests__/views/audit-navigation.test.js.map +1 -0
  18. package/dist/__tests__/views/audit-pages.test.d.ts +2 -0
  19. package/dist/__tests__/views/audit-pages.test.d.ts.map +1 -0
  20. package/dist/__tests__/views/audit-pages.test.js +78 -0
  21. package/dist/__tests__/views/audit-pages.test.js.map +1 -0
  22. package/dist/__tests__/views/audit-settings.test.d.ts +2 -0
  23. package/dist/__tests__/views/audit-settings.test.d.ts.map +1 -0
  24. package/dist/__tests__/views/audit-settings.test.js +105 -0
  25. package/dist/__tests__/views/audit-settings.test.js.map +1 -0
  26. package/dist/__tests__/views/dashboard.test.js +7 -0
  27. package/dist/__tests__/views/dashboard.test.js.map +1 -1
  28. package/dist/__tests__/views/form-entries.render.test.js +74 -1
  29. package/dist/__tests__/views/form-entries.render.test.js.map +1 -1
  30. package/dist/__tests__/views/pages-list-view.test.js +9 -1
  31. package/dist/__tests__/views/pages-list-view.test.js.map +1 -1
  32. package/dist/lib/fetch-all-pages.d.ts +18 -0
  33. package/dist/lib/fetch-all-pages.d.ts.map +1 -0
  34. package/dist/lib/fetch-all-pages.js +45 -0
  35. package/dist/lib/fetch-all-pages.js.map +1 -0
  36. package/dist/lib/pages-service.d.ts +1 -1
  37. package/dist/lib/pages-service.d.ts.map +1 -1
  38. package/dist/lib/pages-service.js +24 -10
  39. package/dist/lib/pages-service.js.map +1 -1
  40. package/dist/lib/useApiData.d.ts +2 -0
  41. package/dist/lib/useApiData.d.ts.map +1 -1
  42. package/dist/lib/useApiData.js +17 -8
  43. package/dist/lib/useApiData.js.map +1 -1
  44. package/dist/prenta-admin.css +1 -1
  45. package/dist/router/index.d.ts.map +1 -1
  46. package/dist/router/index.js +29 -2
  47. package/dist/router/index.js.map +1 -1
  48. package/dist/views/Dashboard.js +1 -1
  49. package/dist/views/Dashboard.js.map +1 -1
  50. package/dist/views/FormsSettings.d.ts.map +1 -1
  51. package/dist/views/FormsSettings.js +10 -3
  52. package/dist/views/FormsSettings.js.map +1 -1
  53. package/dist/views/MediaBrowser.d.ts.map +1 -1
  54. package/dist/views/MediaBrowser.js +11 -7
  55. package/dist/views/MediaBrowser.js.map +1 -1
  56. package/dist/views/Pages/PagesListView.d.ts.map +1 -1
  57. package/dist/views/Pages/PagesListView.js +3 -1
  58. package/dist/views/Pages/PagesListView.js.map +1 -1
  59. package/dist/views/entries/EntriesInbox.d.ts.map +1 -1
  60. package/dist/views/entries/EntriesInbox.js +112 -25
  61. package/dist/views/entries/EntriesInbox.js.map +1 -1
  62. package/package.json +5 -5
  63. package/src/__tests__/lib/fetch-all-pages.test.ts +49 -0
  64. package/src/__tests__/views/audit-entries.test.tsx +182 -0
  65. package/src/__tests__/views/audit-media.test.tsx +88 -0
  66. package/src/__tests__/views/audit-navigation.test.tsx +57 -0
  67. package/src/__tests__/views/audit-pages.test.tsx +81 -0
  68. package/src/__tests__/views/audit-settings.test.tsx +126 -0
  69. package/src/__tests__/views/dashboard.test.tsx +8 -0
  70. package/src/__tests__/views/form-entries.render.test.tsx +84 -1
  71. package/src/__tests__/views/pages-list-view.test.tsx +10 -1
  72. package/src/lib/fetch-all-pages.ts +55 -0
  73. package/src/lib/pages-service.ts +27 -20
  74. package/src/lib/useApiData.ts +18 -7
  75. package/src/router/index.ts +40 -2
  76. package/src/styles/theme.css +48 -4
  77. package/src/views/Dashboard.tsx +1 -1
  78. package/src/views/FormsSettings.tsx +11 -4
  79. package/src/views/MediaBrowser.tsx +12 -8
  80. package/src/views/Pages/PagesListView.tsx +3 -1
  81. package/src/views/entries/EntriesInbox.tsx +176 -72
@@ -213,6 +213,13 @@ export function EntriesInbox({ formId, initialFilter, currentPath, onNavigate, c
213
213
  const [total, setTotal] = useState(0);
214
214
  const [counts, setCounts] = useState(null);
215
215
  const [loading, setLoading] = useState(true);
216
+ const [loadingMore, setLoadingMore] = useState(false);
217
+ const [refreshing, setRefreshing] = useState(false);
218
+ const refreshInFlight = useRef(false);
219
+ const [moreError, setMoreError] = useState(null);
220
+ const [nextPage, setNextPage] = useState(null);
221
+ const moreInFlight = useRef(false);
222
+ const loadedPageCount = useRef(5);
216
223
  const loadRequestRef = useRef(0);
217
224
  const loadedQueryRef = useRef(null);
218
225
  // Track operations separately: overlapping writes to one entry must not
@@ -492,23 +499,31 @@ export function EntriesInbox({ formId, initialFilter, currentPath, onNavigate, c
492
499
  if (onNavigate)
493
500
  onNavigate(path);
494
501
  else
495
- window.history.replaceState(null, '', path);
502
+ window.history.replaceState(window.history.state, '', path);
496
503
  }, [formId, onNavigate]);
497
504
  const load = useCallback(async (background = false) => {
498
505
  const request = ++loadRequestRef.current;
506
+ refreshInFlight.current = true;
507
+ setRefreshing(true);
508
+ moreInFlight.current = false;
509
+ setLoadingMore(false);
510
+ setMoreError(null);
499
511
  const query = JSON.stringify([filter, scopedFormId, search.trim(), currentUserId]);
500
512
  // An event may supersede a foreground load. Until this query has a
501
513
  // successful dataset, its failures must remain foreground errors.
502
514
  const keepRows = background && loadedQueryRef.current === query;
503
- if (!keepRows)
515
+ if (!keepRows) {
504
516
  setLoading(true);
517
+ setNextPage(null);
518
+ }
505
519
  setError(null);
506
520
  const params = filterParams(filter, currentUserId);
507
521
  try {
508
522
  const collected = [];
509
523
  const seen = new Set();
510
524
  let reported = 0;
511
- for (let page = 1; page <= 5; page++) {
525
+ let continuation = null;
526
+ for (let page = 1; page <= loadedPageCount.current; page++) {
512
527
  const result = await fetchEntries({
513
528
  formId: scopedFormId,
514
529
  search: search.trim() || undefined,
@@ -525,6 +540,7 @@ export function EntriesInbox({ formId, initialFilter, currentPath, onNavigate, c
525
540
  for (const entry of fresh)
526
541
  seen.add(entry.id);
527
542
  collected.push(...fresh);
543
+ continuation = collected.length < reported && fresh.length > 0 ? page + 1 : null;
528
544
  if (collected.length >= reported ||
529
545
  fresh.length === 0 ||
530
546
  result.entries.length < PAGE_SIZE) {
@@ -536,6 +552,7 @@ export function EntriesInbox({ formId, initialFilter, currentPath, onNavigate, c
536
552
  setEntries(applyPendingPatches(collected));
537
553
  loadedQueryRef.current = query;
538
554
  setTotal(reported);
555
+ setNextPage(continuation);
539
556
  setChecked((current) => keepRows ? new Set([...current].filter((id) => seen.has(id))) : new Set());
540
557
  }
541
558
  catch (err) {
@@ -548,10 +565,53 @@ export function EntriesInbox({ formId, initialFilter, currentPath, onNavigate, c
548
565
  setError(message);
549
566
  }
550
567
  finally {
551
- if (request === loadRequestRef.current)
568
+ if (request === loadRequestRef.current) {
569
+ refreshInFlight.current = false;
570
+ setRefreshing(false);
552
571
  setLoading(false);
572
+ }
553
573
  }
554
574
  }, [filter, scopedFormId, search, currentUserId, applyPendingPatches]);
575
+ async function loadMore() {
576
+ if (nextPage === null || moreInFlight.current || refreshInFlight.current)
577
+ return;
578
+ moreInFlight.current = true;
579
+ const generation = ++loadRequestRef.current;
580
+ setLoadingMore(true);
581
+ setMoreError(null);
582
+ try {
583
+ const result = await fetchEntries({
584
+ formId: scopedFormId,
585
+ search: search.trim() || undefined,
586
+ page: nextPage,
587
+ pageSize: PAGE_SIZE,
588
+ sortBy: 'submittedAt',
589
+ sortDirection: 'desc',
590
+ ...filterParams(filter, currentUserId),
591
+ });
592
+ if (generation !== loadRequestRef.current)
593
+ return;
594
+ const seen = new Set(entries.map((entry) => entry.id));
595
+ const fresh = result.entries.filter((entry) => !seen.has(entry.id));
596
+ if (fresh.length === 0 && entries.length < result.total) {
597
+ throw new Error('The list changed while loading. Refresh the list and try again.');
598
+ }
599
+ setEntries((current) => applyPendingPatches([...current, ...fresh]));
600
+ loadedPageCount.current = nextPage;
601
+ setTotal(result.total);
602
+ setNextPage(entries.length + fresh.length < result.total ? nextPage + 1 : null);
603
+ }
604
+ catch (err) {
605
+ if (generation === loadRequestRef.current)
606
+ setMoreError(err instanceof Error ? err.message : 'Failed to load more entries');
607
+ }
608
+ finally {
609
+ if (generation === loadRequestRef.current) {
610
+ moreInFlight.current = false;
611
+ setLoadingMore(false);
612
+ }
613
+ }
614
+ }
555
615
  const loadCounts = useCallback(() => {
556
616
  void fetchEntryCounts({
557
617
  formId: scopedFormId,
@@ -564,6 +624,7 @@ export function EntriesInbox({ formId, initialFilter, currentPath, onNavigate, c
564
624
  loadRequestRef.current++;
565
625
  }, []);
566
626
  useEffect(() => {
627
+ loadedPageCount.current = 5;
567
628
  void load();
568
629
  return cancelLoad;
569
630
  }, [load, cancelLoad]);
@@ -1040,7 +1101,7 @@ export function EntriesInbox({ formId, initialFilter, currentPath, onNavigate, c
1040
1101
  else
1041
1102
  next.add(entry.id);
1042
1103
  return next;
1043
- }), onStar: () => void patchOne(entry.id, { starred: !entry.starred }) }, entry.id)))] }, group.label)))) }), _jsxs("div", { className: "border-bdr text-faint flex shrink-0 items-center gap-2 border-t px-3 py-[7px] text-[11px]", children: [_jsxs("span", { children: ["Showing", ' ', _jsx("b", { className: "text-sub font-semibold tabular-nums", children: visibleEntries.length }), " of", ' ', _jsx("b", { className: "text-sub font-semibold tabular-nums", children: unsupported ? 0 : (counts?.total ?? total) })] }), _jsx("span", { className: "ml-auto", children: unreadInList > 0 ? (_jsxs(_Fragment, { children: [_jsx("b", { className: "text-sub font-semibold tabular-nums", children: unreadInList }), " unread"] })) : ('All caught up') })] })] })) : null, showList && showDetail && !narrow ? (_jsx("button", { type: "button", role: "separator", "aria-orientation": "vertical", "aria-valuemin": RAIL_MIN, "aria-valuemax": RAIL_MAX, "aria-valuenow": railW, "aria-label": "Resize entry list", className: `bg-bg relative z-[3] w-[7px] shrink-0 cursor-col-resize border-0 p-0 ${dragging ? 'bg-acc' : ''}`, onPointerDown: startDrag, onDoubleClick: () => {
1104
+ }), onStar: () => void patchOne(entry.id, { starred: !entry.starred }) }, entry.id)))] }, group.label)))) }), _jsxs("div", { className: "border-bdr text-faint flex shrink-0 items-center gap-2 border-t px-3 py-[7px] text-[11px]", children: [nextPage !== null && !loading && (_jsx("button", { type: "button", className: "text-acc underline", disabled: loadingMore || refreshing, onClick: () => void loadMore(), children: loadingMore ? 'Loading more…' : 'Load more entries' })), moreError && (_jsx("span", { role: "alert", className: "text-err", children: moreError })), _jsxs("span", { children: ["Showing", ' ', _jsx("b", { className: "text-sub font-semibold tabular-nums", children: visibleEntries.length }), " of", ' ', _jsx("b", { className: "text-sub font-semibold tabular-nums", children: unsupported ? 0 : (counts?.total ?? total) })] }), _jsx("span", { className: "ml-auto", children: unreadInList > 0 ? (_jsxs(_Fragment, { children: [_jsx("b", { className: "text-sub font-semibold tabular-nums", children: unreadInList }), " unread"] })) : ('All caught up') })] })] })) : null, showList && showDetail && !narrow ? (_jsx("button", { type: "button", role: "separator", "aria-orientation": "vertical", "aria-valuemin": RAIL_MIN, "aria-valuemax": RAIL_MAX, "aria-valuenow": railW, "aria-label": "Resize entry list", className: `bg-bg relative z-[3] w-[7px] shrink-0 cursor-col-resize border-0 p-0 ${dragging ? 'bg-acc' : ''}`, onPointerDown: startDrag, onDoubleClick: () => {
1044
1105
  setRailW(RAIL_DEFAULT);
1045
1106
  try {
1046
1107
  globalThis.localStorage?.setItem(RAIL_KEY, String(RAIL_DEFAULT));
@@ -1093,9 +1154,9 @@ function EntryRow({ entry, selected, checked, compact, showForm, team, onOpen, o
1093
1154
  : 'border-l-transparent hover:bg-[var(--bg)]'}`, children: [_jsxs("div", { className: "flex flex-col items-center gap-1.5 pt-px", children: [_jsx("button", { type: "button", "aria-pressed": checked, "aria-label": `Select ${name}`, onClick: (event) => {
1094
1155
  event.stopPropagation();
1095
1156
  onCheck();
1096
- }, className: `flex size-6 items-center justify-center rounded-[4px] border-[1.5px] ${checked
1157
+ }, className: `inbox-row-checkbox ${checked
1097
1158
  ? 'border-acc bg-acc text-[var(--on-acc)]'
1098
- : 'border-bdr bg-card text-transparent'}`, children: _jsx(Check, { size: 11, "aria-hidden": true }) }), compact ? null : (_jsxs("span", { className: "relative flex size-8 items-center justify-center rounded-full text-[12px] font-bold", style: { background: avatarColor(name), color: 'var(--on-avatar)' }, children: [initials(name), entry.unread ? (_jsx("span", { className: "bg-acc absolute -top-px -right-px size-[9px] rounded-full border-2 border-[var(--sb)]" })) : null] }))] }), _jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("div", { className: `text-txt min-w-0 flex-1 truncate text-[13px] ${entry.unread ? 'font-bold' : 'font-medium'}`, children: name }), _jsx("div", { className: "text-sub shrink-0 text-[11px] tabular-nums", children: relativeEntryTime(entry.submittedAt) })] }), _jsx("p", { className: `mt-0.5 text-[12.5px] leading-[1.45] ${entry.unread ? 'text-txt' : 'text-sub'} ${compact ? 'line-clamp-1' : 'line-clamp-2'}`, children: preview }), _jsxs("div", { className: "mt-[3px] flex items-center gap-1.5", children: [showForm && entry.formName ? (_jsx("span", { className: "rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold whitespace-nowrap", style: {
1159
+ : 'border-bdr bg-card text-transparent'}`, children: _jsx(Check, { size: 10, "aria-hidden": true }) }), compact ? null : (_jsxs("span", { className: "relative flex size-8 items-center justify-center rounded-full text-[12px] font-bold", style: { background: avatarColor(name), color: 'var(--on-avatar)' }, children: [initials(name), entry.unread ? (_jsx("span", { className: "bg-acc absolute -top-px -right-px size-[9px] rounded-full border-2 border-[var(--sb)]" })) : null] }))] }), _jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("div", { className: `text-txt min-w-0 flex-1 truncate text-[13px] ${entry.unread ? 'font-bold' : 'font-medium'}`, children: name }), _jsx("div", { className: "text-sub shrink-0 text-[11px] tabular-nums", children: relativeEntryTime(entry.submittedAt) })] }), _jsx("p", { className: `mt-0.5 text-[12.5px] leading-[1.45] ${entry.unread ? 'text-txt' : 'text-sub'} ${compact ? 'line-clamp-1' : 'line-clamp-2'}`, children: preview }), _jsxs("div", { className: "mt-[3px] flex items-center gap-1.5", children: [showForm && entry.formName ? (_jsx("span", { className: "rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold whitespace-nowrap", style: {
1099
1160
  background: formBadgeStyle(entry.formSlug).bg,
1100
1161
  color: formBadgeStyle(entry.formSlug).fg,
1101
1162
  }, children: entry.formName })) : null, entry.spamStatus === 'spam' ? (_jsx("span", { className: "bg-err-l text-err rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold", children: entry.spamMeta?.by ? (SPAM_BY_LABELS[entry.spamMeta.by] ?? 'Spam') : 'Spam' })) : entry.spamStatus === 'suspected' ? (_jsx("span", { className: "bg-err-l text-err rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold", children: "Likely spam" })) : null, entry.deleted
@@ -1124,7 +1185,7 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
1124
1185
  const [fields, setFields] = useState([]);
1125
1186
  const [otherCount, setOtherCount] = useState(entry.otherEntryCount ?? 0);
1126
1187
  const [metaOpen, setMetaOpen] = useState(true);
1127
- const [showEmpty, setShowEmpty] = useState(false);
1188
+ const [showAllFields, setShowAllFields] = useState(false);
1128
1189
  const [noteText, setNoteText] = useState('');
1129
1190
  const notes = entry.notes ?? [];
1130
1191
  const index = list.findIndex((item) => item.id === entry.id);
@@ -1141,7 +1202,7 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
1141
1202
  const isFreeDomain = Boolean(emailDomain && FREE_EMAIL_DOMAINS.has(emailDomain));
1142
1203
  const isDomainBlocked = Boolean(emailDomain && blocked.domains.some((d) => d.term === emailDomain));
1143
1204
  useEffect(() => {
1144
- setShowEmpty(false);
1205
+ setShowAllFields(false);
1145
1206
  setNoteText('');
1146
1207
  setOtherCount(entry.otherEntryCount ?? 0);
1147
1208
  let cancelled = false;
@@ -1189,8 +1250,38 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
1189
1250
  return present.find(({ key }) => displayValue(entry.data[key]).length > 70) ?? null;
1190
1251
  }, [present, entry.data]);
1191
1252
  const submissionRows = useMemo(() => present.filter(({ key }) => key !== msgEntry?.key), [present, msgEntry]);
1192
- const filledRows = useMemo(() => submissionRows.filter(({ key }) => Boolean(displayValue(entry.data[key]))), [submissionRows, entry.data]);
1193
- const emptyRows = useMemo(() => submissionRows.filter(({ key }) => !displayValue(entry.data[key])), [submissionRows, entry.data]);
1253
+ // Collapse only values actually represented by the contact header. Some
1254
+ // legacy submissions store a first name as senderName without the surname.
1255
+ const headerFieldKeys = new Set(['name', 'first_name', 'last_name', 'full_name'].filter((key) => {
1256
+ const value = displayValue(entry.data[key]).trim().toLocaleLowerCase();
1257
+ return value && ` ${name.toLocaleLowerCase()} `.includes(` ${value} `);
1258
+ }));
1259
+ if (email && displayValue(entry.data.email) === email)
1260
+ headerFieldKeys.add('email');
1261
+ if (phone && displayValue(entry.data.phone) === phone)
1262
+ headerFieldKeys.add('phone');
1263
+ if (website)
1264
+ headerFieldKeys.add('website');
1265
+ const hiddenHeaderRows = submissionRows.filter(({ key }) => headerFieldKeys.has(key));
1266
+ const emptyRows = submissionRows.filter(({ key }) => !displayValue(entry.data[key]));
1267
+ const visibleRows = showAllFields
1268
+ ? submissionRows
1269
+ : submissionRows.filter(({ key }) => !headerFieldKeys.has(key) && Boolean(displayValue(entry.data[key])));
1270
+ const hiddenHeaderCount = hiddenHeaderRows.filter(({ key }) => displayValue(entry.data[key])).length;
1271
+ const hiddenFieldSummary = [
1272
+ hiddenHeaderCount ? `${hiddenHeaderCount} shown above` : '',
1273
+ emptyRows.length ? `${emptyRows.length} empty` : '',
1274
+ ]
1275
+ .filter(Boolean)
1276
+ .join(', ');
1277
+ const messageTitle = msgEntry
1278
+ ? {
1279
+ description: 'Project description',
1280
+ message: 'Message',
1281
+ goal: 'Primary goal',
1282
+ services: 'Services',
1283
+ }[msgEntry.key] || msgEntry.label
1284
+ : '';
1194
1285
  const answeredCount = useMemo(() => present.filter(({ key }) => Boolean(displayValue(entry.data[key]))).length, [present, entry.data]);
1195
1286
  const firstName = (typeof entry.data.first_name === 'string' && entry.data.first_name.trim()) ||
1196
1287
  name.split(/\s+/)[0] ||
@@ -1240,7 +1331,7 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
1240
1331
  : 'Future entries from this domain go straight to Spam', className: `${toolbarBtn} disabled:cursor-not-allowed disabled:opacity-45`, onClick: () => onBlockDomain(emailDomain), children: [_jsx(ShieldX, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: isDomainBlocked ? 'Domain blocked' : `Block ${emailDomain}` })] })) : null, _jsx("button", { type: "button", className: toolbarBtn, title: "Block a word", onClick: () => onManageBlocklist('words'), children: _jsx("span", { className: "max-[640px]:sr-only", children: "Block a word\u2026" }) }), _jsxs("button", { type: "button", className: toolbarBtn, title: "Copy all", onClick: copyAll, children: [_jsx(Copy, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Copy all" })] }), _jsx("span", { className: "flex-1" }), _jsxs("button", { type: "button", title: "Delete forever", className: "text-sub hover:bg-err-l hover:text-err inline-flex items-center gap-[5px] rounded-[7px] px-[9px] py-1.5 text-[12.5px] font-medium whitespace-nowrap", onClick: () => onDelete(entry.id), children: [_jsx(Trash2, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Delete forever" })] })] })) : (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", className: toolbarBtn, title: entry.unread ? 'Mark read (U)' : 'Mark unread (U)', onClick: () => onPatch(entry.id, { unread: !entry.unread }, entry.unread ? 'Marked read' : 'Marked unread'), children: [entry.unread ? _jsx(Check, { size: 14, "aria-hidden": true }) : _jsx(Mail, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: entry.unread ? 'Mark read' : 'Mark unread' })] }), _jsxs("button", { type: "button", "aria-pressed": entry.starred, title: entry.starred ? 'Unstar (S)' : 'Star (S)', className: `${toolbarBtn} ${entry.starred ? 'text-warn' : ''}`, onClick: () => onPatch(entry.id, { starred: !entry.starred }), children: [_jsx(Star, { size: 14, "aria-hidden": true, className: entry.starred ? 'fill-current' : '' }), _jsx("span", { className: "max-[640px]:sr-only", children: entry.starred ? 'Starred' : 'Star' })] }), _jsxs("button", { type: "button", className: toolbarBtn, title: entry.archived ? 'Unarchive (E)' : 'Archive (E)', onClick: () => onPatch(entry.id, { archived: !entry.archived }, entry.archived ? 'Moved to inbox' : 'Archived', { archived: entry.archived }), children: [_jsx(Archive, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: entry.archived ? 'Unarchive' : 'Archive' })] }), _jsxs("button", { type: "button", className: toolbarBtn, title: "Copy all fields", onClick: copyAll, children: [_jsx(Copy, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Copy all" })] }), _jsx("span", { className: "flex-1" }), _jsxs("button", { type: "button", className: toolbarBtn, title: "Mark as spam", onClick: () => onPatch(entry.id, {
1241
1332
  spamStatus: 'spam',
1242
1333
  spamMeta: { by: 'manual', reason: 'Marked as spam by you.' },
1243
- }, 'Moved to Spam', { spamStatus: entry.spamStatus, spamMeta: null }, true), children: [_jsx(ShieldX, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Spam" })] }), _jsxs("button", { type: "button", title: "Delete", className: "text-sub hover:bg-err-l hover:text-err inline-flex items-center gap-[5px] rounded-[7px] px-[9px] py-1.5 text-[12.5px] font-medium whitespace-nowrap", onClick: () => onDelete(entry.id), children: [_jsx(Trash2, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Delete" })] })] })), _jsx("span", { className: "bg-bdr mx-2 h-5 w-px shrink-0" }), _jsx("button", { type: "button", className: iconBtn, title: "Previous (K)", "aria-label": "Previous entry", disabled: index <= 0, onClick: () => index > 0 && list[index - 1] && onOpen(list[index - 1].id), children: _jsx(ChevronLeft, { size: 15, "aria-hidden": true }) }), index >= 0 ? (_jsxs("span", { "aria-live": "polite", className: "text-faint mx-1 text-[12px] whitespace-nowrap tabular-nums max-[640px]:sr-only", children: ["Entry ", index + 1, " of ", list.length] })) : null, _jsx("button", { type: "button", className: iconBtn, title: "Next (J)", "aria-label": "Next entry", disabled: index < 0 || index >= list.length - 1, onClick: () => list[index + 1] && onOpen(list[index + 1].id), children: _jsx(ChevronRight, { size: 15, "aria-hidden": true }) }), narrow ? null : (_jsx("button", { type: "button", className: iconBtn, title: "Close (Esc)", "aria-label": "Close entry", onClick: onClose, children: _jsx(X, { size: 15, "aria-hidden": true }) }))] }), _jsx("div", { className: "border-bdr bg-card border-b", children: _jsxs("div", { className: "mx-auto max-w-[860px] px-8 pt-7 pb-[30px] max-[900px]:px-4 max-[900px]:pt-5 max-[900px]:pb-6 @[1240px]:max-w-[1180px]", children: [_jsxs("div", { className: `flex items-start gap-4 max-[640px]:flex-wrap ${msgEntry ? 'mb-6' : ''}`, children: [_jsx("span", { className: "flex size-[52px] shrink-0 items-center justify-center rounded-full text-[18px] font-bold", style: { background: avatarColor(name), color: 'var(--on-avatar)' }, children: initials(name) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("h2", { className: "text-txt m-0 text-[22px] leading-[1.2] font-bold tracking-[-0.4px] break-words", children: name }), _jsxs("div", { className: "text-faint mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1.5 text-[12.5px]", children: [_jsx("span", { className: "rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold whitespace-nowrap", style: { background: formColor.bg, color: formColor.fg }, children: formLabel }), entry.unread ? (_jsx("span", { className: "bg-acc-l text-acc rounded-[5px] px-2 py-[3px] text-[11px] font-semibold", children: "Unread" })) : null, entry.starred ? (_jsxs("span", { className: "bg-warn-l text-warn inline-flex items-center gap-1 rounded-[5px] px-2 py-[3px] text-[11px] font-semibold", children: [_jsx(Star, { size: 11, "aria-hidden": true, className: "fill-current" }), " Starred"] })) : null, entry.archived ? (_jsx("span", { className: "border-bdr bg-bg text-faint rounded-[5px] border px-2 py-[3px] text-[11px] font-semibold", children: "Archived" })) : null, _jsx("span", { children: fullEntryTime(entry.submittedAt) }), otherCount > 0 && email ? (_jsxs("button", { type: "button", onClick: () => onFindEmail(email), className: "text-acc decoration-acc-m hover:decoration-acc cursor-pointer border-0 bg-transparent p-0 text-[12.5px] font-semibold whitespace-nowrap underline underline-offset-2", children: [otherCount, " other ", otherCount === 1 ? 'entry' : 'entries', " from this person"] })) : null] }), _jsxs("div", { className: "text-sub mt-2 flex min-w-0 items-center gap-2 text-[12.5px]", children: [_jsx("span", { className: "inline-flex shrink-0 items-center rounded-[5px] px-2 py-[3px] text-[11px] font-semibold", style: { color: attr.channelFg, background: attr.channelBg }, children: attr.channelLabel }), _jsxs("span", { className: "min-w-0 truncate", children: [_jsx("b", { className: "text-txt font-semibold", children: attr.source }), " / ", attr.medium, attr.campaign ? ` · ${attr.campaign}` : ''] })] }), email || phone || website ? (_jsxs("div", { className: "mt-3 flex flex-wrap gap-1.5", children: [email ? (_jsxs("a", { href: mailHref, title: "Email with their message quoted", className: "border-bdr bg-card text-txt hover:border-acc-m hover:bg-acc-l hover:text-acc inline-flex max-w-full items-center gap-1.5 truncate rounded-full border px-[11px] py-[5px] text-[12.5px] no-underline", children: [_jsx(Mail, { size: 13, "aria-hidden": true, className: "text-faint shrink-0" }), email] })) : null, phone ? (_jsxs("a", { href: `tel:${phone.replace(/[^\d+]/g, '')}`, className: "border-bdr bg-card text-txt hover:border-acc-m hover:bg-acc-l hover:text-acc inline-flex max-w-full items-center gap-1.5 truncate rounded-full border px-[11px] py-[5px] text-[12.5px] no-underline", children: [_jsx(Phone, { size: 13, "aria-hidden": true, className: "text-faint shrink-0" }), phone] })) : null, website ? (_jsxs("a", { href: website, target: "_blank", rel: "noopener noreferrer", className: "border-bdr bg-card text-txt hover:border-acc-m hover:bg-acc-l hover:text-acc inline-flex max-w-full items-center gap-1.5 truncate rounded-full border px-[11px] py-[5px] text-[12.5px] no-underline", children: [_jsx(Globe, { size: 13, "aria-hidden": true, className: "text-faint shrink-0" }), website.replace(/^https?:\/\//, '').replace(/\/$/, '')] })) : null] })) : null] }), entry.spamStatus !== 'spam' && !entry.partial && !entry.deleted ? (_jsxs("div", { className: "flex shrink-0 flex-col items-end gap-2 max-[640px]:w-full max-[640px]:flex-row max-[640px]:justify-start max-[640px]:pl-[68px]", children: [_jsxs("label", { className: "focus-within:outline-acc inline-flex cursor-pointer items-center gap-[7px] rounded-full border px-2.5 py-1 text-[12.5px] font-semibold focus-within:outline focus-within:outline-offset-2", style: {
1334
+ }, 'Moved to Spam', { spamStatus: entry.spamStatus, spamMeta: null }, true), children: [_jsx(ShieldX, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Spam" })] }), _jsxs("button", { type: "button", title: "Delete", className: "text-sub hover:bg-err-l hover:text-err inline-flex items-center gap-[5px] rounded-[7px] px-[9px] py-1.5 text-[12.5px] font-medium whitespace-nowrap", onClick: () => onDelete(entry.id), children: [_jsx(Trash2, { size: 14, "aria-hidden": true }), _jsx("span", { className: "max-[640px]:sr-only", children: "Delete" })] })] })), _jsx("span", { className: "bg-bdr mx-2 h-5 w-px shrink-0" }), _jsx("button", { type: "button", className: iconBtn, title: "Previous (K)", "aria-label": "Previous entry", disabled: index <= 0, onClick: () => index > 0 && list[index - 1] && onOpen(list[index - 1].id), children: _jsx(ChevronLeft, { size: 15, "aria-hidden": true }) }), index >= 0 ? (_jsxs("span", { "aria-live": "polite", className: "text-faint mx-1 text-[12px] whitespace-nowrap tabular-nums max-[640px]:sr-only", children: ["Entry ", index + 1, " of ", list.length] })) : null, _jsx("button", { type: "button", className: iconBtn, title: "Next (J)", "aria-label": "Next entry", disabled: index < 0 || index >= list.length - 1, onClick: () => list[index + 1] && onOpen(list[index + 1].id), children: _jsx(ChevronRight, { size: 15, "aria-hidden": true }) }), narrow ? null : (_jsx("button", { type: "button", className: iconBtn, title: "Close (Esc)", "aria-label": "Close entry", onClick: onClose, children: _jsx(X, { size: 15, "aria-hidden": true }) }))] }), _jsx("div", { className: "border-bdr bg-card border-b", children: _jsxs("div", { className: "mx-auto max-w-[860px] px-8 pt-7 pb-6 max-[900px]:px-4 max-[900px]:pt-5 max-[900px]:pb-6 @[1240px]:max-w-[1180px]", children: [_jsxs("div", { className: "flex items-start gap-4 max-[640px]:flex-wrap", children: [_jsx("span", { className: "flex size-[52px] shrink-0 items-center justify-center rounded-full text-[18px] font-bold", style: { background: avatarColor(name), color: 'var(--on-avatar)' }, children: initials(name) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("h2", { className: "text-txt m-0 text-[22px] leading-[1.2] font-bold tracking-[-0.4px] break-words", children: name }), _jsxs("div", { className: "text-faint mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1.5 text-[12.5px]", children: [_jsx("span", { className: "rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold whitespace-nowrap", style: { background: formColor.bg, color: formColor.fg }, children: formLabel }), entry.unread ? (_jsx("span", { className: "bg-acc-l text-acc rounded-[5px] px-2 py-[3px] text-[11px] font-semibold", children: "Unread" })) : null, entry.starred ? (_jsxs("span", { className: "bg-warn-l text-warn inline-flex items-center gap-1 rounded-[5px] px-2 py-[3px] text-[11px] font-semibold", children: [_jsx(Star, { size: 11, "aria-hidden": true, className: "fill-current" }), " Starred"] })) : null, entry.archived ? (_jsx("span", { className: "border-bdr bg-bg text-faint rounded-[5px] border px-2 py-[3px] text-[11px] font-semibold", children: "Archived" })) : null, _jsx("span", { children: fullEntryTime(entry.submittedAt) }), otherCount > 0 && email ? (_jsxs("button", { type: "button", onClick: () => onFindEmail(email), className: "text-acc decoration-acc-m hover:decoration-acc cursor-pointer border-0 bg-transparent p-0 text-[12.5px] font-semibold whitespace-nowrap underline underline-offset-2", children: [otherCount, " other ", otherCount === 1 ? 'entry' : 'entries', " from this person"] })) : null] }), _jsxs("div", { className: "text-sub mt-2 flex min-w-0 items-center gap-2 text-[12.5px]", children: [_jsx("span", { className: "inline-flex shrink-0 items-center rounded-[5px] px-2 py-[3px] text-[11px] font-semibold whitespace-nowrap", style: { color: attr.channelFg, background: attr.channelBg }, children: attr.channelLabel }), attr.channelKey !== 'direct' ? (_jsxs("span", { className: "min-w-0 truncate", children: [_jsx("b", { className: "text-txt font-semibold", children: attr.source }), " / ", attr.medium, attr.campaign ? ` · ${attr.campaign}` : ''] })) : null] }), email || phone || website ? (_jsxs("div", { className: "mt-3 flex flex-wrap gap-1.5", children: [email ? (_jsxs("a", { href: mailHref, title: "Email with their message quoted", className: "border-bdr bg-card text-txt hover:border-acc-m hover:bg-acc-l hover:text-acc inline-flex max-w-full items-center gap-1.5 truncate rounded-full border px-[11px] py-[5px] text-[12.5px] no-underline", children: [_jsx(Mail, { size: 13, "aria-hidden": true, className: "text-faint shrink-0" }), email] })) : null, phone ? (_jsxs("a", { href: `tel:${phone.replace(/[^\d+]/g, '')}`, className: "border-bdr bg-card text-txt hover:border-acc-m hover:bg-acc-l hover:text-acc inline-flex max-w-full items-center gap-1.5 truncate rounded-full border px-[11px] py-[5px] text-[12.5px] no-underline", children: [_jsx(Phone, { size: 13, "aria-hidden": true, className: "text-faint shrink-0" }), phone] })) : null, website ? (_jsxs("a", { href: website, target: "_blank", rel: "noopener noreferrer", className: "border-bdr bg-card text-txt hover:border-acc-m hover:bg-acc-l hover:text-acc inline-flex max-w-full items-center gap-1.5 truncate rounded-full border px-[11px] py-[5px] text-[12.5px] no-underline", children: [_jsx(Globe, { size: 13, "aria-hidden": true, className: "text-faint shrink-0" }), website.replace(/^https?:\/\//, '').replace(/\/$/, '')] })) : null] })) : null] }), entry.spamStatus !== 'spam' && !entry.partial && !entry.deleted ? (_jsxs("div", { className: "flex shrink-0 flex-col items-end gap-2 max-[640px]:w-full max-[640px]:flex-row max-[640px]:justify-start max-[640px]:pl-[68px]", children: [_jsxs("label", { className: "focus-within:outline-acc inline-flex cursor-pointer items-center gap-[7px] rounded-full border px-2.5 py-1 text-[12.5px] font-semibold focus-within:outline focus-within:outline-offset-2", style: {
1244
1335
  color: pipe.fg,
1245
1336
  background: pipe.bg,
1246
1337
  borderColor: `color-mix(in srgb, ${pipe.fg} 30%, transparent)`,
@@ -1271,15 +1362,11 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
1271
1362
  : 'color-mix(in srgb, var(--warn) 20%, var(--card))',
1272
1363
  } }, idx))) })] })] })) : null, entry.spamStatus === 'spam' ? (_jsxs("div", { role: "note", className: "bg-err-l text-err mb-3 flex items-start gap-2.5 rounded-[10px] border px-3.5 py-[11px] text-[12.5px] leading-[1.5]", style: { borderColor: 'color-mix(in srgb, var(--err) 25%, transparent)' }, children: [_jsx(ShieldX, { size: 16, "aria-hidden": true, className: "mt-px shrink-0" }), _jsxs("div", { children: [_jsxs("b", { className: "flex flex-wrap items-center gap-2 text-[13px]", children: ["Marked as spam \u00B7", ' ', entry.spamMeta?.by && entry.spamMeta.by !== 'manual'
1273
1364
  ? (SPAM_BY_LABELS[entry.spamMeta.by] ?? 'You')
1274
- : 'You', entry.spamMeta?.score ? (_jsxs("span", { className: "bg-card text-err rounded-full border px-[7px] text-[11px] font-semibold whitespace-nowrap", style: { borderColor: 'color-mix(in srgb, var(--err) 25%, transparent)' }, children: [entry.spamMeta.score, "% confidence"] })) : null] }), _jsx("span", { className: "text-txt block", children: `${entry.spamMeta?.reason ?? 'Marked as spam by you.'} No notification email was sent.` })] })] })) : null, msgEntry ? (_jsxs("section", { className: "group", "aria-labelledby": "d-msg-l", children: [_jsxs("div", { className: "text-faint mb-2 flex items-center gap-2 text-[12px] font-semibold", children: [_jsx("span", { id: "d-msg-l", children: msgEntry.label }), _jsx("button", { type: "button", title: `Copy ${msgEntry.label}`, "aria-label": `Copy ${msgEntry.label}`, onClick: () => copyValue(msgText), className: "text-faint hover:bg-acc-l hover:text-acc ml-auto inline-flex size-6 items-center justify-center rounded-[6px] opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100", children: _jsx(Copy, { size: 13, "aria-hidden": true }) })] }), _jsx("div", { dir: "auto", className: "text-txt max-w-[68ch] text-[15.5px] leading-[1.7] break-words whitespace-pre-wrap @[1240px]:max-w-[75ch]", children: formatFieldDisplay(msgEntry.key, msgText, fieldMap.get(msgEntry.key)) })] })) : null] }) }), _jsxs("div", { className: "mx-auto max-w-[860px] px-8 pt-[22px] pb-12 max-[900px]:px-4 max-[900px]:pt-4 max-[900px]:pb-10 @[1240px]:grid @[1240px]:max-w-[1180px] @[1240px]:grid-cols-[minmax(0,1fr)_400px] @[1240px]:items-start @[1240px]:gap-x-5", children: [_jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1", children: [_jsxs("h3", { className: "border-bdr text-faint m-0 flex items-center gap-2 border-b px-5 py-3 text-[11px] font-bold tracking-[0.6px] uppercase", children: ["Submission", _jsxs("span", { className: "ml-auto text-[11.5px] font-semibold tracking-normal normal-case", children: [answeredCount, " of ", present.length, " answered"] })] }), _jsxs("dl", { className: "divide-bdr m-0 divide-y", children: [filledRows.map(({ key, label }) => {
1275
- const raw = displayValue(entry.data[key]);
1276
- const formatted = formatFieldDisplay(key, raw, fieldMap.get(key));
1277
- return (_jsx(DetailRow, { label: label, copyText: formatted, onCopy: copyValue, children: formatted }, key));
1278
- }), showEmpty
1279
- ? emptyRows.map(({ key, label }) => (_jsxs("div", { className: "grid grid-cols-[minmax(110px,32%)_minmax(0,1fr)] items-baseline gap-x-4 gap-y-1 px-5 py-[11px] max-[520px]:grid-cols-1", children: [_jsx("dt", { className: "text-sub text-[12.5px] leading-[1.5] font-medium", children: label }), _jsx("dd", { className: "text-faint m-0 text-[14px] leading-[1.55]", children: "Not answered" })] }, key)))
1280
- : null] }), emptyRows.length > 0 ? (_jsx("button", { type: "button", "aria-expanded": showEmpty, onClick: () => setShowEmpty((v) => !v), className: "border-bdr text-acc hover:bg-acc-l block w-full cursor-pointer border-0 border-t bg-transparent px-5 py-2.5 text-left text-[12.5px] font-medium", children: showEmpty
1281
- ? 'Hide empty fields'
1282
- : `Show ${emptyRows.length} empty ${emptyRows.length === 1 ? 'field' : 'fields'}` })) : null] }), entry.spamStatus !== 'spam' && !entry.partial ? (_jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1", children: [_jsxs("h3", { className: "border-bdr text-faint m-0 flex items-center gap-2 border-b px-5 py-3 text-[11px] font-bold tracking-[0.6px] uppercase", children: ["Team notes", _jsxs("span", { className: "ml-auto text-[11.5px] font-semibold tracking-normal normal-case", children: [notes.length, " ", notes.length === 1 ? 'note' : 'notes'] })] }), _jsxs("div", { className: "flex flex-col gap-3.5 px-5 pt-3.5 pb-4", children: [notes.map((n, idx) => {
1365
+ : 'You', entry.spamMeta?.score ? (_jsxs("span", { className: "bg-card text-err rounded-full border px-[7px] text-[11px] font-semibold whitespace-nowrap", style: { borderColor: 'color-mix(in srgb, var(--err) 25%, transparent)' }, children: [entry.spamMeta.score, "% confidence"] })) : null] }), _jsx("span", { className: "text-txt block", children: `${entry.spamMeta?.reason ?? 'Marked as spam by you.'} No notification email was sent.` })] })] })) : null] }) }), _jsxs("div", { className: "mx-auto max-w-[860px] px-8 pt-[22px] pb-12 max-[900px]:px-4 max-[900px]:pt-4 max-[900px]:pb-10 @[1240px]:grid @[1240px]:max-w-[1180px] @[1240px]:grid-cols-[minmax(0,1fr)_400px] @[1240px]:items-start @[1240px]:gap-x-5", children: [msgEntry ? (_jsxs("article", { className: "group border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1", "aria-labelledby": "d-msg-l", children: [_jsxs("h3", { id: "d-msg-l", className: "border-bdr text-txt m-0 flex items-center gap-2 border-b px-5 py-3 text-[13px] font-semibold", children: [messageTitle, _jsx("button", { type: "button", title: `Copy ${messageTitle}`, "aria-label": `Copy ${messageTitle}`, onClick: () => copyValue(msgText), className: "text-faint hover:bg-acc-l hover:text-acc ml-auto inline-flex size-6 items-center justify-center rounded-[6px] opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100", children: _jsx(Copy, { size: 13, "aria-hidden": true }) })] }), _jsx("div", { dir: "auto", className: "text-txt px-5 pt-4 pb-5 text-[15px] leading-[1.7] [text-wrap:pretty] break-words whitespace-pre-wrap", children: formatFieldDisplay(msgEntry.key, msgText, fieldMap.get(msgEntry.key)) })] })) : null, _jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1", children: [_jsxs("h3", { className: "border-bdr text-faint m-0 flex items-center gap-2 border-b px-5 py-3 text-[11px] font-bold tracking-[0.6px] uppercase", children: ["Submission", _jsxs("span", { className: "ml-auto text-[11.5px] font-semibold tracking-normal normal-case", children: [answeredCount, " of ", present.length, " answered"] })] }), _jsx("dl", { className: "divide-bdr m-0 divide-y", children: visibleRows.map(({ key, label }) => {
1366
+ const raw = displayValue(entry.data[key]);
1367
+ const formatted = formatFieldDisplay(key, raw, fieldMap.get(key));
1368
+ return (_jsx(DetailRow, { label: label, copyText: formatted || undefined, onCopy: copyValue, children: formatted || _jsx("span", { className: "text-faint", children: "Not answered" }) }, key));
1369
+ }) }), hiddenFieldSummary ? (_jsx("button", { type: "button", "aria-expanded": showAllFields, onClick: () => setShowAllFields((v) => !v), className: "border-bdr text-acc hover:bg-acc-l block w-full cursor-pointer border-0 border-t bg-transparent px-5 py-2.5 text-left text-[12.5px] font-medium", children: showAllFields ? 'Show fewer fields' : `Show all fields (${hiddenFieldSummary})` })) : null] }), entry.spamStatus !== 'spam' && !entry.partial ? (_jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:col-start-1", children: [_jsxs("h3", { className: "border-bdr text-faint m-0 flex items-center gap-2 border-b px-5 py-3 text-[11px] font-bold tracking-[0.6px] uppercase", children: ["Team notes", _jsxs("span", { className: "ml-auto text-[11.5px] font-semibold tracking-normal normal-case", children: [notes.length, " ", notes.length === 1 ? 'note' : 'notes'] })] }), _jsxs("div", { className: "flex flex-col gap-3.5 px-5 pt-3.5 pb-4", children: [notes.map((n, idx) => {
1283
1370
  const author = team.find((t) => t.id === n.authorId)?.name ||
1284
1371
  n.authorName ||
1285
1372
  n.authorId ||
@@ -1290,16 +1377,16 @@ function EntryDetail({ entry, list, narrow, team, currentUserId, currentUserName
1290
1377
  e.preventDefault();
1291
1378
  addNote();
1292
1379
  }
1293
- }, className: "border-bdr bg-card text-txt focus-visible:outline-acc min-h-[58px] w-full resize-y rounded-[9px] border px-2.5 py-2 text-[13px] leading-[1.45] focus-visible:outline focus-visible:outline-offset-2" }), _jsxs("div", { className: "text-faint mt-1.5 flex items-center gap-2.5 text-[11.5px]", children: [_jsx("span", { className: "flex-1", children: "\u2318 Enter to save \u00B7 only visible to your team" }), _jsx("button", { type: "button", disabled: !noteText.trim(), onClick: addNote, className: "bg-acc inline-flex items-center gap-1.5 rounded-[8px] px-[15px] py-2 text-[13px] font-medium text-[var(--on-acc)] disabled:cursor-not-allowed disabled:opacity-45", children: "Add note" })] })] })] })] })] })) : null, _jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:sticky @[1240px]:top-[68px] @[1240px]:col-start-2 @[1240px]:row-span-2 @[1240px]:row-start-1", children: [_jsx("h3", { className: "m-0", children: _jsxs("button", { type: "button", "aria-expanded": metaOpen, "aria-controls": "d-attr", onClick: () => setMetaOpen((open) => !open), className: `border-bdr text-faint hover:text-acc flex w-full cursor-pointer items-center gap-2 bg-transparent px-5 py-3 text-left text-[11px] font-bold tracking-[0.6px] uppercase ${metaOpen ? 'border-b' : ''}`, children: ["Attribution & technical", _jsxs("span", { className: "ml-auto inline-flex items-center gap-1.5 text-[11.5px] font-semibold tracking-normal normal-case", children: [attr.spamScore >= 80 ? (_jsxs("span", { className: "bg-err-l text-err rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold", children: ["Spam ", attr.spamScore] })) : (_jsxs("span", { className: "text-faint", children: ["Spam score ", attr.spamScore] })), _jsx(ChevronDown, { size: 14, "aria-hidden": true, className: `transition-transform ${metaOpen ? 'rotate-180' : ''}` })] })] }) }), metaOpen ? (_jsxs("dl", { id: "d-attr", className: "divide-bdr m-0 divide-y", children: [_jsx(DetailRow, { label: "Channel", compact: true, children: _jsx("span", { className: "inline-flex items-center rounded-[5px] border px-2 py-[3px] text-[11px] font-semibold", style: {
1380
+ }, className: "border-bdr bg-card text-txt focus-visible:outline-acc min-h-[58px] w-full resize-y rounded-[9px] border px-2.5 py-2 text-[13px] leading-[1.45] focus-visible:outline focus-visible:outline-offset-2" }), _jsxs("div", { className: "text-faint mt-1.5 flex items-center gap-2.5 text-[11.5px]", children: [_jsx("span", { className: "flex-1", children: "\u2318 Enter to save \u00B7 only visible to your team" }), _jsx("button", { type: "button", disabled: !noteText.trim(), onClick: addNote, className: "bg-acc inline-flex items-center gap-1.5 rounded-[8px] px-[15px] py-2 text-[13px] font-medium text-[var(--on-acc)] disabled:cursor-not-allowed disabled:opacity-45", children: "Add note" })] })] })] })] })] })) : null, _jsxs("article", { className: "border-bdr bg-card shadow-shd mb-3.5 overflow-hidden rounded-[10px] border @[1240px]:sticky @[1240px]:top-[68px] @[1240px]:col-start-2 @[1240px]:row-span-3 @[1240px]:row-start-1", children: [_jsx("h3", { className: "m-0", children: _jsxs("button", { type: "button", "aria-expanded": metaOpen, "aria-controls": "d-attr", onClick: () => setMetaOpen((open) => !open), className: `border-bdr text-faint hover:text-acc flex w-full cursor-pointer items-center gap-2 bg-transparent px-5 py-3 text-left text-[11px] font-bold tracking-[0.6px] uppercase ${metaOpen ? 'border-b' : ''}`, children: ["Attribution & technical", _jsxs("span", { className: "ml-auto inline-flex items-center gap-1.5 text-[11.5px] font-semibold tracking-normal normal-case", children: [attr.spamScore >= 80 ? (_jsxs("span", { className: "bg-err-l text-err rounded-[5px] px-[7px] py-0.5 text-[10px] font-semibold", children: ["Spam ", attr.spamScore] })) : (_jsxs("span", { className: "text-faint", children: ["Spam score ", attr.spamScore] })), _jsx(ChevronDown, { size: 14, "aria-hidden": true, className: `transition-transform ${metaOpen ? 'rotate-180' : ''}` })] })] }) }), metaOpen ? (_jsxs("dl", { id: "d-attr", className: "divide-bdr m-0 divide-y", children: [_jsx(DetailRow, { label: "Channel", compact: true, children: _jsx("span", { className: "inline-flex items-center rounded-[5px] border px-2 py-[3px] text-[11px] font-semibold", style: {
1294
1381
  color: attr.channelFg,
1295
1382
  background: attr.channelBg,
1296
1383
  borderColor: `color-mix(in srgb, ${attr.channelFg} 22%, transparent)`,
1297
- }, children: attr.channelLabel }) }), _jsx(DetailRow, { label: "Source / Medium", compact: true, copyText: `${attr.source} / ${attr.medium}`, onCopy: copyValue, children: _jsxs("b", { className: "text-txt font-semibold", children: [attr.source, " ", _jsx("span", { className: "text-faint font-normal", children: "/" }), " ", attr.medium] }) }), attr.campaign ? (_jsx(DetailRow, { label: "Campaign", compact: true, copyText: attr.campaign, onCopy: copyValue, children: attr.campaign })) : null, attr.term ? (_jsx(DetailRow, { label: "Keyword", compact: true, copyText: attr.term, onCopy: copyValue, children: attr.term })) : null, _jsx(ClickIdRow, { ids: attr.clickIds, onCopy: copyValue }), _jsx(DetailRow, { label: "Landing page", compact: true, copyText: attr.landingPage !== '—' ? attr.landingPage : undefined, onCopy: copyValue, children: attr.landingPage !== '—' ? (_jsx("a", { href: attr.landingPage, target: "_blank", rel: "noopener noreferrer", className: "text-acc hover:underline", children: attr.landingPage })) : ('—') }), _jsx(DetailRow, { label: "Referrer", compact: true, copyText: attr.referrer, onCopy: copyValue, children: attr.referrer }), _jsx(DetailRow, { label: "Device", compact: true, copyText: attr.device, onCopy: copyValue, clamp: true, children: attr.device }), _jsx(DetailRow, { label: "IP address", compact: true, mono: true, copyText: attr.ip !== '—' ? attr.ip : undefined, onCopy: copyValue, children: attr.ip }), _jsx(DetailRow, { label: "Submitted", compact: true, copyText: fullEntryTime(entry.submittedAt), onCopy: copyValue, children: fullEntryTime(entry.submittedAt) }), _jsx(DetailRow, { label: "Form", compact: true, copyText: formLabel, onCopy: copyValue, children: formLabel }), _jsx(DetailRow, { label: "Entry ID", compact: true, mono: true, copyText: entryIdLabel(entry), onCopy: copyValue, children: entryIdLabel(entry) })] })) : null] })] })] }));
1384
+ }, children: attr.channelLabel }) }), _jsx(DetailRow, { label: "Source / Medium", compact: true, copyText: `${attr.source} / ${attr.medium}`, onCopy: copyValue, children: _jsxs("b", { className: "text-txt font-semibold", children: [attr.source, " ", _jsx("span", { className: "text-faint font-normal", children: "/" }), " ", attr.medium] }) }), attr.campaign ? (_jsx(DetailRow, { label: "Campaign", compact: true, copyText: attr.campaign, onCopy: copyValue, children: attr.campaign })) : null, attr.term ? (_jsx(DetailRow, { label: "Keyword", compact: true, copyText: attr.term, onCopy: copyValue, children: attr.term })) : null, _jsx(ClickIdRow, { ids: attr.clickIds, onCopy: copyValue }), _jsx(DetailRow, { label: "Landing page", compact: true, copyText: attr.landingPage !== '—' ? attr.landingPage : undefined, onCopy: copyValue, children: attr.landingPage !== '—' ? (_jsx("a", { href: attr.landingPage, target: "_blank", rel: "noopener noreferrer", title: attr.landingPage, className: "text-acc block truncate hover:underline", children: attr.landingPage.replace(/^https?:\/\/(?:www\.)?/, '') })) : ('—') }), _jsx(DetailRow, { label: "Referrer", compact: true, copyText: attr.referrer, onCopy: copyValue, children: attr.referrer }), _jsx(DetailRow, { label: "Device", compact: true, copyText: attr.device, onCopy: copyValue, clamp: true, children: attr.device }), _jsx(DetailRow, { label: "IP address", compact: true, mono: true, copyText: attr.ip !== '—' ? attr.ip : undefined, onCopy: copyValue, children: attr.ip }), _jsx(DetailRow, { label: "Submitted", compact: true, copyText: fullEntryTime(entry.submittedAt), onCopy: copyValue, children: fullEntryTime(entry.submittedAt) }), _jsx(DetailRow, { label: "Form", compact: true, copyText: formLabel, onCopy: copyValue, children: formLabel }), _jsx(DetailRow, { label: "Entry ID", compact: true, mono: true, copyText: entryIdLabel(entry), onCopy: copyValue, children: entryIdLabel(entry) })] })) : null] })] })] }));
1298
1385
  }
1299
1386
  function DetailRow({ label, children, copyText, onCopy, compact, mono, clamp, }) {
1300
- return (_jsxs("div", { className: `group grid items-baseline gap-x-4 gap-y-1 px-5 hover:bg-[color-mix(in_srgb,var(--bg)_60%,transparent)] max-[520px]:grid-cols-1 ${compact
1387
+ return (_jsxs("div", { className: `group grid items-baseline gap-x-4 gap-y-1 px-5 hover:bg-[color-mix(in_srgb,var(--bg)_60%,transparent)] @max-[520px]:grid-cols-1 ${compact
1301
1388
  ? 'grid-cols-[minmax(110px,32%)_minmax(0,1fr)] py-[9px] @[1240px]:grid-cols-[118px_minmax(0,1fr)]'
1302
- : 'grid-cols-[minmax(110px,32%)_minmax(0,1fr)] py-[11px]'}`, children: [_jsx("dt", { className: "text-sub text-[12.5px] leading-[1.5] font-medium", children: label }), _jsxs("dd", { className: `m-0 flex min-w-0 items-start gap-2 leading-[1.55] ${compact ? 'text-sub text-[13px]' : 'text-txt text-[14px]'}`, children: [_jsx("span", { dir: "auto", className: `min-w-0 flex-1 break-words ${clamp ? 'line-clamp-2 whitespace-normal' : 'whitespace-pre-wrap'} ${mono ? 'font-mono text-[12px]' : ''}`, children: children }), copyText && onCopy ? (_jsx("button", { type: "button", title: `Copy ${label}`, "aria-label": `Copy ${label}`, onClick: () => onCopy(copyText), className: "text-faint hover:bg-acc-l hover:text-acc -my-0.5 inline-flex size-6 shrink-0 items-center justify-center rounded-[6px] opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100", children: _jsx(Copy, { size: 13, "aria-hidden": true }) })) : null] })] }));
1389
+ : 'grid-cols-[minmax(110px,170px)_minmax(0,1fr)] py-2'}`, children: [_jsx("dt", { className: "text-sub text-[12.5px] leading-[1.5] font-medium", children: label }), _jsxs("dd", { className: `m-0 flex min-w-0 items-start gap-2 leading-[1.55] ${compact ? 'text-sub text-[13px]' : 'text-txt text-[14px]'}`, children: [_jsx("span", { dir: "auto", className: `min-w-0 flex-1 break-words ${clamp ? 'line-clamp-2 whitespace-normal' : 'whitespace-pre-wrap'} ${mono ? 'font-mono text-[12px]' : ''}`, children: children }), copyText && onCopy ? (_jsx("button", { type: "button", title: `Copy ${label}`, "aria-label": `Copy ${label}`, onClick: () => onCopy(copyText), className: "text-faint hover:bg-acc-l hover:text-acc -my-0.5 inline-flex size-6 shrink-0 items-center justify-center rounded-[6px] opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100", children: _jsx(Copy, { size: 13, "aria-hidden": true }) })) : null] })] }));
1303
1390
  }
1304
1391
  function ClickIdRow({ ids, onCopy, }) {
1305
1392
  const label = ids.length > 1 ? 'Click IDs' : 'Click ID';