@syncello/auth 4.0.0 → 4.2.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.
package/README.md CHANGED
@@ -297,6 +297,29 @@ A `verify` hook that throws is logged and treated as "not invited": invitation m
297
297
  OAuth sign-up in open mode goes ahead unlinked, and a password signup with the token answers
298
298
  `400`.
299
299
 
300
+ ## Custom Emails
301
+
302
+ `renderEmail` puts an app's own emails in the same template as the auth emails. Every value is
303
+ plain text and escaped; every URL must be http(s) on `appUrl`'s host or a subdomain.
304
+
305
+ ```typescript
306
+ import { renderEmail } from '@syncello/auth';
307
+
308
+ const html = renderEmail({
309
+ heading: 'Your daily digest',
310
+ paragraphs: ['Here is what changed today.'],
311
+ sections: [
312
+ { title: 'Acme', url: `${appUrl}/accounts/1`, rows: [{ text: 'PO 1001 shipped', url: `${appUrl}/orders/1001` }] },
313
+ ],
314
+ button: { label: 'Open the portal', url: `${appUrl}/orders` },
315
+ notice: 'This link expires in 7 days.',
316
+ footerNote: 'You get this because you follow Acme.',
317
+ appUrl,
318
+ appName: 'My App',
319
+ branding: emailBranding,
320
+ });
321
+ ```
322
+
300
323
  ## Direct Imports
301
324
 
302
325
  For advanced usage, you can import utilities directly:
@@ -319,6 +342,30 @@ import {
319
342
 
320
343
  ## Release Notes
321
344
 
345
+ ### 4.2.0
346
+
347
+ - `renderEmail` renders an app's own emails (invitations, notifications, digests) in the
348
+ template the auth emails use, from plain text: a heading, paragraphs, optional sections of
349
+ rows, a button, a notice, a footer note and `EmailBranding`. It escapes every value and
350
+ refuses links off the app's host (see Custom Emails).
351
+ - `emailBranding.logoWidth` and `logoHeight` (CSS px, positive integers, given together): the
352
+ header logo renders at that fixed size, with `width` and `height` attributes so mail clients
353
+ reserve its space and Outlook sizes it right, instead of filling half the email's width.
354
+ - A cleaner template for every email, with no new options needed: a white card on a light grey
355
+ page, a left-aligned heading and body, the notice as a grey panel edged in `headingColor`
356
+ instead of the cyan box, and the link to copy small and grey under a thin rule. URLs in the
357
+ markup are now HTML-escaped (`&` is written `&`), which browsers read as the same URL.
358
+
359
+ ### 4.1.0
360
+
361
+ - `emailBranding.marketingUrl`: the site the email footer's Privacy Policy (`/privacy`) and Get
362
+ in Touch (`/contact`) links point at. Without it the footer has no links; they used to point
363
+ at the app, where those pages don't exist.
364
+ - Emails state each link's or code's real lifetime from `AUTH_DEFAULTS`: the password reset
365
+ email said 1 hour for a 15-minute token, and the verification email 48 hours for a 24-hour
366
+ one. `AUTH_DEFAULTS` gains `EMAIL_VERIFICATION_TTL_HOURS`, `EMAIL_CHANGE_TTL_HOURS` and
367
+ `TWO_FACTOR_EMAIL_CODE_TTL_MINUTES`, which the token code now reads too (values unchanged).
368
+
322
369
  ### 4.0.0
323
370
 
324
371
  **Breaking:** `verifyWebhookSignature` takes all three svix headers. Svix signs