create-nextblock 0.15.8 → 0.15.9

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 (71) hide show
  1. package/package.json +1 -1
  2. package/templates/nextblock-template/app/ToasterProvider.tsx +26 -17
  3. package/templates/nextblock-template/app/actions/contactSellerActions.test.ts +280 -0
  4. package/templates/nextblock-template/app/actions/contactSellerActions.ts +222 -0
  5. package/templates/nextblock-template/app/actions/email-retry.test.ts +62 -0
  6. package/templates/nextblock-template/app/actions/email.ts +241 -110
  7. package/templates/nextblock-template/app/actions/formActions.ts +245 -116
  8. package/templates/nextblock-template/app/actions/interactions.ts +489 -396
  9. package/templates/nextblock-template/app/actions/threadActions.ts +166 -0
  10. package/templates/nextblock-template/app/api/checkout/route.ts +162 -146
  11. package/templates/nextblock-template/app/api/cron/reset-sandbox/sandboxResetSql.ts +664 -1
  12. package/templates/nextblock-template/app/checkout/page.tsx +57 -52
  13. package/templates/nextblock-template/app/cms/CmsClientLayout.tsx +552 -529
  14. package/templates/nextblock-template/app/cms/blocks/editors/FormBlockEditor.tsx +304 -181
  15. package/templates/nextblock-template/app/cms/components/ContactReminderBanner.tsx +75 -0
  16. package/templates/nextblock-template/app/cms/components/PaymentsReminderBanner.tsx +58 -0
  17. package/templates/nextblock-template/app/cms/components/VisibilityControl.tsx +542 -528
  18. package/templates/nextblock-template/app/cms/inquiries/actions.ts +66 -0
  19. package/templates/nextblock-template/app/cms/inquiries/page.tsx +12 -0
  20. package/templates/nextblock-template/app/cms/interactions/page.tsx +12 -51
  21. package/templates/nextblock-template/app/cms/layout.tsx +101 -73
  22. package/templates/nextblock-template/app/cms/messages/MessagesClient.tsx +661 -0
  23. package/templates/nextblock-template/app/cms/messages/actions.ts +404 -0
  24. package/templates/nextblock-template/app/cms/messages/loadInbox.ts +333 -0
  25. package/templates/nextblock-template/app/cms/messages/page.tsx +87 -0
  26. package/templates/nextblock-template/app/cms/messages/require-admin.ts +37 -0
  27. package/templates/nextblock-template/app/cms/products/[id]/edit/page.tsx +370 -362
  28. package/templates/nextblock-template/app/cms/revisions/service.ts +20 -0
  29. package/templates/nextblock-template/app/cms/settings/email/components/EmailForm.tsx +227 -185
  30. package/templates/nextblock-template/app/layout.tsx +671 -671
  31. package/templates/nextblock-template/app/product/[slug]/page.tsx +502 -482
  32. package/templates/nextblock-template/app/providers.tsx +96 -96
  33. package/templates/nextblock-template/app/thread/ThreadView.tsx +164 -0
  34. package/templates/nextblock-template/app/thread/[token]/route.ts +57 -0
  35. package/templates/nextblock-template/app/thread/layout.tsx +15 -0
  36. package/templates/nextblock-template/app/thread/page.tsx +98 -0
  37. package/templates/nextblock-template/components/BlockRenderer.tsx +312 -296
  38. package/templates/nextblock-template/components/ContactSellerSection.tsx +188 -0
  39. package/templates/nextblock-template/components/PostCommentsSection.tsx +378 -369
  40. package/templates/nextblock-template/components/ProductReviewsSection.tsx +426 -419
  41. package/templates/nextblock-template/components/StaffReplies.tsx +102 -0
  42. package/templates/nextblock-template/components/blocks/renderers/CartBlockRenderer.tsx +18 -17
  43. package/templates/nextblock-template/components/blocks/renderers/CheckoutBlockRenderer.tsx +20 -19
  44. package/templates/nextblock-template/components/blocks/renderers/FeaturedProductBlockRenderer.tsx +25 -22
  45. package/templates/nextblock-template/components/blocks/renderers/FormBlockRenderer.tsx +385 -381
  46. package/templates/nextblock-template/components/blocks/renderers/ProductDetailsBlockRenderer.tsx +157 -92
  47. package/templates/nextblock-template/components/blocks/renderers/ProductGridBlockRenderer.tsx +34 -31
  48. package/templates/nextblock-template/components/blocks/renderers/SectionBlockRenderer.tsx +612 -600
  49. package/templates/nextblock-template/components/commerce/PaymentReadinessBoundary.tsx +32 -0
  50. package/templates/nextblock-template/docs/14-MESSAGES-INBOX.md +309 -0
  51. package/templates/nextblock-template/docs/README.md +42 -41
  52. package/templates/nextblock-template/docs/assets/lighthouse-scores.png +0 -0
  53. package/templates/nextblock-template/lib/blocks/blockColors.test.ts +22 -2
  54. package/templates/nextblock-template/lib/blocks/blockColors.ts +44 -1
  55. package/templates/nextblock-template/lib/blocks/blockRegistry.ts +761 -753
  56. package/templates/nextblock-template/lib/cms/contact-reminder.ts +64 -0
  57. package/templates/nextblock-template/lib/cms/payments-reminder.ts +98 -0
  58. package/templates/nextblock-template/lib/cms/unread-messages.ts +42 -0
  59. package/templates/nextblock-template/lib/commerce/seller-contact.ts +162 -0
  60. package/templates/nextblock-template/lib/config/email-settings.ts +323 -254
  61. package/templates/nextblock-template/lib/config/email-tls.test.ts +57 -0
  62. package/templates/nextblock-template/lib/email/placeholder-address.test.ts +59 -0
  63. package/templates/nextblock-template/lib/email/placeholder-address.ts +39 -0
  64. package/templates/nextblock-template/lib/messages/thread-reference.test.ts +70 -0
  65. package/templates/nextblock-template/lib/messages/thread-token.test.ts +93 -0
  66. package/templates/nextblock-template/lib/messages/thread-token.ts +157 -0
  67. package/templates/nextblock-template/lib/messages/threads.ts +579 -0
  68. package/templates/nextblock-template/lib/setup/migrations-bundle.ts +20 -0
  69. package/templates/nextblock-template/lib/site-url.test.ts +89 -0
  70. package/templates/nextblock-template/lib/site-url.ts +102 -48
  71. package/templates/nextblock-template/package.json +1 -1
