@inkeep/agents-email 0.55.3

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/LICENSE.md ADDED
@@ -0,0 +1,56 @@
1
+ <!--
2
+ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
3
+ Source: ./LICENSE.md
4
+ This file is automatically copied from the root LICENSE.md during build.
5
+ Any changes should be made to the root LICENSE.md file.
6
+ -->
7
+
8
+ # Inkeep SDK – Elastic License 2.0 with Supplemental Terms
9
+
10
+ NOTE: The Inkeep SDK is licensed under the Elastic License 2.0 (ELv2), subject to Supplemental Terms included in [SUPPLEMENTAL_TERMS.md](SUPPLEMENTAL_TERMS.md). In the event of conflict, the Supplemental Terms control.
11
+
12
+ # Elastic License 2.0
13
+
14
+ ## Acceptance
15
+ By using the software, you agree to all of the terms and conditions below.
16
+
17
+ ## Copyright License
18
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below.
19
+
20
+ ## Limitations
21
+ You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
22
+
23
+ You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
24
+
25
+ You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
26
+
27
+ ## Patents
28
+ The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
29
+
30
+ ## Notices
31
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
32
+
33
+ If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
34
+
35
+ ## No Other Rights
36
+ These terms do not imply any licenses other than those expressly granted in these terms.
37
+
38
+ ## Termination
39
+ If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
40
+
41
+ ## No Liability
42
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
43
+
44
+ ## Definitions
45
+ The **licensor** is the entity offering these terms, and the **software** is the software the licensor makes available under these terms, including any portion of it.
46
+
47
+ **you** refers to the individual or entity agreeing to these terms.
48
+
49
+ **your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
50
+
51
+ **your licenses** are all the licenses granted to you for the software under these terms.
52
+
53
+ **use** means anything you do with the software requiring one of your licenses.
54
+
55
+ **trademark** means trademarks, service marks, and similar rights.
56
+
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from "react";
2
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
3
+
4
+ //#region src/components/email-button.d.ts
5
+ interface EmailButtonProps {
6
+ href: string;
7
+ children: ReactNode;
8
+ }
9
+ declare function EmailButton({
10
+ href,
11
+ children
12
+ }: EmailButtonProps): react_jsx_runtime4.JSX.Element;
13
+ //#endregion
14
+ export { EmailButton };
@@ -0,0 +1,27 @@
1
+ import { emailColors } from "../theme.js";
2
+ import { Button, Link, Text } from "@react-email/components";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+
5
+ //#region src/components/email-button.tsx
6
+ function EmailButton({ href, children }) {
7
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
8
+ href,
9
+ className: "rounded-[8px] px-[24px] py-[12px] text-[14px] font-semibold text-white no-underline text-center",
10
+ style: { backgroundColor: emailColors.brand },
11
+ children
12
+ }), /* @__PURE__ */ jsxs(Text, {
13
+ className: "text-email-text-muted text-[11px] leading-[16px] mt-[16px] mb-0",
14
+ children: [
15
+ "Link:",
16
+ " ",
17
+ /* @__PURE__ */ jsx(Link, {
18
+ href,
19
+ className: "text-email-text-muted underline",
20
+ children: href
21
+ })
22
+ ]
23
+ })] });
24
+ }
25
+
26
+ //#endregion
27
+ export { EmailButton };
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
2
+
3
+ //#region src/components/email-footer.d.ts
4
+ interface EmailFooterProps {
5
+ securityText: string;
6
+ }
7
+ declare function EmailFooter({
8
+ securityText
9
+ }: EmailFooterProps): react_jsx_runtime3.JSX.Element;
10
+ //#endregion
11
+ export { EmailFooter };
@@ -0,0 +1,25 @@
1
+ import { COMPANY_LOCATION, COMPANY_NAME } from "../theme.js";
2
+ import { Hr, Section, Text } from "@react-email/components";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+
5
+ //#region src/components/email-footer.tsx
6
+ function EmailFooter({ securityText }) {
7
+ return /* @__PURE__ */ jsxs(Section, { children: [
8
+ /* @__PURE__ */ jsx(Hr, { className: "border-email-border my-[24px]" }),
9
+ /* @__PURE__ */ jsxs(Text, {
10
+ className: "text-email-text-muted text-[12px] leading-[16px] text-center m-0",
11
+ children: [
12
+ COMPANY_NAME,
13
+ " · ",
14
+ COMPANY_LOCATION
15
+ ]
16
+ }),
17
+ /* @__PURE__ */ jsx(Text, {
18
+ className: "text-email-text-muted text-[12px] leading-[16px] text-center mt-[8px]",
19
+ children: securityText
20
+ })
21
+ ] });
22
+ }
23
+
24
+ //#endregion
25
+ export { EmailFooter };
@@ -0,0 +1,6 @@
1
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
2
+
3
+ //#region src/components/email-header.d.ts
4
+ declare function EmailHeader(): react_jsx_runtime2.JSX.Element;
5
+ //#endregion
6
+ export { EmailHeader };
@@ -0,0 +1,18 @@
1
+ import { LOGO_ALT, LOGO_HEIGHT, LOGO_URL } from "../theme.js";
2
+ import { Img, Section } from "@react-email/components";
3
+ import { jsx } from "react/jsx-runtime";
4
+
5
+ //#region src/components/email-header.tsx
6
+ function EmailHeader() {
7
+ return /* @__PURE__ */ jsx(Section, {
8
+ className: "py-[24px]",
9
+ children: /* @__PURE__ */ jsx(Img, {
10
+ src: LOGO_URL,
11
+ alt: LOGO_ALT,
12
+ height: LOGO_HEIGHT
13
+ })
14
+ });
15
+ }
16
+
17
+ //#endregion
18
+ export { EmailHeader };
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region src/components/email-layout.d.ts
5
+ interface EmailLayoutProps {
6
+ previewText: string;
7
+ securityText: string;
8
+ children: ReactNode;
9
+ }
10
+ declare function EmailLayout({
11
+ previewText,
12
+ securityText,
13
+ children
14
+ }: EmailLayoutProps): react_jsx_runtime0.JSX.Element;
15
+ //#endregion
16
+ export { EmailLayout };
@@ -0,0 +1,30 @@
1
+ import { emailTailwindConfig } from "../theme.js";
2
+ import { EmailFooter } from "./email-footer.js";
3
+ import { EmailHeader } from "./email-header.js";
4
+ import { Body, Container, Head, Html, Preview, Tailwind } from "@react-email/components";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+
7
+ //#region src/components/email-layout.tsx
8
+ function EmailLayout({ previewText, securityText, children }) {
9
+ return /* @__PURE__ */ jsxs(Html, {
10
+ lang: "en",
11
+ children: [/* @__PURE__ */ jsx(Head, {}), /* @__PURE__ */ jsx(Tailwind, {
12
+ config: emailTailwindConfig,
13
+ children: /* @__PURE__ */ jsxs(Body, {
14
+ className: "bg-email-bg my-0 mx-auto",
15
+ style: { fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif" },
16
+ children: [/* @__PURE__ */ jsx(Preview, { children: previewText }), /* @__PURE__ */ jsxs(Container, {
17
+ className: "bg-email-card rounded-[8px] mx-auto my-[40px] p-[32px] max-w-[600px]",
18
+ children: [
19
+ /* @__PURE__ */ jsx(EmailHeader, {}),
20
+ children,
21
+ /* @__PURE__ */ jsx(EmailFooter, { securityText })
22
+ ]
23
+ })]
24
+ })
25
+ })]
26
+ });
27
+ }
28
+
29
+ //#endregion
30
+ export { EmailLayout };
package/dist/env.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/env.d.ts
4
+ declare const emailEnvSchema: z.ZodObject<{
5
+ RESEND_API_KEY: z.ZodOptional<z.ZodString>;
6
+ SMTP_HOST: z.ZodOptional<z.ZodString>;
7
+ SMTP_PORT: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
8
+ SMTP_USER: z.ZodOptional<z.ZodString>;
9
+ SMTP_PASSWORD: z.ZodOptional<z.ZodString>;
10
+ SMTP_SECURE: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<boolean | undefined, string | undefined>>;
11
+ SMTP_FROM_ADDRESS: z.ZodOptional<z.ZodString>;
12
+ SMTP_FROM_NAME: z.ZodOptional<z.ZodString>;
13
+ SMTP_REPLY_TO: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ type EmailEnv = z.infer<typeof emailEnvSchema>;
16
+ declare function parseEmailEnv(env?: Record<string, string | undefined>): EmailEnv;
17
+ //#endregion
18
+ export { EmailEnv, emailEnvSchema, parseEmailEnv };
package/dist/env.js ADDED
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/env.ts
4
+ const booleanString = z.string().optional().transform((val) => val == null ? void 0 : val === "true" || val === "1");
5
+ const emailEnvSchema = z.object({
6
+ RESEND_API_KEY: z.string().optional().describe("Resend API key for SMTP relay (takes priority over generic SMTP)"),
7
+ SMTP_HOST: z.string().optional().describe("SMTP server hostname (e.g., smtp.gmail.com, localhost)"),
8
+ SMTP_PORT: z.coerce.number().optional().describe("SMTP server port (e.g., 465 for SSL, 587 for TLS, 1025 for Mailpit)"),
9
+ SMTP_USER: z.string().optional().describe("SMTP authentication username"),
10
+ SMTP_PASSWORD: z.string().optional().describe("SMTP authentication password"),
11
+ SMTP_SECURE: booleanString.describe("Use TLS/SSL for SMTP connection (auto-detected from port if not set)"),
12
+ SMTP_FROM_ADDRESS: z.string().optional().describe("Email from address (e.g., notifications@updates.inkeep.com)"),
13
+ SMTP_FROM_NAME: z.string().optional().describe("Email from display name (e.g., Inkeep)"),
14
+ SMTP_REPLY_TO: z.string().optional().describe("Reply-to email address (defaults to from address)")
15
+ });
16
+ function parseEmailEnv(env = process.env) {
17
+ return emailEnvSchema.parse(env);
18
+ }
19
+
20
+ //#endregion
21
+ export { emailEnvSchema, parseEmailEnv };
@@ -0,0 +1,11 @@
1
+ import { EmailEnv, emailEnvSchema, parseEmailEnv } from "./env.js";
2
+ import { EmailService, InvitationEmailData, PasswordResetEmailData, SendResult } from "./types.js";
3
+ import { createTransport } from "./transport.js";
4
+
5
+ //#region src/index.d.ts
6
+ interface CreateEmailServiceOptions {
7
+ env?: Record<string, string | undefined>;
8
+ }
9
+ declare function createEmailService(options?: CreateEmailServiceOptions): EmailService;
10
+ //#endregion
11
+ export { CreateEmailServiceOptions, type EmailEnv, type EmailService, type InvitationEmailData, type PasswordResetEmailData, type SendResult, createEmailService, createTransport, emailEnvSchema, parseEmailEnv };
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
1
+ import { emailEnvSchema, parseEmailEnv } from "./env.js";
2
+ import { sendEmail } from "./send.js";
3
+ import { InvitationEmail } from "./templates/invitation.js";
4
+ import { PasswordResetEmail } from "./templates/password-reset.js";
5
+ import { createTransport } from "./transport.js";
6
+ import { createElement } from "react";
7
+
8
+ //#region src/index.ts
9
+ function createEmailService(options) {
10
+ const emailEnv = parseEmailEnv(options?.env ?? process.env);
11
+ const { transporter, isConfigured } = createTransport(emailEnv);
12
+ const from = emailEnv.SMTP_FROM_NAME ? `${emailEnv.SMTP_FROM_NAME} <${emailEnv.SMTP_FROM_ADDRESS}>` : emailEnv.SMTP_FROM_ADDRESS ?? "";
13
+ const replyTo = emailEnv.SMTP_REPLY_TO;
14
+ return {
15
+ isConfigured,
16
+ async sendInvitationEmail(data) {
17
+ if (!transporter) return { emailSent: false };
18
+ return sendEmail({
19
+ transporter,
20
+ from,
21
+ replyTo,
22
+ to: data.to,
23
+ subject: `${data.inviterName} invited you to ${data.organizationName}`,
24
+ react: createElement(InvitationEmail, { data })
25
+ });
26
+ },
27
+ async sendPasswordResetEmail(data) {
28
+ if (!transporter) return { emailSent: false };
29
+ return sendEmail({
30
+ transporter,
31
+ from,
32
+ replyTo,
33
+ to: data.to,
34
+ subject: "Reset your Inkeep password",
35
+ react: createElement(PasswordResetEmail, { data })
36
+ });
37
+ }
38
+ };
39
+ }
40
+
41
+ //#endregion
42
+ export { createEmailService, createTransport, emailEnvSchema, parseEmailEnv };
package/dist/send.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { SendResult } from "./types.js";
2
+ import { ReactElement } from "react";
3
+ import { Transporter } from "nodemailer";
4
+
5
+ //#region src/send.d.ts
6
+ interface SendEmailOptions {
7
+ transporter: Transporter;
8
+ from: string;
9
+ replyTo?: string;
10
+ to: string;
11
+ subject: string;
12
+ react: ReactElement;
13
+ }
14
+ declare function sendEmail(options: SendEmailOptions): Promise<SendResult>;
15
+ //#endregion
16
+ export { SendEmailOptions, sendEmail };
package/dist/send.js ADDED
@@ -0,0 +1,27 @@
1
+ import { render } from "@react-email/render";
2
+
3
+ //#region src/send.ts
4
+ async function sendEmail(options) {
5
+ const { transporter, from, replyTo, to, subject, react } = options;
6
+ try {
7
+ const html = await render(react);
8
+ await transporter.sendMail({
9
+ from,
10
+ replyTo: replyTo ?? from,
11
+ to,
12
+ subject,
13
+ html
14
+ });
15
+ return { emailSent: true };
16
+ } catch (err) {
17
+ const message = err instanceof Error ? err.message : String(err);
18
+ console.error(`[email] Failed to send email to ${to}: ${message}`);
19
+ return {
20
+ emailSent: false,
21
+ error: message
22
+ };
23
+ }
24
+ }
25
+
26
+ //#endregion
27
+ export { sendEmail };
@@ -0,0 +1,12 @@
1
+ import { InvitationEmailData } from "../types.js";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region src/templates/invitation.d.ts
5
+ interface InvitationEmailProps {
6
+ data: InvitationEmailData;
7
+ }
8
+ declare function InvitationEmail({
9
+ data
10
+ }: InvitationEmailProps): react_jsx_runtime0.JSX.Element;
11
+ //#endregion
12
+ export { InvitationEmail };
@@ -0,0 +1,62 @@
1
+ import { EmailButton } from "../components/email-button.js";
2
+ import { EmailLayout } from "../components/email-layout.js";
3
+ import { Section, Text } from "@react-email/components";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+
6
+ //#region src/templates/invitation.tsx
7
+ function getCtaText(authMethod) {
8
+ switch (authMethod) {
9
+ case "google": return "Sign in with Google";
10
+ case "sso": return "Sign in with SSO";
11
+ default: return "Accept Invitation";
12
+ }
13
+ }
14
+ function getInstructions(authMethod) {
15
+ switch (authMethod) {
16
+ case "google": return "Sign in with your Google account to get started.";
17
+ case "sso": return "Sign in with your organization's SSO to get started.";
18
+ default: return "Click the button below to accept the invitation and set up your account.";
19
+ }
20
+ }
21
+ function InvitationEmail({ data }) {
22
+ const { inviterName, organizationName, role, invitationUrl, authMethod, expiresInDays = 7 } = data;
23
+ return /* @__PURE__ */ jsxs(EmailLayout, {
24
+ previewText: `Accept your invitation to join ${organizationName} as ${role}.`,
25
+ securityText: "If you didn't expect this invitation, you can safely ignore this email.",
26
+ children: [
27
+ /* @__PURE__ */ jsxs(Section, { children: [/* @__PURE__ */ jsxs(Text, {
28
+ className: "text-email-text text-[16px] leading-[24px] mt-0",
29
+ children: [
30
+ inviterName,
31
+ " invited you to join ",
32
+ /* @__PURE__ */ jsx("strong", { children: organizationName }),
33
+ " as",
34
+ " ",
35
+ /* @__PURE__ */ jsx("strong", { children: role }),
36
+ "."
37
+ ]
38
+ }), /* @__PURE__ */ jsx(Text, {
39
+ className: "text-email-text-secondary text-[14px] leading-[20px]",
40
+ children: getInstructions(authMethod)
41
+ })] }),
42
+ /* @__PURE__ */ jsx(Section, {
43
+ className: "text-center my-[24px]",
44
+ children: /* @__PURE__ */ jsx(EmailButton, {
45
+ href: invitationUrl,
46
+ children: getCtaText(authMethod)
47
+ })
48
+ }),
49
+ /* @__PURE__ */ jsx(Section, { children: /* @__PURE__ */ jsxs(Text, {
50
+ className: "text-email-text-muted text-[12px] leading-[16px]",
51
+ children: [
52
+ "This invitation expires in ",
53
+ expiresInDays,
54
+ " days."
55
+ ]
56
+ }) })
57
+ ]
58
+ });
59
+ }
60
+
61
+ //#endregion
62
+ export { InvitationEmail };
@@ -0,0 +1,12 @@
1
+ import { PasswordResetEmailData } from "../types.js";
2
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
3
+
4
+ //#region src/templates/password-reset.d.ts
5
+ interface PasswordResetEmailProps {
6
+ data: PasswordResetEmailData;
7
+ }
8
+ declare function PasswordResetEmail({
9
+ data
10
+ }: PasswordResetEmailProps): react_jsx_runtime1.JSX.Element;
11
+ //#endregion
12
+ export { PasswordResetEmail };
@@ -0,0 +1,40 @@
1
+ import { EmailButton } from "../components/email-button.js";
2
+ import { EmailLayout } from "../components/email-layout.js";
3
+ import { Section, Text } from "@react-email/components";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+
6
+ //#region src/templates/password-reset.tsx
7
+ function PasswordResetEmail({ data }) {
8
+ const { resetUrl, expiresInMinutes = 30 } = data;
9
+ return /* @__PURE__ */ jsxs(EmailLayout, {
10
+ previewText: `This link expires in ${expiresInMinutes} minutes.`,
11
+ securityText: "If you didn't request this, you can safely ignore this email.",
12
+ children: [
13
+ /* @__PURE__ */ jsxs(Section, { children: [/* @__PURE__ */ jsx(Text, {
14
+ className: "text-email-text text-[16px] leading-[24px] mt-0",
15
+ children: "Reset your Inkeep password"
16
+ }), /* @__PURE__ */ jsx(Text, {
17
+ className: "text-email-text-secondary text-[14px] leading-[20px]",
18
+ children: "We received a request to reset the password for your account."
19
+ })] }),
20
+ /* @__PURE__ */ jsx(Section, {
21
+ className: "text-center my-[24px]",
22
+ children: /* @__PURE__ */ jsx(EmailButton, {
23
+ href: resetUrl,
24
+ children: "Reset Password"
25
+ })
26
+ }),
27
+ /* @__PURE__ */ jsx(Section, { children: /* @__PURE__ */ jsxs(Text, {
28
+ className: "text-email-text-muted text-[12px] leading-[16px]",
29
+ children: [
30
+ "This link expires in ",
31
+ expiresInMinutes,
32
+ " minutes."
33
+ ]
34
+ }) })
35
+ ]
36
+ });
37
+ }
38
+
39
+ //#endregion
40
+ export { PasswordResetEmail };
@@ -0,0 +1,38 @@
1
+ //#region src/theme.d.ts
2
+ declare const emailColors: {
3
+ readonly brand: "#3784ff";
4
+ readonly brandLight: "#D5E5FF";
5
+ readonly background: "#F5F5F5";
6
+ readonly card: "#FFFFFF";
7
+ readonly text: {
8
+ readonly primary: "#1C1917";
9
+ readonly secondary: "#57534E";
10
+ readonly muted: "#A8A29E";
11
+ };
12
+ readonly border: "#E7E5E4";
13
+ readonly link: "#3784ff";
14
+ };
15
+ declare const emailTailwindConfig: {
16
+ theme: {
17
+ extend: {
18
+ colors: {
19
+ brand: "#3784ff";
20
+ 'brand-light': "#D5E5FF";
21
+ 'email-bg': "#F5F5F5";
22
+ 'email-card': "#FFFFFF";
23
+ 'email-text': "#1C1917";
24
+ 'email-text-secondary': "#57534E";
25
+ 'email-text-muted': "#A8A29E";
26
+ 'email-border': "#E7E5E4";
27
+ 'email-link': "#3784ff";
28
+ };
29
+ };
30
+ };
31
+ };
32
+ declare const LOGO_URL = "https://inkeep.com/icon.png";
33
+ declare const LOGO_ALT = "Inkeep";
34
+ declare const LOGO_HEIGHT = 40;
35
+ declare const COMPANY_NAME = "Inkeep, Inc.";
36
+ declare const COMPANY_LOCATION = "San Francisco, CA";
37
+ //#endregion
38
+ export { COMPANY_LOCATION, COMPANY_NAME, LOGO_ALT, LOGO_HEIGHT, LOGO_URL, emailColors, emailTailwindConfig };
package/dist/theme.js ADDED
@@ -0,0 +1,33 @@
1
+ //#region src/theme.ts
2
+ const emailColors = {
3
+ brand: "#3784ff",
4
+ brandLight: "#D5E5FF",
5
+ background: "#F5F5F5",
6
+ card: "#FFFFFF",
7
+ text: {
8
+ primary: "#1C1917",
9
+ secondary: "#57534E",
10
+ muted: "#A8A29E"
11
+ },
12
+ border: "#E7E5E4",
13
+ link: "#3784ff"
14
+ };
15
+ const emailTailwindConfig = { theme: { extend: { colors: {
16
+ brand: emailColors.brand,
17
+ "brand-light": emailColors.brandLight,
18
+ "email-bg": emailColors.background,
19
+ "email-card": emailColors.card,
20
+ "email-text": emailColors.text.primary,
21
+ "email-text-secondary": emailColors.text.secondary,
22
+ "email-text-muted": emailColors.text.muted,
23
+ "email-border": emailColors.border,
24
+ "email-link": emailColors.link
25
+ } } } };
26
+ const LOGO_URL = "https://inkeep.com/icon.png";
27
+ const LOGO_ALT = "Inkeep";
28
+ const LOGO_HEIGHT = 40;
29
+ const COMPANY_NAME = "Inkeep, Inc.";
30
+ const COMPANY_LOCATION = "San Francisco, CA";
31
+
32
+ //#endregion
33
+ export { COMPANY_LOCATION, COMPANY_NAME, LOGO_ALT, LOGO_HEIGHT, LOGO_URL, emailColors, emailTailwindConfig };
@@ -0,0 +1,11 @@
1
+ import { EmailEnv } from "./env.js";
2
+ import { Transporter } from "nodemailer";
3
+
4
+ //#region src/transport.d.ts
5
+ interface TransportResult {
6
+ transporter: Transporter | null;
7
+ isConfigured: boolean;
8
+ }
9
+ declare function createTransport(env: EmailEnv): TransportResult;
10
+ //#endregion
11
+ export { TransportResult, createTransport };
@@ -0,0 +1,62 @@
1
+ import nodemailer from "nodemailer";
2
+
3
+ //#region src/transport.ts
4
+ function createTransport(env) {
5
+ if (env.RESEND_API_KEY) {
6
+ if (!env.SMTP_FROM_ADDRESS) {
7
+ console.warn("[email] RESEND_API_KEY is set but SMTP_FROM_ADDRESS is missing. Email will be disabled.");
8
+ return {
9
+ transporter: null,
10
+ isConfigured: false
11
+ };
12
+ }
13
+ return {
14
+ transporter: nodemailer.createTransport({
15
+ host: "smtp.resend.com",
16
+ port: 465,
17
+ secure: true,
18
+ auth: {
19
+ user: "resend",
20
+ pass: env.RESEND_API_KEY
21
+ },
22
+ connectionTimeout: 1e4,
23
+ greetingTimeout: 1e4,
24
+ socketTimeout: 3e4
25
+ }),
26
+ isConfigured: true
27
+ };
28
+ }
29
+ if (env.SMTP_HOST) {
30
+ if (!env.SMTP_FROM_ADDRESS) {
31
+ console.warn("[email] SMTP_HOST is set but SMTP_FROM_ADDRESS is missing. Email will be disabled.");
32
+ return {
33
+ transporter: null,
34
+ isConfigured: false
35
+ };
36
+ }
37
+ const port = env.SMTP_PORT ?? 587;
38
+ const secure = env.SMTP_SECURE ?? port === 465;
39
+ return {
40
+ transporter: nodemailer.createTransport({
41
+ host: env.SMTP_HOST,
42
+ port,
43
+ secure,
44
+ ...env.SMTP_USER && env.SMTP_PASSWORD ? { auth: {
45
+ user: env.SMTP_USER,
46
+ pass: env.SMTP_PASSWORD
47
+ } } : {},
48
+ connectionTimeout: 1e4,
49
+ greetingTimeout: 1e4,
50
+ socketTimeout: 3e4
51
+ }),
52
+ isConfigured: true
53
+ };
54
+ }
55
+ return {
56
+ transporter: null,
57
+ isConfigured: false
58
+ };
59
+ }
60
+
61
+ //#endregion
62
+ export { createTransport };
@@ -0,0 +1,26 @@
1
+ //#region src/types.d.ts
2
+ interface SendResult {
3
+ emailSent: boolean;
4
+ error?: string;
5
+ }
6
+ interface InvitationEmailData {
7
+ to: string;
8
+ inviterName: string;
9
+ organizationName: string;
10
+ role: string;
11
+ invitationUrl: string;
12
+ authMethod?: string;
13
+ expiresInDays?: number;
14
+ }
15
+ interface PasswordResetEmailData {
16
+ to: string;
17
+ resetUrl: string;
18
+ expiresInMinutes?: number;
19
+ }
20
+ interface EmailService {
21
+ sendInvitationEmail(data: InvitationEmailData): Promise<SendResult>;
22
+ sendPasswordResetEmail(data: PasswordResetEmailData): Promise<SendResult>;
23
+ isConfigured: boolean;
24
+ }
25
+ //#endregion
26
+ export { EmailService, InvitationEmailData, PasswordResetEmailData, SendResult };
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export { };
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@inkeep/agents-email",
3
+ "version": "0.55.3",
4
+ "description": "Email service for Inkeep Agents — transactional emails via Nodemailer/SMTP",
5
+ "private": false,
6
+ "type": "module",
7
+ "license": "SEE LICENSE IN LICENSE.md",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "build": "tsdown",
17
+ "dev": "pnpm build --watch",
18
+ "test": "vitest --run",
19
+ "lint": "biome lint --error-on-warnings",
20
+ "lint:fix": "biome check --write src",
21
+ "format": "biome format --write src",
22
+ "format:check": "biome format src",
23
+ "typecheck": "tsc --noEmit"
24
+ },
25
+ "dependencies": {
26
+ "nodemailer": "^7.0.3",
27
+ "@react-email/components": "^0.0.36",
28
+ "@react-email/render": "^1.1.2"
29
+ },
30
+ "peerDependencies": {
31
+ "react": "^19.0.0",
32
+ "zod": "^4.3.6"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^20.11.24",
36
+ "@types/nodemailer": "^6.4.17",
37
+ "@types/react": "^19.1.3",
38
+ "react": "^19.0.0",
39
+ "react-dom": "^19.0.0",
40
+ "typescript": "^5.9.2",
41
+ "vitest": "^3.2.4",
42
+ "zod": "^4.3.6"
43
+ },
44
+ "engines": {
45
+ "node": ">=22.18.0"
46
+ },
47
+ "files": [
48
+ "dist",
49
+ "README.md",
50
+ "LICENSE.md"
51
+ ],
52
+ "publishConfig": {
53
+ "access": "public",
54
+ "registry": "https://registry.npmjs.org/"
55
+ },
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/inkeep/agents.git",
59
+ "directory": "packages/agents-email"
60
+ }
61
+ }