@stacksjs/defaults 0.75.661 → 0.75.667

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 (35) hide show
  1. package/ai/skills/stacks-actions/SKILL.md +1 -1
  2. package/ai/skills/stacks-auth/SKILL.md +1 -0
  3. package/ai/skills/stacks-composables/SKILL.md +6 -5
  4. package/ai/skills/stacks-dashboard/SKILL.md +2 -2
  5. package/ai/skills/stacks-logging/SKILL.md +5 -1
  6. package/ai/skills/stacks-models/SKILL.md +7 -0
  7. package/ai/skills/stacks-native/CATALOG.md +27 -25
  8. package/ai/skills/stacks-newsletter/SKILL.md +51 -0
  9. package/ai/skills/stacks-payments/SKILL.md +13 -0
  10. package/ai/skills/stacks-scheduler/SKILL.md +10 -0
  11. package/ai/skills/stacks-socials/SKILL.md +20 -2
  12. package/ai/skills/stacks-testing/SKILL.md +11 -0
  13. package/app/Actions/ConfirmSubscriptionAction.ts +53 -0
  14. package/app/Actions/SubscriberEmailAction.ts +123 -40
  15. package/app/Actions/UnsubscribeAction.ts +5 -24
  16. package/app/Actions/form-return.ts +65 -0
  17. package/app/Actions/subscription-page.ts +50 -0
  18. package/app/Mail/SubscriptionConfirmRequest.ts +56 -0
  19. package/app/Mail/SubscriptionConfirmation.ts +46 -6
  20. package/app/Models/FailedJob.ts +1 -1
  21. package/app/Models/Referral.ts +1 -1
  22. package/app/Models/commerce/Auction.ts +2 -2
  23. package/app/Models/commerce/AuctionItem.ts +1 -1
  24. package/app/Models/commerce/Bid.ts +1 -1
  25. package/app/Models/commerce/WaitlistProduct.ts +3 -3
  26. package/ide/vscode/package.json +1 -1
  27. package/package.json +7 -7
  28. package/project/storage/framework/types/src/auth.ts +3 -1
  29. package/resources/assets/scripts/main.ts +5 -6
  30. package/resources/components/Marketing/ComingSoon.stx +3 -101
  31. package/resources/components/Marketing/SubscribeForm.stx +315 -0
  32. package/resources/emails/subscription-confirm.stx +31 -0
  33. package/resources/emails/subscription-confirmation.stx +23 -88
  34. package/routes/dashboard.ts +2 -0
  35. package/scaffold/config/server.ts +141 -0
