@locusgraph/email 0.1.0 → 0.1.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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { EmailLayout } from "./kit/email-layout";
2
- export { EmailButton, EmailHeading, EmailLabel, EmailRows, EmailText } from "./kit/parts";
3
- export { type RenderedEmail, renderEmail } from "./render";
4
- export * from "./templates/invitation";
5
- export * from "./templates/low-credits";
6
- export * from "./templates/receipt";
7
- export * from "./templates/usage-over-plan";
1
+ export { EmailLayout } from "./kit/email-layout.js";
2
+ export { EmailButton, EmailHeading, EmailLabel, EmailRows, EmailText } from "./kit/parts.js";
3
+ export { type RenderedEmail, renderEmail } from "./render.js";
4
+ export * from "./templates/invitation.js";
5
+ export * from "./templates/low-credits.js";
6
+ export * from "./templates/receipt.js";
7
+ export * from "./templates/usage-over-plan.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export { EmailLayout } from "./kit/email-layout";
2
- export { EmailButton, EmailHeading, EmailLabel, EmailRows, EmailText } from "./kit/parts";
3
- export { renderEmail } from "./render";
4
- export * from "./templates/invitation";
5
- export * from "./templates/low-credits";
6
- export * from "./templates/receipt";
7
- export * from "./templates/usage-over-plan";
1
+ export { EmailLayout } from "./kit/email-layout.js";
2
+ export { EmailButton, EmailHeading, EmailLabel, EmailRows, EmailText } from "./kit/parts.js";
3
+ export { renderEmail } from "./render.js";
4
+ export * from "./templates/invitation.js";
5
+ export * from "./templates/low-credits.js";
6
+ export * from "./templates/receipt.js";
7
+ export * from "./templates/usage-over-plan.js";
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { contentWidth, emailColors, emailFonts } from "./theme";
2
+ import { contentWidth, emailColors, emailFonts } from "./theme.js";
3
3
  export function EmailLayout({ preview, children, footer }) {
4
4
  return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { httpEquiv: "Content-Type", content: "text/html; charset=UTF-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("meta", { name: "color-scheme", content: "light" })] }), _jsxs("body", { style: {
5
5
  margin: 0,
package/dist/kit/parts.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { emailColors, emailFonts } from "./theme";
2
+ import { emailColors, emailFonts } from "./theme.js";
3
3
  export function EmailLabel({ children }) {
4
4
  return (_jsx("p", { style: {
5
5
  margin: "0 0 8px",
package/dist/render.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { renderToStaticMarkup } from "react-dom/server";
2
2
  function plainText(html) {
3
3
  return html
4
- .replace(/<div style="display:none[^>]*>.*?<\/div>/s, "")
5
- .replace(/<a [^>]*href="([^"]+)"[^>]*>(.*?)<\/a>/gs, "$2: $1")
4
+ .replace(/<div style="display:none[^>]*>[\s\S]*?<\/div>/, "")
5
+ .replace(/<a [^>]*href="([^"]+)"[^>]*>([\s\S]*?)<\/a>/g, "$2: $1")
6
6
  .replace(/<\/(p|h1|tr|table)>/g, "\n")
7
7
  .replace(/<\/td>/g, " ")
8
8
  .replace(/<[^>]+>/g, "")
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { EmailLayout } from "../kit/email-layout";
3
- import { EmailButton, EmailHeading, EmailLabel, EmailText } from "../kit/parts";
4
- import { renderEmail } from "../render";
2
+ import { EmailLayout } from "../kit/email-layout.js";
3
+ import { EmailButton, EmailHeading, EmailLabel, EmailText } from "../kit/parts.js";
4
+ import { renderEmail } from "../render.js";
5
5
  export function InvitationEmail({ organizationName, inviterName, role, acceptUrl, expiresOn, }) {
6
6
  return (_jsxs(EmailLayout, { preview: `${inviterName} invited you to ${organizationName}`, footer: `The invitation expires on ${expiresOn}. If you did not expect it, ignore this email.`, children: [_jsx(EmailLabel, { children: "Invitation" }), _jsxs(EmailHeading, { children: ["Join ", organizationName, " on LocusGraph"] }), _jsxs(EmailText, { children: [inviterName, " invited you to ", organizationName, " as ", role, ". Sign in with Google or GitHub to accept."] }), _jsx(EmailButton, { href: acceptUrl, children: "Accept invitation" })] }));
7
7
  }
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { formatMicroUsd } from "@locusgraph/utils";
3
- import { EmailLayout } from "../kit/email-layout";
4
- import { EmailButton, EmailHeading, EmailLabel, EmailText } from "../kit/parts";
5
- import { renderEmail } from "../render";
3
+ import { EmailLayout } from "../kit/email-layout.js";
4
+ import { EmailButton, EmailHeading, EmailLabel, EmailText } from "../kit/parts.js";
5
+ import { renderEmail } from "../render.js";
6
6
  export function LowCreditsEmail({ organizationName, balanceMicroUsd, buyCreditsUrl, }) {
7
7
  const empty = balanceMicroUsd <= 0;
8
8
  return (_jsxs(EmailLayout, { preview: empty ? `${organizationName} is out of credits` : `${organizationName} is low on credits`, children: [_jsx(EmailLabel, { children: "Credits" }), _jsx(EmailHeading, { children: empty ? "Out of credits" : `${formatMicroUsd(balanceMicroUsd)} of credits left` }), _jsx(EmailText, { children: empty
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { formatCents } from "@locusgraph/utils";
3
- import { EmailLayout } from "../kit/email-layout";
4
- import { EmailButton, EmailHeading, EmailLabel, EmailRows, EmailText } from "../kit/parts";
5
- import { renderEmail } from "../render";
3
+ import { EmailLayout } from "../kit/email-layout.js";
4
+ import { EmailButton, EmailHeading, EmailLabel, EmailRows, EmailText } from "../kit/parts.js";
5
+ import { renderEmail } from "../render.js";
6
6
  export function ReceiptEmail({ organizationName, description, amountCents, paidOn, receiptUrl, }) {
7
7
  return (_jsxs(EmailLayout, { preview: `${formatCents(amountCents)} paid for ${organizationName}`, footer: "Stripe processed this payment. The receipt link shows the full invoice.", children: [_jsx(EmailLabel, { children: "Receipt" }), _jsxs(EmailHeading, { children: [formatCents(amountCents), " paid"] }), _jsxs(EmailText, { children: ["Thanks. Here is what ", organizationName, " paid for."] }), _jsx(EmailRows, { rows: [
8
8
  ["Item", description],
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { formatCount } from "@locusgraph/utils";
3
- import { EmailLayout } from "../kit/email-layout";
4
- import { EmailButton, EmailHeading, EmailLabel, EmailRows, EmailText } from "../kit/parts";
5
- import { renderEmail } from "../render";
3
+ import { EmailLayout } from "../kit/email-layout.js";
4
+ import { EmailButton, EmailHeading, EmailLabel, EmailRows, EmailText } from "../kit/parts.js";
5
+ import { renderEmail } from "../render.js";
6
6
  export function UsageOverPlanEmail({ organizationName, quotas, usageUrl, }) {
7
7
  return (_jsxs(EmailLayout, { preview: `${organizationName} is over its plan`, children: [_jsx(EmailLabel, { children: "Usage" }), _jsx(EmailHeading, { children: "Usage is over your plan" }), _jsxs(EmailText, { children: [organizationName, " used more than its plan includes. Usage past the plan comes from prepaid credits, or stops when overage is off."] }), _jsx(EmailRows, { rows: quotas.map((quota) => [
8
8
  quota.key,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusgraph/email",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "LocusGraph transactional emails as React templates with inline styles: invitation, receipt, low credits and usage over plan.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -30,8 +30,8 @@
30
30
  "react-dom": "^19.2.0"
31
31
  },
32
32
  "dependencies": {
33
- "@locusgraph/tokens": "0.1.0",
34
- "@locusgraph/utils": "0.1.0"
33
+ "@locusgraph/tokens": "0.1.1",
34
+ "@locusgraph/utils": "0.1.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@locusgraph/config": "0.1.0",
@@ -44,7 +44,7 @@
44
44
  "vitest": "^5.0.3"
45
45
  },
46
46
  "scripts": {
47
- "build": "rm -rf dist && tsc -p tsconfig.build.json",
47
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && node ../../scripts/esm-extensions.mjs dist",
48
48
  "typecheck": "tsc -p tsconfig.json --noEmit",
49
49
  "test": "vitest run"
50
50
  }