@prenta/admin 2.12.0 → 2.13.0

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 (75) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/AdminRoot.d.ts.map +1 -1
  3. package/dist/AdminRoot.js +3 -3
  4. package/dist/AdminRoot.js.map +1 -1
  5. package/dist/__tests__/components/attribution-rows.test.js +17 -5
  6. package/dist/__tests__/components/attribution-rows.test.js.map +1 -1
  7. package/dist/__tests__/layout/shell-nav.render.test.js +3 -1
  8. package/dist/__tests__/layout/shell-nav.render.test.js.map +1 -1
  9. package/dist/__tests__/views/form-entries.render.test.js +5 -5
  10. package/dist/__tests__/views/form-entries.render.test.js.map +1 -1
  11. package/dist/__tests__/views/form-submissions.render.test.js +3 -3
  12. package/dist/__tests__/views/form-submissions.render.test.js.map +1 -1
  13. package/dist/__tests__/views/search-data-card.render.test.d.ts +2 -0
  14. package/dist/__tests__/views/search-data-card.render.test.d.ts.map +1 -0
  15. package/dist/__tests__/views/search-data-card.render.test.js +236 -0
  16. package/dist/__tests__/views/search-data-card.render.test.js.map +1 -0
  17. package/dist/__tests__/views/seo-settings.render.test.js +8 -4
  18. package/dist/__tests__/views/seo-settings.render.test.js.map +1 -1
  19. package/dist/components/forms/ExportMenu.d.ts +7 -1
  20. package/dist/components/forms/ExportMenu.d.ts.map +1 -1
  21. package/dist/components/forms/ExportMenu.js +17 -5
  22. package/dist/components/forms/ExportMenu.js.map +1 -1
  23. package/dist/layout/nav-config.d.ts.map +1 -1
  24. package/dist/layout/nav-config.js +8 -1
  25. package/dist/layout/nav-config.js.map +1 -1
  26. package/dist/lib/entry-attribution.d.ts +33 -0
  27. package/dist/lib/entry-attribution.d.ts.map +1 -1
  28. package/dist/lib/entry-attribution.js +115 -30
  29. package/dist/lib/entry-attribution.js.map +1 -1
  30. package/dist/lib/forms-service.d.ts +38 -0
  31. package/dist/lib/forms-service.d.ts.map +1 -1
  32. package/dist/lib/forms-service.js +10 -0
  33. package/dist/lib/forms-service.js.map +1 -1
  34. package/dist/prenta-admin.css +1 -1
  35. package/dist/views/FormEntries.d.ts +4 -1
  36. package/dist/views/FormEntries.d.ts.map +1 -1
  37. package/dist/views/FormEntries.js +2 -2
  38. package/dist/views/FormEntries.js.map +1 -1
  39. package/dist/views/FormSubmissions.d.ts +3 -1
  40. package/dist/views/FormSubmissions.d.ts.map +1 -1
  41. package/dist/views/FormSubmissions.js +2 -2
  42. package/dist/views/FormSubmissions.js.map +1 -1
  43. package/dist/views/SpamFolder.d.ts +6 -1
  44. package/dist/views/SpamFolder.d.ts.map +1 -1
  45. package/dist/views/SpamFolder.js +4 -11
  46. package/dist/views/SpamFolder.js.map +1 -1
  47. package/dist/views/entries/EntriesInbox.d.ts +12 -2
  48. package/dist/views/entries/EntriesInbox.d.ts.map +1 -1
  49. package/dist/views/entries/EntriesInbox.js +820 -81
  50. package/dist/views/entries/EntriesInbox.js.map +1 -1
  51. package/dist/views/entries/inbox-format.d.ts +0 -1
  52. package/dist/views/entries/inbox-format.d.ts.map +1 -1
  53. package/dist/views/entries/inbox-format.js +0 -4
  54. package/dist/views/entries/inbox-format.js.map +1 -1
  55. package/dist/views/settings/SearchDataCard.d.ts.map +1 -1
  56. package/dist/views/settings/SearchDataCard.js +162 -24
  57. package/dist/views/settings/SearchDataCard.js.map +1 -1
  58. package/package.json +7 -7
  59. package/src/AdminRoot.tsx +23 -3
  60. package/src/__tests__/components/attribution-rows.test.ts +19 -5
  61. package/src/__tests__/layout/shell-nav.render.test.tsx +3 -1
  62. package/src/__tests__/views/form-entries.render.test.tsx +5 -5
  63. package/src/__tests__/views/form-submissions.render.test.tsx +3 -3
  64. package/src/__tests__/views/search-data-card.render.test.tsx +275 -0
  65. package/src/__tests__/views/seo-settings.render.test.tsx +15 -5
  66. package/src/components/forms/ExportMenu.tsx +37 -13
  67. package/src/layout/nav-config.tsx +8 -0
  68. package/src/lib/entry-attribution.ts +155 -29
  69. package/src/lib/forms-service.ts +44 -0
  70. package/src/views/FormEntries.tsx +17 -2
  71. package/src/views/FormSubmissions.tsx +16 -2
  72. package/src/views/SpamFolder.tsx +14 -26
  73. package/src/views/entries/EntriesInbox.tsx +2119 -337
  74. package/src/views/entries/inbox-format.ts +0 -6
  75. package/src/views/settings/SearchDataCard.tsx +306 -45