@@ -53,109 +53,11 @@ const { appName, description } = withDefaults(
53
53
  </p>
54
54
 
55
55
  <div class="flex gap-x-6 items-center mt-10">
56
- <form id="coming-soon-form" class="flex w-380px rounded-md shadow-sm" novalidate>
57
- <div class="flex relative focus-within:z-10 flex-grow items-stretch">
58
- <div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
59
- <div class="h-5 w-5 text-gray-400 i-hugeicons-envelope"></div>
60
- </div>
61
-
62
- <input
63
- id="coming-soon-email"
64
- type="email"
65
- name="email"
66
- required
67
- class="block pl-10 py-1.5 w-full text-gray-900 sm:leading-6 sm:text-sm placeholder:text-gray-400 border-0 ring-1 ring-gray-300 ring-inset rounded-l-md rounded-none focus:ring-2 focus:ring-blue-600 focus:ring-inset"
68
- placeholder="may-we-ask@your-email.org">
69
- </div>
70
-
71
- <button
72
- id="coming-soon-submit"
73
- type="submit"
74
- class="inline-flex relative gap-x-1.5 items-center -ml-px px-3 py-2 w-120px font-semibold text-gray-900 text-sm hover:bg-gray-50 ring-1 ring-gray-300 ring-inset rounded-r-md">
75
- <span id="coming-soon-submit-label">Stay in Touch</span>
76
- <div id="coming-soon-spinner" class="hidden h-4 w-4 animate-spin i-hugeicons-loading-01"></div>
77
- </button>
78
- </form>
56
+ <div class="w-380px">
57
+ <SubscribeForm source="coming-soon" label="Stay in touch" placeholder="may-we-ask@your-email.org" successText="Thanks, we will be in touch." />
58
+ </div>
79
59
  </div>
80
-
81
- <p id="coming-soon-error" class="hidden pt-2 text-red-500 text-xs"></p>
82
- <p id="coming-soon-success" class="hidden pt-2 text-green-700 text-xs">
83
- Thanks, we'll be in touch.
84
- </p>
85
60
  </div>
86
61
  </div>
87
62
  </div>
88
63
 
89
- <script client>
90
- // Client-side wiring for the holding-page email form. The endpoint
91
- // itself (/api/email/subscribe) is rate-limited server-side; this
92
- // handler just gives the visitor immediate feedback.
93
- const form = document.getElementById('coming-soon-form') as HTMLFormElement | null
94
- const emailInput = document.getElementById('coming-soon-email') as HTMLInputElement | null
95
- const submitBtn = document.getElementById('coming-soon-submit') as HTMLButtonElement | null
96
- const submitLabel = document.getElementById('coming-soon-submit-label')
97
- const spinner = document.getElementById('coming-soon-spinner')
98
- const errorEl = document.getElementById('coming-soon-error')
99
- const successEl = document.getElementById('coming-soon-success')
100
-
101
- function setLoading(loading: boolean) {
102
- if (!submitBtn || !submitLabel || !spinner) return
103
- submitBtn.disabled = loading
104
- submitBtn.classList.toggle('opacity-50', loading)
105
- submitLabel.classList.toggle('hidden', loading)
106
- spinner.classList.toggle('hidden', !loading)
107
- }
108
-
109
- function showError(message: string) {
110
- if (!errorEl) return
111
- errorEl.textContent = message
112
- errorEl.classList.remove('hidden')
113
- }
114
-
115
- function clearMessages() {
116
- if (errorEl) errorEl.classList.add('hidden')
117
- if (successEl) successEl.classList.add('hidden')
118
- }
119
-
120
- if (form) {
121
- form.addEventListener('submit', async function (event) {
122
- event.preventDefault()
123
- clearMessages()
124
-
125
- const email = emailInput && emailInput.value ? emailInput.value.trim() : ''
126
- if (!email || email.indexOf('@') === -1) {
127
- showError('Please enter a valid email address.')
128
- return
129
- }
130
-
131
- setLoading(true)
132
- try {
133
- const response = await fetch('/api/email/subscribe', {
134
- method: 'POST',
135
- headers: { 'Content-Type': 'application/json' },
136
- body: JSON.stringify({ email }),
137
- })
138
-
139
- if (response.ok) {
140
- if (successEl) successEl.classList.remove('hidden')
141
- if (form) form.reset()
142
- }
143
- else {
144
- let message = 'Sorry, we could not subscribe you. Please try again later.'
145
- try {
146
- const data = await response.json()
147
- if (data && data.message) message = data.message
148
- }
149
- catch { /* ignore parse errors */ }
150
- showError(message)
151
- }
152
- }
153
- catch {
154
- showError('Network error, please try again.')
155
- }
156
- finally {
157
- setLoading(false)
158
- }
159
- })
160
- }
161
- </script>
@@ -0,0 +1,315 @@
1
+ <script client>
2
+ /*
3
+ * A newsletter signup, answered in place. Drop it on any page:
4
+ *
5
+ * <SubscribeForm />
6
+ * <SubscribeForm list="launch" source="blog" label="Get the launch email" />
7
+ *
8
+ * It posts to the framework's public endpoint, POST /api/email/subscribe
9
+ * (SubscriberEmailAction), which puts the address on a newsletter list through
10
+ * @stacksjs/newsletter and sends the welcome email. Submitting does not reload
11
+ * the page: the button shows a spinner while the request is out and the answer
12
+ * appears under the field. A good address clears the field; a bad one keeps it,
13
+ * with focus, to fix.
14
+ *
15
+ * Without JavaScript it is still a plain form. The endpoint sends the browser
16
+ * back with ?subscribe=<outcome>; hand that to `outcome` and the matching
17
+ * message shows on load:
18
+ *
19
+ * <SubscribeForm outcome="{{ typeof query !== 'undefined' ? query.subscribe : '' }}" />
20
+ *
21
+ * Props (all optional):
22
+ * list a public list's slug; the default list when empty
23
+ * source where the signup came from, stored on the subscriber
24
+ * returnTo the path (and #fragment) a plain form post comes back to
25
+ * outcome the ?subscribe= value the page was loaded with
26
+ * label the button text
27
+ * placeholder the field's placeholder
28
+ * intro a visible label above the field (else a screen-reader label)
29
+ * fine fine print under the field, replaced by the answer
30
+ * successText, pendingText, alreadyText what to say for those outcomes
31
+ * (pending: the list has double opt-in on and a confirmation
32
+ * email went out)
33
+ * tone 'primary' for a filled button, 'outline' for an outlined one
34
+ * buttonClass extra classes for the button, such as an app's own button class
35
+ *
36
+ * Styling: everything is under `.subscribe-form` at zero specificity, coloured
37
+ * from CSS variables (--subscribe-accent, --subscribe-text, --subscribe-muted,
38
+ * --subscribe-border, --subscribe-field, --subscribe-success, --subscribe-error),
39
+ * so an app's own stylesheet wins without a fight.
40
+ */
41
+ type Outcome = 'subscribed' | 'pending' | 'already' | 'invalid' | 'busy' | 'error'
42
+
43
+ const list = useReactiveProp<string>('list', '')
44
+ const source = useReactiveProp<string>('source', 'website')
45
+ const returnTo = useReactiveProp<string>('returnTo', '')
46
+ const loadedWith = useReactiveProp<string>('outcome', '')
47
+ const label = useReactiveProp<string>('label', 'Subscribe')
48
+ const placeholder = useReactiveProp<string>('placeholder', 'you@example.com')
49
+ const intro = useReactiveProp<string>('intro', '')
50
+ const fine = useReactiveProp<string>('fine', '')
51
+ const successText = useReactiveProp<string>('successText', 'Thanks, you are subscribed. A welcome email is on its way to your inbox.')
52
+ const pendingText = useReactiveProp<string>('pendingText', 'Almost there. Check your inbox and open the link to confirm your subscription.')
53
+ const alreadyText = useReactiveProp<string>('alreadyText', 'You are already subscribed. Thanks for sticking around.')
54
+ const tone = useReactiveProp<string>('tone', 'primary')
55
+ const buttonClass = useReactiveProp<string>('buttonClass', '')
56
+
57
+ const messages = {
58
+ invalid: 'That email address did not look right. Try it again?',
59
+ busy: 'That was a lot of tries in a minute. Give it a moment and try again.',
60
+ error: 'Something went wrong on our side and you are not subscribed yet. Please try again.',
61
+ }
62
+ const outcomes = ['subscribed', 'pending', 'already', 'invalid', 'busy', 'error']
63
+
64
+ const email = state('')
65
+ const sending = state(false)
66
+ const outcome = state<Outcome | ''>(outcomes.includes(loadedWith()) ? loadedWith() as Outcome : '')
67
+ const tonePositive = derived(() => outcome() === 'subscribed' || outcome() === 'pending' || outcome() === 'already')
68
+ const noticeText = derived(() => {
69
+ switch (outcome()) {
70
+ case 'subscribed': return successText()
71
+ case 'pending': return pendingText()
72
+ case 'already': return alreadyText()
73
+ case '': return ''
74
+ default: return messages[outcome() as 'invalid' | 'busy' | 'error']
75
+ }
76
+ })
77
+ const noticeClass = derived(() => !outcome() ? 'subscribe-form__notice--empty' : tonePositive() ? 'subscribe-form__notice--success' : 'subscribe-form__notice--error')
78
+ const noticeIcon = derived(() => tonePositive() ? 'i-hugeicons-checkmark-circle-02' : 'i-hugeicons-alert-circle')
79
+ const emailInput = useRef('emailInput')
80
+
81
+ // Long enough to read as "working" rather than a flicker, short enough never
82
+ // to be the slow part.
83
+ const minimumSpin = 450
84
+
85
+ /** Read the endpoint's JSON answer as an outcome. */
86
+ function outcomeOf(status: number, body: { success?: unknown, pending?: unknown, message?: unknown } | null): Outcome {
87
+ if (status === 429)
88
+ return 'busy'
89
+ if (status >= 200 && status < 300 && body) {
90
+ if (body.success === true && body.pending === true)
91
+ return 'pending'
92
+ if (body.success === true)
93
+ return body.message === 'Already subscribed' ? 'already' : 'subscribed'
94
+ if (body.success === false)
95
+ return 'invalid'
96
+ }
97
+ return 'error'
98
+ }
99
+
100
+ async function send(): Promise<Outcome> {
101
+ try {
102
+ const response = await fetch('/api/email/subscribe', {
103
+ method: 'POST',
104
+ headers: { 'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' },
105
+ body: new URLSearchParams({ email: email(), source: source(), list: list(), return: returnTo() }).toString(),
106
+ })
107
+ let body: { success?: unknown, pending?: unknown, message?: unknown } | null = null
108
+ try {
109
+ body = await response.json()
110
+ }
111
+ catch {}
112
+ return outcomeOf(response.status, body)
113
+ }
114
+ catch {
115
+ return 'error'
116
+ }
117
+ }
118
+
119
+ async function submit(): Promise<void> {
120
+ if (sending())
121
+ return
122
+
123
+ sending.set(true)
124
+ const [answer] = await Promise.all([send(), new Promise(resolve => setTimeout(resolve, minimumSpin))])
125
+ outcome.set(answer)
126
+ sending.set(false)
127
+
128
+ if (answer === 'subscribed' || answer === 'pending' || answer === 'already')
129
+ email.set('')
130
+ else
131
+ void nextTick(() => emailInput.current?.focus())
132
+ }
133
+ </script>
134
+
135
+ <form
136
+ class="subscribe-form"
137
+ :class="sending() ? 'is-loading' : ''"
138
+ action="/api/email/subscribe"
139
+ method="POST"
140
+ :aria-busy="sending() ? 'true' : 'false'"
141
+ @submit.prevent="submit()"
142
+ >
143
+ <input type="hidden" name="source" :value="source()">
144
+ <input type="hidden" name="list" :value="list()">
145
+ <input type="hidden" name="return" :value="returnTo()">
146
+ <label class="subscribe-form__intro" :class="intro() ? '' : 'subscribe-form__sr'" for="subscribe-email">{{ intro() || 'Email address' }}</label>
147
+ <div class="subscribe-form__row">
148
+ <input id="subscribe-email" ref="emailInput" class="subscribe-form__field" type="email" name="email" :placeholder="placeholder()" autocomplete="email" required x-model.trim="email">
149
+ <button type="submit" class="subscribe-form__button" :class="(tone() === 'outline' ? 'subscribe-form__button--outline ' : '') + buttonClass()" :disabled="sending()">
150
+ <span class="subscribe-form__spinner" aria-hidden="true"></span>
151
+ <span>{{ label() }}</span>
152
+ </button>
153
+ </div>
154
+ <p class="subscribe-form__notice" :class="noticeClass()" role="status" aria-live="polite">
155
+ <i aria-hidden="true" :class="noticeIcon()"></i>
156
+ <span>{{ noticeText() }}</span>
157
+ </p>
158
+ <p class="subscribe-form__fine" :class="outcome() || !fine() ? 'subscribe-form__fine--gone' : ''">{{ fine() }}</p>
159
+ </form>
160
+
161
+ <style>
162
+ :where(.subscribe-form) {
163
+ --subscribe-accent: #3451b2;
164
+ --subscribe-on-accent: #ffffff;
165
+ --subscribe-text: inherit;
166
+ --subscribe-muted: #6b7280;
167
+ --subscribe-border: rgba(0, 0, 0, 0.15);
168
+ --subscribe-field: #ffffff;
169
+ --subscribe-success: rgba(52, 81, 178, 0.1);
170
+ --subscribe-error: rgba(220, 38, 38, 0.1);
171
+ display: grid;
172
+ gap: 0.7rem;
173
+ color: var(--subscribe-text);
174
+ }
175
+
176
+ :where(.subscribe-form__row) {
177
+ display: flex;
178
+ gap: 0.5rem;
179
+ }
180
+
181
+ :where(.subscribe-form__field) {
182
+ flex: 1 1 auto;
183
+ min-width: 0;
184
+ min-height: 44px;
185
+ padding: 0 0.9rem;
186
+ border: 1px solid var(--subscribe-border);
187
+ border-radius: 10px;
188
+ color: inherit;
189
+ font: inherit;
190
+ background: var(--subscribe-field);
191
+ }
192
+
193
+ :where(.subscribe-form__button) {
194
+ display: inline-flex;
195
+ flex: 0 0 auto;
196
+ gap: 0.5rem;
197
+ align-items: center;
198
+ justify-content: center;
199
+ min-height: 44px;
200
+ padding: 0 1.1rem;
201
+ border: 1px solid transparent;
202
+ border-radius: 10px;
203
+ color: var(--subscribe-on-accent);
204
+ font: inherit;
205
+ font-weight: 600;
206
+ white-space: nowrap;
207
+ background: var(--subscribe-accent);
208
+ cursor: pointer;
209
+ }
210
+
211
+ :where(.subscribe-form__button--outline) {
212
+ border-color: var(--subscribe-border);
213
+ color: inherit;
214
+ background: transparent;
215
+ }
216
+
217
+ :where(.subscribe-form__button:disabled) {
218
+ cursor: progress;
219
+ opacity: 0.85;
220
+ }
221
+
222
+ :where(.subscribe-form__spinner) {
223
+ display: none;
224
+ width: 1em;
225
+ height: 1em;
226
+ border: 2px solid currentColor;
227
+ border-right-color: transparent;
228
+ border-radius: 50%;
229
+ animation: subscribe-form-spin 0.7s linear infinite;
230
+ }
231
+
232
+ :where(.subscribe-form.is-loading .subscribe-form__spinner) {
233
+ display: inline-block;
234
+ }
235
+
236
+ :where(.subscribe-form__intro) {
237
+ color: var(--subscribe-muted);
238
+ font-size: 0.9rem;
239
+ }
240
+
241
+ :where(.subscribe-form__sr) {
242
+ position: absolute;
243
+ width: 1px;
244
+ height: 1px;
245
+ margin: -1px;
246
+ overflow: hidden;
247
+ clip: rect(0, 0, 0, 0);
248
+ white-space: nowrap;
249
+ }
250
+
251
+ :where(.subscribe-form__notice) {
252
+ display: flex;
253
+ gap: 0.5rem;
254
+ align-items: flex-start;
255
+ margin: 0;
256
+ padding: 0.65rem 0.8rem;
257
+ border-radius: 10px;
258
+ font-size: 0.88rem;
259
+ line-height: 1.45;
260
+ animation: subscribe-form-in 0.22s ease-out;
261
+ }
262
+
263
+ :where(.subscribe-form__notice i) {
264
+ flex: 0 0 auto;
265
+ width: 1.1rem;
266
+ height: 1.1rem;
267
+ margin-top: 0.05rem;
268
+ }
269
+
270
+ :where(.subscribe-form__notice--success) {
271
+ background: var(--subscribe-success);
272
+ }
273
+
274
+ :where(.subscribe-form__notice--success i) {
275
+ color: var(--subscribe-accent);
276
+ }
277
+
278
+ :where(.subscribe-form__notice--error) {
279
+ background: var(--subscribe-error);
280
+ }
281
+
282
+ :where(.subscribe-form__notice--error i) {
283
+ color: #dc2626;
284
+ }
285
+
286
+ :where(.subscribe-form__notice--empty, .subscribe-form__fine--gone) {
287
+ display: none;
288
+ }
289
+
290
+ :where(.subscribe-form__fine) {
291
+ margin: 0;
292
+ color: var(--subscribe-muted);
293
+ font-size: 0.8rem;
294
+ line-height: 1.5;
295
+ }
296
+
297
+ @keyframes subscribe-form-spin {
298
+ to { transform: rotate(360deg); }
299
+ }
300
+
301
+ @keyframes subscribe-form-in {
302
+ from { opacity: 0; transform: translateY(-3px); }
303
+ }
304
+
305
+ @media (max-width: 560px) {
306
+ :where(.subscribe-form__row) {
307
+ flex-direction: column;
308
+ }
309
+ }
310
+
311
+ @media (prefers-reduced-motion: reduce) {
312
+ :where(.subscribe-form__spinner) { animation-duration: 1.6s; }
313
+ :where(.subscribe-form__notice) { animation: none; }
314
+ }
315
+ </style>
@@ -0,0 +1,31 @@
1
+ <script server>
2
+ // The double opt-in email: sent by SubscriptionConfirmRequest (defaults/app/Mail)
3
+ // when someone signs up to a list that has `double_opt_in` on. The button
4
+ // confirms the address; until then the list sends nothing to it. It speaks for
5
+ // the app, from config, and an app overrides it with its own
6
+ // resources/emails/subscription-confirm.stx.
7
+ const email = props.email || ''
8
+ const confirmUrl = props.confirmUrl || '#'
9
+ const appName = props.appName || 'our newsletter'
10
+ const appUrl = props.appUrl || ''
11
+ const primaryColor = props.primaryColor || '#3451b2'
12
+ const year = props.year || new Date().getFullYear()
13
+ const subject = `Confirm your subscription to ${appName}`
14
+ </script>
15
+
16
+ <EmailLayout title="{{ subject }}" preheader="One click to confirm, and you are on the {{ appName }} list." brand="{{ appName }}" brandUrl="{{ appUrl }}" accent="{{ primaryColor }}">
17
+ <EmailText size="heading">Confirm your subscription</EmailText>
18
+ <EmailText>Someone, hopefully you, asked to get {{ appName }} by email at {{ email }}. Confirm the address and you are on the list.</EmailText>
19
+
20
+ <EmailButton href="{{ confirmUrl }}" bg="{{ primaryColor }}">Yes, subscribe me</EmailButton>
21
+
22
+ <EmailDivider />
23
+ <EmailText size="sm" spacing="8px">If you did not sign up, ignore this email and nothing happens: you will not get anything else from us.</EmailText>
24
+ <EmailText size="sm" spacing="0">If the button does not work, open this link: <a href="{{ confirmUrl }}" style="color:{{ primaryColor }};word-break:break-all;">{{ confirmUrl }}</a></EmailText>
25
+
26
+ <template #footer>
27
+ <tr>
28
+ <td class="email-muted" style="padding:16px 40px 20px;border-top:1px solid #e4e4e7;color:#a1a1aa;font-size:11px;text-align:center;">&copy; {{ year }} {{ appName }}</td>
29
+ </tr>
30
+ </template>
31
+ </EmailLayout>
@@ -1,99 +1,34 @@
1
1
  <script server>
2
+ // The default welcome for a newsletter signup, sent by SubscriptionConfirmation
3
+ // (defaults/app/Mail) when someone subscribes through /api/email/subscribe.
4
+ //
5
+ // It speaks for the app, not for Stacks: the name and address come from the
6
+ // app's config. It used to describe Stacks as "a rapid application development
7
+ // framework" in every app's welcome email. An app overrides it with its own
8
+ // resources/emails/subscription-confirmation.stx.
2
9
  const email = props.email || ''
3
10
  const unsubscribeUrl = props.unsubscribeUrl || '#'
4
- const appName = props.appName || 'Stacks'
5
- const appUrl = props.appUrl || 'https://stacksjs.com'
11
+ const appName = props.appName || 'our newsletter'
12
+ const appUrl = props.appUrl || ''
6
13
  const primaryColor = props.primaryColor || '#3451b2'
7
14
  const year = props.year || new Date().getFullYear()
15
+ const subject = `You are on the ${appName} list`
8
16
  </script>
9
17
 
10
- <!DOCTYPE html>
11
- <html lang="en">
12
- <head>
13
- <meta charset="UTF-8">
14
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
15
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
16
- <title>Welcome to {{ appName }}</title>
17
- </head>
18
- <body style="margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background-color: #0e0e0e; line-height: 1.6; color: #d4d4d4;">
19
- <table role="presentation" cellpadding="0" cellspacing="0" style="width: 100%; border-collapse: collapse;">
20
- <tr>
21
- <td style="padding: 40px 20px;">
22
- <table role="presentation" cellpadding="0" cellspacing="0" style="max-width: 600px; margin: 0 auto;">
23
-
24
- <!-- Logo -->
25
- <tr>
26
- <td style="text-align: center; padding-bottom: 32px;">
27
- <h1 style="color: #ececec; font-size: 28px; font-weight: 600; margin: 0;">{{ appName }}</h1>
28
- </td>
29
- </tr>
30
-
31
- <!-- Main Content -->
32
- <tr>
33
- <td style="background-color: #1a1a1a; border-radius: 12px; padding: 40px;">
34
-
35
- <h2 style="color: #ececec; font-size: 22px; font-weight: 600; margin: 0 0 16px;">Thanks for subscribing!</h2>
36
-
37
- <p style="color: #a0a0a0; font-size: 16px; line-height: 1.6; margin: 0 0 16px;">
38
- You're now on the list. We'll keep you in the loop on new releases, features, and framework updates.
39
- </p>
18
+ <EmailLayout title="{{ subject }}" preheader="Thanks for subscribing to {{ appName }}." brand="{{ appName }}" brandUrl="{{ appUrl }}" accent="{{ primaryColor }}">
19
+ <EmailText size="heading">Thanks for subscribing.</EmailText>
20
+ <EmailText>You are on the {{ appName }} list. We will write when there is something worth reading, and never more than that.</EmailText>
40
21
 
41
- <p style="color: #a0a0a0; font-size: 16px; line-height: 1.6; margin: 0 0 24px;">
42
- {{ appName }} is a rapid application development framework that helps you build type-safe web apps, APIs, and cloud infrastructure with ease.
43
- </p>
22
+ @if (appUrl)
23
+ <EmailButton href="{{ appUrl }}" bg="{{ primaryColor }}">Visit {{ appName }}</EmailButton>
24
+ @endif
44
25
 
45
- <!-- CTA Button -->
46
- <table role="presentation" cellpadding="0" cellspacing="0" style="margin: 0 0 24px;">
47
- <tr>
48
- <td>
49
- <a href="{{ appUrl }}" style="display: inline-block; background-color: {{ primaryColor }}; color: #ffffff; text-decoration: none; padding: 12px 24px; border-radius: 8px; font-size: 14px; font-weight: 500;">
50
- Visit {{ appName }}
51
- </a>
52
- </td>
53
- </tr>
54
- </table>
26
+ <EmailDivider />
27
+ <EmailText size="sm" spacing="0">You are getting this because {{ email }} subscribed. Changed your mind? <a href="{{ unsubscribeUrl }}" style="color:#71717a;text-decoration:underline;">Unsubscribe</a> in one click.</EmailText>
55
28
 
56
- <!-- Divider -->
57
- <table role="presentation" cellpadding="0" cellspacing="0" style="width: 100%; margin: 8px 0 24px;">
58
- <tr>
59
- <td style="border-top: 1px solid #2a2a2a;"></td>
60
- </tr>
61
- </table>
62
-
63
- <!-- Links -->
64
- <table role="presentation" cellpadding="0" cellspacing="0" style="width: 100%;">
65
- <tr>
66
- <td style="color: #666; font-size: 13px;">
67
- <a href="https://docs.stacksjs.com" style="color: #888; text-decoration: none;">Docs</a>
68
- &nbsp;&middot;&nbsp;
69
- <a href="https://github.com/stacksjs/stacks" style="color: #888; text-decoration: none;">GitHub</a>
70
- &nbsp;&middot;&nbsp;
71
- <a href="https://stacksjs.com/discord" style="color: #888; text-decoration: none;">Discord</a>
72
- </td>
73
- </tr>
74
- </table>
75
-
76
- </td>
77
- </tr>
78
-
79
- <!-- Footer -->
80
- <tr>
81
- <td style="text-align: center; padding-top: 32px;">
82
- <p style="color: #555; font-size: 13px; margin: 0 0 8px;">
83
- You received this email because {{ email }} subscribed at {{ appUrl }}.
84
- </p>
85
- <p style="margin: 0;">
86
- <a href="{{ unsubscribeUrl }}" style="color: #666; font-size: 12px; text-decoration: underline;">Unsubscribe</a>
87
- </p>
88
- <p style="color: #444; font-size: 11px; margin: 12px 0 0;">
89
- &copy; {{ year }} {{ appName }}. All rights reserved.
90
- </p>
91
- </td>
92
- </tr>
93
-
94
- </table>
95
- </td>
29
+ <template #footer>
30
+ <tr>
31
+ <td class="email-muted" style="padding:16px 40px 20px;border-top:1px solid #e4e4e7;color:#a1a1aa;font-size:11px;text-align:center;">&copy; {{ year }} {{ appName }}</td>
96
32
  </tr>
97
- </table>
98
- </body>
99
- </html>
33
+ </template>
34
+ </EmailLayout>
@@ -69,6 +69,8 @@ function guarded(prefix: string, base?: Parameters<typeof dashboardGroupMiddlewa
69
69
  // the subscriber list) is better handled with the rate limiter — at
70
70
  // the action layer — than with a token check the form can't satisfy.
71
71
  route.post('/api/email/subscribe', 'Actions/SubscriberEmailAction').name('email.subscribe').skipCsrf()
72
+ // The button in the double opt-in email (lists with `double_opt_in` on).
73
+ route.get('/api/email/confirm', 'Actions/ConfirmSubscriptionAction').name('email.confirm')
72
74
  route.get('/api/email/unsubscribe', 'Actions/UnsubscribeAction').name('email.unsubscribe')
73
75
  // RFC 8058 one-click endpoint. Mailbox providers (Gmail, Yahoo, Outlook)
74
76
  // POST here with body `List-Unsubscribe=One-Click` when the user clicks