@ossy/email 1.5.2 → 1.5.4

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 CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.5.4 (2026-05-31)
7
+
8
+ **Note:** Version bump only for package @ossy/email
9
+
10
+
11
+
12
+
13
+
14
+ ## 1.5.3 (2026-05-31)
15
+
16
+ **Note:** Version bump only for package @ossy/email
17
+
18
+
19
+
20
+
21
+
6
22
  ## 1.5.2 (2026-05-30)
7
23
 
8
24
  **Note:** Version bump only for package @ossy/email
package/README.md CHANGED
@@ -144,7 +144,7 @@ const { html, text } = EmailRenderer.render(VerifySignInEmail, { token: 'abc', b
144
144
 
145
145
  The `email` integration is an `*.integration.js` primitive that the platform connects at startup. It provides two methods: `send` (raw) and `sendTemplate` (React component).
146
146
 
147
- **Required environment variables:**
147
+ **Required environment variables** (not required when `BUILD_ENVIRONMENT=local` — emails are logged to stdout instead):
148
148
 
149
149
  | Variable | Description |
150
150
  |---|---|
@@ -152,7 +152,7 @@ The `email` integration is an `*.integration.js` primitive that the platform con
152
152
  | `AWS_ACCESS_KEY_ID` | AWS access key |
153
153
  | `AWS_SECRET_ACCESS_KEY` | AWS secret key |
154
154
 
155
- If any variable is missing the integration is skipped with a warning, and `integrations.get('email')` returns `null`.
155
+ If any variable is missing (and `BUILD_ENVIRONMENT` is not `local`), the integration is skipped with a warning, and `integrations.get('email')` returns `null`.
156
156
 
157
157
  **Using the email client in a task:**
158
158
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ossy/email",
3
3
  "private": false,
4
- "version": "1.5.2",
4
+ "version": "1.5.4",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "module": "./src/index.js",
@@ -19,5 +19,5 @@
19
19
  "react": "*",
20
20
  "react-dom": "*"
21
21
  },
22
- "gitHead": "51e33c2eaff6973c34f00024a082c6912252ec72"
22
+ "gitHead": "188d15e1d90f102bc31996da3b32a5aef213f4b7"
23
23
  }
@@ -1,10 +1,22 @@
1
1
  import { renderToStaticMarkup } from 'react-dom/server'
2
2
  import React from 'react'
3
3
 
4
+ /** Preserve link targets when stripping tags so local stdout logs include magic-link URLs. */
5
+ function htmlToPlainText(html) {
6
+ const withLinks = html.replace(
7
+ /<a\b[^>]*\bhref=["']([^"']+)["'][^>]*>([\s\S]*?)<\/a>/gi,
8
+ (_, href, inner) => {
9
+ const label = inner.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim()
10
+ return label ? `${label}: ${href}` : href
11
+ },
12
+ )
13
+ return withLinks.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim()
14
+ }
15
+
4
16
  export const EmailRenderer = {
5
17
  render(Component, props) {
6
18
  const html = renderToStaticMarkup(React.createElement(Component, props))
7
- const text = html.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim()
19
+ const text = htmlToPlainText(html)
8
20
  return { html, text }
9
21
  }
10
22
  }
@@ -3,12 +3,16 @@ import { EmailRenderer } from './email-renderer.js'
3
3
 
4
4
  export const id = 'email'
5
5
 
6
- export const credentials = [
6
+ const SES_CREDENTIALS = [
7
7
  'SES_REGION',
8
8
  'AWS_ACCESS_KEY_ID',
9
9
  'AWS_SECRET_ACCESS_KEY',
10
10
  ]
11
11
 
12
+ /** Local dev logs to stdout; SES env vars are not required. */
13
+ export const credentials =
14
+ process.env.BUILD_ENVIRONMENT === 'local' ? [] : SES_CREDENTIALS
15
+
12
16
  /**
13
17
  * Returns an email client configured from env vars.
14
18
  * Exposes `send({ to, from, subject, html, text })` and
@@ -17,16 +21,19 @@ export const credentials = [
17
21
  * @param {{ env: NodeJS.ProcessEnv }} opts
18
22
  */
19
23
  export async function connect({ env }) {
20
- const ses = new SESClient({
21
- region: env.SES_REGION,
22
- credentials: {
23
- accessKeyId: env.AWS_ACCESS_KEY_ID,
24
- secretAccessKey: env.AWS_SECRET_ACCESS_KEY,
25
- },
26
- })
24
+ const isLocal = env.BUILD_ENVIRONMENT === 'local'
25
+ const ses = isLocal
26
+ ? null
27
+ : new SESClient({
28
+ region: env.SES_REGION,
29
+ credentials: {
30
+ accessKeyId: env.AWS_ACCESS_KEY_ID,
31
+ secretAccessKey: env.AWS_SECRET_ACCESS_KEY,
32
+ },
33
+ })
27
34
 
28
35
  function send({ to, from, subject, html, text }) {
29
- if (env.BUILD_ENVIRONMENT === 'local') {
36
+ if (isLocal) {
30
37
  console.log('\n-----------YOU GOT MAIL-----------')
31
38
  console.log(`To: ${to}`)
32
39
  console.log(`From: ${from}`)