@lovable.dev/email-js 0.3.0 → 0.3.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/README.md CHANGED
@@ -204,6 +204,7 @@ import { createAuthEmailHandler } from "@lovable.dev/email-js";
204
204
  const handler = createAuthEmailHandler({
205
205
  apiKey: process.env.LOVABLE_API_KEY!,
206
206
  from: { name: "My App", address: "noreply@notify.example.com" }, // sender domain derived from the address
207
+ replyTo: { name: "My App Support", address: "support@example.com" },
207
208
  sendUrl: process.env.LOVABLE_SEND_URL,
208
209
  emails: {
209
210
  signup: { subject: "Confirm your email", render: (data) => <SignupEmail confirmationUrl={data.url} /> },
@@ -216,6 +217,10 @@ const handler = createAuthEmailHandler({
216
217
  });
217
218
  ```
218
219
 
220
+ `replyTo` takes the same string-or-parts form as `from` and sets the Reply-To
221
+ header, so a user who replies to a confirmation email reaches a monitored
222
+ inbox instead of the noreply sender. Omit it and replies go to `from`.
223
+
219
224
  `render` may be async — look up personalization data first, and fall back
220
225
  (`?? "friend"`) instead of throwing when it's missing: auth emails are
221
226
  load-bearing. A per-type entry can also be a single async function returning
package/dist/index.cjs CHANGED
@@ -173,6 +173,7 @@ function createAuthEmailHandler(options) {
173
173
  const { apiKey, emails } = options;
174
174
  if (!apiKey) throw new Error("Missing Lovable API key");
175
175
  const from = formatEmailFrom(options.from);
176
+ const replyTo = options.replyTo === void 0 ? void 0 : formatEmailFrom(options.replyTo);
176
177
  const senderDomain = options.senderDomain ?? domainOfAddress(from);
177
178
  if (!senderDomain) throw new Error(`Cannot derive a sender domain from "${from}"; pass senderDomain`);
178
179
  return async (req) => {
@@ -210,6 +211,7 @@ function createAuthEmailHandler(options) {
210
211
  to: event.data.email,
211
212
  from,
212
213
  sender_domain: senderDomain,
214
+ reply_to: replyTo,
213
215
  subject,
214
216
  html,
215
217
  text,
package/dist/index.d.cts CHANGED
@@ -137,6 +137,8 @@ interface AuthEmailHandlerOptions {
137
137
  from: EmailFrom;
138
138
  /** Defaults to the domain of `from`. */
139
139
  senderDomain?: string;
140
+ /** Reply-To header. Replies go to `from` when omitted. */
141
+ replyTo?: EmailFrom;
140
142
  sendUrl?: string | undefined;
141
143
  emails: AuthEmailDefinitions;
142
144
  }
package/dist/index.d.ts CHANGED
@@ -137,6 +137,8 @@ interface AuthEmailHandlerOptions {
137
137
  from: EmailFrom;
138
138
  /** Defaults to the domain of `from`. */
139
139
  senderDomain?: string;
140
+ /** Reply-To header. Replies go to `from` when omitted. */
141
+ replyTo?: EmailFrom;
140
142
  sendUrl?: string | undefined;
141
143
  emails: AuthEmailDefinitions;
142
144
  }
package/dist/index.js CHANGED
@@ -172,6 +172,7 @@ function createAuthEmailHandler(options) {
172
172
  const { apiKey, emails } = options;
173
173
  if (!apiKey) throw new Error("Missing Lovable API key");
174
174
  const from = formatEmailFrom(options.from);
175
+ const replyTo = options.replyTo === void 0 ? void 0 : formatEmailFrom(options.replyTo);
175
176
  const senderDomain = options.senderDomain ?? domainOfAddress(from);
176
177
  if (!senderDomain) throw new Error(`Cannot derive a sender domain from "${from}"; pass senderDomain`);
177
178
  return async (req) => {
@@ -209,6 +210,7 @@ function createAuthEmailHandler(options) {
209
210
  to: event.data.email,
210
211
  from,
211
212
  sender_domain: senderDomain,
213
+ reply_to: replyTo,
212
214
  subject,
213
215
  html,
214
216
  text,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/email-js",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Lovable Email JS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@lovable.dev/webhooks-js": "0.0.1"
24
+ "@lovable.dev/webhooks-js": "0.0.3"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@react-email/render": ">=1.0.0",
@@ -55,8 +55,8 @@
55
55
  "build": "tsdown",
56
56
  "check:package": "tmp=$(mktemp -d) && pnpm pack --out \"$tmp/pkg.tgz\" && tar -xzf \"$tmp/pkg.tgz\" -C \"$tmp\" && publint \"$tmp/package\" --strict && attw \"$tmp/pkg.tgz\"",
57
57
  "dev": "tsdown --watch",
58
- "test": "vitest run",
58
+ "test": "pnpm --filter @lovable.dev/webhooks-js run build && vitest run",
59
59
  "clean": "rimraf dist",
60
- "typecheck": "tsgo --noEmit"
60
+ "typecheck": "pnpm --filter @lovable.dev/webhooks-js run build && tsc --noEmit"
61
61
  }
62
62
  }