Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(email): let the workspace invitation template render without copy

Andrejf3ea6b51f3dc
diff --git a/packages/email/package.json b/packages/email/package.json
index 8b2c474ac..51f6dae9b 100644
--- a/packages/email/package.json
+++ b/packages/email/package.json
@@ -28,7 +28,6 @@
"react-dom": "^19.2.8"
},
"devDependencies": {
- "@react-email/preview-server": "5.2.10",
"@react-email/render": "^2.1.0",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.4",
diff --git a/packages/email/src/templates/workspace-invitation.test.ts b/packages/email/src/templates/workspace-invitation.test.ts
index 2454c1440..9b2b33835 100644
--- a/packages/email/src/templates/workspace-invitation.test.ts
+++ b/packages/email/src/templates/workspace-invitation.test.ts
@@ -1,6 +1,7 @@
import { render } from "@react-email/render";
import { createElement } from "react";
import { describe, expect, it } from "vitest";
+import enUS from "../../../../i18n/en-US.json";
import frFR from "../../../../i18n/fr-FR.json";
import WorkspaceInvitationEmail from "./workspace-invitation";
@@ -22,3 +23,44 @@ describe("WorkspaceInvitationEmail", () => {
expect(html).toContain("Camille ([email protected])");
});
});
+
+describe("WorkspaceInvitationEmail default copy", () => {
+ it("renders without a copy prop so previews and exports work", async () => {
+ const html = await render(
+ createElement(WorkspaceInvitationEmail, {
+ workspaceName: "Acme Inc",
+ inviterName: "John Doe",
+ inviterEmail: "[email protected]",
+ invitationLink: "https://kaneo.app/invite/abc123",
+ }),
+ );
+
+ expect(html).toContain("Join Acme Inc");
+ expect(html).toContain("Accept invitation");
+ });
+
+ it("keeps the fallback in sync with the en-US bundle", async () => {
+ const html = await render(
+ createElement(WorkspaceInvitationEmail, {
+ workspaceName: "Acme Inc",
+ inviterName: "John Doe",
+ inviterEmail: "[email protected]",
+ invitationLink: "https://kaneo.app/invite/abc123",
+ }),
+ );
+ const withEnUs = await render(
+ createElement(WorkspaceInvitationEmail, {
+ workspaceName: "Acme Inc",
+ inviterName: "John Doe",
+ inviterEmail: "[email protected]",
+ invitationLink: "https://kaneo.app/invite/abc123",
+ copy: enUS.invitations.email,
+ }),
+ );
+
+ expect(html).toBe(withEnUs);
+ });
+});
diff --git a/packages/email/src/templates/workspace-invitation.tsx b/packages/email/src/templates/workspace-invitation.tsx
index 3e31b6af6..0e624094c 100644
--- a/packages/email/src/templates/workspace-invitation.tsx
+++ b/packages/email/src/templates/workspace-invitation.tsx
@@ -10,7 +10,7 @@ export type WorkspaceInvitationEmailProps = {
inviterEmail: string;
invitationLink: string;
to: string;
- copy: WorkspaceInvitationEmailCopy;
+ copy?: WorkspaceInvitationEmailCopy;
};
export type WorkspaceInvitationEmailCopy = {
@@ -24,6 +24,21 @@ export type WorkspaceInvitationEmailCopy = {
footer: string;
};
+// Inlined rather than imported from i18n/en-US.json: this package builds with
+// tsc, so the import would survive into dist and resolve outside the published
+// files at runtime.
+const DEFAULT_COPY: WorkspaceInvitationEmailCopy = {
+ subject: "{{inviterName}} invited you to join {{workspaceName}} on Kaneo",
+ preview: "You're invited to {{workspaceName}} on Kaneo",
+ title: "Join {{workspaceName}}",
+ subtitle:
+ "{{inviterName}} ({{inviterEmail}}) invited you to collaborate in Kaneo.",
+ cta: "Accept invitation",
+ sameEmail: "You can accept with the same email that received this message.",
+ ignore: "If this wasn't expected, you can safely ignore this email.",
+ footer: "Kaneo workspace invitation",
+};
+
function interpolate(template: string, values: Record<string, string>) {
return template.replace(/\{\{(\w+)\}\}/g, (_match, key: string) => {
return values[key] ?? "";
@@ -36,7 +51,7 @@ const WorkspaceInvitationEmail = ({
inviterEmail,
invitationLink,
to,
- copy,
+ copy = DEFAULT_COPY,
}: WorkspaceInvitationEmailProps) => {
const values = { workspaceName, inviterName, inviterEmail };
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index eebdcc143..1cac9f5d8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -133,7 +133,7 @@ importers:
version: 3.0.3
better-auth:
specifier: 1.6.25
creem:
specifier: ^1.6.0
version: 1.6.0
@@ -432,7 +432,7 @@ importers:
version: 1.0.0
better-auth:
specifier: 1.6.25
class-variance-authority:
specifier: ^0.7.1
version: 0.7.1
@@ -609,9 +609,6 @@ importers:
specifier: ^19.2.8
version: 19.2.8([email protected])
devDependencies:
- '@react-email/preview-server':
- specifier: 5.2.10
'@react-email/render':
specifier: ^2.1.0
@@ -699,7 +696,7 @@ importers:
dependencies:
better-auth:
specifier: 1.6.25
devDependencies:
'@kaneo/typescript-config':
specifier: workspace:*
@@ -1963,43 +1960,21 @@ packages:
resolution: {integrity: sha512-VVPPgHyQ6ShqnrmDWuxjmUIsO9gWyOZFmuOfLd9LfBGQJwZfy0gvv9pbHSJuoFNIYC7ZDX9aoFwowjcdSC4E8w==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-rJJbIdJB/RQr2F1nylZr/PJzamvNNhfr3brdKP6s/GW850jbtR70QlSfFselvIBbcPUOlQwBakexjFzqLzF6pg==}
-
resolution: {integrity: sha512-o9r1S0BNiNreHP9Vs+Qnqd9kviDkJh8xIACY7UFZSmiGbbQRzPBBosvHzAU4TULHOIuOj/18RSsyz2qrREmIFw==}
- resolution: {integrity: sha512-b2wWIE8sABdyafc4IM8r5Y/dS6kD80JRtOGrUiKTsACFQfWWgUQ2NwoUX1yjFMXVsAwcQeNpnucF2ZrujsBBPg==}
- engines: {node: '>= 10'}
- cpu: [arm64]
- os: [darwin]
-
resolution: {integrity: sha512-55hpqq18bEVAlxedlTt3tFqZmKg2nUXT1kn1G/BGEy0R13h3LwtwHPVzzjG6P4LLeOHE32PFDQUVaJEWvBEZBw==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
- resolution: {integrity: sha512-zcnVaaZulS1WL0Ss38R5Q6D2gz7MtBu8GZLPfK+73D/hp4GFMrC2sudLky1QibfV7h6RJBJs/gOFvYP0X7UVlQ==}
- engines: {node: '>= 10'}
- cpu: [x64]
- os: [darwin]
-
resolution: {integrity: sha512-SOi96kSaF5T+0wW4koiM1bWzSPwjzTesC1p3df+FjdOi5LIQkBK/blxh7HdoKnNuI4PURF1OO7TZqtfnbWDSgw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
- resolution: {integrity: sha512-2ant89Lux/Q3VyC8vNVg7uBaFVP9SwoK2jJOOR0L8TQnX8CAYnh4uctAScy2Hwj2dgjVHqHLORQZJ2wH6VxhSQ==}
- engines: {node: '>= 10'}
- cpu: [arm64]
- os: [linux]
- libc: [glibc]
-
resolution: {integrity: sha512-P0gZAoPMF4dyTRzhmkV4PrqVzSOB6t4mC1oI3c4dqijJ+OVEVx5clIXAKR4/uQpsqw2KKM/0D5tVumcR2r5blg==}
engines: {node: '>= 10'}
@@ -2007,13 +1982,6 @@ packages:
os: [linux]
libc: [glibc]
- resolution: {integrity: sha512-uufcze7LYv0FQg9GnNeZ3/whYfo+1Q3HnQpm16o6Uyi0OVzLlk2ZWoY7j07KADZFY8qwDbsmFnMQP3p3+Ftprw==}
- engines: {node: '>= 10'}
- cpu: [arm64]
- os: [linux]
- libc: [musl]
-
resolution: {integrity: sha512-tXXGKJw0m37O0eKJARVTX/TheKPhz0QFVtVVZXmOig+9YKLQOSP6hvf2pxv5DO7CLEJyTHx3Pg043CDQkv1G4Q==}
engines: {node: '>= 10'}
@@ -2021,13 +1989,6 @@ packages:
os: [linux]
libc: [musl]
- resolution: {integrity: sha512-KWVf2gxYvHtvuT+c4MBOGxuse5TD7DsMFYSxVxRBnOzok/xryNeQSjXgxSv9QpIVlaGzEn/pIuI6Koosx8CGWA==}
- engines: {node: '>= 10'}
- cpu: [x64]
- os: [linux]
- libc: [glibc]
-
resolution: {integrity: sha512-pjGxK5EY7yWml78ALejFkWmgHsU7wbFQrISiugpH6FbUJhgEvw3xFZ/EBAtLl7QtL0WdQKiG9eWJ3mOKGTukHw==}
engines: {node: '>= 10'}
@@ -2035,13 +1996,6 @@ packages:
os: [linux]
libc: [glibc]
- resolution: {integrity: sha512-HguhaGwsGr1YAGs68uRKc4aGWxLET+NevJskOcCAwXbwj0fYX0RgZW2gsOCzr9S11CSQPIkxmoSbuVaBp4Z3dA==}
- engines: {node: '>= 10'}
- cpu: [x64]
- os: [linux]
- libc: [musl]
-
resolution: {integrity: sha512-sjo++Xx+lomlPs3HRsHWhVDyGG6ms1kGW5EtHLERdII8AyG1i+f6aq68xHREO6AEMlhjTNEWBSmfJfqm9orf7g==}
engines: {node: '>= 10'}
@@ -2049,24 +2003,12 @@ packages:
os: [linux]
libc: [musl]
- resolution: {integrity: sha512-S0n3KrDJokKTeFyM/vGGGR8+pCmXYrjNTk2ZozOL1C/JFdfUIL9O1ATaJOl5r2POe56iRChbsszrjMAdWSv7kQ==}
- engines: {node: '>= 10'}
- cpu: [arm64]
- os: [win32]
-
resolution: {integrity: sha512-C5JSgiO54wURdaxdEUIXqkz04uMqC9UmPX1gtDrV/5Tf1UowdWYI8uA5hfFbPolTlp0q4KZ60xlHePNibf0VIw==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
- resolution: {integrity: sha512-mwgtg8CNZGYm06LeEd+bNnOUfwOyNem/rOiP14Lsz+AnUY92Zq/LXwtebtUiaeVkhbroRCQ0c8GlR4UT1U+0yg==}
- engines: {node: '>= 10'}
- cpu: [x64]
- os: [win32]
-
resolution: {integrity: sha512-fDOggsweNb5SSw0ZKVk6U+gxSyGFFlIBY/LBc1r8GUj4u/6t6oArL+Pmkg0MBnsgR+KkdsURilVH4F3GXUGepA==}
engines: {node: '>= 10'}
@@ -3188,10 +3130,6 @@ packages:
peerDependencies:
react: ^18.0 || ^19.0 || ^19.0.0-rc
- '@react-email/[email protected]':
- resolution: {integrity: sha512-cYi21KF+Z/HGXT8RpkQMNFFubBafxyoB9Hn/wrslfDNtdoews2MdsDo6XXKkZvDTRG9SxQN3HGk4v4aoQZc20g==}
- deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
-
'@react-email/[email protected]':
resolution: {integrity: sha512-aYK8q0IPkBXyMsbpMXgxazwHxYJxTrXrV95GFuu2HbEiIToMwSyUgb8HDFYwPqqfV03/jbwqlsXmFxsOd+VNaw==}
engines: {node: '>=20.0.0'}
@@ -6826,27 +6764,6 @@ packages:
resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==}
engines: {node: '>= 0.6'}
- resolution: {integrity: sha512-WM0L7WrSvKwoLegLYr6V+mz+RIofqQgVAfHhMp9a88ms0cFX8iX9ew+snpWlSBwpkURJOUdvCEt3uLl3NNzvWg==}
- engines: {node: '>=20.9.0'}
- hasBin: true
- peerDependencies:
- '@opentelemetry/api': ^1.1.0
- '@playwright/test': ^1.51.1
- babel-plugin-react-compiler: '*'
- react: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0
- react-dom: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0
- sass: ^1.3.0
- peerDependenciesMeta:
- '@opentelemetry/api':
- optional: true
- '@playwright/test':
- optional: true
- babel-plugin-react-compiler:
- optional: true
- sass:
- optional: true
-
resolution: {integrity: sha512-NEdGOzH+08eTXMUp9UYkA99Nhi5N6Thrhc1jgFOQgfgnGK/dA2hRwBpXep+exdFQrnwlRf/3Wixyp8lLBUpE2A==}
engines: {node: '>=20.9.0'}
@@ -8770,7 +8687,7 @@ snapshots:
dependencies:
'@better-auth/utils': 0.4.2
better-call: 1.3.7([email protected])
zod: 4.4.3
@@ -8778,7 +8695,7 @@ snapshots:
dependencies:
'@better-auth/utils': 0.4.2
better-call: 1.3.7([email protected])
zod: 4.4.3
@@ -9524,55 +9441,29 @@ snapshots:
strict-event-emitter: 0.5.1
optional: true
- '@next/[email protected]': {}
-
'@next/[email protected]': {}
- optional: true
-
optional: true
- optional: true
-
optional: true
- optional: true
-
optional: true
- optional: true
-
optional: true
- optional: true
-
optional: true
- optional: true
-
optional: true
- optional: true
-
optional: true
- optional: true
-
optional: true
@@ -10781,21 +10672,6 @@ snapshots:
marked: 15.0.12
react: 19.2.8
- dependencies:
- esbuild: 0.28.1
- transitivePeerDependencies:
- - '@babel/core'
- - '@opentelemetry/api'
- - '@playwright/test'
- - '@types/node'
- - babel-plugin-macros
- - babel-plugin-react-compiler
- - react
- - react-dom
- - sass
-
dependencies:
react: 19.2.8
@@ -12255,7 +12131,7 @@ snapshots:
dependencies:
@@ -14218,33 +14094,6 @@ snapshots:
- dependencies:
- '@next/env': 16.1.7
- '@swc/helpers': 0.5.15
- baseline-browser-mapping: 2.11.12
- caniuse-lite: 1.0.30001806
- postcss: 8.5.25
- react: 19.2.8
- react-dom: 19.2.8([email protected])
- styled-jsx: 5.1.6(@babel/[email protected])([email protected])
- optionalDependencies:
- '@next/swc-darwin-arm64': 16.1.7
- '@next/swc-darwin-x64': 16.1.7
- '@next/swc-linux-arm64-gnu': 16.1.7
- '@next/swc-linux-arm64-musl': 16.1.7
- '@next/swc-linux-x64-gnu': 16.1.7
- '@next/swc-linux-x64-musl': 16.1.7
- '@next/swc-win32-arm64-msvc': 16.1.7
- '@next/swc-win32-x64-msvc': 16.1.7
- '@opentelemetry/api': 1.9.1
- babel-plugin-react-compiler: 1.0.0
- sharp: 0.35.3(@types/[email protected])
- transitivePeerDependencies:
- - '@babel/core'
- - '@types/node'
- - babel-plugin-macros
-
dependencies:
'@next/env': 16.3.0