@@ -46,6 +46,32 @@ export type {
46
46
  EntryCounts,
47
47
  } from '@prenta/core'
48
48
 
49
+ export interface FormEntryNote {
50
+ authorId: string
51
+ authorName?: string
52
+ at: string
53
+ text: string
54
+ }
55
+
56
+ interface FormEntryDeleted {
57
+ at: string
58
+ by: string
59
+ byName?: string
60
+ }
61
+
62
+ interface FormEntryPartial {
63
+ step: number
64
+ of: number
65
+ stepName: string
66
+ lastAt: string
67
+ }
68
+
69
+ interface FormEntrySpamMeta {
70
+ by: 'ai' | 'keyword' | 'fast' | 'honeypot' | 'manual'
71
+ reason: string
72
+ score?: number
73
+ }
74
+
49
75
  /**
50
76
  * `cmsApi` never throws — it returns `{ error, status }` on a network/HTTP
51
77
  * failure. Read (GET) fetchers must re-surface that as a thrown error so the
@@ -354,12 +380,23 @@ export interface EntryPatch {
354
380
  unread?: boolean
355
381
  starred?: boolean
356
382
  archived?: boolean
383
+ status?: string
384
+ spamStatus?: 'clean' | 'suspected' | 'spam'
385
+ assigneeId?: string | null
386
+ assigneeName?: string | null
387
+ notes?: FormEntryNote[]
388
+ note?: { text: string; authorName?: string }
389
+ deleted?: FormEntryDeleted | null
390
+ partial?: FormEntryPartial | null
391
+ spamMeta?: FormEntrySpamMeta | null
357
392
  }
358
393
 
359
394
  function buildEntriesQuery(params: FetchFormEntriesParams): string {
360
395
  const qs = new URLSearchParams()
361
396
  if (params.search) qs.set('search', params.search)
362
397
  if (params.formId) qs.set('formId', params.formId)
398
+ if (params.folder) qs.set('folder', params.folder)
399
+ if (params.assigneeId) qs.set('assigneeId', params.assigneeId)
363
400
  if (typeof params.unread === 'boolean') qs.set('unread', String(params.unread))
364
401
  if (typeof params.starred === 'boolean') qs.set('starred', String(params.starred))
365
402
  if (typeof params.archived === 'boolean') qs.set('archived', String(params.archived))
@@ -395,6 +432,7 @@ export async function fetchEntryCounts(params: FetchFormEntriesParams = {}): Pro
395
432
  export interface EntryDetail {
396
433
  entry: FormSubmission
397
434
  fields: FormField[]
435
+ otherEntryCount?: number
398
436
  }
399
437
 
400
438
  export async function fetchEntry(id: string): Promise<EntryDetail | null> {
@@ -443,11 +481,17 @@ export async function downloadEntriesExport(
443
481
  options: {
444
482
  formId?: string
445
483
  format?: EntriesExportFormat
484
+ folder?: string
485
+ search?: string
486
+ assigneeId?: string
446
487
  } = {},
447
488
  ): Promise<{ error?: string }> {
448
489
  const format: EntriesExportFormat = options.format ?? 'csv'
449
490
  const qs = new URLSearchParams({ format })
450
491
  if (options.formId) qs.set('formId', options.formId)
492
+ if (options.folder && options.folder !== 'all') qs.set('folder', options.folder)
493
+ if (options.search?.trim()) qs.set('search', options.search.trim())
494
+ if (options.assigneeId) qs.set('assigneeId', options.assigneeId)
451
495
 
452
496
  let res: Response
453
497
  try {
@@ -7,8 +7,23 @@ import { EntriesInbox } from './entries/EntriesInbox.js'
7
7
 
8
8
  export interface FormEntriesProps {
9
9
  onNavigate?: (path: string) => void
10
+ currentPath?: string
11
+ currentUserId?: string
12
+ currentUserName?: string
10
13
  }
11
14
 
12
- export function FormEntries({ onNavigate }: FormEntriesProps) {
13
- return <EntriesInbox onNavigate={onNavigate} />
15
+ export function FormEntries({
16
+ onNavigate,
17
+ currentPath,
18
+ currentUserId,
19
+ currentUserName,
20
+ }: FormEntriesProps) {
21
+ return (
22
+ <EntriesInbox
23
+ onNavigate={onNavigate}
24
+ currentPath={currentPath}
25
+ currentUserId={currentUserId}
26
+ currentUserName={currentUserName}
27
+ />
28
+ )
14
29
  }
@@ -9,8 +9,22 @@ import { EntriesInbox } from './entries/EntriesInbox.js'
9
9
  export interface FormSubmissionsProps {
10
10
  formId: string
11
11
  onNavigate?: (path: string) => void
12
+ currentUserId?: string
13
+ currentUserName?: string
12
14
  }
13
15
 
14
- export function FormSubmissions({ formId, onNavigate }: FormSubmissionsProps) {
15
- return <EntriesInbox formId={formId} onNavigate={onNavigate} />
16
+ export function FormSubmissions({
17
+ formId,
18
+ onNavigate,
19
+ currentUserId,
20
+ currentUserName,
21
+ }: FormSubmissionsProps) {
22
+ return (
23
+ <EntriesInbox
24
+ formId={formId}
25
+ onNavigate={onNavigate}
26
+ currentUserId={currentUserId}
27
+ currentUserName={currentUserName}
28
+ />
29
+ )
16
30
  }
@@ -1,32 +1,20 @@
1
1
  'use client'
2
2
 
3
- import { Breadcrumb } from '../components/ui/Breadcrumb.js'
4
- import { PageHeader } from '../components/ui/PageHeader.js'
5
- import { EmptyState } from '../components/ui/EmptyState.js'
6
- import { ShieldAlert } from 'lucide-react'
3
+ import { EntriesInbox } from './entries/EntriesInbox.js'
7
4
 
8
- export function SpamFolder() {
5
+ export interface SpamFolderProps {
6
+ onNavigate?: (path: string) => void
7
+ currentUserId?: string
8
+ currentUserName?: string
9
+ }
10
+
11
+ export function SpamFolder({ onNavigate, currentUserId, currentUserName }: SpamFolderProps) {
9
12
  return (
10
- <div className="flex flex-col gap-6 p-6">
11
- <PageHeader
12
- flush
13
- title="Spam"
14
- subtitle="Entries caught by the blocklist stay out of the inbox."
15
- breadcrumb={
16
- <Breadcrumb
17
- items={[
18
- { label: 'Dashboard', path: '/' },
19
- { label: 'Forms', path: '/forms' },
20
- { label: 'Spam' },
21
- ]}
22
- />
23
- }
24
- />
25
- <EmptyState
26
- icon={<ShieldAlert size={24} aria-hidden />}
27
- title="The spam folder isn't ready yet"
28
- description="Caught entries are in All Entries under the Spam filter. Restoring one as not spam comes with this folder."
29
- />
30
- </div>
13
+ <EntriesInbox
14
+ initialFilter="spam"
15
+ onNavigate={onNavigate}
16
+ currentUserId={currentUserId}
17
+ currentUserName={currentUserName}
18
+ />
31
19
  )
32
20
  }