@@ -400,6 +400,26 @@ async function restoreInternal(
400
400
  .order('order', { ascending: true })
401
401
  .order('id', { ascending: true });
402
402
 
403
+ // Carry contact-form routing across the restore.
404
+ //
405
+ // A snapshot taken before migration 27 stores `recipient_email` and no `form_key`.
406
+ // Restoring it verbatim would strand the form: the renderer strips the legacy address
407
+ // (so nothing leaks), but with no key the submission falls back to the site-wide
408
+ // contact address, losing whatever per-form destination the owner had configured.
409
+ // Reuse the key from the live block being replaced, matched positionally.
410
+ const liveFormKeys = ((previousBlocks ?? []) as Array<{ block_type: string; content: unknown }>)
411
+ .filter((block) => block.block_type === 'form')
412
+ .map((block) => (block.content as Record<string, unknown> | null)?.['form_key'])
413
+ .filter((key): key is string => typeof key === 'string' && key.length > 0);
414
+
415
+ for (const block of blockPayload as Array<{ block_type?: string; content?: unknown }>) {
416
+ if (block.block_type !== 'form') continue;
417
+ const content = (block.content ?? {}) as Record<string, unknown>;
418
+ if (typeof content['form_key'] === 'string' && content['form_key']) continue;
419
+ const inherited = liveFormKeys.shift();
420
+ if (inherited) block.content = { ...content, form_key: inherited };
421
+ }
422
+
403
423
  const { error: deleteError } = await supabase
404
424
  .from('blocks')
405
425
  .delete()
@@ -1,185 +1,227 @@
1
- 'use client';
2
-
3
- import { useRef, useState, useTransition } from 'react';
4
- import {
5
- Alert,
6
- AlertDescription,
7
- Button,
8
- Checkbox,
9
- Input,
10
- Label,
11
- Spinner,
12
- } from '@nextblock-cms/ui';
13
- import type { EmailSettingsView } from '../../../../../lib/config/email-settings';
14
- import { updateEmailSettings, sendTestEmail } from '../actions';
15
- import type { Message } from '../../../../../components/form-message';
16
- import { useHotkeys } from '../../../../../hooks/use-hotkeys';
17
-
18
- interface EmailFormProps {
19
- initialSettings: EmailSettingsView;
20
- }
21
-
22
- export default function EmailForm({ initialSettings }: EmailFormProps) {
23
- const [isPending, startTransition] = useTransition();
24
- const [isTesting, startTestTransition] = useTransition();
25
- const [message, setMessage] = useState<Message | null>(null);
26
-
27
- const [host, setHost] = useState(initialSettings.host);
28
- const [port, setPort] = useState(initialSettings.port);
29
- const [fromEmail, setFromEmail] = useState(initialSettings.fromEmail);
30
- const [fromName, setFromName] = useState(initialSettings.fromName);
31
- const [secure, setSecure] = useState(initialSettings.secure);
32
- const [user, setUser] = useState('');
33
- const [pass, setPass] = useState('');
34
- const [testTo, setTestTo] = useState('');
35
-
36
- const formRef = useRef<HTMLFormElement>(null);
37
- useHotkeys('ctrl+s', () => formRef.current?.requestSubmit());
38
-
39
- const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
40
- event.preventDefault();
41
- setMessage(null);
42
- const formData = new FormData();
43
- formData.append('host', host);
44
- formData.append('port', port);
45
- formData.append('fromEmail', fromEmail);
46
- formData.append('fromName', fromName);
47
- formData.append('secure', secure ? 'on' : '');
48
- // Only send credentials when changed blank keeps the stored secret.
49
- if (user.trim()) formData.append('user', user.trim());
50
- if (pass.trim()) formData.append('pass', pass.trim());
51
-
52
- startTransition(async () => {
53
- try {
54
- const result = await updateEmailSettings(formData);
55
- if (!result.ok) {
56
- setMessage({ error: result.error });
57
- return;
58
- }
59
- setMessage({ success: result.message });
60
- setUser('');
61
- setPass('');
62
- } catch (error) {
63
- setMessage({ error: error instanceof Error ? error.message : 'Failed to save settings.' });
64
- }
65
- });
66
- };
67
-
68
- const handleSendTest = () => {
69
- setMessage(null);
70
- const formData = new FormData();
71
- formData.append('to', testTo.trim());
72
- startTestTransition(async () => {
73
- try {
74
- const result = await sendTestEmail(formData);
75
- setMessage(result.ok ? { success: result.message } : { error: result.error });
76
- } catch (error) {
77
- setMessage({ error: error instanceof Error ? error.message : 'Failed to send test email.' });
78
- }
79
- });
80
- };
81
-
82
- return (
83
- <div className="space-y-6">
84
- {initialSettings.envFallbackActive && (
85
- <Alert className="py-2 px-4">
86
- <AlertDescription className="text-xs">
87
- SMTP is currently read from environment variables (<code>SMTP_*</code>). Saving here
88
- moves it into the database and takes precedence.
89
- </AlertDescription>
90
- </Alert>
91
- )}
92
-
93
- <form ref={formRef} onSubmit={handleSubmit} className="space-y-6">
94
- <div className="grid gap-4 sm:grid-cols-2">
95
- <div className="space-y-2">
96
- <Label htmlFor="host">SMTP host</Label>
97
- <Input id="host" value={host} onChange={(e) => setHost(e.target.value)} placeholder="smtp.example.com" />
98
- </div>
99
- <div className="space-y-2">
100
- <Label htmlFor="port">Port</Label>
101
- <Input id="port" value={port} onChange={(e) => setPort(e.target.value)} placeholder="465" />
102
- </div>
103
- <div className="space-y-2">
104
- <Label htmlFor="fromEmail">From email</Label>
105
- <Input id="fromEmail" type="email" value={fromEmail} onChange={(e) => setFromEmail(e.target.value)} placeholder="no-reply@example.com" />
106
- </div>
107
- <div className="space-y-2">
108
- <Label htmlFor="fromName">From name</Label>
109
- <Input id="fromName" value={fromName} onChange={(e) => setFromName(e.target.value)} placeholder="My Site" />
110
- </div>
111
- <div className="space-y-2">
112
- <Label htmlFor="user">
113
- Username{' '}
114
- {initialSettings.hasUser && (
115
- <span className="text-xs text-muted-foreground">
116
- (stored{initialSettings.userLast4 ? ` ••••${initialSettings.userLast4}` : ''} — leave blank to keep)
117
- </span>
118
- )}
119
- </Label>
120
- <Input id="user" autoComplete="off" value={user} onChange={(e) => setUser(e.target.value)} placeholder={initialSettings.hasUser ? '••••••••' : 'smtp username'} />
121
- </div>
122
- <div className="space-y-2">
123
- <Label htmlFor="pass">
124
- Password{' '}
125
- {initialSettings.hasPass && (
126
- <span className="text-xs text-muted-foreground">(stored — leave blank to keep)</span>
127
- )}
128
- </Label>
129
- <Input id="pass" type="password" autoComplete="new-password" value={pass} onChange={(e) => setPass(e.target.value)} placeholder={initialSettings.hasPass ? '••••••••' : 'smtp password'} />
130
- </div>
131
- </div>
132
-
133
- <label className="flex items-start gap-3">
134
- <Checkbox checked={secure} onCheckedChange={(c) => setSecure(c === true)} className="mt-1" />
135
- <span className="text-sm">
136
- <span className="font-medium">Use implicit TLS (SMTPS)</span>
137
- <span className="block text-xs text-muted-foreground">
138
- Enable for port 465. Disable for STARTTLS on ports like 587.
139
- </span>
140
- </span>
141
- </label>
142
-
143
- <div className="flex items-center gap-4">
144
- <Button type="submit" disabled={isPending}>
145
- {isPending ? (<><Spinner className="mr-2 h-4 w-4" /> Saving…</>) : 'Save settings'}
146
- </Button>
147
- </div>
148
- </form>
149
-
150
- <div className="rounded-lg border p-4 space-y-3">
151
- <div className="space-y-1">
152
- <Label htmlFor="testTo">Send a test email</Label>
153
- <p className="text-xs text-muted-foreground">
154
- Save your settings first, then send a test message to confirm delivery.
155
- </p>
156
- </div>
157
- <div className="flex flex-col gap-3 sm:flex-row sm:items-center">
158
- <Input
159
- id="testTo"
160
- type="email"
161
- value={testTo}
162
- onChange={(e) => setTestTo(e.target.value)}
163
- placeholder="you@example.com"
164
- className="sm:max-w-xs"
165
- />
166
- <Button type="button" variant="outline" onClick={handleSendTest} disabled={isTesting || !testTo.trim()}>
167
- {isTesting ? (<><Spinner className="mr-2 h-4 w-4" /> Sending…</>) : 'Send test email'}
168
- </Button>
169
- </div>
170
- </div>
171
-
172
- {message && (
173
- <Alert variant={'error' in message ? 'destructive' : 'success'} className="py-2 px-4">
174
- <AlertDescription>
175
- {'error' in message
176
- ? message.error
177
- : 'success' in message
178
- ? message.success
179
- : message.message}
180
- </AlertDescription>
181
- </Alert>
182
- )}
183
- </div>
184
- );
185
- }
1
+ 'use client';
2
+
3
+ import { useRef, useState, useTransition } from 'react';
4
+ import {
5
+ Alert,
6
+ AlertDescription,
7
+ Button,
8
+ Checkbox,
9
+ Input,
10
+ Label,
11
+ Spinner,
12
+ } from '@nextblock-cms/ui';
13
+ import type { EmailSettingsView } from '../../../../../lib/config/email-settings';
14
+ import { updateEmailSettings, sendTestEmail } from '../actions';
15
+ import type { Message } from '../../../../../components/form-message';
16
+ import { useHotkeys } from '../../../../../hooks/use-hotkeys';
17
+
18
+ interface EmailFormProps {
19
+ initialSettings: EmailSettingsView;
20
+ }
21
+
22
+ /**
23
+ * TLS mode implied by a port, or null when the port carries no convention.
24
+ *
25
+ * 465 is SMTPS (TLS from the first byte); 25, 587 and 2525 open in plaintext and upgrade
26
+ * via STARTTLS. Mixing them up is the single most common SMTP misconfiguration, and it
27
+ * surfaces as an OpenSSL "wrong version number" that names neither TLS mode nor port.
28
+ */
29
+ function impliedSecureForPort(port: string): boolean | null {
30
+ const value = Number(port.trim());
31
+ if (value === 465) return true;
32
+ if (value === 25 || value === 587 || value === 2525) return false;
33
+ return null;
34
+ }
35
+
36
+ export default function EmailForm({ initialSettings }: EmailFormProps) {
37
+ const [isPending, startTransition] = useTransition();
38
+ const [isTesting, startTestTransition] = useTransition();
39
+ const [message, setMessage] = useState<Message | null>(null);
40
+
41
+ const [host, setHost] = useState(initialSettings.host);
42
+ const [port, setPort] = useState(initialSettings.port);
43
+ const [fromEmail, setFromEmail] = useState(initialSettings.fromEmail);
44
+ const [fromName, setFromName] = useState(initialSettings.fromName);
45
+ const [secure, setSecure] = useState(initialSettings.secure);
46
+
47
+ // Surfaces a saved-but-impossible combination (e.g. an install that entered 2525 while
48
+ // the toggle still held its default of ON).
49
+ const impliedSecure = impliedSecureForPort(port);
50
+ const tlsMismatch =
51
+ impliedSecure !== null && impliedSecure !== secure ? { expected: impliedSecure } : null;
52
+ const [user, setUser] = useState('');
53
+ const [pass, setPass] = useState('');
54
+ const [testTo, setTestTo] = useState('');
55
+
56
+ const formRef = useRef<HTMLFormElement>(null);
57
+ useHotkeys('ctrl+s', () => formRef.current?.requestSubmit());
58
+
59
+ const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
60
+ event.preventDefault();
61
+ setMessage(null);
62
+ const formData = new FormData();
63
+ formData.append('host', host);
64
+ formData.append('port', port);
65
+ formData.append('fromEmail', fromEmail);
66
+ formData.append('fromName', fromName);
67
+ formData.append('secure', secure ? 'on' : '');
68
+ // Only send credentials when changed — blank keeps the stored secret.
69
+ if (user.trim()) formData.append('user', user.trim());
70
+ if (pass.trim()) formData.append('pass', pass.trim());
71
+
72
+ startTransition(async () => {
73
+ try {
74
+ const result = await updateEmailSettings(formData);
75
+ if (!result.ok) {
76
+ setMessage({ error: result.error });
77
+ return;
78
+ }
79
+ setMessage({ success: result.message });
80
+ setUser('');
81
+ setPass('');
82
+ } catch (error) {
83
+ setMessage({ error: error instanceof Error ? error.message : 'Failed to save settings.' });
84
+ }
85
+ });
86
+ };
87
+
88
+ const handleSendTest = () => {
89
+ setMessage(null);
90
+ const formData = new FormData();
91
+ formData.append('to', testTo.trim());
92
+ startTestTransition(async () => {
93
+ try {
94
+ const result = await sendTestEmail(formData);
95
+ setMessage(result.ok ? { success: result.message } : { error: result.error });
96
+ } catch (error) {
97
+ setMessage({ error: error instanceof Error ? error.message : 'Failed to send test email.' });
98
+ }
99
+ });
100
+ };
101
+
102
+ return (
103
+ <div className="space-y-6">
104
+ {initialSettings.envFallbackActive && (
105
+ <Alert className="py-2 px-4">
106
+ <AlertDescription className="text-xs">
107
+ SMTP is currently read from environment variables (<code>SMTP_*</code>). Saving here
108
+ moves it into the database and takes precedence.
109
+ </AlertDescription>
110
+ </Alert>
111
+ )}
112
+
113
+ <form ref={formRef} onSubmit={handleSubmit} className="space-y-6">
114
+ <div className="grid gap-4 sm:grid-cols-2">
115
+ <div className="space-y-2">
116
+ <Label htmlFor="host">SMTP host</Label>
117
+ <Input id="host" value={host} onChange={(e) => setHost(e.target.value)} placeholder="smtp.example.com" />
118
+ </div>
119
+ <div className="space-y-2">
120
+ <Label htmlFor="port">Port</Label>
121
+ <Input
122
+ id="port"
123
+ value={port}
124
+ onChange={(e) => {
125
+ const next = e.target.value;
126
+ setPort(next);
127
+ // The TLS mode is a property of the port, not a preference. Follow it, so
128
+ // the impossible combination is never saved in the first place.
129
+ const implied = impliedSecureForPort(next);
130
+ if (implied !== null) setSecure(implied);
131
+ }}
132
+ placeholder="465"
133
+ />
134
+ </div>
135
+ <div className="space-y-2">
136
+ <Label htmlFor="fromEmail">From email</Label>
137
+ <Input id="fromEmail" type="email" value={fromEmail} onChange={(e) => setFromEmail(e.target.value)} placeholder="no-reply@example.com" />
138
+ </div>
139
+ <div className="space-y-2">
140
+ <Label htmlFor="fromName">From name</Label>
141
+ <Input id="fromName" value={fromName} onChange={(e) => setFromName(e.target.value)} placeholder="My Site" />
142
+ </div>
143
+ <div className="space-y-2">
144
+ <Label htmlFor="user">
145
+ Username{' '}
146
+ {initialSettings.hasUser && (
147
+ <span className="text-xs text-muted-foreground">
148
+ (stored{initialSettings.userLast4 ? ` ••••${initialSettings.userLast4}` : ''} — leave blank to keep)
149
+ </span>
150
+ )}
151
+ </Label>
152
+ <Input id="user" autoComplete="off" value={user} onChange={(e) => setUser(e.target.value)} placeholder={initialSettings.hasUser ? '••••••••' : 'smtp username'} />
153
+ </div>
154
+ <div className="space-y-2">
155
+ <Label htmlFor="pass">
156
+ Password{' '}
157
+ {initialSettings.hasPass && (
158
+ <span className="text-xs text-muted-foreground">(stored — leave blank to keep)</span>
159
+ )}
160
+ </Label>
161
+ <Input id="pass" type="password" autoComplete="new-password" value={pass} onChange={(e) => setPass(e.target.value)} placeholder={initialSettings.hasPass ? '••••••••' : 'smtp password'} />
162
+ </div>
163
+ </div>
164
+
165
+ <label className="flex items-start gap-3">
166
+ <Checkbox checked={secure} onCheckedChange={(c) => setSecure(c === true)} className="mt-1" />
167
+ <span className="text-sm">
168
+ <span className="font-medium">Use implicit TLS (SMTPS)</span>
169
+ <span className="block text-xs text-muted-foreground">
170
+ Port 465 needs this on. Ports 25, 587 and 2525 need it off — they upgrade to
171
+ TLS with STARTTLS instead.
172
+ </span>
173
+ </span>
174
+ </label>
175
+
176
+ {tlsMismatch && (
177
+ <p className="rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-xs">
178
+ Port {port} expects implicit TLS to be{' '}
179
+ <strong>{tlsMismatch.expected ? 'on' : 'off'}</strong>. As set, the connection
180
+ fails during the TLS handshake with a &ldquo;wrong version number&rdquo; error.
181
+ Saving will correct it.
182
+ </p>
183
+ )}
184
+
185
+ <div className="flex items-center gap-4">
186
+ <Button type="submit" disabled={isPending}>
187
+ {isPending ? (<><Spinner className="mr-2 h-4 w-4" /> Saving…</>) : 'Save settings'}
188
+ </Button>
189
+ </div>
190
+ </form>
191
+
192
+ <div className="rounded-lg border p-4 space-y-3">
193
+ <div className="space-y-1">
194
+ <Label htmlFor="testTo">Send a test email</Label>
195
+ <p className="text-xs text-muted-foreground">
196
+ Save your settings first, then send a test message to confirm delivery.
197
+ </p>
198
+ </div>
199
+ <div className="flex flex-col gap-3 sm:flex-row sm:items-center">
200
+ <Input
201
+ id="testTo"
202
+ type="email"
203
+ value={testTo}
204
+ onChange={(e) => setTestTo(e.target.value)}
205
+ placeholder="you@example.com"
206
+ className="sm:max-w-xs"
207
+ />
208
+ <Button type="button" variant="outline" onClick={handleSendTest} disabled={isTesting || !testTo.trim()}>
209
+ {isTesting ? (<><Spinner className="mr-2 h-4 w-4" /> Sending…</>) : 'Send test email'}
210
+ </Button>
211
+ </div>
212
+ </div>
213
+
214
+ {message && (
215
+ <Alert variant={'error' in message ? 'destructive' : 'success'} className="py-2 px-4">
216
+ <AlertDescription>
217
+ {'error' in message
218
+ ? message.error
219
+ : 'success' in message
220
+ ? message.success
221
+ : message.message}
222
+ </AlertDescription>
223
+ </Alert>
224
+ )}
225
+ </div>
226
+ );
227
+ }