@prenta/admin 2.13.0 → 2.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/design-system/tokens.css +5 -0
- package/design-system/tokens.json +20 -0
- package/design-system/tokens.scss +8 -0
- package/dist/__tests__/views/form-editor.render.test.js +20 -0
- package/dist/__tests__/views/form-editor.render.test.js.map +1 -1
- package/dist/__tests__/views/media-browser.render.test.js +7 -7
- package/dist/__tests__/views/media-browser.render.test.js.map +1 -1
- package/dist/components/FolderTree.d.ts +4 -2
- package/dist/components/FolderTree.d.ts.map +1 -1
- package/dist/components/FolderTree.js +4 -2
- package/dist/components/FolderTree.js.map +1 -1
- package/dist/components/ui/UnderlineTabs.d.ts +3 -1
- package/dist/components/ui/UnderlineTabs.d.ts.map +1 -1
- package/dist/components/ui/UnderlineTabs.js +6 -4
- package/dist/components/ui/UnderlineTabs.js.map +1 -1
- package/dist/lib/page-editor-service.d.ts.map +1 -1
- package/dist/lib/page-editor-service.js +3 -0
- package/dist/lib/page-editor-service.js.map +1 -1
- package/dist/prenta-admin.css +1 -1
- package/dist/views/FormEditor.d.ts.map +1 -1
- package/dist/views/FormEditor.js +18 -14
- package/dist/views/FormEditor.js.map +1 -1
- package/dist/views/FormsSettings.d.ts.map +1 -1
- package/dist/views/FormsSettings.js +23 -14
- package/dist/views/FormsSettings.js.map +1 -1
- package/dist/views/MediaBrowser.d.ts.map +1 -1
- package/dist/views/MediaBrowser.js +83 -18
- package/dist/views/MediaBrowser.js.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/views/form-editor.render.test.tsx +25 -0
- package/src/__tests__/views/media-browser.render.test.tsx +7 -7
- package/src/components/FolderTree.tsx +20 -1
- package/src/components/ui/UnderlineTabs.tsx +14 -2
- package/src/lib/page-editor-service.ts +3 -0
- package/src/styles/prenta-tokens.css +5 -0
- package/src/views/FormEditor.tsx +126 -100
- package/src/views/FormsSettings.tsx +48 -15
- package/src/views/MediaBrowser.tsx +106 -24
package/src/views/FormEditor.tsx
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* routes into this editor so notifications/embed/webhooks — which need a form
|
|
21
21
|
* id — are one click away.
|
|
22
22
|
*/
|
|
23
|
-
import
|
|
23
|
+
import { UnderlineTabs, UnderlineTabPanel } from '../components/ui/UnderlineTabs.js'
|
|
24
|
+
import { Button } from '../components/ui/Button.js'
|
|
24
25
|
import {
|
|
25
26
|
ArrowLeft,
|
|
26
27
|
Check,
|
|
@@ -31,6 +32,11 @@ import {
|
|
|
31
32
|
Loader2,
|
|
32
33
|
MessageSquare,
|
|
33
34
|
Save,
|
|
35
|
+
Settings2,
|
|
36
|
+
Shield,
|
|
37
|
+
Mail,
|
|
38
|
+
Webhook,
|
|
39
|
+
ChartNoAxesCombined,
|
|
34
40
|
} from 'lucide-react'
|
|
35
41
|
import { useCallback, useEffect, useState } from 'react'
|
|
36
42
|
import { toast } from 'sonner'
|
|
@@ -65,13 +71,13 @@ const inputCls =
|
|
|
65
71
|
'border-border bg-input-background text-foreground focus-visible:ring-ring w-full rounded-lg border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:outline-none'
|
|
66
72
|
|
|
67
73
|
const TABS = [
|
|
68
|
-
{ id: 'general', label: 'General' },
|
|
69
|
-
{ id: 'confirmations', label: 'Confirmations' },
|
|
70
|
-
{ id: 'spam', label: 'Spam protection' },
|
|
71
|
-
{ id: 'notifications', label: 'Notifications' },
|
|
72
|
-
{ id: 'webhooks', label: 'Webhooks' },
|
|
73
|
-
{ id: 'analytics', label: 'Analytics' },
|
|
74
|
-
{ id: 'embed', label: 'Embed' },
|
|
74
|
+
{ id: 'general', icon: Settings2, label: 'General' },
|
|
75
|
+
{ id: 'confirmations', icon: Check, label: 'Confirmations' },
|
|
76
|
+
{ id: 'spam', icon: Shield, label: 'Spam protection' },
|
|
77
|
+
{ id: 'notifications', icon: Mail, label: 'Notifications' },
|
|
78
|
+
{ id: 'webhooks', icon: Webhook, label: 'Webhooks' },
|
|
79
|
+
{ id: 'analytics', icon: ChartNoAxesCombined, label: 'Analytics' },
|
|
80
|
+
{ id: 'embed', icon: Code2, label: 'Embed' },
|
|
75
81
|
] as const
|
|
76
82
|
|
|
77
83
|
interface DetailsState {
|
|
@@ -256,8 +262,8 @@ function ExistingFormEditor({
|
|
|
256
262
|
}
|
|
257
263
|
|
|
258
264
|
return (
|
|
259
|
-
<div className="bg-bg flex h-full min-h-0 flex-col">
|
|
260
|
-
<header className="border-bdr bg-sb flex h-[60px] shrink-0 items-center gap-3.5 border-b pr-4 pl-6">
|
|
265
|
+
<div className="bg-bg @container/form-editor relative flex h-full min-h-0 flex-col overflow-hidden">
|
|
266
|
+
<header className="border-bdr bg-sb flex min-h-[60px] shrink-0 items-center gap-3.5 border-b pr-4 pl-6 @max-[640px]/form-editor:flex-wrap @max-[640px]/form-editor:gap-2 @max-[640px]/form-editor:p-3">
|
|
261
267
|
<button
|
|
262
268
|
type="button"
|
|
263
269
|
onClick={() => onNavigate?.('/forms')}
|
|
@@ -291,7 +297,7 @@ function ExistingFormEditor({
|
|
|
291
297
|
Settings
|
|
292
298
|
</button>
|
|
293
299
|
</div>
|
|
294
|
-
<div className="flex flex-1 items-center justify-end gap-1.5">
|
|
300
|
+
<div className="flex flex-1 items-center justify-end gap-1.5 @max-[640px]/form-editor:basis-full">
|
|
295
301
|
{fieldsDirty || detailsDirty ? (
|
|
296
302
|
<span className="text-warn text-[12px] font-semibold">
|
|
297
303
|
{(fieldsDirty ? 1 : 0) + (detailsDirty ? 1 : 0)} unsaved
|
|
@@ -329,9 +335,8 @@ function ExistingFormEditor({
|
|
|
329
335
|
>
|
|
330
336
|
<Code2 size={15} aria-hidden />
|
|
331
337
|
</button>
|
|
332
|
-
<
|
|
338
|
+
<Button
|
|
333
339
|
type="button"
|
|
334
|
-
className={btnPrimary}
|
|
335
340
|
disabled={
|
|
336
341
|
tab === 'build'
|
|
337
342
|
? savingFields || !fieldsDirty
|
|
@@ -351,7 +356,7 @@ function ExistingFormEditor({
|
|
|
351
356
|
<Check size={15} aria-hidden />
|
|
352
357
|
)}
|
|
353
358
|
Save
|
|
354
|
-
</
|
|
359
|
+
</Button>
|
|
355
360
|
</div>
|
|
356
361
|
</header>
|
|
357
362
|
{tab === 'build' ? (
|
|
@@ -366,88 +371,109 @@ function ExistingFormEditor({
|
|
|
366
371
|
}}
|
|
367
372
|
/>
|
|
368
373
|
) : (
|
|
369
|
-
<div className="min-h-0 flex-1
|
|
370
|
-
<
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
<Tabs.Content value="confirmations" tabIndex={-1}>
|
|
398
|
-
<DetailsTab
|
|
399
|
-
part="confirmations"
|
|
400
|
-
details={details}
|
|
401
|
-
onPatch={patchDetails}
|
|
402
|
-
onSave={() => void saveDetails()}
|
|
403
|
-
saving={savingDetails}
|
|
404
|
-
/>
|
|
405
|
-
</Tabs.Content>
|
|
374
|
+
<div className="flex min-h-0 flex-1 flex-col">
|
|
375
|
+
<UnderlineTabs
|
|
376
|
+
idBase="form-editor-settings"
|
|
377
|
+
label="Form settings sections"
|
|
378
|
+
value={tab}
|
|
379
|
+
onChange={setTab}
|
|
380
|
+
collapseInactiveLabels
|
|
381
|
+
className="bg-sb px-6 @max-[640px]/form-editor:px-3"
|
|
382
|
+
tabs={TABS.map(({ icon: Icon, ...item }) => ({
|
|
383
|
+
...item,
|
|
384
|
+
icon: <Icon strokeWidth={1.75} />,
|
|
385
|
+
}))}
|
|
386
|
+
/>
|
|
387
|
+
<div className="relative min-h-0 flex-1 overflow-y-auto">
|
|
388
|
+
<div className="mx-auto w-full max-w-[var(--form-editor-settings-width)] p-6 @max-[640px]/form-editor:p-4">
|
|
389
|
+
{tab === 'general' && (
|
|
390
|
+
<UnderlineTabPanel idBase="form-editor-settings" tabId="general" tabIndex={-1}>
|
|
391
|
+
<DetailsTab
|
|
392
|
+
part="general"
|
|
393
|
+
stepCount={fields.filter((f) => f.type === 'pagebreak').length + 1}
|
|
394
|
+
details={details}
|
|
395
|
+
onPatch={patchDetails}
|
|
396
|
+
onSave={() => void saveDetails()}
|
|
397
|
+
saving={savingDetails}
|
|
398
|
+
/>
|
|
399
|
+
</UnderlineTabPanel>
|
|
400
|
+
)}
|
|
406
401
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
402
|
+
{tab === 'confirmations' && (
|
|
403
|
+
<UnderlineTabPanel
|
|
404
|
+
idBase="form-editor-settings"
|
|
405
|
+
tabId="confirmations"
|
|
406
|
+
tabIndex={-1}
|
|
407
|
+
>
|
|
408
|
+
<DetailsTab
|
|
409
|
+
part="confirmations"
|
|
410
|
+
details={details}
|
|
411
|
+
onPatch={patchDetails}
|
|
412
|
+
onSave={() => void saveDetails()}
|
|
413
|
+
saving={savingDetails}
|
|
414
|
+
/>
|
|
415
|
+
</UnderlineTabPanel>
|
|
416
|
+
)}
|
|
421
417
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
<Tabs.Content value="spam" tabIndex={-1}>
|
|
429
|
-
<div className="border-border bg-card space-y-3 rounded-lg border p-4">
|
|
430
|
-
<h2 className="text-foreground text-base font-medium">Spam protection</h2>
|
|
431
|
-
<p className="text-muted-foreground text-sm">
|
|
432
|
-
Override your global form settings for this form only. Site-wide rules are in Form
|
|
433
|
-
settings.
|
|
434
|
-
</p>
|
|
435
|
-
<button
|
|
436
|
-
type="button"
|
|
437
|
-
className={btnSecondary}
|
|
438
|
-
onClick={() => onNavigate?.('/forms/settings/spam')}
|
|
418
|
+
{tab === 'notifications' && (
|
|
419
|
+
<UnderlineTabPanel
|
|
420
|
+
idBase="form-editor-settings"
|
|
421
|
+
tabId="notifications"
|
|
422
|
+
tabIndex={-1}
|
|
439
423
|
>
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
424
|
+
<div className="border-bdr bg-card rounded-12 shadow-shd border p-5">
|
|
425
|
+
<NotificationsPanel formId={formId} fields={fields} />
|
|
426
|
+
</div>
|
|
427
|
+
</UnderlineTabPanel>
|
|
428
|
+
)}
|
|
444
429
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
430
|
+
{tab === 'analytics' && (
|
|
431
|
+
<UnderlineTabPanel idBase="form-editor-settings" tabId="analytics" tabIndex={-1}>
|
|
432
|
+
<AnalyticsTab
|
|
433
|
+
analytics={analytics}
|
|
434
|
+
onPatch={patchAnalytics}
|
|
435
|
+
onSave={() => void saveAnalytics()}
|
|
436
|
+
saving={savingAnalytics}
|
|
437
|
+
/>
|
|
438
|
+
</UnderlineTabPanel>
|
|
439
|
+
)}
|
|
440
|
+
|
|
441
|
+
{tab === 'embed' && (
|
|
442
|
+
<UnderlineTabPanel idBase="form-editor-settings" tabId="embed" tabIndex={-1}>
|
|
443
|
+
<div className="border-bdr bg-card rounded-12 shadow-shd border p-5">
|
|
444
|
+
<EmbedPanel formId={formId} slug={form.slug} status={form.status} />
|
|
445
|
+
</div>
|
|
446
|
+
</UnderlineTabPanel>
|
|
447
|
+
)}
|
|
448
|
+
|
|
449
|
+
{tab === 'spam' && (
|
|
450
|
+
<UnderlineTabPanel idBase="form-editor-settings" tabId="spam" tabIndex={-1}>
|
|
451
|
+
<div className="border-bdr bg-card rounded-12 shadow-shd space-y-3 border p-5">
|
|
452
|
+
<h2 className="text-foreground text-base font-medium">Spam protection</h2>
|
|
453
|
+
<p className="text-muted-foreground text-sm">
|
|
454
|
+
Override your global form settings for this form only. Site-wide rules are in
|
|
455
|
+
Form settings.
|
|
456
|
+
</p>
|
|
457
|
+
<button
|
|
458
|
+
type="button"
|
|
459
|
+
className={btnSecondary}
|
|
460
|
+
onClick={() => onNavigate?.('/forms/settings/spam')}
|
|
461
|
+
>
|
|
462
|
+
Open Form settings
|
|
463
|
+
</button>
|
|
464
|
+
</div>
|
|
465
|
+
</UnderlineTabPanel>
|
|
466
|
+
)}
|
|
467
|
+
|
|
468
|
+
{tab === 'webhooks' && (
|
|
469
|
+
<UnderlineTabPanel idBase="form-editor-settings" tabId="webhooks" tabIndex={-1}>
|
|
470
|
+
<div className="border-bdr bg-card rounded-12 shadow-shd border p-5">
|
|
471
|
+
<WebhooksPanel formId={formId} formSlug={form.slug} />
|
|
472
|
+
</div>
|
|
473
|
+
</UnderlineTabPanel>
|
|
474
|
+
)}
|
|
475
|
+
</div>
|
|
476
|
+
</div>
|
|
451
477
|
</div>
|
|
452
478
|
)}
|
|
453
479
|
</div>
|
|
@@ -474,12 +500,12 @@ function DetailsTab({
|
|
|
474
500
|
return (
|
|
475
501
|
<div className="space-y-4">
|
|
476
502
|
{part === 'general' ? (
|
|
477
|
-
<div className="border-
|
|
503
|
+
<div className="border-bdr bg-card rounded-12 shadow-shd border p-5">
|
|
478
504
|
<h2 className="text-foreground mb-1 text-base font-medium">General</h2>
|
|
479
505
|
<p className="text-muted-foreground mb-4 text-sm">
|
|
480
506
|
Name, status, and when the form accepts entries.
|
|
481
507
|
</p>
|
|
482
|
-
<div className="grid gap-4">
|
|
508
|
+
<div className="grid min-w-0 gap-4 @min-[641px]/form-editor:grid-cols-2">
|
|
483
509
|
<Field label="Form Name" hint="Only your team sees this.">
|
|
484
510
|
<input
|
|
485
511
|
type="text"
|
|
@@ -502,7 +528,7 @@ function DetailsTab({
|
|
|
502
528
|
<select
|
|
503
529
|
value={details.status}
|
|
504
530
|
onChange={(e) => onPatch({ status: e.target.value as FormStatus })}
|
|
505
|
-
className="border-border bg-input-background text-foreground focus-visible:ring-ring rounded-lg border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:outline-none"
|
|
531
|
+
className="border-border bg-input-background text-foreground focus-visible:ring-ring w-full min-w-0 rounded-lg border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:outline-none"
|
|
506
532
|
>
|
|
507
533
|
<option value="active">Active: accepting entries</option>
|
|
508
534
|
<option value="draft">Draft: not live yet</option>
|
|
@@ -523,14 +549,14 @@ function DetailsTab({
|
|
|
523
549
|
</div>
|
|
524
550
|
) : null}
|
|
525
551
|
{part === 'general' ? (
|
|
526
|
-
<div className="border-
|
|
552
|
+
<div className="border-bdr bg-card rounded-12 shadow-shd border p-5">
|
|
527
553
|
<h2 className="text-foreground mb-1 text-base font-medium">Steps</h2>
|
|
528
554
|
<p className="text-muted-foreground mb-4 text-sm">
|
|
529
555
|
{stepCount > 1
|
|
530
556
|
? `This form has ${stepCount} steps.`
|
|
531
557
|
: 'Add a Page break in Build to split it into steps.'}
|
|
532
558
|
</p>
|
|
533
|
-
<div className="grid gap-4">
|
|
559
|
+
<div className="grid min-w-0 gap-4 @min-[641px]/form-editor:grid-cols-2">
|
|
534
560
|
<Field label="First step title">
|
|
535
561
|
<input
|
|
536
562
|
type="text"
|
|
@@ -545,7 +571,7 @@ function DetailsTab({
|
|
|
545
571
|
<select
|
|
546
572
|
value={details.progress}
|
|
547
573
|
onChange={(e) => onPatch({ progress: e.target.value as DetailsState['progress'] })}
|
|
548
|
-
className="border-border bg-input-background text-foreground focus-visible:ring-ring rounded-lg border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:outline-none"
|
|
574
|
+
className="border-border bg-input-background text-foreground focus-visible:ring-ring w-full min-w-0 rounded-lg border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:outline-none"
|
|
549
575
|
>
|
|
550
576
|
<option value="steps">Numbered steps</option>
|
|
551
577
|
<option value="bar">Progress bar</option>
|
|
@@ -555,7 +581,7 @@ function DetailsTab({
|
|
|
555
581
|
</div>
|
|
556
582
|
</div>
|
|
557
583
|
) : (
|
|
558
|
-
<div className="border-
|
|
584
|
+
<div className="border-bdr bg-card rounded-12 shadow-shd border p-5">
|
|
559
585
|
<h2 className="text-foreground mb-1 text-base font-medium">Confirmations</h2>
|
|
560
586
|
<p className="text-muted-foreground mb-4 text-sm">What people see after they submit.</p>
|
|
561
587
|
<fieldset className="mb-4">
|
|
@@ -655,7 +681,7 @@ function AnalyticsTab({
|
|
|
655
681
|
}) {
|
|
656
682
|
return (
|
|
657
683
|
<div className="space-y-4">
|
|
658
|
-
<div className="border-
|
|
684
|
+
<div className="border-bdr bg-card rounded-12 shadow-shd border p-5">
|
|
659
685
|
<div className="flex items-center justify-between gap-3">
|
|
660
686
|
<span className="min-w-0">
|
|
661
687
|
<span className="text-foreground block text-sm font-medium">
|
|
@@ -300,8 +300,8 @@ export function FormsSettings({
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
return (
|
|
303
|
-
<div className="flex h-full min-h-0 flex-col overflow-x-hidden overflow-y-auto">
|
|
304
|
-
<header className="px-
|
|
303
|
+
<div className="@container/forms-settings relative flex h-full min-h-0 flex-col overflow-x-hidden overflow-y-auto">
|
|
304
|
+
<header className="px-gut shrink-0 pt-5">
|
|
305
305
|
<Breadcrumb items={[{ label: 'Forms', path: '/forms' }, { label: 'Settings' }]} />
|
|
306
306
|
<h1 className="text-txt m-0 mt-2 text-[21px] font-bold tracking-[-0.5px]">Form settings</h1>
|
|
307
307
|
<p className="text-sub mt-1 max-w-[620px] text-[13px]">
|
|
@@ -310,7 +310,9 @@ export function FormsSettings({
|
|
|
310
310
|
</p>
|
|
311
311
|
</header>
|
|
312
312
|
<UnderlineTabs
|
|
313
|
-
className="mx-
|
|
313
|
+
className="mx-gut mt-4"
|
|
314
|
+
collapseInactiveLabels
|
|
315
|
+
idBase="forms-settings"
|
|
314
316
|
label="Form settings tabs"
|
|
315
317
|
value={tab}
|
|
316
318
|
onChange={(id) => go(id as TabId)}
|
|
@@ -331,7 +333,12 @@ export function FormsSettings({
|
|
|
331
333
|
}
|
|
332
334
|
})}
|
|
333
335
|
/>
|
|
334
|
-
<div
|
|
336
|
+
<div
|
|
337
|
+
role="tabpanel"
|
|
338
|
+
id={`forms-settings-panel-${tab}`}
|
|
339
|
+
aria-labelledby={`forms-settings-tab-${tab}`}
|
|
340
|
+
className="px-gut flex w-full max-w-[var(--forms-settings-width)] shrink-0 flex-col gap-4 py-5 pb-[var(--forms-settings-bottom)]"
|
|
341
|
+
>
|
|
335
342
|
{readOnly ? (
|
|
336
343
|
<p className="border-bdr bg-card text-sub flex items-center gap-2.5 rounded-[10px] border px-3.5 py-2.5 text-[13px]">
|
|
337
344
|
<Lock size={16} className="text-faint shrink-0" aria-hidden />
|
|
@@ -343,6 +350,7 @@ export function FormsSettings({
|
|
|
343
350
|
<>
|
|
344
351
|
<Card
|
|
345
352
|
title="Spam protection"
|
|
353
|
+
icon={<Shield size={18} strokeWidth={1.75} aria-hidden />}
|
|
346
354
|
description="Checks run on every submission before it reaches your inbox."
|
|
347
355
|
>
|
|
348
356
|
<Row
|
|
@@ -492,6 +500,7 @@ export function FormsSettings({
|
|
|
492
500
|
</Card>
|
|
493
501
|
<Card
|
|
494
502
|
title="AI spam review"
|
|
503
|
+
icon={<Shield size={18} strokeWidth={1.75} aria-hidden />}
|
|
495
504
|
description="Reads entries that get past the checks above and moves likely spam to the Spam folder. It never deletes anything."
|
|
496
505
|
>
|
|
497
506
|
<p
|
|
@@ -515,7 +524,10 @@ export function FormsSettings({
|
|
|
515
524
|
<Toggle
|
|
516
525
|
checked={draft.spam.ai.on}
|
|
517
526
|
onCheckedChange={(on) =>
|
|
518
|
-
setDraft({
|
|
527
|
+
setDraft({
|
|
528
|
+
...draft,
|
|
529
|
+
spam: { ...draft.spam, ai: { ...draft.spam.ai, on } },
|
|
530
|
+
})
|
|
519
531
|
}
|
|
520
532
|
aria-label="Review entries with AI"
|
|
521
533
|
/>
|
|
@@ -539,7 +551,10 @@ export function FormsSettings({
|
|
|
539
551
|
onClick={() =>
|
|
540
552
|
setDraft({
|
|
541
553
|
...draft,
|
|
542
|
-
spam: {
|
|
554
|
+
spam: {
|
|
555
|
+
...draft.spam,
|
|
556
|
+
ai: { ...draft.spam.ai, strictness: level },
|
|
557
|
+
},
|
|
543
558
|
})
|
|
544
559
|
}
|
|
545
560
|
className={`rounded-[7px] px-2.5 py-[5px] text-[12.5px] font-medium capitalize ${draft.spam.ai.strictness === level ? 'bg-card text-txt shadow-shd' : 'text-sub'}`}
|
|
@@ -586,6 +601,7 @@ export function FormsSettings({
|
|
|
586
601
|
{tab === 'defaults' ? (
|
|
587
602
|
<Card
|
|
588
603
|
title="Defaults for new forms"
|
|
604
|
+
icon={<FileText size={18} strokeWidth={1.75} aria-hidden />}
|
|
589
605
|
description="Starting values when someone creates a form. Each form can change them afterwards."
|
|
590
606
|
>
|
|
591
607
|
<Row label="Notify these addresses" help="Who gets an email for each new submission.">
|
|
@@ -659,6 +675,7 @@ export function FormsSettings({
|
|
|
659
675
|
{tab === 'retention' ? (
|
|
660
676
|
<Card
|
|
661
677
|
title="Data retention"
|
|
678
|
+
icon={<Clock size={18} strokeWidth={1.75} aria-hidden />}
|
|
662
679
|
description="How long submissions and logs are kept before they're permanently deleted."
|
|
663
680
|
>
|
|
664
681
|
{RETENTION_APPLIED ? null : (
|
|
@@ -796,7 +813,10 @@ export function FormsSettings({
|
|
|
796
813
|
<Toggle
|
|
797
814
|
checked={draft.retention.deleteFilesWithEntry}
|
|
798
815
|
onCheckedChange={(deleteFilesWithEntry) =>
|
|
799
|
-
setDraft({
|
|
816
|
+
setDraft({
|
|
817
|
+
...draft,
|
|
818
|
+
retention: { ...draft.retention, deleteFilesWithEntry },
|
|
819
|
+
})
|
|
800
820
|
}
|
|
801
821
|
aria-label="Delete uploaded files with their entry"
|
|
802
822
|
/>
|
|
@@ -900,6 +920,7 @@ function EmailDelivery({
|
|
|
900
920
|
return (
|
|
901
921
|
<Card
|
|
902
922
|
title="Email delivery"
|
|
923
|
+
icon={<Mail size={18} strokeWidth={1.75} aria-hidden />}
|
|
903
924
|
description="The account that sends notifications and confirmation emails. Shared with invites and password resets."
|
|
904
925
|
>
|
|
905
926
|
{email?.configured ? (
|
|
@@ -1006,7 +1027,7 @@ function SettingsSaveBar({
|
|
|
1006
1027
|
role={state === 'error' ? 'alert' : 'region'}
|
|
1007
1028
|
aria-label="Unsaved changes"
|
|
1008
1029
|
aria-live="polite"
|
|
1009
|
-
className={`rounded-12 sticky bottom-4 z-[var(--z-bar)] ml-auto flex w-[min(560px,calc(100%-
|
|
1030
|
+
className={`rounded-12 sticky bottom-4 z-[var(--z-bar)] ml-auto flex w-[min(560px,calc(100%-2*var(--gut)))] items-center gap-2.5 py-2.5 pr-2.5 pl-4 text-[13px] font-[550] shadow-[0_10px_30px_rgba(0,0,0,0.22)] ${tone}`}
|
|
1010
1031
|
>
|
|
1011
1032
|
<span className="flex min-w-0 flex-1 items-center gap-2">
|
|
1012
1033
|
{state === 'saved' ? <Check size={16} aria-hidden /> : null}
|
|
@@ -1060,6 +1081,7 @@ function AttributionTab({
|
|
|
1060
1081
|
<>
|
|
1061
1082
|
<Card
|
|
1062
1083
|
title="Capture"
|
|
1084
|
+
icon={<Target size={18} strokeWidth={1.75} aria-hidden />}
|
|
1063
1085
|
description="Record where each visitor came from and attach it to their submission. Works on every form automatically."
|
|
1064
1086
|
>
|
|
1065
1087
|
<AttributionStatus
|
|
@@ -1096,6 +1118,7 @@ function AttributionTab({
|
|
|
1096
1118
|
</Card>
|
|
1097
1119
|
<Card
|
|
1098
1120
|
title="Memory"
|
|
1121
|
+
icon={<Clock size={18} strokeWidth={1.75} aria-hidden />}
|
|
1099
1122
|
description="How long a visit is remembered on the visitor's device before it stops counting."
|
|
1100
1123
|
>
|
|
1101
1124
|
<WindowRow
|
|
@@ -1132,6 +1155,7 @@ function AttributionTab({
|
|
|
1132
1155
|
</Card>
|
|
1133
1156
|
<Card
|
|
1134
1157
|
title="Fields on every submission"
|
|
1158
|
+
icon={<FileText size={18} strokeWidth={1.75} aria-hidden />}
|
|
1135
1159
|
description="Read only. These are the names used in entry details, exports, notification emails, and webhooks."
|
|
1136
1160
|
>
|
|
1137
1161
|
<div className="flex flex-col gap-3.5 px-5 pt-1.5 pb-4">
|
|
@@ -1556,10 +1580,12 @@ function RecaptchaKeys({
|
|
|
1556
1580
|
}
|
|
1557
1581
|
|
|
1558
1582
|
function Card({
|
|
1583
|
+
icon,
|
|
1559
1584
|
title,
|
|
1560
1585
|
description,
|
|
1561
1586
|
children,
|
|
1562
1587
|
}: {
|
|
1588
|
+
icon: ReactNode
|
|
1563
1589
|
title: string
|
|
1564
1590
|
description: string
|
|
1565
1591
|
children: ReactNode
|
|
@@ -1570,11 +1596,16 @@ function Card({
|
|
|
1570
1596
|
aria-labelledby={id}
|
|
1571
1597
|
className="border-bdr bg-card shadow-shd overflow-hidden rounded-[12px] border"
|
|
1572
1598
|
>
|
|
1573
|
-
<header className="border-bdr border-b px-5 py-4">
|
|
1574
|
-
<
|
|
1575
|
-
{
|
|
1576
|
-
</
|
|
1577
|
-
<
|
|
1599
|
+
<header className="border-bdr flex items-start gap-3 border-b px-5 py-4">
|
|
1600
|
+
<span className="rounded-9 bg-acc-l text-acc flex h-[var(--forms-card-icon)] w-[var(--forms-card-icon)] shrink-0 items-center justify-center">
|
|
1601
|
+
{icon}
|
|
1602
|
+
</span>
|
|
1603
|
+
<div className="min-w-0">
|
|
1604
|
+
<h2 id={id} className="text-txt m-0 text-[15px] font-semibold">
|
|
1605
|
+
{title}
|
|
1606
|
+
</h2>
|
|
1607
|
+
<p className="text-sub text-sm2 m-0 mt-1">{description}</p>
|
|
1608
|
+
</div>
|
|
1578
1609
|
</header>
|
|
1579
1610
|
{children}
|
|
1580
1611
|
</section>
|
|
@@ -1583,12 +1614,14 @@ function Card({
|
|
|
1583
1614
|
|
|
1584
1615
|
function Row({ label, help, children }: { label: string; help?: string; children: ReactNode }) {
|
|
1585
1616
|
return (
|
|
1586
|
-
<div className="border-bdr grid items-center gap-5 border-b px-5 py-[15px] last:border-b-0
|
|
1617
|
+
<div className="border-bdr grid items-center gap-5 border-b px-5 py-[15px] last:border-b-0 @max-[640px]/forms-settings:gap-2.5 @min-[641px]/forms-settings:grid-cols-[minmax(0,1fr)_minmax(0,1.15fr)]">
|
|
1587
1618
|
<div>
|
|
1588
1619
|
<div className="text-txt text-[13px] font-semibold">{label}</div>
|
|
1589
1620
|
{help ? <p className="text-sub m-0 mt-1 text-[12px] leading-[1.45]">{help}</p> : null}
|
|
1590
1621
|
</div>
|
|
1591
|
-
<div className="flex flex-wrap items-center justify-end gap-2">
|
|
1622
|
+
<div className="flex min-w-0 flex-wrap items-center justify-end gap-2 @max-[640px]/forms-settings:justify-start [&>*]:max-w-full">
|
|
1623
|
+
{children}
|
|
1624
|
+
</div>
|
|
1592
1625
|
</div>
|
|
1593
1626
|
)
|
|
1594
1627
|
}
|