Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.
TypeScript fintechinvoiceinvoice-generatorinvoice-pdfinvoice-templateinvoicesnextjsopen-sourcequotesreactreact-pdf-rendererself-hostedshadcn-uitailwindcsstypescript
feat: locale number format, brasilian portugese support, etc (#271)
Vlad Sazonau47c1a0f5b6cd
diff --git a/.agents/skills/unslop/SKILL.md b/.agents/skills/unslop/SKILL.mdnew file mode 100644index 0000000..edba5a3--- /dev/null+++ b/.agents/skills/unslop/SKILL.md@@ -0,0 +1,68 @@+---+name: unslop+description: Cut AI tells from any writing. Must always apply.+disable-model-invocation: true+---++# Unslop++Edit text to remove AI patterns.++## Process++1. Scan for the patterns below.+2. Rewrite. Preserve meaning, match intended tone.+3. Self-audit: "What makes this obviously AI generated?" Fix remaining tells.++## Patterns to detect and fix++Rule numbers are stable ids that other skills cite. A removed rule leaves a gap.++### Content++3. **Superficial -ing phrases.** "highlighting...", "ensuring...", "reflecting...", "showcasing...", "fostering...". Delete or expand with real sources.+4. **Vague attributions.** "Experts believe", "Industry reports suggest", "Some critics argue". Name the source or delete.++### Language++7. **AI vocabulary.** Additionally, crucial, delve, enduring, enhance, fostering, garner, interplay, intricate, landscape (abstract), pivotal, showcase, tapestry (abstract), testament, underscore, vibrant. Replace with plain words.+8. **Fancy ways to say "is".** "serves as", "stands as", "boasts", "features". Just say "is" or "has".+9. **"Not just X, but Y."** State the point directly instead.+10. **Rule of three.** Forcing ideas into groups of three. Use the natural number.+11. **Synonym cycling.** Protagonist, main character, central figure, hero all in one paragraph. Pick one, repeat it.+12. **False ranges.** "from X to Y" where X and Y aren't on a meaningful scale. List topics directly.++### Style++13. **Em dash overuse.** Avoid em dashes entirely. Use periods or commas only (no parentheses, no en dashes, no hyphen-as-dash substitutes). If a thought needs separation, end the sentence or use a comma.+14. **Colon overuse.** Colons are fine before a list or example. Not as mid-sentence connectors. "If you're coming from traditional automation: instead of registering event handlers, you describe conditions" adds nothing with the colon. Rewrite to let the point stand on its own without comparison framing. "Describing when the scheduler should fire works best as plain English." Same meaning, no crutch punctuation.+15. **Boldface overuse.** Don't bold every proper noun or acronym.+16. **Inline-header lists.** The tell is a bold label and colon that restates the line: "**Performance:** Performance improved...". Convert those to prose. A bold lead-in that ends in a period, names the item, and is followed by genuinely new detail ("**Schema in TypeScript.** Tables live in one file.") is fine, not a tell.+17. **Title case headings.** Use sentence case.+18. **Decorative emojis.** Remove from headings and bullets.+19. **Curly quotes.** Replace with straight quotes.++### Communication artifacts++20. **Chatbot phrases.** "I hope this helps!", "Let me know if...", "Of course!", "Certainly!", "Found the smoking gun!" Remove.+21. **Sycophantic tone.** "Great question! You're absolutely right!" Respond directly.++### Filler++23. **Filler phrases.** "In order to" becomes "To". "Due to the fact that" becomes "Because". "It is important to note that" gets deleted.+24. **Excessive hedging.** "could potentially possibly be argued that it might" becomes "may".+25. **Generic conclusions.** "The future looks bright." State specific plans or facts.++### Jargon++26. **Abstract metaphor nouns.** Substrate, wedge, vector, locus, vantage, nexus, primitive (as noun), harness (as metaphor), surface (as in "API surface"), bedrock, scaffolding (as metaphor), modality, paradigm, gold-plating, ratchet (as metaphor), evacuate (for moving code), endgame, north star, flywheel. These read as technical but usually have a plainer concrete word. "Substrate" becomes "base". "Wedge in" becomes "add". "Vector" becomes "way" or "method". "Gold-plating" becomes "more than the job needs". "Ratchet" becomes the mechanism's real name or "a limit that only tightens". "Evacuate" becomes "move out". "Endgame" becomes "the last phase". Pick the concrete word.++### Plain speech++27. **Say what it does, not how it feels.** "the database stays close at hand", "SQL you can read", "types that follow your schema" name a feeling. The fix names the mechanism or a number: "`.toSQL()` returns the exact string sent to the database", "a column rename fails the build". Ask what the sentence tells the reader to do or know, then write that. If you can't restate it as a concrete instruction, fact, or number, cut it. One more check: if the sentence could appear unchanged in another project's docs, it says nothing about this one. Cut it.+28. **Shorten or split dense sentences.** If the reader has to backtrack to parse a sentence, break it in two or drop clauses. One idea per sentence.+29. **Active voice.** Prefer it. Catch "is/are/was/were + past participle" and name the actor: "queries are validated" becomes "the compiler validates queries", "the file is parsed by the loader" becomes "the loader parses the file". Passive is fine only when the actor is unknown or genuinely doesn't matter.+30. **Cut adverbs, or use a stronger verb.** "runs quickly" becomes "is fast" or the number. "significantly improves" becomes the measured delta. An adverb propping up a weak verb means the verb is wrong.+31. **Prefer the plain word.** "utilize" becomes "use", "leverage" becomes "use", "facilitate" becomes "help", "numerous" becomes "many", "in the event that" becomes "if". The fancier synonym is rarely clearer.+32. **Mannered prose.** Metaphor or flourish where a literal phrase exists: aphorisms ("wire it or delete it"), rhetorical fragments for effect, personified code ("the plan holds it"), figurative verbs ("rides along", "stands on"), stock framing phrases. "A dial worth turning" becomes "a parameter worth varying". Say what you mean. Rule 26 covers the metaphor nouns.+33. **Over-compression.** Dropped articles, verbless fragments, symbol-speak, and abbreviations that make the reader decode instead of read. "Parser rejects bad date → exit 2, no write" becomes "The parser rejects a bad date, exits with code 2, and writes nothing." Write whole sentences with their articles and verbs, and spell out arrows and abbreviations.diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 87a39d3..eae43f8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,57 @@# Changelog+## [1.0.5] - 2026-09-24++### Added++- Number Format setting: choose how amounts are grouped and punctuated in the PDF, independently of the invoice language, including a locale-neutral **International** format (`321 200.00`). Each option previews the invoice's own total in the selected template's style+- "Keep format when language changes" switch, which pins the number format across language switches+- Brazilian Portuguese (`pt-BR`) as a PDF language, with `CNPJ/CPF` and `Imposto` labels and amounts in words on the short scale (`um bilhão`). The site itself stays translated into European Portuguese only: invoice PDF languages (`SUPPORTED_INVOICE_PDF_LANGUAGES`) and site locales (`SUPPORTED_I18N_LOCALES`) are now separate lists+- `WrappableAmount` PDF component: amounts too wide for their cell wrap at a thousands boundary instead of overflowing into the next column, in both templates+- "How to customize tax" video in the "How it works" guide++### Changed++- The default template now punctuates amounts in the invoice language by default (`321,200.00` in English, `321.200,00` in German) instead of always printing `321 200.00`. This includes invoices saved or shared before this release, which may re-download with different punctuation; picking **International** restores the old output+- Four-digit amounts are grouped in Polish, Spanish and Italian (`8 111,00` rather than `8111,00`), via `useGrouping: "always"`+- The default template's footer writes the total like the rest of the invoice, with the ISO currency code rather than a localized symbol+- Language pickers name the region for Portuguese: "Portuguese (Portugal)" and "Portuguese (Brazil)"+- Clearer Stripe-template "due" and "amount due" wording in German, Spanish, French, Italian and Portuguese+- Wider quantity column in the Stripe template, so four- and five-digit quantities stay on one line+- Seller and buyer visibility switches are now named by their visible labels instead of separate `aria-label`s++### Fixed++- French amounts in the default template's footer printed `/` in place of the thousands separator (`321/200,00 €`): U+202F is now mapped to a no-break space the PDF fonts cover+- The amount in words no longer leaves `00/100` alone on the next line+- Hydration mismatch on the footer copyright year when the build year and the visitor's year differ++## [1.0.4] - 2026-09-04++### Added++- Redesigned mobile tabs: a pill-shaped track with a single indicator that slides between the invoice form and the preview+- Service period fields in the invoice form+- Terms of Service and founder pages, SEO landing pages, and Markdown versions of key pages+- Welcome popup and a changelog update popup+- Monthly recurring invoice as a Trigger.dev scheduled task++### Changed++- The invoice PDF is rendered once and shared by the desktop preview, the mobile viewer and the download button, removing flicker and duplicate renders+- Dates in the form's helper texts and the out-of-date banner use the invoice's own language and date format, matching the PDF+- The out-of-date dates banner also detects a stale month in the invoice number+- Upgraded to Next.js 15, React 19 and Sentry 10+- Switched linting and formatting to oxlint and oxfmt, and expanded unit and end-to-end test coverage+- Hardened GitHub Actions workflows with zizmor static analysis++### Fixed++- PDFs intermittently dropped the first one or two characters of labels (for example `Fatura` → `atura`) after switching template and language in quick succession+- Text typed just before switching mobile tabs was lost; both panels now stay mounted once opened+- The app crashed in iOS in-app webviews that expose `localStorage` as `null`, and in Safari with "Block all cookies" enabled+- The preview rendered the PDF twice when switching between the default and Stripe templates+## [1.0.3] - 2026-03-29### Added@@ -100,6 +152,8 @@- Invoice numbering, dating, and payment terms- No sign-up required — fully browser-based with no server-side data storage+[1.0.5]: https://github.com/VladSez/easy-invoice-pdf/compare/v1.0.4...v1.0.5+[1.0.4]: https://github.com/VladSez/easy-invoice-pdf/compare/v1.0.3...v1.0.4[1.0.3]: https://github.com/VladSez/easy-invoice-pdf/compare/v1.0.2...v1.0.3[1.0.2]: https://github.com/VladSez/easy-invoice-pdf/compare/EasyInvoicePDF-1.0.1...v1.0.2[1.0.1]: https://github.com/VladSez/easy-invoice-pdf/compare/EasyInvoicePDF-v1.0.0...EasyInvoicePDF-1.0.1diff --git a/CLAUDE.md b/CLAUDE.mdindex 2164a99..f80f2c6 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -81,7 +81,7 @@ Two templates under `src/app/(main)/(app)/components/invoice-templates/`: `invoi### i18n — two separate systems-- **UI/marketing copy**: `next-intl`, messages in `messages/*.json`, locale-prefixed routes under `src/app/[locale]/` (`src/proxy.ts`, the Next 16 `proxy` convention, matches only those). The locale matcher is a static literal — keep it in sync with `SUPPORTED_LANGUAGES`.+- **UI/marketing copy**: `next-intl`, messages in `messages/*.json`, locale-prefixed routes under `src/app/[locale]/` (`src/proxy.ts`, the Next 16 `proxy` convention, matches only those). The locale matcher is a static literal — keep it in sync with `SUPPORTED_I18N_LOCALES` (the languages the site is translated into, a subset of `SUPPORTED_INVOICE_PDF_LANGUAGES`, which is the PDF's own list).- **PDF content**: a hand-rolled catalog, `src/app/(main)/(app)/pdf-i18n-translations/pdf-translations.ts`, validated against `pdf-translations-schema.ts`. Some entries are functions (e.g. `vatAmount({ customTaxLabel })`) so tax labels can be customized per invoice.`next.config.mjs` validates both — every `messages/*.json` against `src/app/schema/i18n-schema.ts` and the PDF catalog against its schema — and `process.exit(1)`s on failure, so a missing translation key breaks `dev` and `build`.diff --git a/README.md b/README.mdindex 395e177..21ee821 100644--- a/README.md+++ b/README.md@@ -4,25 +4,27 @@<img src="https://github.com/user-attachments/assets/cb9bcc91-b4c8-40b1-b406-bc606c5d9315" alt="EasyInvoicePDF Logo" width="80" height="80"></a><h1>EasyInvoicePDF</h1>- <h3>Free & Open-Source Invoice Generator</h3>- <p>Create professional invoices instantly in your browser with <strong>Live Preview</strong>, <strong>Instant PDF Export</strong>, <strong>Multiple Customizable Templates</strong> (including a Stripe-style design). <strong>No Ads</strong>. <strong>No Sign-Up Required</strong>.</p>- <p><a href="https://easyinvoicepdf.com"><strong>Start Invoicing</strong></a></p>+ <h3>Free and Open-Source Invoice Generator</h3>+ <p>Create professional invoices instantly. No account. No ads. No limits. Your data stays yours.</p>+ <p>Live PDF preview · Stripe-style template · 10+ languages · 120+ currencies · Saved seller & buyer profiles</p><p>- <a href="https://easyinvoicepdf.com/en/about?ref=github">About us</a>- ·- <a href="https://github.com/VladSez/easy-invoice-pdf/releases">Releases</a>- </p>--<strong>⭐ Like the project? <a href="https://github.com/VladSez/easy-invoice-pdf" title="Star EasyInvoicePDF on GitHub - free & open-source invoice generator">Star it on GitHub</a></strong>+ <a href="https://easyinvoicepdf.com/?ref=github"><strong>Start Invoicing</strong></a>+ ·+ <a href="https://easyinvoicepdf.com/how-it-works?ref=github">How it works</a>+ ·+ <a href="https://easyinvoicepdf.com/en/about?ref=github">About</a>+ </p><p align="center" style="margin-top: 20px;"><a href="https://vladsazon.com">- <img src="https://github.com/user-attachments/assets/b3506dec-4b50-48c3-8938-94203f5a2d37" width="60" height="60" alt="Software Engineer and founder of EasyInvoicePDF" title="Vlad Sazonau - Software Engineer and founder of EasyInvoicePDF"/>+ <img src="https://github.com/user-attachments/assets/b3506dec-4b50-48c3-8938-94203f5a2d37" width="60" height="60" alt="Product Engineer and founder of EasyInvoicePDF" title="Vlad Sazonau - Product Engineer and founder of EasyInvoicePDF"/></a><br />- Made by <a href="https://vladsazon.com" title="Software Engineer and founder of EasyInvoicePDF"><strong>Vlad Sazonau</strong></a> - a software engineer and design enthusiast+ Made by <a href="https://vladsazon.com" title="Product Engineer and founder of EasyInvoicePDF"><strong>Vlad Sazonau</strong></a> - a product engineer and design enthusiast</p>+<strong>⭐ Like the project? <a href="https://github.com/VladSez/easy-invoice-pdf" title="Star EasyInvoicePDF on GitHub - free and open-source invoice generator">Star it on GitHub</a></strong>+</div><a href="https://easyinvoicepdf.com/?template=stripe">@@ -38,16 +40,16 @@## ✨ Feature Highlights-- 📺 **Instant PDF generation** with live preview-- 🚀 **No sign-up required** - start immediately-- 🎉 **Ad-free experience**-- 👤 **Save Seller & Buyer Profiles** - reuse seller & buyer details for future invoices-- 🎨 **Multiple fully customizable templates** including modern Stripe-style design-- 🧾 **Smart invoicing tools** - VAT, GST, sales tax & custom tax support with automatic calculations-- 🏷️ **Logo support** for custom branding+- 🔒 **Privacy-first** - invoices are created and stored in your browser by default+- 📄 **Live PDF preview** - see every change as you type, download in one click+- 🎨 **Two templates** - classic and Stripe-style, with logo support+- 🧾 **Flexible taxes** - VAT, GST, sales tax or your own label, calculated automatically+- 👤 **Saved seller & buyer profiles** - reuse details across invoices+- 🔗 **Shareable links** - send an invoice as a link, no attachment needed+- 🏞️ **Payment QR codes** and automatic multi-page layout for long invoices+- 🌍 **10+ languages, 120+ currencies**- 📱 **Mobile-friendly** - works on any device-- 🌍 **Multi-language & multi-currency** (10+ languages, 120+ currencies)-- 🔒 **Privacy-first** - browser-only, no server uploads+- 🚀 **Free, no sign-up, no ads**<h4>Learn more about <a href="https://easyinvoicepdf.com/en/about#features">features</a>.</h4>@@ -81,7 +83,7 @@ _**One-click PDF download** ready for printing or sending_<img src="https://github.com/user-attachments/assets/719f74a1-9be0-4b95-a8c1-a2749246aff3" width="800" alt="Language & Currency Demo">-_**Switch between 10 languages and 120+ currencies instantly** with live PDF preview updates_+_**Switch between 10+ languages and 120+ currencies instantly** with live PDF preview updates_---diff --git a/e2e/about.test.ts b/e2e/about.test.tsindex 48595da..564281f 100644--- a/e2e/about.test.ts+++ b/e2e/about.test.ts@@ -3,7 +3,7 @@import { expect, test } from "@playwright/test";-import { LANGUAGE_TO_NATIVE_LABEL, SUPPORTED_LANGUAGES } from "@/app/schema";+import { LANGUAGE_TO_NATIVE_LABEL, SUPPORTED_I18N_LOCALES } from "@/app/schema";import { GITHUB_URL, TWITTER_URL, VIDEO_DEMO_FALLBACK_IMG } from "@/config";test.describe("About page", () => {@@ -108,7 +108,7 @@ test.describe("About page", () => {await expect(heroSection.getByText(- "EasyInvoicePDF is a free, open-source invoice generator with real-time preview. Create, customize, and download professional invoices. No sign-up required.",+ "A free, open-source invoice generator that runs entirely in your browser. No sign-up, no ads, and your data stays yours.",),).toBeVisible();@@ -300,7 +300,7 @@ test.describe("About page", () => {await expect(heroSection.getByText(- "EasyInvoicePDF est un outil gratuit et open-source qui vous permet de créer, personnaliser et télécharger des factures professionnelles avec aperçu en temps réel. Fonctionne entièrement dans votre navigateur.",+ "Un générateur de factures gratuit et open-source qui fonctionne entièrement dans votre navigateur. Sans inscription, sans publicité, et vos données restent les vôtres.",),).toBeVisible();@@ -388,7 +388,7 @@ test.describe("About page", () => {await expect(heroSection.getByText(- "EasyInvoicePDF ist ein kostenloses Open-Source-Tool, mit dem Sie professionelle Rechnungen mit Echtzeit-Vorschau erstellen, anpassen und herunterladen können.",+ "Ein kostenloser Open-Source-Rechnungsgenerator, der vollständig in Ihrem Browser läuft.",),).toBeVisible();@@ -467,7 +467,7 @@ test.describe("About page", () => {}),).toBeVisible();- for (const lang of SUPPORTED_LANGUAGES) {+ for (const lang of SUPPORTED_I18N_LOCALES) {const link = footerAboutLinks.getByRole("link", {name: LANGUAGE_TO_NATIVE_LABEL[lang],exact: true,diff --git a/e2e/default-invoice-template/default-invoice-template.test.ts b/e2e/default-invoice-template/default-invoice-template.test.tsindex aa074b1..5d21f5a 100644--- a/e2e/default-invoice-template/default-invoice-template.test.ts+++ b/e2e/default-invoice-template/default-invoice-template.test.ts@@ -618,7 +618,7 @@ test.describe("Default Invoice Template", () => {await expect(page.getByRole("button", {- name: `Reset to default ("Fatura N°:")`,+ name: `Reset to default ("${INVOICE_PDF_TRANSLATIONS.pt.invoiceNumber}:")`,}),).toBeVisible();diff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/completes-full-invoice-flow-on-mobile-Mobile-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/completes-full-invoice-flow-on-mobile-Mobile-Chrome-darwin.pngindex ea43dae..50b3483 100644Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/completes-full-invoice-flow-on-mobile-Mobile-Chrome-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/completes-full-invoice-flow-on-mobile-Mobile-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/completes-full-invoice-flow-on-mobile-Mobile-Safari-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/completes-full-invoice-flow-on-mobile-Mobile-Safari-darwin.pngindex b251114..468849b 100644Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/completes-full-invoice-flow-on-mobile-Mobile-Safari-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/completes-full-invoice-flow-on-mobile-Mobile-Safari-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/date-of-sales-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/date-of-sales-hidden-in-pdf-default-template-Desktop-Chrome-darwin.pngindex e82a10e..87e8c09 100644Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/date-of-sales-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/date-of-sales-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/date-of-sales-visible-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/date-of-sales-visible-in-pdf-default-template-Desktop-Chrome-darwin.pngindex 59b3128..cd8f85e 100644Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/date-of-sales-visible-in-pdf-default-template-Desktop-Chrome-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/date-of-sales-visible-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/downloads-PDF-in-English-Desktop-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/downloads-PDF-in-English-Desktop-Chrome-darwin.pngindex f81bc4c..7ee6799 100644Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/downloads-PDF-in-English-Desktop-Chrome-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/downloads-PDF-in-English-Desktop-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/downloads-PDF-in-Polish-Desktop-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/downloads-PDF-in-Polish-Desktop-Chrome-darwin.pngindex b90b445..6dec394 100644Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/downloads-PDF-in-Polish-Desktop-Chrome-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/downloads-PDF-in-Polish-Desktop-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/pdf-with-logo-default-template-Desktop-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/pdf-with-logo-default-template-Desktop-Chrome-darwin.pngindex c73791b..4611758 100644Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/pdf-with-logo-default-template-Desktop-Chrome-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/pdf-with-logo-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/pdf-with-logo-stripe-template-after-switch-Desktop-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/pdf-with-logo-stripe-template-after-switch-Desktop-Chrome-darwin.pngindex e07c78d..c291b58 100644Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/pdf-with-logo-stripe-template-after-switch-Desktop-Chrome-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/pdf-with-logo-stripe-template-after-switch-Desktop-Chrome-darwin.png differdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/update-pdf-when-invoice-data-changes-Desktop-Chrome-darwin.png b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/update-pdf-when-invoice-data-changes-Desktop-Chrome-darwin.pngindex f301f2c..a95f4e2 100644Binary files a/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/update-pdf-when-invoice-data-changes-Desktop-Chrome-darwin.png and b/e2e/default-invoice-template/default-invoice-template.test.ts-snapshots/update-pdf-when-invoice-data-changes-Desktop-Chrome-darwin.png differdiff --git a/e2e/how-it-works.test.ts b/e2e/how-it-works.test.tsindex bc257d2..8bb4ec3 100644--- a/e2e/how-it-works.test.ts+++ b/e2e/how-it-works.test.ts@@ -38,7 +38,7 @@ test.describe("How it works page", () => {await expect(page.getByText(- "Learn how to create, customize, download, and share professional PDF invoices online with EasyInvoicePDF. These step-by-step videos show you how to use our free invoice generator, save seller and buyer details, add branding, and prepare weekly invoices. Whether you need an invoice maker for a one-off bill or a small business invoice template you can reuse, you can start in seconds.",+ "Learn how to create, customize, download, and share professional PDF invoices online with EasyInvoicePDF. These step-by-step videos show you how to use our free invoice generator, save seller and buyer details, add branding, set up VAT or your own tax label, and prepare weekly invoices. Whether you need an invoice maker for a one-off bill or a small business invoice template you can reuse, you can start in seconds.",),).toBeVisible();diff --git a/e2e/invoice-form.test.ts b/e2e/invoice-form.test.tsindex 36b7f89..d86ff26 100644--- a/e2e/invoice-form.test.ts+++ b/e2e/invoice-form.test.ts@@ -8,11 +8,11 @@ import {CURRENCY_TO_LABEL,DEFAULT_DATE_FORMAT,getDateFormatsForLanguage,- LANGUAGE_TO_LABEL,+ LANGUAGE_TO_LABEL_WITH_REGION,PDF_DATA_LOCAL_STORAGE_KEY,SUPPORTED_CURRENCIES,SUPPORTED_DATE_FORMATS,- SUPPORTED_LANGUAGES,+ SUPPORTED_INVOICE_PDF_LANGUAGES,type AccordionState,type InvoiceData,} from "@/app/schema";@@ -384,8 +384,8 @@ test.describe("Invoice Generator Page", () => {await expect(languageSelect).toHaveValue(INITIAL_INVOICE_DATA.language);// Verify all supported languages are available as options with correct labels- for (const lang of SUPPORTED_LANGUAGES) {- const languageName = LANGUAGE_TO_LABEL[lang];+ for (const lang of SUPPORTED_INVOICE_PDF_LANGUAGES) {+ const languageName = LANGUAGE_TO_LABEL_WITH_REGION[lang];await expect(languageSelect.locator(`option[value="${lang}"]`),diff --git a/e2e/invoice-templates-common/shared-template-features.test.ts b/e2e/invoice-templates-common/shared-template-features.test.tsindex a05a6b5..7771b93 100644--- a/e2e/invoice-templates-common/shared-template-features.test.ts+++ b/e2e/invoice-templates-common/shared-template-features.test.ts@@ -193,6 +193,67 @@ const SERVICE_PERIOD_TITLE =const MULTI_PAGE_TITLE = "generates multi-page PDF when invoice has many items";const EMAIL_VISIBILITY_TITLE ="toggles seller and buyer email visibility in PDF";+const LARGE_AMOUNTS_TITLE =+ "wraps large amounts inside their column in the PDF";+const LARGE_QUANTITY_TITLE =+ "wraps large amounts multiplied by a quantity in the PDF";++/**+ * One billion, which is fifteen characters wide once it is grouped and given its decimals --+ * more than any money column in either template can hold on one line.+ */+const LARGE_NET_PRICE = "1000000000";++/** A rate, so the tax and total columns carry large numbers of their own rather than zeroes. */+const LARGE_AMOUNTS_TAX_RATE = "20";++/**+ * A quantity small enough to keep the money columns the subject of the screenshot, but not+ * `1`: billed at one of itself the net price and the net amount print the same number, and a+ * column that quietly took its neighbour's value would still look right.+ */+const SMALL_QUANTITY = "2";++/**+ * Ten thousand of them, which takes the net amount to ten trillion and the pre-tax total to+ * twelve -- two thousands groups more than the money columns were drawn for, and the widest+ * thing either template ever has to print.+ *+ * Five figures also puts a thousands separator in the quantity column itself. That is the+ * narrowest column in either template -- the Stripe one draws it at 42.7pt against the 36pt+ * `10,000` needs -- so it is the one place a grouped number has ever been at risk of being+ * split in half.+ */+const LARGE_QUANTITY = "10000";++interface FillLargeFirstItemArgs {+ /** The "Invoice items" section of the form. */+ invoiceItemsSection: Locator;+ /** How many of the item to bill for. */+ quantity: string;+}++/**+ * Bills the first item at {@link LARGE_NET_PRICE}, so that every money column in both+ * templates has to print a number too wide to sit on one line.+ */+async function fillLargeFirstItem({+ invoiceItemsSection,+ quantity,+}: FillLargeFirstItemArgs) {+ await invoiceItemsSection+ .getByRole("spinbutton", { name: "Amount (Quantity)" })+ .fill(quantity);++ await invoiceItemsSection+ .getByRole("spinbutton", { name: "Net Price (Rate or Unit Price)" })+ .fill(LARGE_NET_PRICE);++ await invoiceItemsSection+ .getByRole("group", { name: "Tax Settings" })+ .getByRole("textbox", { name: "VAT Rate", exact: true })+ .fill(LARGE_AMOUNTS_TAX_RATE);+}test.describe("Invoice Template shared features", () => {test.beforeEach(async ({ page }) => {@@ -609,7 +670,7 @@ test.describe("Invoice Template shared features", () => {const sellerEmailSwitchInDialog = manageSellerDialog.getByRole("switch",{- name: "Show the 'Email' field in the PDF",+ name: "Show Seller Email in PDF",},);await expect(sellerEmailSwitchInDialog).toBeVisible();@@ -648,7 +709,7 @@ test.describe("Invoice Template shared features", () => {// Verify email visibility switch is checked by default in dialogconst buyerEmailSwitchInDialog = manageBuyerDialog.getByRole("switch", {- name: "Show the 'Email' field in the PDF",+ name: "Show Buyer Email in PDF",});await expect(buyerEmailSwitchInDialog).toBeVisible();await expect(buyerEmailSwitchInDialog).toBeChecked();@@ -673,5 +734,97 @@ test.describe("Invoice Template shared features", () => {notes: `Test: ${EMAIL_VISIBILITY_TITLE} - emails visible (${testInfo.project.name})`,});});++ /**+ * A number is one unbreakable word, so a column too narrow for `1,000,000,000.00` used to+ * paint it over the column next to it -- and, in the last column of the default+ * template's items table, out past the table's own border. `WrappableAmount` breaks the+ * amount at a thousands boundary instead, and these are the screenshots of it doing so.+ *+ * Both grouping characters are worth a picture, because they fail differently: a comma+ * offers react-pdf no break at all, and `international`'s no-break space offers one it is+ * forbidden to take.+ */+ test(`${LARGE_AMOUNTS_TITLE} (${template} template)`, async ({+ page,+ browserName,+ downloadDir,+ }, testInfo) => {+ await selectTemplate(page, template);++ await fillLargeFirstItem({+ invoiceItemsSection: page.getByTestId("invoice-items-section"),+ quantity: SMALL_QUANTITY,+ });++ await expectPdfScreenshot(page, {+ downloadDir,+ browserName,+ name: `large-amounts-in-pdf-${template}-template.png`,+ notes: `Test: ${LARGE_AMOUNTS_TITLE} (${testInfo.project.name})`,+ });++ /**+ * THE SAME INVOICE GROUPED WITH A NO-BREAK SPACE INSTEAD OF A COMMA+ */++ // the screenshot leaves the app on about:blank; the invoice comes back from localStorage+ await page.goto("/");+ await expect(page).toHaveURL(`/?template=${template}`);++ const numberFormatSelect = page+ .getByRole("group", { name: "Number Format" })+ .getByRole("combobox", { name: "Format" });++ await waitForPdfRegeneration(page, async () => {+ await numberFormatSelect.selectOption("international");+ });++ await expect(numberFormatSelect).toHaveValue("international");++ await expectPdfScreenshot(page, {+ downloadDir,+ browserName,+ filePrefix: "international-",+ name: `large-amounts-international-format-in-pdf-${template}-template.png`,+ notes: `Test: ${LARGE_AMOUNTS_TITLE} - international number format (${testInfo.project.name})`,+ });+ });++ /**+ * The same billion, billed ten thousand times over. It is the widest thing either+ * template ever has to print -- the net amount reaches ten trillion and the pre-tax total+ * twelve -- so it is where an amount wraps onto a second line even in the columns that+ * hold a single billion comfortably.+ *+ * A five-figure quantity is also the only thing that puts a thousands separator in the+ * quantity column, which is the narrowest column either template has and the one place a+ * grouped number has ever been at risk of being split in half.+ *+ * Only the default grouping is worth a picture here; the sibling test above is the one+ * that covers what changes when the separator does.+ */+ test(`${LARGE_QUANTITY_TITLE} (${template} template)`, async ({+ page,+ browserName,+ downloadDir,+ }, testInfo) => {+ await selectTemplate(page, template);++ await fillLargeFirstItem({+ invoiceItemsSection: page.getByTestId("invoice-items-section"),+ quantity: LARGE_QUANTITY,+ });++ const { numPages } = await expectPdfScreenshot(page, {+ downloadDir,+ browserName,+ name: `large-amounts-with-quantity-in-pdf-${template}-template.png`,+ notes: `Test: ${LARGE_QUANTITY_TITLE} (${testInfo.project.name})`,+ });++ // one item, however wide its amounts, still belongs on a single page+ expect(numPages).toBe(1);+ });}});diff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/default-template-multi-pages-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/default-template-multi-pages-Desktop-Chrome-darwin.pngindex 7521cab..408d878 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/default-template-multi-pages-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/default-template-multi-pages-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Desktop-Chrome-darwin.pngindex b17dde3..0314114 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-qr-code-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Desktop-Chrome-darwin.pngindex f6aa5aa..4a34f64 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-qr-code-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-service-period-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-service-period-in-pdf-default-template-Desktop-Chrome-darwin.pngindex df779c8..3ccd026 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-service-period-in-pdf-default-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-service-period-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-service-period-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-service-period-in-pdf-stripe-template-Desktop-Chrome-darwin.pngindex df0f59b..16414b4 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-service-period-in-pdf-stripe-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/displays-service-period-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-hidden-in-pdf-default-template-Desktop-Chrome-darwin.pngindex cac9762..049e11b 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.pngindex a94e310..feb623f 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-visible-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-visible-in-pdf-default-template-Desktop-Chrome-darwin.pngindex 3ae95d2..d601482 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-visible-in-pdf-default-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-visible-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-visible-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-visible-in-pdf-stripe-template-Desktop-Chrome-darwin.pngindex 4dbb2a4..8c0d0be 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-visible-in-pdf-stripe-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/email-visible-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-in-pdf-default-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..5553a93Binary files /dev/null and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-in-pdf-stripe-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..f25245dBinary files /dev/null and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-international-format-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-international-format-in-pdf-default-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..4412fabBinary files /dev/null and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-international-format-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-international-format-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-international-format-in-pdf-stripe-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..58e0f8dBinary files /dev/null and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-international-format-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-with-quantity-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-with-quantity-in-pdf-default-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..42f2da4Binary files /dev/null and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-with-quantity-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-with-quantity-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-with-quantity-in-pdf-stripe-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..25a8974Binary files /dev/null and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/large-amounts-with-quantity-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/qr-code-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/qr-code-hidden-in-pdf-default-template-Desktop-Chrome-darwin.pngindex 1d27d2e..463abf5 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/qr-code-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/qr-code-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/qr-code-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/qr-code-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.pngindex 7a56540..d594fdc 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/qr-code-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/qr-code-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/service-period-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/service-period-hidden-in-pdf-default-template-Desktop-Chrome-darwin.pngindex 3bbc040..8d2e0e1 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/service-period-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/service-period-hidden-in-pdf-default-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/service-period-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/service-period-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.pngindex bba098b..d479679 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/service-period-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/service-period-hidden-in-pdf-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/stripe-template-multi-pages-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/stripe-template-multi-pages-Desktop-Chrome-darwin.pngindex 54e2836..98dd71c 100644Binary files a/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/stripe-template-multi-pages-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/shared-template-features.test.ts-snapshots/stripe-template-multi-pages-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts b/e2e/invoice-templates-common/template-languages.test.tsindex bf1d086..dd24d90 100644--- a/e2e/invoice-templates-common/template-languages.test.ts+++ b/e2e/invoice-templates-common/template-languages.test.ts@@ -8,7 +8,7 @@ import {CURRENCY_SYMBOLS,CURRENCY_TO_LABEL,LANGUAGE_TO_LABEL,- SUPPORTED_LANGUAGES,+ SUPPORTED_INVOICE_PDF_LANGUAGES,type SupportedCurrencies,type SupportedLanguages,type SupportedTemplates,@@ -36,7 +36,8 @@ const LANGUAGE_TO_CURRENCY = {de: "EUR",es: "MXN",sv: "SEK",- pt: "BRL",+ pt: "EUR",+ "pt-BR": "BRL",ru: "RUB",uk: "UAH",fr: "CHF",@@ -46,7 +47,7 @@ const LANGUAGE_TO_CURRENCY = {} as const satisfies Record<SupportedLanguages, SupportedCurrencies>;const PDF_LANGUAGE_CASES = [- ...SUPPORTED_LANGUAGES.map((language) => {+ ...SUPPORTED_INVOICE_PDF_LANGUAGES.map((language) => {return {language,currency: LANGUAGE_TO_CURRENCY[language],@@ -225,7 +226,7 @@ test.describe("PDF language test data", () => {});test("default invoice number labels come from the language translations", () => {- for (const language of SUPPORTED_LANGUAGES) {+ for (const language of SUPPORTED_INVOICE_PDF_LANGUAGES) {expect(getDefaultInvoiceNumberLabel(language, "default")).toBe(`${INVOICE_PDF_TRANSLATIONS[language].invoiceNumber}:`,);diff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-de-EUR-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-de-EUR-Desktop-Chrome-darwin.pngindex 2e10663..7d172f0 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-de-EUR-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-de-EUR-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-en-JPY-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-en-JPY-Desktop-Chrome-darwin.pngindex dcc11c1..7f13cb5 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-en-JPY-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-en-JPY-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-en-USD-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-en-USD-Desktop-Chrome-darwin.pngindex daccd0b..d5019a1 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-en-USD-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-en-USD-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-es-MXN-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-es-MXN-Desktop-Chrome-darwin.pngindex ca036fb..e8ef249 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-es-MXN-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-es-MXN-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-fr-CHF-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-fr-CHF-Desktop-Chrome-darwin.pngindex dd6a8ee..dddf1ef 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-fr-CHF-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-fr-CHF-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-it-EUR-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-it-EUR-Desktop-Chrome-darwin.pngindex 5671d47..3fc0fef 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-it-EUR-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-it-EUR-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-nb-NOK-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-nb-NOK-Desktop-Chrome-darwin.pngindex 51d3c3b..dd15c56 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-nb-NOK-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-nb-NOK-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-nl-EUR-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-nl-EUR-Desktop-Chrome-darwin.pngindex 852bb9f..52254e0 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-nl-EUR-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-nl-EUR-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pl-PLN-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pl-PLN-Desktop-Chrome-darwin.pngindex cb31e28..a127205 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pl-PLN-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pl-PLN-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pt-BR-BRL-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pt-BR-BRL-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..1cca632Binary files /dev/null and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pt-BR-BRL-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pt-BRL-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pt-BRL-Desktop-Chrome-darwin.pngdeleted file mode 100644index 7bcb4eb..0000000Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pt-BRL-Desktop-Chrome-darwin.png and /dev/null differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pt-EUR-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pt-EUR-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..caa0933Binary files /dev/null and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-pt-EUR-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-ru-RUB-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-ru-RUB-Desktop-Chrome-darwin.pngindex 51fb722..8dd711c 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-ru-RUB-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-ru-RUB-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-sv-SEK-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-sv-SEK-Desktop-Chrome-darwin.pngindex bc2901f..52b50e1 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-sv-SEK-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-sv-SEK-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-uk-UAH-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-uk-UAH-Desktop-Chrome-darwin.pngindex 3f5c0b2..28a9630 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-uk-UAH-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/default-template-pdf-uk-UAH-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-de-EUR-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-de-EUR-Desktop-Chrome-darwin.pngindex a04a90a..ae45fc4 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-de-EUR-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-de-EUR-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-en-JPY-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-en-JPY-Desktop-Chrome-darwin.pngindex 755df14..f2cc92f 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-en-JPY-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-en-JPY-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-en-USD-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-en-USD-Desktop-Chrome-darwin.pngindex 8311b2e..97c4178 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-en-USD-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-en-USD-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-es-MXN-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-es-MXN-Desktop-Chrome-darwin.pngindex c61ed74..6d477ad 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-es-MXN-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-es-MXN-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-fr-CHF-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-fr-CHF-Desktop-Chrome-darwin.pngindex cf7acfd..8f3fca0 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-fr-CHF-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-fr-CHF-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-it-EUR-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-it-EUR-Desktop-Chrome-darwin.pngindex b95a36c..7b44981 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-it-EUR-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-it-EUR-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-nb-NOK-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-nb-NOK-Desktop-Chrome-darwin.pngindex 4fa98ad..4b400f6 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-nb-NOK-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-nb-NOK-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-nl-EUR-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-nl-EUR-Desktop-Chrome-darwin.pngindex bf1a982..0ff90b2 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-nl-EUR-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-nl-EUR-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pl-PLN-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pl-PLN-Desktop-Chrome-darwin.pngindex c599c85..603bd8d 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pl-PLN-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pl-PLN-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pt-BR-BRL-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pt-BR-BRL-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..1ce403fBinary files /dev/null and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pt-BR-BRL-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pt-BRL-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pt-BRL-Desktop-Chrome-darwin.pngdeleted file mode 100644index c04a9b5..0000000Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pt-BRL-Desktop-Chrome-darwin.png and /dev/null differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pt-EUR-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pt-EUR-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..b431a63Binary files /dev/null and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-pt-EUR-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-ru-RUB-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-ru-RUB-Desktop-Chrome-darwin.pngindex c2bf585..d7b4648 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-ru-RUB-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-ru-RUB-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-sv-SEK-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-sv-SEK-Desktop-Chrome-darwin.pngindex 3ff0c9c..6cb32a9 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-sv-SEK-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-sv-SEK-Desktop-Chrome-darwin.png differdiff --git a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-uk-UAH-Desktop-Chrome-darwin.png b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-uk-UAH-Desktop-Chrome-darwin.pngindex 8079720..f99edb9 100644Binary files a/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-uk-UAH-Desktop-Chrome-darwin.png and b/e2e/invoice-templates-common/template-languages.test.ts-snapshots/stripe-template-pdf-uk-UAH-Desktop-Chrome-darwin.png differdiff --git a/e2e/locales.test.ts b/e2e/locales.test.tsindex 3004e41..2bba4ee 100644--- a/e2e/locales.test.ts+++ b/e2e/locales.test.ts@@ -3,10 +3,10 @@ import path from "node:path";import { expect, test } from "@playwright/test";-import { SUPPORTED_LANGUAGES } from "@/app/schema";+import { SUPPORTED_I18N_LOCALES } from "@/app/schema";/**- * The app ships a translation file per supported language (`messages/<locale>.json`)+ * The app ships a translation file per supported locale (`messages/<locale>.json`)* and serves a localized about page for each of them (`localePrefix: "always"`).** These are smoke tests: they don't check every string, they check that **every**@@ -35,7 +35,7 @@ test.describe("Localized about page", () => {);});- for (const locale of SUPPORTED_LANGUAGES) {+ for (const locale of SUPPORTED_I18N_LOCALES) {test(`serves /${locale}/about with ${locale} translations`, async ({page,}) => {diff --git a/e2e/seller-buyer-management.test.ts b/e2e/seller-buyer-management.test.tsindex c26a14e..bee3f2c 100644--- a/e2e/seller-buyer-management.test.ts+++ b/e2e/seller-buyer-management.test.ts@@ -145,10 +145,10 @@ async function toggleBankDetailsOff(dialog: Locator, party: Party) {}const accountNumberSwitch = dialog.getByRole("switch", {- name: `Show the 'Account Number' field in the PDF`,+ name: "Show Seller Account Number in PDF",});const swiftBicSwitch = dialog.getByRole("switch", {- name: `Show the 'SWIFT/BIC' field in the PDF`,+ name: "Show Seller SWIFT/BIC in PDF",});await expect(accountNumberSwitch).toBeChecked();@@ -175,14 +175,10 @@ async function expectBankDetailsInDialog(dialog: Locator, party: Party) {);await expect(- dialog.getByRole("switch", {- name: `Show the 'Account Number' field in the PDF`,- }),+ dialog.getByRole("switch", { name: "Show Seller Account Number in PDF" }),).not.toBeChecked();await expect(- dialog.getByRole("switch", {- name: `Show the 'SWIFT/BIC' field in the PDF`,- }),+ dialog.getByRole("switch", { name: "Show Seller SWIFT/BIC in PDF" }),).not.toBeChecked();}@@ -317,7 +313,7 @@ for (const party of PARTIES) {await fillBankDetails(manageDialog, party);const emailSwitchInDialogForm = manageDialog.getByRole("switch", {- name: `Show the 'Email' field in the PDF`,+ name: `Show ${PARTY_CONFIG[party].label} Email in PDF`,});const taxNumberSwitchInDialogForm = manageDialog.getByRole("switch", {diff --git a/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/preview-endpoint-en-invoice-Desktop-Chrome-darwin.png b/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/preview-endpoint-en-invoice-Desktop-Chrome-darwin.pngindex 2420ee4..ebf58a7 100644Binary files a/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/preview-endpoint-en-invoice-Desktop-Chrome-darwin.png and b/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/preview-endpoint-en-invoice-Desktop-Chrome-darwin.png differdiff --git a/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/preview-endpoint-pl-invoice-Desktop-Chrome-darwin.png b/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/preview-endpoint-pl-invoice-Desktop-Chrome-darwin.pngindex b602317..5c18c1c 100644Binary files a/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/preview-endpoint-pl-invoice-Desktop-Chrome-darwin.png and b/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/preview-endpoint-pl-invoice-Desktop-Chrome-darwin.png differdiff --git a/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/server-en-invoice-Desktop-Chrome-darwin.png b/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/server-en-invoice-Desktop-Chrome-darwin.pngindex ad305ee..d47f103 100644Binary files a/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/server-en-invoice-Desktop-Chrome-darwin.png and b/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/server-en-invoice-Desktop-Chrome-darwin.png differdiff --git a/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/server-pl-invoice-Desktop-Chrome-darwin.png b/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/server-pl-invoice-Desktop-Chrome-darwin.pngindex 64fe897..f2ac0e0 100644Binary files a/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/server-pl-invoice-Desktop-Chrome-darwin.png and b/e2e/server-render-pdf/server-render-pdf.test.ts-snapshots/server-pl-invoice-Desktop-Chrome-darwin.png differdiff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts b/e2e/stripe-invoice-template/stripe-invoice-template.test.tsindex a91b93a..1aae87a 100644--- a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts+++ b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts@@ -986,4 +986,76 @@ test.describe("Stripe Invoice Template", () => {name: "pdf-with-logo-and-payment-url-when-using-stripe-template.png",});});++ /**+ * The Stripe template is the only one whose money cells carry a currency token, and some+ * locales render that token in more than one font run: `it` prints `123.400.000,00 USD`+ * and `fr` prints `123 400 000,00 $US`, both joining the number to the code with a+ * no-break space that Inter has no glyph for. react-pdf splits the run there, which is+ * enough to break a wrapping strategy that assumes it gets the whole amount in one piece.+ *+ * When that happened the amount stopped breaking at its thousands boundaries *and*+ * react-pdf painted a hyphen into it -- `123.400.000,00 -` above a lone `USD`, and in+ * French a hyphen inside the currency symbol itself, `$-` above `US`. Both are in these+ * screenshots if they ever come back.+ *+ * The numbers are the ones that first showed it: a hundred thousand of an item priced at+ * 123.4 million, which takes the line total past twelve trillion and forces every money+ * column to wrap.+ */+ for (const language of ["it", "fr"] as const) {+ test(`wraps a wide amount without hyphenating it when ${language} renders the currency in several runs`, async ({+ page,+ browserName,+ downloadDir,+ }) => {+ await page.evaluate(+ ({ invoiceData, storageKey }) => {+ localStorage.setItem(storageKey, JSON.stringify(invoiceData));+ },+ {+ storageKey: PDF_DATA_LOCAL_STORAGE_KEY,+ invoiceData: {+ ...INITIAL_INVOICE_DATA,+ template: "stripe",+ language,+ // `INITIAL_INVOICE_DATA` takes its dates and invoice number from `dayjs()` at+ // import time -- in the test runner, where `page.clock` does not reach -- so they+ // are pinned here instead. Without this the screenshot changes every day.+ invoiceNumberObject: { label: "Invoice", value: "1/12-2025" },+ dateOfIssue: "2025-12-17",+ dateOfServiceStart: "2025-12-01",+ dateOfService: "2025-12-31",+ paymentDue: "2025-12-31",+ // the number format follows the language unless it is pinned, and it is the+ // format -- not the language -- that decides how the currency is written+ numberFormatLocale: language,+ currency: "USD",+ dateFormat: STRIPE_DEFAULT_DATE_FORMAT,+ items: [+ {+ ...INITIAL_INVOICE_DATA.items[0],+ amount: 100_000,+ netPrice: 123_400_000,+ netAmount: 12_340_000_000_000,+ vat: 20,+ vatAmount: 2_468_000_000_000,+ preTaxAmount: 14_808_000_000_000,+ },+ ],+ total: 14_808_000_000_000,+ } satisfies InvoiceData,+ },+ );++ await page.goto("/?template=stripe");+ await expect(page).toHaveURL("/?template=stripe");++ await expectPdfScreenshot(page, {+ downloadDir,+ browserName,+ name: `wide-amount-with-multi-run-currency-${language}-stripe-template.png`,+ });+ });+ }});diff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/automatically-sets-date-format-when-switching-to-Stripe-template-Desktop-Chrome-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/automatically-sets-date-format-when-switching-to-Stripe-template-Desktop-Chrome-darwin.pngindex 46eb53d..309682a 100644Binary files a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/automatically-sets-date-format-when-switching-to-Stripe-template-Desktop-Chrome-darwin.png and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/automatically-sets-date-format-when-switching-to-Stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/pdf-with-logo-and-payment-url-when-using-stripe-template-Desktop-Chrome-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/pdf-with-logo-and-payment-url-when-using-stripe-template-Desktop-Chrome-darwin.pngindex e8db905..d8c896a 100644Binary files a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/pdf-with-logo-and-payment-url-when-using-stripe-template-Desktop-Chrome-darwin.png and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/pdf-with-logo-and-payment-url-when-using-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/wide-amount-with-multi-run-currency-fr-stripe-template-Desktop-Chrome-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/wide-amount-with-multi-run-currency-fr-stripe-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..118ae80Binary files /dev/null and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/wide-amount-with-multi-run-currency-fr-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/wide-amount-with-multi-run-currency-it-stripe-template-Desktop-Chrome-darwin.png b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/wide-amount-with-multi-run-currency-it-stripe-template-Desktop-Chrome-darwin.pngnew file mode 100644index 0000000..a11fba3Binary files /dev/null and b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts-snapshots/wide-amount-with-multi-run-currency-it-stripe-template-Desktop-Chrome-darwin.png differdiff --git a/e2e/utils/latest-changelog-slug.ts b/e2e/utils/latest-changelog-slug.tsnew file mode 100644index 0000000..c8af6dd--- /dev/null+++ b/e2e/utils/latest-changelog-slug.ts@@ -0,0 +1,53 @@+import { readdirSync, readFileSync } from "node:fs";+import path from "node:path";++const CHANGELOG_CONTENT_DIR = path.resolve(+ __dirname,+ "../../src/app/(main)/changelog/content",+);++/** The `date: "YYYY-MM-DD"` field of a post's `metadata` export. */+const METADATA_DATE_REGEX = /^\s*date:\s*"(\d{4}-\d{2}-\d{2})"/m;++/**+ * The slug of the newest changelog post -- what the app stores once its "What's new"+ * popup has been seen, so `playwright.config.ts` can mark it seen up front.+ *+ * The app imports each MDX post to read its metadata, which the Playwright config cannot+ * do, so this reads the `date` field as text instead. The ordering is the app's own, see+ * `getChangelogEntries`: newest date first, and `Array#sort` is stable, so posts sharing a+ * date keep directory order in both places.+ *+ * Throws on a post without a readable date, rather than quietly picking the wrong slug+ * and letting the popup back into every test.+ */+export function getLatestChangelogSlug() {+ const posts = readdirSync(CHANGELOG_CONTENT_DIR)+ .filter((file) => {+ return file.endsWith(".mdx");+ })+ .map((file) => {+ const source = readFileSync(+ path.join(CHANGELOG_CONTENT_DIR, file),+ "utf8",+ );+ const date = METADATA_DATE_REGEX.exec(source)?.[1];++ if (!date) {+ throw new Error(`Changelog post ${file} has no readable metadata date`);+ }++ return { slug: file.replace(".mdx", ""), time: new Date(date).getTime() };+ })+ .sort((a, b) => {+ return b.time - a.time;+ });++ const [latest] = posts;++ if (!latest) {+ throw new Error(`No changelog posts found in ${CHANGELOG_CONTENT_DIR}`);+ }++ return latest.slug;+}diff --git a/messages/de.json b/messages/de.jsonindex 2f9a85b..b3fb1c5 100644--- a/messages/de.json+++ b/messages/de.json@@ -11,7 +11,7 @@"tagline": "Kostenloser Rechnungsgenerator","hero": {"title": "Erstellen Sie professionelle Rechnungen in Sekunden",- "description": "EasyInvoicePDF ist ein <span>kostenloses</span> Open-Source-Tool, mit dem Sie professionelle Rechnungen mit <span>Echtzeit-Vorschau</span> erstellen, anpassen und herunterladen können. Läuft vollständig in Ihrem Browser."+ "description": "Ein <span>kostenloser Open-Source</span>-Rechnungsgenerator, der vollständig in Ihrem Browser läuft. <span>Keine Anmeldung, keine Werbung</span> – und Ihre Daten gehören Ihnen."},"features": {"badge": "Funktionen",diff --git a/messages/en.json b/messages/en.jsonindex 75aff0e..22bfe8c 100644--- a/messages/en.json+++ b/messages/en.json@@ -11,7 +11,7 @@"tagline": "Free & Open-Source Invoice Generator","hero": {"title": "Create professional invoices in seconds",- "description": "EasyInvoicePDF is a <span>free, open-source</span> invoice generator with real-time preview. Create, customize, and download professional invoices. <span>No sign-up required.</span>"+ "description": "A <span>free, open-source</span> invoice generator that runs entirely in your browser. <span>No sign-up, no ads</span>, and your data stays yours."},"features": {"badge": "Features",diff --git a/messages/es.json b/messages/es.jsonindex c27790b..d55f301 100644--- a/messages/es.json+++ b/messages/es.json@@ -11,7 +11,7 @@"tagline": "Generador de facturas gratuito","hero": {"title": "Cree facturas profesionales en segundos",- "description": "EasyInvoicePDF es una <span>herramienta gratuita</span> de código abierto que le permite crear, personalizar y descargar facturas profesionales con <span>vista previa en tiempo real</span>. Funciona completamente en su navegador."+ "description": "Un generador de facturas <span>gratuito y de código abierto</span> que funciona completamente en su navegador. <span>Sin registro ni anuncios</span>, y sus datos siguen siendo suyos."},"features": {"badge": "Características",diff --git a/messages/fr.json b/messages/fr.jsonindex e9b58b4..6a2d52a 100644--- a/messages/fr.json+++ b/messages/fr.json@@ -3,7 +3,7 @@"tagline": "Générateur de factures gratuit","hero": {"title": "Créez des factures professionnelles en quelques secondes",- "description": "EasyInvoicePDF est un outil <span>gratuit</span> et open-source qui vous permet de créer, personnaliser et télécharger des factures professionnelles avec <span>aperçu en temps réel</span>. Fonctionne entièrement dans votre navigateur."+ "description": "Un générateur de factures <span>gratuit et open-source</span> qui fonctionne entièrement dans votre navigateur. <span>Sans inscription, sans publicité</span>, et vos données restent les vôtres."},"features": {"badge": "Fonctionnalités",diff --git a/messages/it.json b/messages/it.jsonindex 31d3f83..1bf94cb 100644--- a/messages/it.json+++ b/messages/it.json@@ -11,7 +11,7 @@"tagline": "Generatore di fatture gratuito","hero": {"title": "Crea fatture professionali in pochi secondi",- "description": "EasyInvoicePDF è uno strumento <span>gratuito</span> e open-source che ti permette di creare, personalizzare e scaricare fatture professionali con <span>anteprima in tempo reale</span>. Funziona completamente nel tuo browser."+ "description": "Un generatore di fatture <span>gratuito e open-source</span> che funziona interamente nel tuo browser. <span>Nessuna registrazione, nessuna pubblicità</span>, e i tuoi dati restano tuoi."},"features": {"badge": "Funzionalità",diff --git a/messages/nb.json b/messages/nb.jsonindex fde881d..79c8a87 100644--- a/messages/nb.json+++ b/messages/nb.json@@ -11,7 +11,7 @@"tagline": "Gratis fakturagenerator med åpen kildekode","hero": {"title": "Lag profesjonelle fakturaer på sekunder",- "description": "EasyInvoicePDF er en <span>gratis fakturagenerator med åpen kildekode</span> og forhåndsvisning i sanntid. Lag, tilpass og last ned profesjonelle fakturaer. <span>Ingen registrering nødvendig.</span>"+ "description": "En <span>gratis fakturagenerator med åpen kildekode</span> som kjører helt i nettleseren din. <span>Ingen registrering, ingen reklame</span>, og dataene dine forblir dine."},"features": {"badge": "Funksjoner",diff --git a/messages/nl.json b/messages/nl.jsonindex de14f61..064bcf3 100644--- a/messages/nl.json+++ b/messages/nl.json@@ -11,7 +11,7 @@"tagline": "Gratis factuurgenerator","hero": {"title": "Maak professionele facturen in seconden",- "description": "EasyInvoicePDF is een <span>gratis</span>, open-source tool waarmee je professionele facturen kunt maken, aanpassen en downloaden met <span>realtime voorbeeld</span>. Draait volledig in je browser."+ "description": "Een <span>gratis, open-source</span> factuurgenerator die volledig in je browser draait. <span>Geen registratie, geen advertenties</span>, en je gegevens blijven van jou."},"features": {"badge": "Functies",diff --git a/messages/pl.json b/messages/pl.jsonindex 1bfb39c..651d59b 100644--- a/messages/pl.json+++ b/messages/pl.json@@ -11,7 +11,7 @@"tagline": "Darmowy generator faktur","hero": {"title": "Twórz profesjonalne faktury w kilka sekund",- "description": "EasyInvoicePDF to <span>darmowe</span> narzędzie open-source, które pozwala tworzyć, dostosowywać i pobierać profesjonalne faktury z <span>podglądem w czasie rzeczywistym</span>. Działa całkowicie w Twojej przeglądarce."+ "description": "<span>Darmowy generator faktur open-source</span>, który działa w całości w Twojej przeglądarce. <span>Bez rejestracji i bez reklam</span>, a Twoje dane należą do Ciebie."},"features": {"badge": "Funkcje",diff --git a/messages/pt.json b/messages/pt.jsonindex 778dd63..a193cd8 100644--- a/messages/pt.json+++ b/messages/pt.json@@ -11,7 +11,7 @@"tagline": "Gerador de faturas gratuito","hero": {"title": "Crie faturas PDF profissionais em segundos",- "description": "EasyInvoicePDF é uma <span>ferramenta gratuita</span> de código aberto que permite criar, personalizar e baixar faturas profissionais com <span>pré-visualização em tempo real</span>. Funciona completamente no seu navegador."+ "description": "Um gerador de faturas <span>gratuito e de código aberto</span> que funciona inteiramente no seu navegador. <span>Sem cadastro, sem anúncios</span>, e seus dados continuam sendo seus."},"features": {"badge": "Recursos",diff --git a/messages/ru.json b/messages/ru.jsonindex 5464edf..a9831ae 100644--- a/messages/ru.json+++ b/messages/ru.json@@ -11,7 +11,7 @@"tagline": "Бесплатный генератор счетов","hero": {"title": "Создавайте профессиональные PDF-счета за секунды",- "description": "EasyInvoicePDF — это <span>бесплатный</span> инструмент с открытым исходным кодом, который позволяет создавать, настраивать и скачивать инвойсы с <span>предпросмотром в реальном времени</span>. Работает полностью в вашем браузере."+ "description": "<span>Бесплатный генератор инвойсов с открытым исходным кодом</span>, который работает полностью в вашем браузере. <span>Без регистрации и рекламы</span>, а ваши данные остаются вашими."},"features": {"badge": "Возможности",diff --git a/messages/sv.json b/messages/sv.jsonindex b925bb0..b87e23b 100644--- a/messages/sv.json+++ b/messages/sv.json@@ -11,7 +11,7 @@"tagline": "Gratis fakturagenerator med öppen källkod","hero": {"title": "Skapa professionella fakturor på några sekunder",- "description": "EasyInvoicePDF är en <span>gratis fakturagenerator med öppen källkod</span> och förhandsvisning i realtid. Skapa, anpassa och ladda ner professionella fakturor. <span>Ingen registrering krävs.</span>"+ "description": "En <span>gratis fakturagenerator med öppen källkod</span> som körs helt i din webbläsare. <span>Ingen registrering, ingen reklam</span>, och dina uppgifter förblir dina."},"features": {"badge": "Funktioner",diff --git a/messages/uk.json b/messages/uk.jsonindex 0f11a87..4ec7931 100644--- a/messages/uk.json+++ b/messages/uk.json@@ -11,7 +11,7 @@"tagline": "Безкоштовний генератор рахунків","hero": {"title": "Створюйте професійні PDF-рахунки за секунди",- "description": "EasyInvoicePDF — це <span>безкоштовний</span> інструмент з відкритим кодом, який дозволяє створювати, налаштовувати та завантажувати професійні рахунки з <span>попереднім переглядом у реальному часі</span>. Працює повністю в вашому браузері."+ "description": "<span>Безкоштовний генератор рахунків з відкритим кодом</span>, який працює повністю у вашому браузері. <span>Без реєстрації та реклами</span>, а ваші дані залишаються вашими."},"features": {"badge": "Можливості",diff --git a/package.json b/package.jsonindex a446eb3..c949205 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "easy-invoice-pdf",- "version": "1.0.4",+ "version": "1.0.5","private": true,"description": "Free and open-source invoice generator. No sign up, no ads, instant PDF download.","keywords": [@@ -103,6 +103,7 @@"remark-gfm": "4.0.1","require-in-the-middle": "8.0.1","resend": "4.2.0",+ "rough-notation": "0.5.1","sonner": "1.7.4","tailwind-merge": "2.6.0","tailwindcss-animate": "1.0.7",diff --git a/playwright.config.ts b/playwright.config.tsindex cff27e6..6ad81a3 100644--- a/playwright.config.ts+++ b/playwright.config.ts@@ -7,6 +7,12 @@ import {} from "@playwright/test";import dotenv from "dotenv";+import { getLatestChangelogSlug } from "./e2e/utils/latest-changelog-slug";+import {+ CHANGELOG_SEEN_STORAGE_KEY,+ WELCOME_POPUP_SEEN_STORAGE_KEY,+ WELCOME_POPUP_SEEN_VALUE,+} from "./src/app/schema";import { SENTRY_E2E_DISABLED_STORAGE_KEY } from "./src/lib/sentry/sentry-e2e-flags";/**@@ -25,7 +31,8 @@ const BASE_URL = process.env.BASE_URL ?? `http://localhost:${PORT}`;const isLocal = process.env.NODE_ENV === "local";/**- * Analytics and error reporting are switched off for every project.+ * Analytics and error reporting are switched off for every project, and both of the app's+ * popups (welcome and "What's new") are marked as seen.** The suite runs against a real preview deployment, which has Sentry enabled like* production does, so an env var on the CI job cannot tell e2e traffic apart from a@@ -46,6 +53,17 @@ const STORAGE_STATE = {name: SENTRY_E2E_DISABLED_STORAGE_KEY,value: "1",},+ // The popups appear 1.5s after load, mid-test. On mobile they sit inside the+ // bottom dock, which grows and pushes the dock's buttons down under whatever the+ // test is doing -- and no test is about them; their behaviour is unit-tested.+ {+ name: WELCOME_POPUP_SEEN_STORAGE_KEY,+ value: WELCOME_POPUP_SEEN_VALUE,+ },+ {+ name: CHANGELOG_SEEN_STORAGE_KEY,+ value: getLatestChangelogSlug(),+ },],},],diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 2210950..5e0407d 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -187,6 +187,9 @@ importers:resend:specifier: 4.2.0+ rough-notation:+ specifier: 0.5.1+ version: 0.5.1sonner:specifier: 1.7.4@@ -6621,6 +6624,9 @@ packages:engines: {node: '>=18.0.0', npm: '>=8.0.0'}hasBin: true+ resolution: {integrity: sha512-ITHofTzm13cWFVfoGsh/4c/k2Mg8geKgBCwex71UZLnNuw403tCRjYPQ68jSAd37DMbZIePXPjDgY0XdZi9HPw==}+resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}engines: {node: '>= 18'}@@ -14018,6 +14024,8 @@ snapshots:'@rollup/rollup-win32-x64-msvc': 4.62.4fsevents: 2.3.3+ [email protected]: {}+dependencies:debug: 4.4.3diff --git a/public/de/about.md b/public/de/about.mdindex c6f05ae..c90571f 100644--- a/public/de/about.md+++ b/public/de/about.md@@ -8,7 +8,7 @@>> Quellcode: https://github.com/VladSez/easy-invoice-pdf>-> Zuletzt aktualisiert: 2026-09-16+> Zuletzt aktualisiert: 2026-09-17## Kanonische Produktzusammenfassung@@ -34,7 +34,7 @@ Alle Begriffe bezeichnen das auf dieser Seite beschriebene Produkt EasyInvoicePD- **Werbung:** keine.- **Browserbasiert:** Bearbeitung, Vorschau und PDF-Erstellung erfolgen im Browser.- **Selbst gehostet:** Bereitstellung aus dem öffentlichen Quellcode wird unterstützt.-- **Sprachen:** Englisch, Polnisch, Deutsch, Spanisch, Portugiesisch, Russisch, Ukrainisch, Französisch, Italienisch, Niederländisch, Schwedisch und Norwegisch.+- **Sprachen:** Englisch, Polnisch, Deutsch, Spanisch, Portugiesisch, brasilianisches Portugiesisch, Russisch, Ukrainisch, Französisch, Italienisch, Niederländisch, Schwedisch und Norwegisch.- **Währungen:** mehr als 120.- **Plattformen:** moderne Desktop-, Tablet- und Mobilbrowser.- **Aktuelle öffentliche Version:** 1.0.4.@@ -61,7 +61,7 @@ Alle Begriffe bezeichnen das auf dieser Seite beschriebene Produkt EasyInvoicePD- Standardvorlage und von Stripe inspirierte Vorlage.- Lokal gespeicherte Verkäufer- und Käuferprofile.- Rechnungspositionen sowie automatische Summen und Steuern.-- Mehr als 120 Währungen und 12 Sprachen.+- Mehr als 120 Währungen und 13 Sprachen.- Mehrwertsteuer, GST, Sales Tax und eigene Steuerbezeichnungen.- Eigener Rechnungstyp und Reverse-Charge-Text.- Nummern, Datumsangaben, Notizen und ein-/ausblendbare Felder.@@ -163,7 +163,7 @@ E-Mail und öffentliche API stehen unter Geplante Integrationen. Wiederkehrende- Kein Konto, kein Abonnement und keine Werbung.- Unterstützt selbst gehostete Bereitstellung.- Speichert Daten lokal statt in einem Cloud-Konto.-- Unterstützt 12 Sprachen, über 120 Währungen und eigene Steuerbezeichnungen.+- Unterstützt 13 Sprachen, über 120 Währungen und eigene Steuerbezeichnungen.- Teilt Rechnungen per Link ohne gehosteten Rechnungsdatensatz.## Datenspeicherung und Datenschutzdiff --git a/public/en/about.md b/public/en/about.mdindex 4890514..61433cf 100644--- a/public/en/about.md+++ b/public/en/about.md@@ -8,7 +8,7 @@>> Source code: https://github.com/VladSez/easy-invoice-pdf>-> Last updated: 2026-09-16+> Last updated: 2026-09-17## Canonical product summary@@ -34,7 +34,7 @@ These names and terms refer to the same EasyInvoicePDF product described on this- **Advertising:** No advertisements are displayed.- **Browser-based:** Yes. Invoice editing, live preview, and PDF generation are browser-based.- **Self-hosted deployment:** Supported from the public source code, subject to the license terms.-- **Supported languages:** English, Polish, German, Spanish, Portuguese, Russian, Ukrainian, French, Italian, Dutch, Swedish, and Norwegian.+- **Supported languages:** English, Polish, German, Spanish, Portuguese, Brazilian Portuguese, Russian, Ukrainian, French, Italian, Dutch, Swedish, and Norwegian.- **Supported currencies:** More than 120 currencies.- **Supported devices:** Desktop computers, tablets, and mobile phones with a compatible web browser.@@ -77,7 +77,7 @@ These names and terms refer to the same EasyInvoicePDF product described on this- Add reverse-charge or other compliance wording in the invoice notes.- Customize invoice number, issue date, sale date, due date, and date format.- Show or hide supported invoice fields.-- Switch the interface and invoice labels between 12 supported languages.+- Switch the invoice labels between 13 supported languages, and the interface between 12.- Upload a custom logo for invoice branding.- Add a QR code containing a payment link, UPI address, contact details, or other text.- Generate multi-page PDFs with automatic pagination for longer invoices.@@ -228,7 +228,7 @@ Recurring invoices, a customer portal, built-in payment processing, and AI integ- **Local persistence:** The current invoice and reusable seller and buyer profiles are stored in browser local storage rather than an EasyInvoicePDF cloud account.- **Open-source licensing:** The code is available under AGPL-3.0.- **Self-hosted deployment:** Users and organizations can deploy the application on their own infrastructure subject to the license terms.-- **International support:** The application includes 12 languages, more than 120 currencies, and customizable tax labels.+- **International support:** The application includes 13 languages, more than 120 currencies, and customizable tax labels.- **Shareable invoice links:** Invoice data can be compressed into a shareable invoice link without creating a hosted invoice record.## Data storage and privacy@@ -294,7 +294,7 @@ Yes. It supports more than 120 currencies.### Which languages does EasyInvoicePDF support?-It supports English, Polish, German, Spanish, Portuguese, Russian, Ukrainian, French, Italian, Dutch, Swedish, and Norwegian.+It supports English, Polish, German, Spanish, Portuguese, Brazilian Portuguese, Russian, Ukrainian, French, Italian, Dutch, Swedish, and Norwegian.### Does EasyInvoicePDF work on mobile devices?diff --git a/public/es/about.md b/public/es/about.mdindex 7f2aa11..279fba1 100644--- a/public/es/about.md+++ b/public/es/about.md@@ -8,7 +8,7 @@>> Código fuente: https://github.com/VladSez/easy-invoice-pdf>-> Última actualización: 2026-09-16+> Última actualización: 2026-09-17## Resumen canónico del producto@@ -34,7 +34,7 @@ Todos estos términos se refieren al producto EasyInvoicePDF descrito en esta p- **Publicidad:** ninguna.- **Navegador:** edición, vista previa y generación del PDF en el navegador.- **Despliegue autogestionado:** compatible mediante el código público.-- **Idiomas:** inglés, polaco, alemán, español, portugués, ruso, ucraniano, francés, italiano, neerlandés, sueco y noruego.+- **Idiomas:** inglés, polaco, alemán, español, portugués, portugués de Brasil, ruso, ucraniano, francés, italiano, neerlandés, sueco y noruego.- **Monedas:** más de 120.- **Plataformas:** navegadores modernos de escritorio, tableta y móvil.- **Versión pública actual:** 1.0.4.@@ -61,7 +61,7 @@ Todos estos términos se refieren al producto EasyInvoicePDF descrito en esta p- Plantilla predeterminada y plantilla inspirada en Stripe.- Perfiles de vendedor y comprador guardados localmente.- Partidas de factura y cálculo automático de totales e impuestos.-- Más de 120 monedas y 12 idiomas.+- Más de 120 monedas y 13 idiomas.- IVA, GST, impuesto sobre ventas y etiquetas fiscales personalizadas.- Tipo de factura y texto de inversión del sujeto pasivo personalizados.- Números, fechas, notas y campos visibles u ocultos.@@ -163,7 +163,7 @@ El correo y la API pública se documentan como integraciones previstas. Las fact- Sin cuenta, suscripción ni publicidad.- Admite despliegue autogestionado.- Guarda datos localmente, no en una cuenta en la nube.-- Incluye 12 idiomas, más de 120 monedas y etiquetas fiscales personalizadas.+- Incluye 13 idiomas, más de 120 monedas y etiquetas fiscales personalizadas.- Comparte facturas por enlace sin crear un registro alojado.## Almacenamiento y privacidaddiff --git a/public/fr/about.md b/public/fr/about.mdindex ed415a0..500d9e0 100644--- a/public/fr/about.md+++ b/public/fr/about.md@@ -8,7 +8,7 @@>> Code source : https://github.com/VladSez/easy-invoice-pdf>-> Dernière mise à jour : 2026-09-16+> Dernière mise à jour : 2026-09-17## Résumé canonique du produit@@ -34,7 +34,7 @@ Tous ces termes désignent le produit EasyInvoicePDF décrit ici.- **Publicité :** aucune.- **Navigateur :** édition, aperçu et génération PDF dans le navigateur.- **Auto-hébergement :** pris en charge depuis le code public.-- **Langues :** anglais, polonais, allemand, espagnol, portugais, russe, ukrainien, français, italien, néerlandais, suédois et norvégien.+- **Langues :** anglais, polonais, allemand, espagnol, portugais, portugais du Brésil, russe, ukrainien, français, italien, néerlandais, suédois et norvégien.- **Devises :** plus de 120.- **Plateformes :** navigateurs modernes sur ordinateur, tablette et mobile.- **Version publique actuelle :** 1.0.4.@@ -61,7 +61,7 @@ Tous ces termes désignent le produit EasyInvoicePDF décrit ici.- Modèles par défaut et inspiré de Stripe.- Profils vendeur et client enregistrés localement.- Lignes, totaux et taxes calculés automatiquement.-- Plus de 120 devises et 12 langues.+- Plus de 120 devises et 13 langues.- TVA, GST, taxe de vente et libellés personnalisés.- Type de facture et texte d’autoliquidation personnalisés.- Numéros, dates, notes et champs affichables ou masquables.@@ -163,7 +163,7 @@ L’e-mail et l’API publique figurent dans les Intégrations prévues. Facture- Sans compte, abonnement ni publicité.- Auto-hébergement pris en charge.- Données stockées localement, pas dans un compte cloud.-- 12 langues, plus de 120 devises et libellés fiscaux personnalisés.+- 13 langues, plus de 120 devises et libellés fiscaux personnalisés.- Partage par lien sans créer de dossier hébergé.## Stockage et confidentialitédiff --git a/public/how-it-works.md b/public/how-it-works.mdindex 1b4f20d..c6141f6 100644--- a/public/how-it-works.md+++ b/public/how-it-works.md@@ -3,7 +3,7 @@> Canonical page: https://easyinvoicepdf.com/how-it-works> Invoice editor: https://easyinvoicepdf.com/> Language: English-> Last updated: 2026-08-02+> Last updated: 2026-09-17EasyInvoicePDF lets users create a professional PDF invoice in the browser: enter seller and buyer information, add invoice items and tax settings, customize the document, review the live preview, and download the PDF. No account or sign-up is required.@@ -48,6 +48,13 @@ Shows how to generate invoices for a week of work.- [Watch on the tutorial page](https://easyinvoicepdf.com/how-it-works?video=weekly-invoices)- [Watch on YouTube](https://www.youtube.com/watch?v=6KzDBBiAJmg)+### Customize tax++Shows how to rename the tax label (VAT, GST, Sales Tax, IVA, or any text) and set a tax rate per invoice item.++- [Watch on the tutorial page](https://easyinvoicepdf.com/how-it-works?video=custom-tax)+- [Watch on YouTube](https://www.youtube.com/watch?v=F_iJxZ3PHbk)+## Data handlingNormal editing, preview, and PDF generation run in the browser. EasyInvoicePDF does not store invoice content on its servers during the normal edit-and-download workflow. A shareable invoice URL contains a compressed copy of the invoice data and should be treated as sensitive.diff --git a/public/invoice-generator.md b/public/invoice-generator.mdindex e14555a..3b6cc34 100644--- a/public/invoice-generator.md+++ b/public/invoice-generator.md@@ -34,7 +34,7 @@ EasyInvoicePDF is a free, open-source, browser-based invoice generator for creat- Custom logo and QR-code support.- Reusable seller and buyer details.- More than 120 currencies.-- Invoice labels and formatting in English, Polish, German, Spanish, Portuguese, Russian, Ukrainian, French, Italian, Dutch, Swedish, and Norwegian.+- Invoice labels and formatting in English, Polish, German, Spanish, Portuguese, Brazilian Portuguese, Russian, Ukrainian, French, Italian, Dutch, Swedish, and Norwegian.- Flexible VAT, GST, sales-tax, and custom tax labels.- Shareable invoice links with invoice data encoded in the URL.- Open-source code under the GNU AGPL-3.0 license.diff --git a/public/it/about.md b/public/it/about.mdindex 20aefd5..758072d 100644--- a/public/it/about.md+++ b/public/it/about.md@@ -8,7 +8,7 @@>> Codice sorgente: https://github.com/VladSez/easy-invoice-pdf>-> Ultimo aggiornamento: 2026-09-16+> Ultimo aggiornamento: 2026-09-17## Riepilogo canonico del prodotto@@ -34,7 +34,7 @@ Tutti questi termini indicano il prodotto EasyInvoicePDF descritto qui.- **Pubblicità:** nessuna.- **Browser:** modifica, anteprima e generazione PDF nel browser.- **Hosting autonomo:** supportato dal codice pubblico.-- **Lingue:** inglese, polacco, tedesco, spagnolo, portoghese, russo, ucraino, francese, italiano, olandese, svedese e norvegese.+- **Lingue:** inglese, polacco, tedesco, spagnolo, portoghese, portoghese brasiliano, russo, ucraino, francese, italiano, olandese, svedese e norvegese.- **Valute:** oltre 120.- **Piattaforme:** browser moderni desktop, tablet e mobili.- **Versione pubblica attuale:** 1.0.4.@@ -61,7 +61,7 @@ Tutti questi termini indicano il prodotto EasyInvoicePDF descritto qui.- Modelli predefinito e ispirato a Stripe.- Profili venditore e cliente salvati localmente.- Voci, totali e imposte calcolati automaticamente.-- Oltre 120 valute e 12 lingue.+- Oltre 120 valute e 13 lingue.- IVA, GST, imposta sulle vendite ed etichette personalizzate.- Tipo di fattura e testo reverse charge personalizzati.- Numeri, date, note e campi visibili o nascosti.@@ -163,7 +163,7 @@ E-mail e API pubblica sono nelle Integrazioni pianificate. Fatture ricorrenti, p- Senza account, abbonamento o pubblicità.- Supporta l’hosting autonomo.- Salva i dati localmente, non in un account cloud.-- Include 12 lingue, oltre 120 valute ed etichette fiscali personalizzate.+- Include 13 lingue, oltre 120 valute ed etichette fiscali personalizzate.- Condivide fatture via link senza creare un record ospitato.## Archiviazione e privacydiff --git a/public/nb/about.md b/public/nb/about.mdindex 7a941ec..5622be8 100644--- a/public/nb/about.md+++ b/public/nb/about.md@@ -8,7 +8,7 @@>> Kildekode: https://github.com/VladSez/easy-invoice-pdf>-> Sist oppdatert: 2026-09-16+> Sist oppdatert: 2026-09-17## Kanonisk produktsammendrag@@ -34,7 +34,7 @@ Alle disse begrepene viser til produktet EasyInvoicePDF som beskrives her.- **Annonser:** ingen.- **Nettleser:** redigering, forhåndsvisning og PDF-generering skjer i nettleseren.- **Egen server:** støttes med utgangspunkt i den offentlige kildekoden.-- **Språk:** engelsk, polsk, tysk, spansk, portugisisk, russisk, ukrainsk, fransk, italiensk, nederlandsk, svensk og norsk.+- **Språk:** engelsk, polsk, tysk, spansk, portugisisk, brasiliansk portugisisk, russisk, ukrainsk, fransk, italiensk, nederlandsk, svensk og norsk.- **Valutaer:** flere enn 120.- **Plattformer:** moderne nettlesere på datamaskin, nettbrett og mobil.- **Gjeldende offentlige versjon:** 1.0.4.@@ -61,7 +61,7 @@ Alle disse begrepene viser til produktet EasyInvoicePDF som beskrives her.- Standardmal og en Stripe-inspirert mal.- Lokalt lagrede selger- og kjøperprofiler.- Fakturalinjer samt automatiske summer og avgifter.-- Flere enn 120 valutaer og 12 språk.+- Flere enn 120 valutaer og 13 språk.- MVA, GST, omsetningsavgift og egne avgiftsetiketter.- Egen fakturatype og tekst for omvendt avgiftsplikt.- Numre, datoer, notater og felt som kan skjules.@@ -163,7 +163,7 @@ E-post og offentlig API står under Planlagte integrasjoner. Gjentakende faktura- Ingen konto, intet abonnement og ingen annonser.- Støtter drift på egen server.- Lagrer data lokalt, ikke i en skykonto.-- Støtter 12 språk, flere enn 120 valutaer og egne avgiftsetiketter.+- Støtter 13 språk, flere enn 120 valutaer og egne avgiftsetiketter.- Deler fakturaer via en lenke uten vertsbasert post.## Datalagring og personverndiff --git a/public/nl/about.md b/public/nl/about.mdindex 91f7d48..1e519c4 100644--- a/public/nl/about.md+++ b/public/nl/about.md@@ -8,7 +8,7 @@>> Broncode: https://github.com/VladSez/easy-invoice-pdf>-> Laatst bijgewerkt: 2026-09-16+> Laatst bijgewerkt: 2026-09-17## Canonieke productsamenvatting@@ -34,7 +34,7 @@ Al deze termen verwijzen naar het product EasyInvoicePDF dat hier wordt beschrev- **Advertenties:** geen.- **Browser:** bewerken, voorbeeld en PDF-generatie gebeuren in de browser.- **Zelfhosting:** ondersteund vanuit de openbare broncode.-- **Talen:** Engels, Pools, Duits, Spaans, Portugees, Russisch, Oekraïens, Frans, Italiaans, Nederlands, Zweeds en Noors.+- **Talen:** Engels, Pools, Duits, Spaans, Portugees, Braziliaans Portugees, Russisch, Oekraïens, Frans, Italiaans, Nederlands, Zweeds en Noors.- **Valuta’s:** meer dan 120.- **Platformen:** moderne desktop-, tablet- en mobiele browsers.- **Huidige openbare versie:** 1.0.4.@@ -61,7 +61,7 @@ Al deze termen verwijzen naar het product EasyInvoicePDF dat hier wordt beschrev- Standaardsjabloon en een op Stripe geïnspireerd sjabloon.- Lokaal opgeslagen verkoper- en klantprofielen.- Regels, automatische totalen en belastingen.-- Meer dan 120 valuta’s en 12 talen.+- Meer dan 120 valuta’s en 13 talen.- Btw, GST, omzetbelasting en aangepaste belastinglabels.- Eigen factuurtype en tekst voor verlegging.- Nummers, datums, notities en verbergbare velden.@@ -163,7 +163,7 @@ E-mail en openbare API staan bij Geplande integraties. Terugkerende facturen, kl- Geen account, abonnement of advertenties.- Ondersteunt zelfhosting.- Slaat gegevens lokaal op, niet in een cloudaccount.-- Ondersteunt 12 talen, meer dan 120 valuta’s en aangepaste belastinglabels.+- Ondersteunt 13 talen, meer dan 120 valuta’s en aangepaste belastinglabels.- Deelt facturen via een link zonder gehost record.## Gegevensopslag en privacydiff --git a/public/pl/about.md b/public/pl/about.mdindex ad7fb09..e493d69 100644--- a/public/pl/about.md+++ b/public/pl/about.md@@ -8,7 +8,7 @@>> Kod źródłowy: https://github.com/VladSez/easy-invoice-pdf>-> Ostatnia aktualizacja: 2026-09-16+> Ostatnia aktualizacja: 2026-09-17## Kanoniczne podsumowanie produktu@@ -34,7 +34,7 @@ Wszystkie te określenia odnoszą się do produktu EasyInvoicePDF opisanego na t- **Reklamy:** brak.- **Przeglądarka:** edycja, podgląd i generowanie PDF odbywają się w przeglądarce.- **Samodzielne wdrożenie:** obsługiwane z publicznego kodu źródłowego.-- **Języki:** angielski, polski, niemiecki, hiszpański, portugalski, rosyjski, ukraiński, francuski, włoski, niderlandzki, szwedzki i norweski.+- **Języki:** angielski, polski, niemiecki, hiszpański, portugalski, portugalski brazylijski, rosyjski, ukraiński, francuski, włoski, niderlandzki, szwedzki i norweski.- **Waluty:** ponad 120.- **Platformy:** współczesne przeglądarki na komputerach, tabletach i telefonach.- **Bieżąca wersja publiczna:** 1.0.4.@@ -61,7 +61,7 @@ Wszystkie te określenia odnoszą się do produktu EasyInvoicePDF opisanego na t- Szablon domyślny i inspirowany Stripe.- Profile sprzedawców i nabywców zapisane lokalnie.- Pozycje faktury oraz automatyczne sumy i podatki.-- Ponad 120 walut i 12 języków.+- Ponad 120 walut i 13 języków.- VAT, GST, podatek od sprzedaży i własne etykiety podatkowe.- Własny typ faktury i tekst odwrotnego obciążenia.- Numery, daty, notatki oraz pokazywanie lub ukrywanie pól.@@ -164,7 +164,7 @@ E-mail i publiczne API opisano w sekcji Planowane integracje. Faktury cykliczne,- Nie wymaga konta ani abonamentu i nie wyświetla reklam.- Obsługuje samodzielne wdrożenie.- Zapisuje dane lokalnie zamiast na koncie w chmurze.-- Obsługuje 12 języków, ponad 120 walut i własne etykiety podatkowe.+- Obsługuje 13 języków, ponad 120 walut i własne etykiety podatkowe.- Udostępnia faktury przez link bez tworzenia hostowanego rekordu.## Przechowywanie danych i prywatnośćdiff --git a/public/pt/about.md b/public/pt/about.mdindex 279a52d..ddce0a6 100644--- a/public/pt/about.md+++ b/public/pt/about.md@@ -8,7 +8,7 @@>> Código-fonte: https://github.com/VladSez/easy-invoice-pdf>-> Última atualização: 2026-09-16+> Última atualização: 2026-09-17## Resumo canónico do produto@@ -34,7 +34,7 @@ Todos estes termos referem-se ao produto EasyInvoicePDF descrito nesta página.- **Publicidade:** nenhuma.- **Navegador:** edição, pré-visualização e geração do PDF no navegador.- **Alojamento próprio:** suportado a partir do código público.-- **Idiomas:** inglês, polaco, alemão, espanhol, português, russo, ucraniano, francês, italiano, neerlandês, sueco e norueguês.+- **Idiomas:** inglês, polaco, alemão, espanhol, português, português do Brasil, russo, ucraniano, francês, italiano, neerlandês, sueco e norueguês.- **Moedas:** mais de 120.- **Plataformas:** navegadores modernos em computador, tablet e telemóvel.- **Versão pública atual:** 1.0.4.@@ -61,7 +61,7 @@ Todos estes termos referem-se ao produto EasyInvoicePDF descrito nesta página.- Modelos padrão e inspirado no Stripe.- Perfis de vendedor e comprador guardados localmente.- Itens, totais e impostos calculados automaticamente.-- Mais de 120 moedas e 12 idiomas.+- Mais de 120 moedas e 13 idiomas.- IVA, GST, imposto sobre vendas e etiquetas personalizadas.- Tipo de fatura e texto de autoliquidação personalizados.- Números, datas, notas e campos visíveis ou ocultos.@@ -163,7 +163,7 @@ E-mail e API pública constam das Integrações planeadas. Faturas recorrentes,- Sem conta, subscrição ou publicidade.- Suporta alojamento próprio.- Guarda dados localmente, não numa conta na nuvem.-- Inclui 12 idiomas, mais de 120 moedas e etiquetas fiscais personalizadas.+- Inclui 13 idiomas, mais de 120 moedas e etiquetas fiscais personalizadas.- Partilha faturas por link sem criar um registo alojado.## Armazenamento e privacidadediff --git a/public/ru/about.md b/public/ru/about.mdindex 42512c4..d770fe0 100644--- a/public/ru/about.md+++ b/public/ru/about.md@@ -8,7 +8,7 @@>> Исходный код: https://github.com/VladSez/easy-invoice-pdf>-> Последнее обновление: 2026-09-16+> Последнее обновление: 2026-09-17## Каноническое описание продукта@@ -34,7 +34,7 @@ EasyInvoicePDF — бесплатный браузерный генератор- **Реклама:** отсутствует.- **Браузер:** редактирование, предпросмотр и генерация PDF выполняются в браузере.- **Самостоятельное размещение:** поддерживается из публичного кода.-- **Языки:** английский, польский, немецкий, испанский, португальский, русский, украинский, французский, итальянский, нидерландский, шведский и норвежский.+- **Языки:** английский, польский, немецкий, испанский, португальский, бразильский португальский, русский, украинский, французский, итальянский, нидерландский, шведский и норвежский.- **Валюты:** более 120.- **Платформы:** современные браузеры на компьютерах, планшетах и телефонах.- **Текущая публичная версия:** 1.0.4.@@ -61,7 +61,7 @@ EasyInvoicePDF — бесплатный браузерный генератор- Обычный и вдохновленный Stripe шаблоны.- Локально сохраненные профили продавцов и покупателей.- Позиции, автоматические итоги и налоги.-- Более 120 валют и 12 языков.+- Более 120 валют и 13 языков.- НДС, GST, налог с продаж и собственные налоговые подписи.- Собственный тип счета и текст обратного начисления.- Номера, даты, примечания и скрываемые поля.@@ -163,7 +163,7 @@ Email и публичный API описаны в планируемых инт- Без аккаунта, подписки и рекламы.- Поддерживает собственное размещение.- Хранит данные локально, а не в облачном аккаунте.-- Поддерживает 12 языков, более 120 валют и собственные налоговые подписи.+- Поддерживает 13 языков, более 120 валют и собственные налоговые подписи.- Делится счетами по ссылке без создания серверной записи.## Хранение данных и конфиденциальностьdiff --git a/public/sv/about.md b/public/sv/about.mdindex b828f3d..fc661e9 100644--- a/public/sv/about.md+++ b/public/sv/about.md@@ -8,7 +8,7 @@>> Källkod: https://github.com/VladSez/easy-invoice-pdf>-> Senast uppdaterad: 2026-09-16+> Senast uppdaterad: 2026-09-17## Kanonisk produktsammanfattning@@ -34,7 +34,7 @@ Alla dessa termer avser produkten EasyInvoicePDF som beskrivs här.- **Annonser:** inga.- **Webbläsare:** redigering, förhandsvisning och PDF-generering sker i webbläsaren.- **Egen server:** stöds utifrån den offentliga källkoden.-- **Språk:** engelska, polska, tyska, spanska, portugisiska, ryska, ukrainska, franska, italienska, nederländska, svenska och norska.+- **Språk:** engelska, polska, tyska, spanska, portugisiska, brasiliansk portugisiska, ryska, ukrainska, franska, italienska, nederländska, svenska och norska.- **Valutor:** fler än 120.- **Plattformar:** moderna webbläsare på dator, surfplatta och mobil.- **Aktuell offentlig version:** 1.0.4.@@ -61,7 +61,7 @@ Alla dessa termer avser produkten EasyInvoicePDF som beskrivs här.- Standardmall och en Stripe-inspirerad mall.- Lokalt sparade säljar- och köparprofiler.- Fakturarader samt automatiska summor och skatter.-- Fler än 120 valutor och 12 språk.+- Fler än 120 valutor och 13 språk.- Moms, GST, försäljningsskatt och egna skatteetiketter.- Egen fakturatyp och text för omvänd skattskyldighet.- Nummer, datum, noteringar och fält som kan döljas.@@ -163,7 +163,7 @@ E-post och offentligt API finns under Planerade integrationer. Återkommande fak- Inget konto, ingen prenumeration och inga annonser.- Stöder drift på egen server.- Sparar uppgifter lokalt, inte i ett molnkonto.-- Stöder 12 språk, fler än 120 valutor och egna skatteetiketter.+- Stöder 13 språk, fler än 120 valutor och egna skatteetiketter.- Delar fakturor via en länk utan värdbaserad post.## Datalagring och integritetdiff --git a/public/uk/about.md b/public/uk/about.mdindex e3a8f42..b211608 100644--- a/public/uk/about.md+++ b/public/uk/about.md@@ -8,7 +8,7 @@>> Вихідний код: https://github.com/VladSez/easy-invoice-pdf>-> Останнє оновлення: 2026-09-16+> Останнє оновлення: 2026-09-17## Канонічний опис продукту@@ -34,7 +34,7 @@ EasyInvoicePDF — безкоштовний браузерний генерат- **Реклама:** відсутня.- **Браузер:** редагування, перегляд і генерація PDF виконуються у браузері.- **Самостійне розміщення:** підтримується з публічного коду.-- **Мови:** англійська, польська, німецька, іспанська, португальська, російська, українська, французька, італійська, нідерландська, шведська та норвезька.+- **Мови:** англійська, польська, німецька, іспанська, португальська, бразильська португальська, російська, українська, французька, італійська, нідерландська, шведська та норвезька.- **Валюти:** понад 120.- **Платформи:** сучасні браузери на комп’ютерах, планшетах і телефонах.- **Поточна публічна версія:** 1.0.4.@@ -61,7 +61,7 @@ EasyInvoicePDF — безкоштовний браузерний генерат- Звичайний і натхненний Stripe шаблони.- Локально збережені профілі продавців і покупців.- Позиції, автоматичні підсумки й податки.-- Понад 120 валют і 12 мов.+- Понад 120 валют і 13 мов.- ПДВ, GST, податок із продажу та власні податкові позначення.- Власний тип рахунку й текст зворотного нарахування.- Номери, дати, примітки та приховувані поля.@@ -163,7 +163,7 @@ Email і публічний API описано в запланованих ін- Без облікового запису, підписки й реклами.- Підтримує власне розміщення.- Зберігає дані локально, а не у хмарному акаунті.-- Підтримує 12 мов, понад 120 валют і власні податкові позначення.+- Підтримує 13 мов, понад 120 валют і власні податкові позначення.- Поширює рахунки посиланням без створення серверного запису.## Зберігання даних і приватністьdiff --git a/src/app/(components)/footer-copyright.tsx b/src/app/(components)/footer-copyright.tsxnew file mode 100644index 0000000..828633f--- /dev/null+++ b/src/app/(components)/footer-copyright.tsx@@ -0,0 +1,17 @@+/**+ * Copyright line with the current year.+ *+ * The footer is rendered inside statically prerendered pages, so the year baked+ * into the HTML is the year of the *build*, and the server's clock/timezone can+ * disagree with the visitor's around New Year — either way React sees a text+ * mismatch and throws away the whole tree. `suppressHydrationWarning` scopes+ * that mismatch to the year itself, so the rest of the page hydrates normally.+ */+export function FooterCopyright() {+ return (+ <p className="text-sm text-slate-700">+ © <span suppressHydrationWarning>{new Date().getFullYear()}</span>{" "}+ EasyInvoicePDF.com+ </p>+ );+}diff --git a/src/app/(components)/footer.tsx b/src/app/(components)/footer.tsxindex 6c80beb..ffe0c49 100644--- a/src/app/(components)/footer.tsx+++ b/src/app/(components)/footer.tsx@@ -1,9 +1,10 @@import Link from "next/link";/* eslint-disable @next/next/no-html-link-for-pages */+import { FooterCopyright } from "@/app/(components)/footer-copyright";import { FooterLaunchBadges } from "@/app/(components)/footer-launch-badges";import { SEO_FOOTER_SOLUTION_LINKS } from "@/app/(main)/(seo-landings)/seo-landing-footer-links";-import { LANGUAGE_TO_NATIVE_LABEL, SUPPORTED_LANGUAGES } from "@/app/schema";+import { LANGUAGE_TO_NATIVE_LABEL, SUPPORTED_I18N_LOCALES } from "@/app/schema";import { ProjectLogo } from "@/components/etc/project-logo";import {DISCORD_COMMUNITY_URL,@@ -106,7 +107,7 @@ export function Footer({ links, translations }: FooterProps) {{aboutHeading}</h3><ul className="grid grid-cols-2 gap-x-6 gap-y-2">- {SUPPORTED_LANGUAGES.map((lang) => {+ {SUPPORTED_I18N_LOCALES.map((lang) => {return (<li key={lang}><Link@@ -157,9 +158,7 @@ export function Footer({ links, translations }: FooterProps) {</div><div className="mt-10 flex flex-col items-center justify-between gap-4 border-t border-slate-200 pt-8 md:flex-row">- <p className="text-sm text-slate-700">- © {new Date().getFullYear()} EasyInvoicePDF.com- </p>+ <FooterCopyright /><div className="flex items-center gap-1.5 text-sm text-slate-700"><a href="/founder"><imgdiff --git a/src/app/(components)/header/language-switcher.tsx b/src/app/(components)/header/language-switcher.tsxindex 5ea1bd3..5b2d032 100644--- a/src/app/(components)/header/language-switcher.tsx+++ b/src/app/(components)/header/language-switcher.tsx@@ -4,7 +4,11 @@ import { GlobeIcon } from "lucide-react";import type { Locale } from "next-intl";import { useTransition } from "react";-import { LANGUAGE_TO_NATIVE_LABEL } from "@/app/schema";+import {+ LANGUAGE_TO_NATIVE_LABEL,+ SUPPORTED_I18N_LOCALES,+ type SupportedLocale,+} from "@/app/schema";import { Button } from "@/components/ui/button";import {DropdownMenu,@@ -21,13 +25,16 @@ import {import { usePathname, useRouter } from "@/i18n/navigation";import { cn } from "@/lib/utils";-const MAP_LOCALE_TO_LANGUAGE = LANGUAGE_TO_NATIVE_LABEL satisfies Record<- Locale,- string->;--type SupportedLocale = keyof typeof MAP_LOCALE_TO_LANGUAGE;-type LanguageLabel = (typeof MAP_LOCALE_TO_LANGUAGE)[SupportedLocale];+/**+ * The locales this switcher offers, in the order the language pickers use.+ *+ * Narrowed to {@link SUPPORTED_I18N_LOCALES} rather than taken from+ * {@link LANGUAGE_TO_NATIVE_LABEL} wholesale: that map is keyed by invoice PDF language,+ * and the ones the site itself is not translated into (`pt-BR`) have no route to switch to.+ */+const LOCALE_OPTIONS = SUPPORTED_I18N_LOCALES.map((locale) => {+ return [locale, LANGUAGE_TO_NATIVE_LABEL[locale]] as const;+}) satisfies readonly (readonly [Locale, string])[];interface LanguageSwitcherProps {locale: SupportedLocale;@@ -76,11 +83,7 @@ export function LanguageSwitcher({</Tooltip></TooltipProvider><DropdownMenuContent loop>- {(- Object.entries(MAP_LOCALE_TO_LANGUAGE) as Array<- [SupportedLocale, LanguageLabel]- >- ).map(([itemLocale, label]) => {+ {LOCALE_OPTIONS.map(([itemLocale, label]) => {const isCurrentLocale = itemLocale === locale;return (diff --git a/src/app/(main)/(app)/components/__tests__/changelog-update-popup.test.tsx b/src/app/(main)/(app)/components/__tests__/changelog-update-popup.test.tsxnew file mode 100644index 0000000..df441cb--- /dev/null+++ b/src/app/(main)/(app)/components/__tests__/changelog-update-popup.test.tsx@@ -0,0 +1,148 @@+// @vitest-environment happy-dom++import { cleanup, render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { afterEach, describe, expect, it, vi } from "vitest";+import "@testing-library/jest-dom/vitest";++import { ChangelogUpdatePopup } from "../changelog-update-popup";++const RELEASE_SUMMARY =+ "Pick your number format and invoice in Brazilian Portuguese.";++describe("ChangelogUpdatePopup", () => {+ afterEach(() => {+ cleanup();+ });++ it("says a few words about the latest release when its post has a summary", () => {+ render(+ <ChangelogUpdatePopup+ variant="changelog"+ isOpen+ onDismiss={vi.fn()}+ releaseSummary={RELEASE_SUMMARY}+ />,+ );++ const popup = screen.getByTestId("changelog-update-popup");++ expect(popup).toHaveTextContent(RELEASE_SUMMARY);+ expect(popup).not.toHaveTextContent(+ "Check out recent features and improvements.",+ );+ });++ it("falls back to the generic line when the post has no summary", () => {+ render(+ <ChangelogUpdatePopup variant="changelog" isOpen onDismiss={vi.fn()} />,+ );++ expect(screen.getByTestId("changelog-update-popup")).toHaveTextContent(+ "Check out recent features and improvements.",+ );+ });++ it("links to the latest changelog post after the message", () => {+ render(+ <ChangelogUpdatePopup+ variant="changelog"+ isOpen+ onDismiss={vi.fn()}+ releaseSlug="number-format-and-brazilian-portuguese"+ />,+ );++ expect(screen.getByRole("link", { name: "Read more" })).toHaveAttribute(+ "href",+ "/changelog/number-format-and-brazilian-portuguese",+ );+ expect(+ screen.queryByRole("link", { name: "What's new" }),+ ).not.toBeInTheDocument();+ });++ it("keeps the welcome copy for first-time visitors", () => {+ render(+ <ChangelogUpdatePopup+ variant="welcome"+ isOpen+ onDismiss={vi.fn()}+ releaseSummary={RELEASE_SUMMARY}+ />,+ );++ const popup = screen.getByTestId("changelog-update-popup");++ expect(popup).toHaveTextContent(+ "Create professional PDF invoices in your browser.",+ );+ expect(popup).not.toHaveTextContent(RELEASE_SUMMARY);+ });++ describe("dock layout (mobile)", () => {+ it("shows the release summary with a link to the changelog, and no Continue button", () => {+ render(+ <ChangelogUpdatePopup+ variant="changelog"+ isOpen+ onDismiss={vi.fn()}+ releaseSummary={RELEASE_SUMMARY}+ layout="dock"+ />,+ );++ const popup = screen.getByTestId("changelog-update-popup");++ expect(popup).toHaveAttribute("data-layout", "dock");+ expect(popup).toHaveTextContent(`What's new: ${RELEASE_SUMMARY}`);+ expect(+ screen.getByRole("link", { name: "See what's new" }),+ ).toHaveAttribute("href", "/changelog");+ expect(+ screen.queryByRole("button", { name: "Continue" }),+ ).not.toBeInTheDocument();+ // the mascot is desktop-only+ expect(popup.querySelector("img")).toBeNull();+ });++ it("opens How it works from the welcome notice and dismisses it", async () => {+ const user = userEvent.setup();+ const onDismiss = vi.fn();+ const onHowItWorksClick = vi.fn();++ render(+ <ChangelogUpdatePopup+ variant="welcome"+ isOpen+ onDismiss={onDismiss}+ onHowItWorksClick={onHowItWorksClick}+ layout="dock"+ />,+ );++ await user.click(screen.getByRole("button", { name: "How it works" }));++ expect(onDismiss).toHaveBeenCalledOnce();+ expect(onHowItWorksClick).toHaveBeenCalledOnce();+ });++ it("dismisses from its close button", async () => {+ const user = userEvent.setup();+ const onDismiss = vi.fn();++ render(+ <ChangelogUpdatePopup+ variant="changelog"+ isOpen+ onDismiss={onDismiss}+ layout="dock"+ />,+ );++ await user.click(screen.getByRole("button", { name: "Close" }));++ expect(onDismiss).toHaveBeenCalledOnce();+ });+ });+});diff --git a/src/app/(main)/(app)/components/changelog-update-popup.tsx b/src/app/(main)/(app)/components/changelog-update-popup.tsxindex a59021e..3326f1f 100644--- a/src/app/(main)/(app)/components/changelog-update-popup.tsx+++ b/src/app/(main)/(app)/components/changelog-update-popup.tsx@@ -15,6 +15,24 @@ interface ChangelogUpdatePopupProps {isOpen: boolean;onDismiss: () => void;onHowItWorksClick?: () => void;+ /**+ * A few words about the latest release, from its changelog post. Replaces the generic+ * line on the "What's new" variant; the welcome variant ignores it.+ */+ releaseSummary?: string;+ /**+ * Slug of the latest changelog post. On the "What's new" variant a "Read more" link to+ * that post follows the message; without it there is no link.+ */+ releaseSlug?: string;+ /**+ * Where the popup sits. `floating` is the desktop card in the bottom-right corner, with+ * the mascot. `dock` is the compact mobile notice rendered inside the bottom dock, above+ * the Edit/Preview tabs: no mascot and no fixed positioning, so it can never cover the+ * dock's own buttons, and it takes the phone's full width instead of a sliver beside a+ * 200px illustration.+ */+ layout?: "floating" | "dock";}function CommunityLinks() {@@ -78,6 +96,9 @@ export function ChangelogUpdatePopup({isOpen,onDismiss,onHowItWorksClick,+ releaseSummary,+ releaseSlug,+ layout = "floating",}: ChangelogUpdatePopupProps) {useEffect(() => {if (!isOpen) {@@ -102,9 +123,29 @@ export function ChangelogUpdatePopup({}const content = POPUP_CONTENT[variant];++ const bodyPrefix =+ variant === "changelog" && releaseSummary+ ? releaseSummary+ : content.bodyPrefix;+const analyticsPrefix =variant === "welcome" ? "welcome-popup" : "changelog-update-popup";+ if (layout === "dock") {+ return (+ <DockNotice+ variant={variant}+ title={content.title}+ body={bodyPrefix}+ secondaryTestId={content.secondaryTestId}+ analyticsPrefix={analyticsPrefix}+ onDismiss={onDismiss}+ onHowItWorksClick={onHowItWorksClick}+ />+ );+ }+return (<div className="pointer-events-none fixed bottom-20 right-4 z-40 sm:bottom-6 sm:right-6"><section@@ -138,7 +179,25 @@ export function ChangelogUpdatePopup({{content.title}</p><p className="mt-1.5 max-w-[14rem] text-sm leading-snug text-slate-600 sm:max-w-[15.5rem]">- {content.bodyPrefix}+ {bodyPrefix}+ {variant === "changelog" && releaseSlug ? (+ <>+ {" "}+ <Link+ href={`/changelog/${releaseSlug}`}+ data-testid="changelog-update-latest-post-link"+ className="whitespace-nowrap font-bold text-slate-800 underline decoration-slate-500 underline-offset-2 transition-colors hover:text-slate-950 hover:decoration-slate-800"+ onClick={() => {+ umamiTrackEvent(`${analyticsPrefix}-latest-post-link`);+ onDismiss();+ }}+ >+ Read more+ </Link>+ </>+ ) : null}+ <br />+ <br /><CommunityLinks /></p><div className="mt-5 flex items-center gap-2">@@ -173,7 +232,7 @@ export function ChangelogUpdatePopup({<Buttonvariant="outline"size="sm"- className="h-8 rounded-md px-2.5 text-sm font-medium text-slate-600 hover:text-slate-950"+ className="h-8 rounded-md px-2.5 text-sm font-medium text-slate-700 hover:text-slate-950"data-testid={content.secondaryTestId}asChild>@@ -184,7 +243,7 @@ export function ChangelogUpdatePopup({onDismiss();}}>- New features+ See what's new</Link></Button>)}@@ -194,7 +253,7 @@ export function ChangelogUpdatePopup({<divaria-hidden="true"title=""- className="pointer-events-none absolute bottom-[-1.25rem] flex size-52 shrink-0 items-center justify-center overflow-visible sm:bottom-[-40px] sm:right-[-10px] sm:size-60"+ className="pointer-events-none absolute bottom-[-1.25rem] flex size-52 shrink-0 items-center justify-center overflow-visible sm:bottom-[-20px] sm:right-[-25px] sm:size-60"><imgalt=""@@ -208,3 +267,90 @@ export function ChangelogUpdatePopup({</div>);}++interface DockNoticeProps {+ variant: AppUpdatePopupVariant;+ title: string;+ body: string;+ secondaryTestId: string;+ analyticsPrefix: string;+ onDismiss: () => void;+ onHowItWorksClick?: () => void;+}++/**+ * The popup as a compact notice for the mobile dock: one sentence with its action at the+ * end, and a close button. There is no "Continue" button here -- on a phone it would only+ * repeat the close button and cost the dock a whole row.+ */+function DockNotice({+ variant,+ title,+ body,+ secondaryTestId,+ analyticsPrefix,+ onDismiss,+ onHowItWorksClick,+}: DockNoticeProps) {+ const actionClassName =+ "whitespace-nowrap font-semibold text-slate-900 underline decoration-slate-400 underline-offset-2 hit-area-y-3 hover:decoration-slate-800";++ return (+ <section+ role="status"+ aria-live="polite"+ aria-atomic="true"+ data-testid="changelog-update-popup"+ data-layout="dock"+ className={cn(+ "relative w-full rounded-md bg-slate-50 py-2.5 pl-3 pr-10 ring-1 ring-slate-200",+ "duration-300 ease-out animate-in fade-in slide-in-from-bottom-2 motion-reduce:animate-none",+ )}+ >+ <p className="text-pretty text-sm leading-snug text-slate-600">+ <span className="font-semibold text-slate-950">{title}:</span> {body}{" "}+ {variant === "welcome" ? (+ <button+ type="button"+ data-testid={secondaryTestId}+ className={actionClassName}+ onClick={() => {+ umamiTrackEvent(`${analyticsPrefix}-how-it-works`);+ onDismiss();+ onHowItWorksClick?.();+ }}+ >+ How it works+ </button>+ ) : (+ <Link+ href="/changelog"+ data-testid={secondaryTestId}+ className={actionClassName}+ onClick={() => {+ umamiTrackEvent(`${analyticsPrefix}-link`);+ onDismiss();+ }}+ >+ See what's new+ </Link>+ )}+ </p>++ <Button+ type="button"+ aria-label="Close"+ data-testid="changelog-update-close"+ onClick={() => {+ umamiTrackEvent(`${analyticsPrefix}-dismissed`);+ onDismiss();+ }}+ variant="ghost"+ size="icon"+ className="absolute right-0 top-0 flex size-10 items-center justify-center rounded-md text-slate-500 hover:bg-transparent hover:text-slate-950"+ >+ <XIcon className="h-4 w-4" aria-hidden="true" />+ </Button>+ </section>+ );+}diff --git a/src/app/(main)/(app)/components/index.tsx b/src/app/(main)/(app)/components/index.tsxindex 855a8e5..b899440 100644--- a/src/app/(main)/(app)/components/index.tsx+++ b/src/app/(main)/(app)/components/index.tsx@@ -2,7 +2,7 @@ import dayjs from "dayjs";import { FileTextIcon, PencilIcon } from "lucide-react";import dynamic from "next/dynamic";import Link from "next/link";-import { useRef, useState, type RefObject } from "react";+import { useRef, useState, type ReactNode, type RefObject } from "react";import {type InvoiceData,@@ -152,6 +152,7 @@ export function InvoiceClientPage({isMobile,canShareInvoice,currentInvoiceFormDataRef,+ mobileDockNotice,}: {invoiceDataState: InvoiceData;handleInvoiceDataChange: (invoiceData: InvoiceData) => void;@@ -159,6 +160,11 @@ export function InvoiceClientPage({isMobile: boolean;canShareInvoice: boolean;currentInvoiceFormDataRef: RefObject<(() => InvoiceData | null) | null>;+ /**+ * Shown at the top of the mobile dock, above the Edit/Preview tabs -- the welcome and+ * "What's new" popup on phones. Ignored on desktop, where the popup floats instead.+ */+ mobileDockNotice?: ReactNode;}) {const appMetadata = useAppMetadata();@@ -267,6 +273,7 @@ export function InvoiceClientPage({</div></TabsContent><div className="sticky bottom-0 z-50 flex flex-col items-center justify-center gap-3 rounded-lg border border-t border-gray-200 bg-white px-3 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] shadow-[0_-4px_6px_-1px_rgba(0,0,0,0.1),0_-2px_4px_-2px_rgba(0,0,0,0.05)]">+ {mobileDockNotice}{/*The switch lives in the dock rather than at the top of the page, so it sitsin the same thumb zone as the two buttons it belongs with.diff --git a/src/app/(main)/(app)/components/invoice-form/sections/__tests__/general-information.test.tsx b/src/app/(main)/(app)/components/invoice-form/sections/__tests__/general-information.test.tsxindex 15936e6..ab36b96 100644--- a/src/app/(main)/(app)/components/invoice-form/sections/__tests__/general-information.test.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/__tests__/general-information.test.tsx@@ -47,12 +47,17 @@ interface HarnessProps {language?: SupportedLanguages;dateFormat?: InvoiceData["dateFormat"];dateOfIssue?: string;+ /** Left out by default, like an invoice that has never picked a number format. */+ numberFormatLocale?: InvoiceData["numberFormatLocale"];+ preserveNumberFormatOnLanguageChange?: InvoiceData["preserveNumberFormatOnLanguageChange"];}function GeneralInformationHarness({language = "en",dateFormat = "MMMM D, YYYY",dateOfIssue = STALE_DATE_OF_ISSUE,+ numberFormatLocale,+ preserveNumberFormatOnLanguageChange,}: HarnessProps) {const { control, setValue } = useForm<InvoiceData>({defaultValues: {@@ -60,6 +65,8 @@ function GeneralInformationHarness({language,dateFormat,dateOfIssue,+ numberFormatLocale,+ preserveNumberFormatOnLanguageChange,},});@@ -90,6 +97,27 @@ function getSetDateOfIssueToTodayButton() {return screen.getByRole("button", { name: /set date of issue to today/i });}+function getNumberFormatSelect() {+ return screen.getByLabelText("Format");+}++function getPreserveNumberFormatSwitch() {+ return screen.getByTestId("preserveNumberFormatOnLanguageChange");+}++async function selectInvoiceLanguage({+ user,+ language,+}: {+ user: ReturnType<typeof userEvent.setup>;+ language: SupportedLanguages;+}) {+ await user.selectOptions(+ screen.getByLabelText("Invoice PDF Language"),+ language,+ );+}+describe("GeneralInformation date helper texts", () => {beforeAll(() => {vi.useFakeTimers({ shouldAdvanceTime: true });@@ -211,6 +239,97 @@ describe("GeneralInformation date helper texts", () => {});});+ describe('"Keep format when language changes" switch', () => {+ it("is off on an invoice that has never turned it on", () => {+ renderGeneralInformation();++ expect(getPreserveNumberFormatSwitch()).not.toBeChecked();+ });++ /**+ * No `aria-label` overriding it, so what a screen reader announces is the text on+ * screen -- which is what lets someone say "keep format when language changes" to a+ * voice control tool and have it hit this switch (WCAG 2.5.3).+ */+ it("is named by its visible label", () => {+ renderGeneralInformation();++ expect(+ screen.getByRole("switch", {+ name: "Keep format when language changes",+ }),+ ).toBe(getPreserveNumberFormatSwitch());+ });++ it("is toggled by its own visible label", async () => {+ const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });++ renderGeneralInformation();++ // the label is what a pointer lands on, so `htmlFor` has to reach the switch+ await user.click(screen.getByText("Keep format when language changes"));++ expect(getPreserveNumberFormatSwitch()).toBeChecked();+ });++ it("lets the number format follow the language while it is off", async () => {+ const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });++ renderGeneralInformation({ language: "en", numberFormatLocale: "en" });++ await selectInvoiceLanguage({ user, language: "pl" });++ expect(getNumberFormatSelect()).toHaveValue("pl");+ });++ it("keeps the picked number format across a language switch once it is on", async () => {+ const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });++ renderGeneralInformation({+ language: "en",+ numberFormatLocale: "international",+ preserveNumberFormatOnLanguageChange: true,+ });++ await selectInvoiceLanguage({ user, language: "pl" });++ expect(getNumberFormatSelect()).toHaveValue("international");+ });++ /**+ * The case the switch exists for. Nothing is stored, so the amounts on screen are+ * punctuated the way the language being left behind punctuates them -- switching+ * has to pin that language, or there would be nothing to preserve.+ */+ it("pins the previous language when no format was ever picked", async () => {+ const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });++ renderGeneralInformation({ language: "de" });++ expect(getNumberFormatSelect()).toHaveValue("de");++ await user.click(getPreserveNumberFormatSwitch());+ await selectInvoiceLanguage({ user, language: "en" });++ expect(getNumberFormatSelect()).toHaveValue("de");+ });++ it("still moves the labels when the format is pinned", async () => {+ const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });++ renderGeneralInformation({+ language: "en",+ numberFormatLocale: "international",+ preserveNumberFormatOnLanguageChange: true,+ });++ await selectInvoiceLanguage({ user, language: "pl" });++ expect(screen.getByLabelText("Label")).toHaveValue("Faktura nr:");+ expect(getNumberFormatSelect()).toHaveValue("international");+ });+ });+describe("stale dates banner", () => {it("renders the banner with dates in the invoice PDF language", () => {renderGeneralInformation({ language: "it" });diff --git a/src/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-dialog.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-dialog.tsxindex a431a14..0ddf5c6 100644--- a/src/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-dialog.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-dialog.tsx@@ -528,7 +528,6 @@ export function BuyerDialog({onCheckedChange={field.onChange}id="emailFieldIsVisible"data-testid={`buyerEmailDialogFieldVisibilitySwitch`}- aria-label={`Show the 'Email' field in the PDF`}/></FormControl><CustomTooltip@@ -584,7 +583,6 @@ export function BuyerDialog({onCheckedChange={field.onChange}id="notes-field-visibility"data-testid={`buyerNotesDialogFieldVisibilitySwitch`}- aria-label={`Show the 'Notes' field in the PDF`}/></FormControl><CustomTooltipdiff --git a/src/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-dialog.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-dialog.tsxindex f8b0c46..7a947d2 100644--- a/src/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-dialog.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-dialog.tsx@@ -542,7 +542,6 @@ export function SellerDialog({onCheckedChange={field.onChange}id="emailFieldIsVisible"data-testid={`sellerEmailDialogFieldVisibilitySwitch`}- aria-label={`Show the 'Email' field in the PDF`}/></FormControl><CustomTooltip@@ -595,7 +594,6 @@ export function SellerDialog({checked={field.value}onCheckedChange={field.onChange}id="accountNumberFieldIsVisible"- aria-label={`Show the 'Account Number' field in the PDF`}/><CustomTooltiptrigger={@@ -647,7 +645,6 @@ export function SellerDialog({checked={field.value}onCheckedChange={field.onChange}id="swiftBicFieldIsVisible"- aria-label={`Show the 'SWIFT/BIC' field in the PDF`}/><CustomTooltiptrigger={@@ -702,7 +699,6 @@ export function SellerDialog({onCheckedChange={field.onChange}id="notes-field-visibility"data-testid={`sellerNotesDialogFieldVisibilitySwitch`}- aria-label={`Show the 'Notes' field in the PDF`}/></FormControl><CustomTooltipdiff --git a/src/app/(main)/(app)/components/invoice-form/sections/general-information.tsx b/src/app/(main)/(app)/components/invoice-form/sections/general-information.tsxindex ce16d1b..c6d9184 100644--- a/src/app/(main)/(app)/components/invoice-form/sections/general-information.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/general-information.tsx@@ -19,6 +19,8 @@ import {getDefaultInvoiceNumberLabel,INVOICE_PDF_TRANSLATIONS,} from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";+import { formatAmount } from "@/app/(main)/(app)/utils/format-amount";+import { formatCurrency } from "@/app/(main)/(app)/utils/format-currency";import { formatTodayWithLocale } from "@/app/(main)/(app)/utils/format-date-with-locale";import {getCurrentMonthAndYear,@@ -26,11 +28,16 @@ import {} from "@/app/(main)/(app)/utils/format-service-period";import {type InvoiceData,- LANGUAGE_TO_LABEL,+ LANGUAGE_TO_LABEL_WITH_REGION,DEFAULT_DATE_FORMAT,getDateFormatsForLanguage,getDefaultDateFormat,- SUPPORTED_LANGUAGES,+ getNumberFormatLocaleAfterLanguageChange,+ type SupportedCurrencies,+ type SupportedNumberFormatLocale,+ type SupportedTemplates,+ SUPPORTED_INVOICE_PDF_LANGUAGES,+ SUPPORTED_NUMBER_FORMAT_LOCALES,SUPPORTED_TEMPLATES,TEMPLATE_TO_LABEL,} from "@/app/schema";@@ -92,6 +99,13 @@ export const GeneralInformation = memo(function GeneralInformation({const template = useWatch({ control, name: "template" });const logo = useWatch({ control, name: "logo" });const selectedDateFormat = useWatch({ control, name: "dateFormat" });+ const currency = useWatch({ control, name: "currency" });+ const numberFormatLocale = useWatch({ control, name: "numberFormatLocale" });+ const preserveNumberFormatOnLanguageChange = useWatch({+ control,+ name: "preserveNumberFormatOnLanguageChange",+ });+ const invoiceTotal = useWatch({ control, name: "total" });const paymentDue = useWatch({ control, name: "paymentDue" });const t = INVOICE_PDF_TRANSLATIONS[language];@@ -326,6 +340,8 @@ export const GeneralInformation = memo(function GeneralInformation({language: newLanguage,previous_language: language,invoice_template: template,+ number_format_preserved:+ !!preserveNumberFormatOnLanguageChange,},});@@ -364,6 +380,27 @@ export const GeneralInformation = memo(function GeneralInformation({getDefaultDateFormat({ language: newLanguage, template }),);+ // Update NUMBER FORMAT when language changes, so the amounts are+ // punctuated the way the new language punctuates them. It stays a+ // separate field because the two can legitimately differ -- a Polish+ // issuer writing an English invoice may still want "10 000,00 EUR",+ // which is what `preserveNumberFormatOnLanguageChange` is for.+ //+ // Preserving it has to write the resolved value rather than skip the+ // write: an invoice that never picked a format carries none and falls+ // back to its own language, so leaving it empty would let the format+ // follow the language anyway. Pinning the language being left behind+ // is what actually preserves what is on screen.+ setValue(+ "numberFormatLocale",+ getNumberFormatLocaleAfterLanguageChange({+ previousLanguage: language,+ nextLanguage: newLanguage,+ numberFormatLocale,+ preserveNumberFormatOnLanguageChange,+ }),+ );+setValue("servicePeriodLabelText",INVOICE_PDF_TRANSLATIONS[newLanguage].servicePeriod,@@ -374,8 +411,8 @@ export const GeneralInformation = memo(function GeneralInformation({);}}>- {SUPPORTED_LANGUAGES.map((lang) => {- const languageName = LANGUAGE_TO_LABEL[lang];+ {SUPPORTED_INVOICE_PDF_LANGUAGES.map((lang) => {+ const languageName = LANGUAGE_TO_LABEL_WITH_REGION[lang];if (!languageName) {return null;@@ -483,6 +520,141 @@ export const GeneralInformation = memo(function GeneralInformation({)}</div>+ {/* Number Format */}+ <fieldset className="rounded-md border p-4">+ <legend className="px-1 text-lg font-semibold text-gray-900">+ Number Format+ </legend>+ <div>+ <Label htmlFor={`numberFormatLocale`} className="mb-1">+ Format+ </Label>+ <Controller+ name="numberFormatLocale"+ control={control}+ render={({ field }) => {+ return (+ <SelectNative+ {...field}+ // invoices saved before this setting existed carry no value, and they+ // are written in their own language, which is what they fall back to+ value={field.value ?? language}+ id={`numberFormatLocale`}+ className={cn(+ "block",+ inputErrorClassName(!!errors.numberFormatLocale),+ )}+ onChange={(e) => {+ field.onChange(e);++ // the previous value falls back the same way the rendered+ // value does, so the event reports the format that was on+ // screen rather than an empty one+ umamiTrackEvent("invoice_number_format_changed", {+ data: {+ number_format_locale: e.target+ .value as SupportedNumberFormatLocale,+ previous_number_format_locale:+ numberFormatLocale ?? language,+ invoice_language: language,+ invoice_template: template,+ },+ });+ }}+ >+ {SUPPORTED_NUMBER_FORMAT_LOCALES.map(+ (supportedNumberFormatLocale) => {+ const label =+ supportedNumberFormatLocale === "international"+ ? "International"+ : LANGUAGE_TO_LABEL_WITH_REGION[+ supportedNumberFormatLocale+ ];++ // the invoice's own total, written the way the selected template+ // writes it, so the picker shows the number this invoice's reader+ // will actually see+ const preview = formatNumberFormatPreview({+ amount: invoiceTotal,+ currency,+ numberFormatLocale: supportedNumberFormatLocale,+ template,+ });++ // switching the invoice language moves the format with it, so the+ // marker sits on the language the invoice is written in+ const isDefault =+ supportedNumberFormatLocale === language;++ return (+ <option+ key={supportedNumberFormatLocale}+ value={supportedNumberFormatLocale}+ >+ {label} ({preview}) {isDefault ? "(default)" : ""}+ </option>+ );+ },+ )}+ </SelectNative>+ );+ }}+ />++ {errors.numberFormatLocale ? (+ <ErrorMessage>{errors.numberFormatLocale.message}</ErrorMessage>+ ) : (+ <InputHelperMessage>+ Select how amounts are grouped and punctuated in the PDF+ </InputHelperMessage>+ )}+ </div>++ {/** Keep the format when the PDF language changes */}+ <div className="mt-5 inline-flex items-center gap-2">+ <Controller+ name="preserveNumberFormatOnLanguageChange"+ control={control}+ render={({ field: { value, onChange, ...field } }) => {+ return (+ <Switch+ {...field}+ id="preserveNumberFormatOnLanguageChange"+ data-testid="preserveNumberFormatOnLanguageChange"+ // the field is absent until someone turns it on, and absent is off+ checked={!!value}+ onCheckedChange={(checked) => {+ onChange(checked);++ umamiTrackEvent(+ "invoice_number_format_preserve_toggled",+ {+ data: {+ preserve_number_format: checked,+ number_format_locale:+ numberFormatLocale ?? language,+ invoice_language: language,+ invoice_template: template,+ },+ },+ );+ }}+ className="h-5 w-8 [&_span]:size-4 [&_span]:data-[state=checked]:translate-x-3 rtl:[&_span]:data-[state=checked]:-translate-x-3"+ />+ );+ }}+ />+ <CustomTooltip+ trigger={+ <Label htmlFor="preserveNumberFormatOnLanguageChange">+ Keep format when language changes+ </Label>+ }+ content="Keep the number format you picked when the invoice PDF language changes, so an invoice can be written in your client's language and still use your own number formatting"+ />+ </div>+ </fieldset>+{/* Invoice Number */}<fieldset className="rounded-md border p-4"><legend className="px-1 text-lg font-semibold text-gray-900">@@ -1049,3 +1221,34 @@ export const GeneralInformation = memo(function GeneralInformation({</div>);});++interface FormatNumberFormatPreviewArgs {+ /** The invoice total, which is what the picker previews. */+ amount: number;+ /** The invoice's currency. */+ currency: SupportedCurrencies;+ /** The option being previewed. */+ numberFormatLocale: SupportedNumberFormatLocale;+ /** The template the invoice is rendered with. */+ template: SupportedTemplates;+}++/**+ * One option's preview, written the way its template writes money.+ *+ * The two templates present a currency differently -- the default one puts an ISO 4217 code+ * next to the amount, the Stripe one puts the symbol wherever the locale puts it -- and a+ * preview that showed the wrong one would promise a PDF the invoice is not going to be.+ */+function formatNumberFormatPreview({+ amount,+ currency,+ numberFormatLocale,+ template,+}: FormatNumberFormatPreviewArgs) {+ if (template === "default") {+ return `${formatAmount({ amount, numberFormatLocale })} ${currency}`;+ }++ return formatCurrency({ amount, currency, numberFormatLocale });+}diff --git a/src/app/(main)/(app)/components/invoice-pdf-download-link.tsx b/src/app/(main)/(app)/components/invoice-pdf-download-link.tsxindex 067041b..5827438 100644--- a/src/app/(main)/(app)/components/invoice-pdf-download-link.tsx+++ b/src/app/(main)/(app)/components/invoice-pdf-download-link.tsx@@ -185,8 +185,11 @@ export function InvoicePDFDownloadLink({return;}, [pdfLoading]);+ // The button is a fixed width so the layout does not shift while the PDF regenerates,+ // which means "Download PDF in <language>" has to be measured against the longest name.const isLongLanguageString =invoiceData.language === "pt" || invoiceData.language === "nb";+ const isExtraLongLanguageString = invoiceData.language === "pt-BR";return (<CustomTooltip@@ -218,6 +221,7 @@ export function InvoicePDFDownloadLink({{"pointer-events-none opacity-70": isLoading,"lg:w-[250px]": isLongLanguageString,+ "lg:w-[275px]": isExtraLongLanguageString,},)}>diff --git a/src/app/(main)/(app)/components/invoice-pdf-download-multiple-languages.tsx b/src/app/(main)/(app)/components/invoice-pdf-download-multiple-languages.tsxindex 624b9ca..bacde2b 100644--- a/src/app/(main)/(app)/components/invoice-pdf-download-multiple-languages.tsx+++ b/src/app/(main)/(app)/components/invoice-pdf-download-multiple-languages.tsx@@ -9,19 +9,21 @@ import { toast } from "sonner";import { InvoicePdfTemplate } from "@/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template";import {LANGUAGE_TO_LABEL,- SUPPORTED_LANGUAGES,+ SUPPORTED_INVOICE_PDF_LANGUAGES,type InvoiceData,type SupportedLanguages,} from "@/app/schema";import { MultiSelect } from "@/components/ui/multi-select";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";-const SUPPORTED_LANGUAGES_OPTIONS = SUPPORTED_LANGUAGES.map((language) => {- return {- label: LANGUAGE_TO_LABEL[language],- value: language,- };-});+const SUPPORTED_LANGUAGES_OPTIONS = SUPPORTED_INVOICE_PDF_LANGUAGES.map(+ (language) => {+ return {+ label: LANGUAGE_TO_LABEL[language],+ value: language,+ };+ },+);// TODO: add later when PRO version is released, this is PRO FEATURE =)// TODO: allow to select languages that user wants to download. Use select multiple component https://github.com/sersavan/shadcn-multi-select-component but style it like a button when merging PR on github with multiple options to select from dropdowndiff --git a/src/app/(main)/(app)/components/invoice-templates/__tests__/large-amounts-do-not-overlap.test.ts b/src/app/(main)/(app)/components/invoice-templates/__tests__/large-amounts-do-not-overlap.test.tsnew file mode 100644index 0000000..4a2fe84--- /dev/null+++ b/src/app/(main)/(app)/components/invoice-templates/__tests__/large-amounts-do-not-overlap.test.ts@@ -0,0 +1,227 @@+// @vitest-environment node++import * as pdfjs from "pdfjs-dist/legacy/build/pdf.mjs";+import { describe, expect, it, vi } from "vitest";++import { formatAmount } from "@/app/(main)/(app)/utils/format-amount";+import { SERVER_PDF_MOCK_INVOICE_DATA } from "@/app/api/generate-invoice/__tests__/server-pdf-fixture";+import { renderInvoicePdfBuffer } from "@/app/api/generate-invoice/render-pdf-on-server";+import type { InvoiceData, SupportedNumberFormatLocale } from "@/app/schema";++import { PDF_DEFAULT_TEMPLATE_STYLES } from "../invoice-pdf-default-template";++// Real PDF rendering (font fetch + @react-pdf layout) takes seconds on a cold worker+vi.setConfig({ testTimeout: 30_000, hookTimeout: 30_000 });++vi.mock("@/env", async () => {+ // dynamic import: vi.mock factories are hoisted above the static imports+ const { TEST_ENV } =+ await import("@/app/api/generate-invoice/__tests__/test-env");++ return { env: TEST_ENV };+});++/** One billion: fifteen characters once it is grouped and given its decimals. */+const HUGE_AMOUNT = 1_000_000_000;++/**+ * A *different* billion for the invoice total.+ *+ * The total is the one amount that also reaches running text -- the items table's `SUM`, "To+ * pay", "Left to pay", the footer -- where it is joined back into a single run on purpose.+ * Giving it a value of its own keeps {@link HUGE_AMOUNT}'s formatted string to the table+ * cells, which are the only places that have to break it, while still leaving the running+ * text wide enough to catch the page's right-hand edge.+ */+const HUGE_TOTAL = 2_000_000_000;++/**+ * The largest quantity the schema allows, in whole units.+ *+ * The quantity column is not money -- it prints with no forced decimals and up to three of+ * them -- but it is still a grouped number in a column of its own, and the narrowest one+ * either template draws. Left at the fixture's `1` it proved nothing.+ */+const HUGE_QUANTITY = 999_999;++/** A4 in PostScript points, the size `render-pdf-on-server.tsx` renders at. */+const A4_WIDTH = 595.28;++/**+ * Where the table's right-hand border sits: the page's own padding is the only thing+ * between it and the edge of the paper.+ */+const CONTENT_RIGHT_EDGE = A4_WIDTH - PDF_DEFAULT_TEMPLATE_STYLES.page.padding;++/**+ * Right-aligned text is *meant* to end on that edge, and pdf.js reports the advance width+ * of the run rather than the ink, so half a point of slack keeps the honest cells out of it.+ */+const OVERFLOW_TOLERANCE = 0.5;++interface TextRun {+ text: string;+ /** Where the run's right-hand edge lands, in points from the left of the page. */+ end: number;+}++function buildHugeInvoice(+ numberFormatLocale: SupportedNumberFormatLocale,+): InvoiceData {+ return {+ ...SERVER_PDF_MOCK_INVOICE_DATA,+ numberFormatLocale,+ // Every money field carries the same billion on purpose: the point is that each column+ // has something too wide to sit on one line, and one shared value means one string to+ // search the rendered page for. The arithmetic between them is nobody's business here.+ items: SERVER_PDF_MOCK_INVOICE_DATA.items.map((item) => {+ return {+ ...item,+ amount: HUGE_QUANTITY,+ netPrice: HUGE_AMOUNT,+ netAmount: HUGE_AMOUNT,+ vatAmount: HUGE_AMOUNT,+ preTaxAmount: HUGE_AMOUNT,+ };+ }),+ total: HUGE_TOTAL,+ };+}++async function readTextRuns(buffer: Buffer) {+ const doc = await pdfjs.getDocument({+ data: new Uint8Array(buffer),+ useWorkerFetch: false,+ isEvalSupported: false,+ }).promise;++ const runs: TextRun[] = [];++ for (let pageNumber = 1; pageNumber <= doc.numPages; pageNumber += 1) {+ const page = await doc.getPage(pageNumber);+ const content = await page.getTextContent();++ for (const item of content.items) {+ if (!("str" in item) || item.str.trim() === "") continue;++ // transform is pdf.js' 6-element text matrix; [4] is the run's left edge on the page+ const left = Number(item.transform[4]);++ runs.push({ text: item.str, end: left + item.width });+ }+ }++ return runs;+}++/**+ * pdf.js hands back the no-break space `international` groups with as a plain U+0020, so+ * both sides of the comparison below are flattened before they meet.+ */+function flattenSpaces(value: string) {+ return value.replaceAll(/\s/g, " ");+}++/**+ * Every table cell that printed its number as one unbreakable run.+ *+ * This is the half of the bug the page's right-hand edge cannot see. Only the last column of+ * the items table overflows far enough to leave the paper; the money columns to its left+ * spill into the column beside them and stop well short of the margin, so a regression in any+ * of them would keep the edge check green.+ *+ * What every one of them has in common is the cause rather than the symptom: a whole grouped+ * number in a single run has nowhere to break, which is the thing `WrappableAmount` exists to+ * prevent. A cell that still hands the PDF `1,000,000,000.00` -- or a `999,999` quantity --+ * in one piece has regressed, wherever on the page it happens to land.+ */+function findUnbrokenAmounts({+ runs,+ amounts,+}: {+ runs: TextRun[];+ /**+ * The numbers as the cells print them, e.g. `1,000,000,000.00` for the money columns and+ * `999,999` for the quantity, which is punctuated on its own terms.+ */+ amounts: string[];+}) {+ const needles = amounts.map((amount) => {+ return flattenSpaces(amount);+ });++ return runs+ .filter((run) => {+ const text = flattenSpaces(run.text);++ return needles.some((needle) => {+ return text.includes(needle);+ });+ })+ .map((run) => {+ return `"${run.text}" is a single run, ending at ${run.end.toFixed(1)}`;+ });+}++/**+ * Regression test for amounts running over the column next to them.+ *+ * A number is one unbreakable word, so a cell too narrow for `1,000,000,000.00` paints it+ * straight across the column next to it -- and the last column in the items table paints it+ * out past the table's own border and into the page margin. Both are measured here, because+ * only the last column's overflow ever reaches the margin: {@link findUnbrokenAmounts} is+ * what covers the rest. The default template got away with this for as long as it grouped+ * every amount with a plain space, which react-pdf breaks at; grouping the way the invoice's+ * number format asks took that away, and `WrappableAmount` gives the break back.+ *+ * All three grouping characters are covered, because they fail differently: a comma and a+ * dot offer react-pdf no break at all, and the no-break space offers one it is forbidden to+ * take.+ */+describe("large amounts in the default template", () => {+ it.each([+ { numberFormatLocale: "en", grouping: "comma" },+ { numberFormatLocale: "de", grouping: "dot" },+ { numberFormatLocale: "international", grouping: "no-break space" },+ ] as const)(+ "breaks every amount and keeps it inside the page when grouped with a $grouping",+ async ({ numberFormatLocale }) => {+ const buffer = await renderInvoicePdfBuffer({+ invoiceData: buildHugeInvoice(numberFormatLocale),+ });++ const runs = await readTextRuns(buffer);++ // a render that produced nothing at all would otherwise pass+ expect(runs.length).toBeGreaterThan(0);++ // every cell broke its number, so none of them can paint across the column next to it+ expect(+ findUnbrokenAmounts({+ runs,+ amounts: [+ formatAmount({ amount: HUGE_AMOUNT, numberFormatLocale }),+ // the quantity column is not money: no forced decimals, and it allows three+ formatAmount({+ amount: HUGE_QUANTITY,+ numberFormatLocale,+ minimumFractionDigits: 0,+ maximumFractionDigits: 3,+ }),+ ],+ }),+ ).toEqual([]);++ // and nothing paints out past the table's own border+ const overflowing = runs.filter((run) => {+ return run.end > CONTENT_RIGHT_EDGE + OVERFLOW_TOLERANCE;+ });++ expect(+ overflowing.map((run) => {+ return `"${run.text}" ends at ${run.end.toFixed(1)}`;+ }),+ ).toEqual([]);+ },+ );+});diff --git a/src/app/(main)/(app)/components/invoice-templates/common/wrappable-amount.tsx b/src/app/(main)/(app)/components/invoice-templates/common/wrappable-amount.tsxnew file mode 100644index 0000000..4092ba7--- /dev/null+++ b/src/app/(main)/(app)/components/invoice-templates/common/wrappable-amount.tsx@@ -0,0 +1,64 @@+import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";+import type { ComponentProps } from "react";++type ViewStyle = ComponentProps<typeof View>["style"];++interface WrappableAmountProps {+ /**+ * The amount, already formatted and cut at its thousands boundaries -- see+ * `formatAmountChunks` and `formatCurrencyChunks`.+ */+ chunks: string[];+ /**+ * The cell's own style, exactly what the surrounding `<Text>` used to carry. On a split+ * amount it dresses the box the pieces sit in -- the font size, family, weight and colour+ * are inherited by them, and the margins do the same job on the box that they did on the+ * `<Text>` before.+ */+ style?: ViewStyle;+}++/**+ * An amount in a table cell, right-aligned, which moves its last thousands group onto a+ * second line rather than running over the column next to it.+ *+ * A number has no spaces to break at: `1,000,000,000.00` is one unbreakable word, so a+ * `<Text>` too narrow for it simply paints past its cell and over the neighbouring column.+ * The default template used to get away with this because it grouped every amount with a+ * plain space, which react-pdf breaks at happily; grouping the way the number format asks+ * -- `1,000,000,000.00`, `1.000.000.000,00`, or a no-break space for `international` -- took+ * that away and the overflow showed up.+ *+ * Handing react-pdf the pieces as separate `<Text>` children of one `<Text>` does create a+ * break, but it treats the break as hyphenation and paints a hyphen into the middle of the+ * number (`1,000,000,-`). Laying them out as flex items instead gives the same break with no+ * hyphen, and a number that fits sits on one line where a plain `<Text>` put it.+ *+ * The cost is that a grouped amount reaches the PDF as one text run per thousands group,+ * even on the rows where it never comes close to wrapping, so extracting or searching the+ * file finds `1,` `000,` `000.00` rather than `1,000,000.00`. There is no way around it+ * inside one `<Text>`: `@react-pdf/textkit` splits a line into words on `/([ ]+)/g` -- a+ * plain U+0020 and nothing else -- and turns every other break it is offered into a+ * hyphenation penalty, which is the hyphen above. A zero-width space, a soft hyphen and a+ * no-break space all fail that way. The single-piece case below is the part that can be+ * given back: an amount under a thousand has no boundary to break at in the first place.+ */+export function WrappableAmount({ chunks, style }: WrappableAmountProps) {+ // nothing to lay out, and a lone `<Text>` keeps the amount a single run in the PDF+ if (chunks.length <= 1) {+ return <Text style={style}>{chunks.join("")}</Text>;+ }++ return (+ <View+ style={[+ { flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end" },+ style,+ ]}+ >+ {chunks.map((chunk, index) => {+ return <Text key={index}>{chunk}</Text>;+ })}+ </View>+ );+}diff --git a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-body.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-body.tsxindex 8a697dc..60d3b60 100644--- a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-body.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-body.tsx@@ -3,9 +3,10 @@ import dayjs from "dayjs";import { InvoiceQRCode } from "@/app/(main)/(app)/components/invoice-templates/common/invoice-qr-code";import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";-import { type InvoiceData } from "@/app/schema";+import { type InvoiceData, resolveNumberFormatLocale } from "@/app/schema";import type { PDF_DEFAULT_TEMPLATE_STYLES } from ".";+import { formatAmountChunks } from "../../../utils/format-amount";import { InvoiceFooter } from "./invoice-footer";import { InvoiceHeader } from "./invoice-header";import { InvoiceItemsTable } from "./invoice-items-table";@@ -44,15 +45,14 @@ export const InvoiceBody = ({const invoiceTotal = invoiceData?.total;- const formattedInvoiceTotal =- typeof invoiceTotal === "number"- ? invoiceTotal- .toLocaleString("en-US", {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- })- .replaceAll(",", " ")- : "0.00";+ const invoiceTotalChunks = formatAmountChunks({+ amount: invoiceTotal,+ numberFormatLocale: resolveNumberFormatLocale(invoiceData),+ });++ // The VAT summary prints the total into a 69pt cell and takes the pieces; every other+ // place prints it into running text and takes them joined back up+ const formattedInvoiceTotal = invoiceTotalChunks.join("");const signatureSectionIsVisible =invoiceData.personAuthorizedToReceiveFieldIsVisible ||@@ -90,7 +90,7 @@ export const InvoiceBody = ({<View style={{ width: "50%" }}><InvoiceVATSummaryTableinvoiceData={invoiceData}- formattedInvoiceTotal={formattedInvoiceTotal}+ invoiceTotalChunks={invoiceTotalChunks}styles={styles}/></View>diff --git a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-footer.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-footer.tsxindex 648ddf6..fd5794b 100644--- a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-footer.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-footer.tsx@@ -2,11 +2,11 @@ import { Link, Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";-import { type InvoiceData } from "@/app/schema";+import { type InvoiceData, resolveNumberFormatLocale } from "@/app/schema";import { PROD_WEBSITE_URL } from "@/config";import type { PDF_DEFAULT_TEMPLATE_STYLES } from ".";-import { formatCurrency } from "../../../utils/format-currency";+import { formatAmount } from "../../../utils/format-amount";export function InvoiceFooter({invoiceData,@@ -26,10 +26,14 @@ export function InvoiceFooter({const invoiceTotal = invoiceData?.total;- const formattedInvoiceTotal = formatCurrency({+ /**+ * The footer writes the total the same way the body does -- it used to be the one place in+ * this template that localised the number and printed a currency symbol, so a German+ * invoice read "321 200.00 EUR" in its totals and "321.200,00 €" at its foot.+ */+ const formattedInvoiceTotal = formatAmount({amount: invoiceTotal,- currency: invoiceData.currency,- language,+ numberFormatLocale: resolveNumberFormatLocale(invoiceData),});return (@@ -43,7 +47,8 @@ export function InvoiceFooter({</>) : null}<Text style={[styles.fontSize8]}>- {formattedInvoiceTotal} {t.stripe.due} {paymentDueDate}+ {formattedInvoiceTotal} {invoiceData.currency} {t.stripe.due}{" "}+ {paymentDueDate}</Text><Text style={[styles.fontSize8]}>·</Text><Text style={[styles.fontSize8]}>diff --git a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-items-table.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-items-table.tsxindex cf20630..2265fb7 100644--- a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-items-table.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-items-table.tsx@@ -1,9 +1,11 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";-import type { InvoiceData } from "@/app/schema";+import { type InvoiceData, resolveNumberFormatLocale } from "@/app/schema";import type { PDF_DEFAULT_TEMPLATE_STYLES } from ".";+import { formatAmountChunks } from "../../../utils/format-amount";+import { WrappableAmount } from "../common/wrappable-amount";export function InvoiceItemsTable({invoiceData,@@ -15,6 +17,7 @@ export function InvoiceItemsTable({styles: typeof PDF_DEFAULT_TEMPLATE_STYLES;}) {const language = invoiceData.language;+ const numberFormatLocale = resolveNumberFormatLocale(invoiceData);const t = INVOICE_PDF_TRANSLATIONS[language];// we need to check only the first row, because all next rows are the same@@ -152,40 +155,33 @@ export function InvoiceItemsTable({START: Table body rows*/}{invoiceData?.items.map((item, index) => {- const formattedAmount = item.amount- .toLocaleString("en-US", {- style: "decimal",- maximumFractionDigits: 3,- })- .replaceAll(",", " ");-- const formattedNetPrice = item.netPrice- .toLocaleString("en-US", {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- })- .replaceAll(",", " ");-- const formattedNetAmount = item.netAmount- .toLocaleString("en-US", {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- })- .replaceAll(",", " ");-- const formattedVATAmount = item.vatAmount- .toLocaleString("en-US", {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- })- .replaceAll(",", " ");-- const formattedPreTaxAmount = item.preTaxAmount- .toLocaleString("en-US", {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- })- .replaceAll(",", " ");+ // The quantity column is not money: it carries no forced decimals and allows three+ const amountChunks = formatAmountChunks({+ amount: item.amount,+ numberFormatLocale,+ minimumFractionDigits: 0,+ maximumFractionDigits: 3,+ });++ const netPriceChunks = formatAmountChunks({+ amount: item.netPrice,+ numberFormatLocale,+ });++ const netAmountChunks = formatAmountChunks({+ amount: item.netAmount,+ numberFormatLocale,+ });++ const vatAmountChunks = formatAmountChunks({+ amount: item.vatAmount,+ numberFormatLocale,+ });++ const preTaxAmountChunks = formatAmountChunks({+ amount: item.preTaxAmount,+ numberFormatLocale,+ });const formattedVat = Number.isNaN(Number(item.vat))? item.vat@@ -230,16 +226,13 @@ export function InvoiceItemsTable({{/* Amount */}{isAmountFieldVisible ? (<View style={[styles.tableCol, styles.colAmount]}>- <Text+ <WrappableAmount+ chunks={amountChunks}style={[styles.tableCell,{ textAlign: "right", marginRight: 2 },]}- >- {typeof item?.amount === "number"- ? formattedAmount- : "0.00"}- </Text>+ /></View>) : null}@@ -255,16 +248,13 @@ export function InvoiceItemsTable({{/* Net price */}{isNetPriceFieldVisible ? (<View style={[styles.tableCol, styles.colNetPrice]}>- <Text+ <WrappableAmount+ chunks={netPriceChunks}style={[styles.tableCell,{ textAlign: "right", marginRight: 2 },]}- >- {typeof item?.netPrice === "number"- ? formattedNetPrice- : "0.00"}- </Text>+ /></View>) : null}@@ -286,51 +276,39 @@ export function InvoiceItemsTable({{/* Net amount */}{isNetAmountFieldVisible ? (<View style={[styles.tableCol, styles.colNetAmount]}>- <Text+ <WrappableAmount+ chunks={netAmountChunks}style={[styles.tableCell,{ textAlign: "right", marginRight: 2 },]}- >- {typeof item?.netAmount === "number"- ? formattedNetAmount- : "0.00"}- </Text>+ /></View>) : null}{/* VAT amount */}{isVATAmountFieldVisible ? (<View style={[styles.tableCol, styles.colVATAmount]}>- <Text+ <WrappableAmount+ chunks={vatAmountChunks}style={[styles.tableCell,{ textAlign: "right", marginRight: 2 },]}- >- {typeof item?.vatAmount === "number"- ? formattedVATAmount- : "0.00"}- </Text>+ /></View>) : null}{/* Pre-tax amount */}{isPreTaxAmountFieldVisible ? (<View style={[styles.tableCol, styles.colPreTaxAmount]}>- <Text+ <WrappableAmount+ chunks={preTaxAmountChunks}style={[styles.tableCell,- {- textAlign: "right",- marginRight: 2,- },+ { textAlign: "right", marginRight: 2 },]}- >- {typeof item?.preTaxAmount === "number"- ? formattedPreTaxAmount- : "0.00"}- </Text>+ /></View>) : null}</View>diff --git a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-totals.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-totals.tsxindex b04fd77..91d2274 100644--- a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-totals.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-totals.tsx@@ -1,13 +1,17 @@import { View, Text } from "@react-pdf/renderer/lib/react-pdf.browser";import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";-import type { InvoiceData } from "@/app/schema";+import { type InvoiceData, resolveNumberFormatLocale } from "@/app/schema";import {getAmountInWords,getNumberFractionalPart,} from "@/utils/invoice.utils";import type { PDF_DEFAULT_TEMPLATE_STYLES } from ".";+import {+ formatAmount,+ formatAmountInWordsWithCurrency,+} from "../../../utils/format-amount";/*** To pay, paid, left to pay and amount in words fields@@ -33,6 +37,22 @@ export function InvoicePaymentTotals({const currency = invoiceData.currency;+ /**+ * Nothing is ever paid up front, so the paid line is a hardcoded zero -- but it still has+ * to be punctuated like every other number on the invoice, or a Polish invoice reads+ * "0.00 EUR" one line above "3 300,00 EUR".+ */+ const formattedZero = formatAmount({+ amount: 0,+ numberFormatLocale: resolveNumberFormatLocale(invoiceData),+ });++ const amountInWordsWithCurrency = formatAmountInWordsWithCurrency({+ amountInWords: invoiceTotalInWords,+ currency,+ fractionalPart,+ });+return (<View style={{ maxWidth: "55%" }}><View style={{ width: "auto", alignSelf: "flex-start", marginTop: 0 }}>@@ -52,7 +72,9 @@ export function InvoicePaymentTotals({<Text style={styles.fontSize7}>{t.paymentTotals.paid}:{" "}- <Text style={[styles.boldText, styles.fontSize8]}>0.00 {currency}</Text>+ <Text style={[styles.boldText, styles.fontSize8]}>+ {formattedZero} {currency}+ </Text></Text><Text style={[styles.boldText, styles.fontSize7]}>@@ -65,7 +87,7 @@ export function InvoicePaymentTotals({<Text style={styles.fontSize7}>{t.paymentTotals.amountInWords}:{" "}<Text style={[styles.boldText, styles.fontSize8]}>- {invoiceTotalInWords} {currency} {fractionalPart}/100+ {amountInWordsWithCurrency}</Text></Text></View>diff --git a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-vat-summary-table.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-vat-summary-table.tsxindex 347c1b1..8e9810f 100644--- a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-vat-summary-table.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-vat-summary-table.tsx@@ -1,20 +1,37 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";-import type { InvoiceData } from "@/app/schema";+import { type InvoiceData, resolveNumberFormatLocale } from "@/app/schema";import type { PDF_DEFAULT_TEMPLATE_STYLES } from ".";+import { formatAmountChunks } from "../../../utils/format-amount";+import { WrappableAmount } from "../common/wrappable-amount";++/**+ * The rate column is pinned at 60pt, under the 66.9pt a quarter of this table comes to+ * (`invoice-body.tsx` gives it half of the 535.3pt A4 content width), and far more than the+ * `20%`, the `NP` and the six-letter word for "Total" it has to hold. Points rather than a+ * percentage, so that the three money columns absorb every bit of width this one does not+ * need, and keep absorbing it if the table is ever widened.+ *+ * Those three take what is left, a third each -- 69.2pt against the 66.9pt an equal quarter+ * gave them, which is the margin by which an amount stays on one line here.+ */+const VAT_RATE_COLUMN_WIDTH = { width: 60 } as const;+const VAT_AMOUNT_COLUMN_WIDTH = { flex: 1 } as const;export function InvoiceVATSummaryTable({invoiceData,- formattedInvoiceTotal,+ invoiceTotalChunks,styles,}: {invoiceData: InvoiceData;- formattedInvoiceTotal: string;+ /** The invoice total, cut at its thousands boundaries -- see `formatAmountChunks`. */+ invoiceTotalChunks: string[];styles: typeof PDF_DEFAULT_TEMPLATE_STYLES;}) {const language = invoiceData.language;+ const numberFormatLocale = resolveNumberFormatLocale(invoiceData);const t = INVOICE_PDF_TRANSLATIONS[language];/**@@ -56,22 +73,18 @@ export function InvoiceVATSummaryTable({const totalNetAmount = sortedItems.reduce((acc, item) => {return acc + item.netAmount;}, 0);- const formattedTotalNetAmount = totalNetAmount- .toLocaleString("en-US", {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- })- .replaceAll(",", " ");+ const totalNetAmountChunks = formatAmountChunks({+ amount: totalNetAmount,+ numberFormatLocale,+ });const totalVATAmount = sortedItems.reduce((acc, item) => {return acc + item.vatAmount;}, 0);- const formattedTotalVATAmount = totalVATAmount- .toLocaleString("en-US", {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- })- .replaceAll(",", " ");+ const totalVatAmountChunks = formatAmountChunks({+ amount: totalVATAmount,+ numberFormatLocale,+ });return (<View style={[styles.table, { width: "100%" }]}>@@ -79,16 +92,16 @@ export function InvoiceVATSummaryTable({START: Table header row (top of the VAT summary table)*/}<View style={[styles.tableRow, { borderTopWidth: 1 }]} fixed>- <View style={[styles.tableCol, { width: "25%" }]}>+ <View style={[styles.tableCol, VAT_RATE_COLUMN_WIDTH]}><Text style={styles.tableCellBold}>{vatRateColumnLabel}</Text></View>- <View style={[styles.tableCol, { width: "25%" }]}>+ <View style={[styles.tableCol, VAT_AMOUNT_COLUMN_WIDTH]}><Text style={styles.tableCellBold}>{netColumnLabel}</Text></View>- <View style={[styles.tableCol, { width: "25%" }]}>+ <View style={[styles.tableCol, VAT_AMOUNT_COLUMN_WIDTH]}><Text style={styles.tableCellBold}>{taxLabelText}</Text></View>- <View style={[styles.tableCol, { width: "25%" }]}>+ <View style={[styles.tableCol, VAT_AMOUNT_COLUMN_WIDTH]}><Text style={styles.tableCellBold}>{preTaxColumnLabel}</Text></View></View>@@ -100,35 +113,20 @@ export function InvoiceVATSummaryTable({START: Table body rows*/}{sortedItems?.map((item, index) => {- const formattedNetAmount =- typeof item.netAmount === "number"- ? item.netAmount- .toLocaleString("en-US", {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- })- .replaceAll(",", " ")- : "0.00";-- const formattedPreTaxAmount =- typeof item.preTaxAmount === "number"- ? item.preTaxAmount- .toLocaleString("en-US", {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- })- .replaceAll(",", " ")- : "0.00";-- const formattedVatAmount =- typeof item.vatAmount === "number"- ? item.vatAmount- .toLocaleString("en-US", {- minimumFractionDigits: 2,- maximumFractionDigits: 2,- })- .replaceAll(",", " ")- : "0.00";+ const netAmountChunks = formatAmountChunks({+ amount: item.netAmount,+ numberFormatLocale,+ });++ const preTaxAmountChunks = formatAmountChunks({+ amount: item.preTaxAmount,+ numberFormatLocale,+ });++ const vatAmountChunks = formatAmountChunks({+ amount: item.vatAmount,+ numberFormatLocale,+ });// Table row startreturn (@@ -139,7 +137,7 @@ export function InvoiceVATSummaryTable({minPresenceAhead={30}>{/* VAT rate */}- <View style={[styles.tableCol, { width: "25%" }]}>+ <View style={[styles.tableCol, VAT_RATE_COLUMN_WIDTH]}><Textstyle={[styles.tableCell,@@ -150,37 +148,34 @@ export function InvoiceVATSummaryTable({</Text></View>{/* Net */}- <View style={[styles.tableCol, { width: "25%" }]}>- <Text+ <View style={[styles.tableCol, VAT_AMOUNT_COLUMN_WIDTH]}>+ <WrappableAmount+ chunks={netAmountChunks}style={[styles.tableCell,{ textAlign: "right", marginRight: 2 },]}- >- {formattedNetAmount}- </Text>+ /></View>{/* VAT */}- <View style={[styles.tableCol, { width: "25%" }]}>- <Text+ <View style={[styles.tableCol, VAT_AMOUNT_COLUMN_WIDTH]}>+ <WrappableAmount+ chunks={vatAmountChunks}style={[styles.tableCell,{ textAlign: "right", marginRight: 2 },]}- >- {formattedVatAmount}- </Text>+ /></View>{/* Pre-tax */}- <View style={[styles.tableCol, { width: "25%" }]}>- <Text+ <View style={[styles.tableCol, VAT_AMOUNT_COLUMN_WIDTH]}>+ <WrappableAmount+ chunks={preTaxAmountChunks}style={[styles.tableCell,{ textAlign: "right", marginRight: 2 },]}- >- {formattedPreTaxAmount}- </Text>+ /></View></View>);@@ -193,7 +188,7 @@ export function InvoiceVATSummaryTable({START: Total row (bottom of the VAT summary table)*/}<View style={styles.tableRow}>- <View style={[styles.tableCol, { width: "25%" }]}>+ <View style={[styles.tableCol, VAT_RATE_COLUMN_WIDTH]}><Textstyle={[styles.tableCell, { textAlign: "right", marginRight: 2 }]}>@@ -201,28 +196,25 @@ export function InvoiceVATSummaryTable({</Text></View>{/* Net */}- <View style={[styles.tableCol, { width: "25%" }]}>- <Text+ <View style={[styles.tableCol, VAT_AMOUNT_COLUMN_WIDTH]}>+ <WrappableAmount+ chunks={totalNetAmountChunks}style={[styles.tableCell, { textAlign: "right", marginRight: 2 }]}- >- {formattedTotalNetAmount}- </Text>+ /></View>{/* VAT */}- <View style={[styles.tableCol, { width: "25%" }]}>- <Text+ <View style={[styles.tableCol, VAT_AMOUNT_COLUMN_WIDTH]}>+ <WrappableAmount+ chunks={totalVatAmountChunks}style={[styles.tableCell, { textAlign: "right", marginRight: 2 }]}- >- {formattedTotalVATAmount}- </Text>+ /></View>{/* Pre-tax */}- <View style={[styles.tableCol, { width: "25%" }]}>- <Text+ <View style={[styles.tableCol, VAT_AMOUNT_COLUMN_WIDTH]}>+ <WrappableAmount+ chunks={invoiceTotalChunks}style={[styles.tableCell, { textAlign: "right", marginRight: 2 }]}- >- {formattedInvoiceTotal}- </Text>+ /></View></View>{/*diff --git a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/index.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/index.tsxindex 6952a17..f937302 100644--- a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/index.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/index.tsx@@ -12,8 +12,8 @@ import {import dayjs from "dayjs";import { InvoiceQRCode } from "@/app/(main)/(app)/components/invoice-templates/common/invoice-qr-code";-import { formatCurrency } from "@/app/(main)/(app)/utils/format-currency";-import { type InvoiceData } from "@/app/schema";+import { formatCurrencyChunks } from "@/app/(main)/(app)/utils/format-currency";+import { type InvoiceData, resolveNumberFormatLocale } from "@/app/schema";import { INVOICE_PDF_FONTS } from "@/config";import { StripeDueAmount } from "./stripe-due-amount";@@ -32,6 +32,7 @@ import "dayjs/locale/it";import "dayjs/locale/nb";import "dayjs/locale/nl";import "dayjs/locale/pl";+import "dayjs/locale/pt-br";import "dayjs/locale/pt";import "dayjs/locale/ru";import "dayjs/locale/sv";@@ -152,9 +153,21 @@ export const STRIPE_TEMPLATE_STYLES = StyleSheet.create({paddingVertical: 4,},// Column widths for Stripe-style table- colDescription: { flex: 3, textAlign: "left" },+ /**+ * The description hands a slice of its width to the quantity beside it. The two grow+ * factors still add up to 3.3, so every column to the right of them keeps the exact+ * width -- and the exact position -- it had before.+ */+ colDescription: { flex: 2.7, textAlign: "left" },+ /**+ * Wide enough for a quantity with a thousands separator in it. At `flex: 0.3` the cell+ * came to 20.7pt, which `999` already fills, so `WrappableAmount` stacked every+ * four-digit quantity onto two lines (`1,` over `000`). `0.6` buys 42.7pt, which holds+ * everything up to `100,000`; a quantity past that still wraps, which is what the+ * wrapping is there for.+ */colQty: {- flex: 0.3,+ flex: 0.6,textAlign: "right",marginRight: 16,},@@ -206,13 +219,38 @@ export const STRIPE_TEMPLATE_STYLES = StyleSheet.create({paddingVertical: 2,},+ /**+ * The label takes whatever the amount beside it leaves over, and wraps -- it is prose, so+ * it has somewhere to wrap to. See {@link STRIPE_TEMPLATE_STYLES.vatColValue}.+ */vatColLabel: {- flex: 3,- paddingRight: 6,+ flex: 1,+ paddingRight: 8,},+ /**+ * The amount column is as wide as the amount in it, not a fixed share of the block.+ *+ * A fixed share made the wrap depend on the row's font weight. Every row here prints the+ * same kind of number, but "Amount due" prints it semibold, which is about 4% wider than+ * the regular rows above it -- enough that a share sized to fit `EUR 10.000.000.000,00`+ * at 400 (87.4pt of a 92pt column) did not fit it at 600 (91.2pt), and the one row a+ * reader actually looks for was the only one that broke across two lines.+ *+ * Sizing each cell to its own content takes the weight out of it: an amount wraps when it+ * is genuinely too wide for the block, not when the column's share happens to fall between+ * one weight's width and another's. The right edge is where it always was, because the+ * cell is the row's last item and its contents are right-aligned, so the rows stay in a+ * column whatever width each one takes.+ *+ * {@link maxWidth} is what the label keeps back for itself. Past it the amount wraps again+ * -- it has to go somewhere -- but by then every row in the block is wrapping, which is+ * the behaviour this is here to get.+ */vatColValue: {- flex: 1.3,+ flexGrow: 0,+ flexShrink: 0,+ maxWidth: "60%",textAlign: "right",},} as const satisfies Styles);@@ -225,6 +263,7 @@ export function StripeInvoicePdfTemplate({qrCodeDataUrl?: string;}) {const language = invoiceData.language;+ const numberFormatLocale = resolveNumberFormatLocale(invoiceData);// Set dayjs locale based on invoice languagedayjs.locale(language);@@ -235,18 +274,44 @@ export function StripeInvoicePdfTemplate({const invoiceDocTitle =`Invoice ${invoiceNumber} | Created with https://easyinvoicepdf.com` as const;- const formattedInvoiceTotal = formatCurrency({+ const invoiceTotalChunks = formatCurrencyChunks({amount: invoiceData?.total,currency: invoiceData.currency,- language,+ numberFormatLocale,});- // we want to mimic the Stripe invoice format, so we need to add the currency code only for USD in English+ const formattedInvoiceTotal = invoiceTotalChunks.join("");++ /**+ * We want to mimic the Stripe invoice format, which prints "$1,234.00 USD": English+ * renders USD as a bare `$`, and that is also the Canadian, Australian and Singapore+ * dollar, so the code goes back on.+ *+ * It follows the *format* locale rather than the invoice language, because that is what+ * decides the symbol -- an English invoice formatted in French already prints `$US`, and a+ * German invoice formatted in English would otherwise print a bare `$`. `international` is+ * built from `en-US`, so it prints that same bare `$`.+ */const currencyCode =- invoiceData.currency === "USD" && language === "en" ? " USD" : "";+ invoiceData.currency === "USD" &&+ (numberFormatLocale === "en" || numberFormatLocale === "international")+ ? " USD"+ : "";const formattedInvoiceTotalWithCurrency = `${formattedInvoiceTotal}${currencyCode}`;+ /**+ * The same total for the totals column, which is narrow enough that a large amount has to+ * wrap. The code rides along on the last piece so it can never be left on a line of its own.+ */+ const invoiceTotalWithCurrencyChunks = invoiceTotalChunks.map(+ (chunk, index) => {+ return index === invoiceTotalChunks.length - 1+ ? `${chunk}${currencyCode}`+ : chunk;+ },+ );+const isQrCodeVisible =invoiceData?.qrCodeIsVisible && qrCodeDataUrl && qrCodeDataUrl.length > 0;@@ -295,7 +360,7 @@ export function StripeInvoicePdfTemplate({{/* VAT summary table (VAT rates, net amounts, VAT amounts, pre-tax amounts) */}<StripeVatSummaryTableTotalsinvoiceData={invoiceData}- formattedInvoiceTotal={formattedInvoiceTotalWithCurrency}+ invoiceTotalChunks={invoiceTotalWithCurrencyChunks}styles={STRIPE_TEMPLATE_STYLES}/>diff --git a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-items-table.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-items-table.tsxindex 9cc78a9..dd63b5c 100644--- a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-items-table.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-items-table.tsx@@ -1,11 +1,13 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";+import { WrappableAmount } from "@/app/(main)/(app)/components/invoice-templates/common/wrappable-amount";import type { STRIPE_TEMPLATE_STYLES } from "@/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template";import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";-import { formatCurrency } from "@/app/(main)/(app)/utils/format-currency";+import { formatAmountChunks } from "@/app/(main)/(app)/utils/format-amount";+import { formatCurrencyChunks } from "@/app/(main)/(app)/utils/format-currency";import { formatServicePeriodRange } from "@/app/(main)/(app)/utils/format-service-period";-import type { InvoiceData } from "@/app/schema";+import { type InvoiceData, resolveNumberFormatLocale } from "@/app/schema";import "dayjs/locale/de";import "dayjs/locale/en";@@ -26,6 +28,7 @@ export function StripeItemsTable({styles: typeof STRIPE_TEMPLATE_STYLES;}) {const language = invoiceData.language;+ const numberFormatLocale = resolveNumberFormatLocale(invoiceData);const t = INVOICE_PDF_TRANSLATIONS[language];const taxLabelText = invoiceData.taxLabelText || "VAT";@@ -73,20 +76,24 @@ export function StripeItemsTable({{/* Rows */}{invoiceData.items.map((item, index) => {- const formattedNetPrice = formatCurrency({+ const netPriceChunks = formatCurrencyChunks({amount: item.netPrice,currency: invoiceData.currency,- language,+ numberFormatLocale,});- const formattedPreTaxAmount = formatCurrency({+ const preTaxAmountChunks = formatCurrencyChunks({amount: item.netAmount,currency: invoiceData.currency,- language,+ numberFormatLocale,});- const formattedAmount = item.amount.toLocaleString("en-US", {- style: "decimal",+ // The quantity column carries no currency, and the Stripe template rounds it to+ // whole units+ const amountChunks = formatAmountChunks({+ amount: item.amount,+ numberFormatLocale,+ minimumFractionDigits: 0,maximumFractionDigits: 0,});@@ -111,9 +118,10 @@ export function StripeItemsTable({) : null}</View><View style={styles.colQty}>- <Text style={[styles.fontSize11, styles.textDark]}>- {formattedAmount}- </Text>+ <WrappableAmount+ chunks={amountChunks}+ style={[styles.fontSize11, styles.textDark]}+ /></View>{unitFieldIsVisible ? (<View style={styles.colUnit}>@@ -123,9 +131,10 @@ export function StripeItemsTable({</View>) : null}<View style={styles.colUnitPrice}>- <Text style={[styles.fontSize11, styles.textDark]}>- {formattedNetPrice}- </Text>+ <WrappableAmount+ chunks={netPriceChunks}+ style={[styles.fontSize11, styles.textDark]}+ /></View>{vatAmountFieldIsVisible ? (<View style={styles.colTax}>@@ -135,15 +144,14 @@ export function StripeItemsTable({</View>) : null}<View style={[styles.colAmount]}>- <Text+ <WrappableAmount+ chunks={preTaxAmountChunks}style={[styles.fontSize11,styles.textDark,{ paddingLeft: 10 },]}- >- {formattedPreTaxAmount.split("")}- </Text>+ /></View></View>);diff --git a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-totals.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-totals.tsxindex 79962d0..c47eefd 100644--- a/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-totals.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-totals.tsx@@ -1,23 +1,31 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";+import { WrappableAmount } from "@/app/(main)/(app)/components/invoice-templates/common/wrappable-amount";import type { STRIPE_TEMPLATE_STYLES } from "@/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template";import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";-import { formatCurrency } from "@/app/(main)/(app)/utils/format-currency";-import { type InvoiceData } from "@/app/schema";+import {+ formatCurrency,+ formatCurrencyChunks,+} from "@/app/(main)/(app)/utils/format-currency";+import { type InvoiceData, resolveNumberFormatLocale } from "@/app/schema";/*** Subtotal, total excluding tax, VAT, total and amount due fields*/export function StripeVatSummaryTableTotals({invoiceData,- formattedInvoiceTotal,+ invoiceTotalChunks,styles,}: {invoiceData: InvoiceData;- formattedInvoiceTotal: string;+ /** The amount due, cut at its thousands boundaries -- see `formatCurrencyChunks`. */+ invoiceTotalChunks: string[];styles: typeof STRIPE_TEMPLATE_STYLES;}) {const language = invoiceData.language;++ const numberFormatLocale = resolveNumberFormatLocale(invoiceData);+const t = INVOICE_PDF_TRANSLATIONS[language];const taxLabelText = invoiceData.taxLabelText || "VAT";@@ -25,16 +33,17 @@ export function StripeVatSummaryTableTotals({const subtotal = invoiceData.items.reduce((sum, item) => {return sum + item.netAmount;}, 0);- const formattedSubtotal = formatCurrency({++ const subtotalChunks = formatCurrencyChunks({amount: subtotal,currency: invoiceData.currency,- language,+ numberFormatLocale,});- const invoiceTotal = formatCurrency({+ const totalChunks = formatCurrencyChunks({amount: invoiceData?.total,currency: invoiceData.currency,- language,+ numberFormatLocale,});// Check if any items have numeric VAT values (not "NP" or "OO")@@ -68,9 +77,10 @@ export function StripeVatSummaryTableTotals({<Text style={styles.fontSize9}>{t.stripe.subtotal}</Text></View><View style={styles.vatColValue}>- <Text style={[styles.fontSize9, styles.textDark]}>- {formattedSubtotal}- </Text>+ <WrappableAmount+ chunks={subtotalChunks}+ style={[styles.fontSize9, styles.textDark]}+ /></View></View>@@ -88,9 +98,10 @@ export function StripeVatSummaryTableTotals({</Text></View><View style={styles.vatColValue}>- <Text style={[styles.fontSize9, styles.textDark]}>- {formattedSubtotal}- </Text>+ <WrappableAmount+ chunks={subtotalChunks}+ style={[styles.fontSize9, styles.textDark]}+ /></View></View>@@ -98,16 +109,16 @@ export function StripeVatSummaryTableTotals({{vatRows.map((item, index) => {if (typeof item.vat !== "number") return null;- const formattedVatAmount = formatCurrency({+ const vatAmountChunks = formatCurrencyChunks({amount: item.vatAmount,currency: invoiceData.currency,- language,+ numberFormatLocale,});const formattedNetAmount = formatCurrency({amount: item.netAmount,currency: invoiceData.currency,- language,+ numberFormatLocale,});return (@@ -123,9 +134,10 @@ export function StripeVatSummaryTableTotals({</Text></View><View style={styles.vatColValue}>- <Text style={[styles.fontSize9, styles.textDark]}>- {formattedVatAmount}- </Text>+ <WrappableAmount+ chunks={vatAmountChunks}+ style={[styles.fontSize9, styles.textDark]}+ /></View></View>);@@ -143,9 +155,10 @@ export function StripeVatSummaryTableTotals({<Text style={styles.fontSize9}>{t.stripe.total}</Text></View><View style={styles.vatColValue}>- <Text style={[styles.fontSize9, styles.textDark]}>- {invoiceTotal}- </Text>+ <WrappableAmount+ chunks={totalChunks}+ style={[styles.fontSize9, styles.textDark]}+ /></View></View>@@ -160,10 +173,11 @@ export function StripeVatSummaryTableTotals({{t.stripe.amountDue}</Text></View>- <View style={styles.vatColValue}>- <Text style={[styles.fontSize9, styles.fontBold, styles.textDark]}>- {formattedInvoiceTotal}- </Text>+ <View style={[styles.vatColValue]}>+ <WrappableAmount+ chunks={invoiceTotalChunks}+ style={[styles.fontSize9, styles.fontBold, styles.textDark]}+ /></View></View></View>diff --git a/src/app/(main)/(app)/hooks/__tests__/use-changelog-update-popup.test.ts b/src/app/(main)/(app)/hooks/__tests__/use-changelog-update-popup.test.tsindex 8655efa..6111541 100644--- a/src/app/(main)/(app)/hooks/__tests__/use-changelog-update-popup.test.ts+++ b/src/app/(main)/(app)/hooks/__tests__/use-changelog-update-popup.test.ts@@ -41,14 +41,12 @@ function renderChangelogPopupHook(overrides: Partial<{latestChangelog: ChangelogSummary | null;isViewingSharedInvoice: boolean;- isMobile: boolean;}> = {},) {return renderHook(() => {return useChangelogUpdatePopup({latestChangelog: null,isViewingSharedInvoice: false,- isMobile: false,...overrides,});});@@ -87,7 +85,6 @@ describe("useChangelogUpdatePopup", () => {return useChangelogUpdatePopup({latestChangelog: latest,isViewingSharedInvoice: false,- isMobile: false,});},{ initialProps: { latest: null as ChangelogSummary | null } },@@ -121,7 +118,6 @@ describe("useChangelogUpdatePopup", () => {return useChangelogUpdatePopup({latestChangelog: latest,isViewingSharedInvoice: false,- isMobile: false,});},{ initialProps: { latest: null as ChangelogSummary | null } },@@ -186,7 +182,6 @@ describe("useChangelogUpdatePopup", () => {return useChangelogUpdatePopup({latestChangelog: latest,isViewingSharedInvoice: false,- isMobile: false,});},{ initialProps: { latest: previousChangelog } },@@ -238,17 +233,6 @@ describe("useChangelogUpdatePopup", () => {expect(result.current.variant).toBeNull();});- it("should not show popup on mobile", () => {- const { result } = renderChangelogPopupHook({ isMobile: true });-- act(() => {- vi.advanceTimersByTime(1500);- });-- expect(result.current.isOpen).toBe(false);- expect(result.current.variant).toBeNull();- });-it("should not show popup when viewing a shared invoice", () => {const { result } = renderChangelogPopupHook({isViewingSharedInvoice: true,diff --git a/src/app/(main)/(app)/hooks/use-changelog-update-popup.ts b/src/app/(main)/(app)/hooks/use-changelog-update-popup.tsindex 8c89339..75f6fbd 100644--- a/src/app/(main)/(app)/hooks/use-changelog-update-popup.ts+++ b/src/app/(main)/(app)/hooks/use-changelog-update-popup.ts@@ -20,7 +20,6 @@ export type AppUpdatePopupVariant = "welcome" | "changelog";interface UseChangelogUpdatePopupOptions {latestChangelog: ChangelogSummary | null;isViewingSharedInvoice: boolean;- isMobile: boolean;}interface UseChangelogUpdatePopupResult {@@ -47,8 +46,10 @@ function resolvePopupVariant(* Hook to manage showing welcome or changelog update popup to user.** Shows welcome popup on first visit, then changelog popup when a new- * changelog version is unseen. Never shows on mobile or when viewing a- * shared invoice.+ * changelog version is unseen. Never shows when viewing a shared invoice.+ *+ * It decides only *whether* a popup shows; where it sits is up to the page --+ * a floating card on desktop, a notice inside the bottom dock on mobile.** A popup is marked as seen the moment it is shown, so each one appears only* once per browser - whether or not the user interacts with it. At most one@@ -58,7 +59,6 @@ function resolvePopupVariant(export function useChangelogUpdatePopup({latestChangelog,isViewingSharedInvoice,- isMobile,}: UseChangelogUpdatePopupOptions): UseChangelogUpdatePopupResult {/** The popup the timer below decided to show, if any */const [shownVariant, setShownVariant] =@@ -72,8 +72,8 @@ export function useChangelogUpdatePopup({}, []);useEffect(() => {- // Never show popup on mobile or when viewing a shared invoice- if (isMobile || isViewingSharedInvoice) {+ // Never show popup when viewing a shared invoice+ if (isViewingSharedInvoice) {return;}@@ -108,15 +108,11 @@ export function useChangelogUpdatePopup({return () => {window.clearTimeout(timer);};- }, [isMobile, isViewingSharedInvoice, latestChangelog]);-- // Switching to a mobile viewport hides an already shown popup, so this is- // derived rather than stored- const variant = isMobile ? null : shownVariant;+ }, [isViewingSharedInvoice, latestChangelog]);return {- isOpen: variant !== null && !isDismissed,+ isOpen: shownVariant !== null && !isDismissed,dismiss,- variant,+ variant: shownVariant,};}diff --git a/src/app/(main)/(app)/page.client.tsx b/src/app/(main)/(app)/page.client.tsxindex 35652d1..b68c5a8 100644--- a/src/app/(main)/(app)/page.client.tsx+++ b/src/app/(main)/(app)/page.client.tsx@@ -149,11 +149,26 @@ export function AppPageClient({} = useChangelogUpdatePopup({latestChangelog,isViewingSharedInvoice,- isMobile,});const [isHowItWorksDialogOpen, setIsHowItWorksDialogOpen] = useState(false);+ // One popup, placed by viewport: a floating card on desktop, a notice inside the bottom+ // dock on mobile, where a floating card would cover the dock's buttons+ const changelogPopup = changelogPopupVariant ? (+ <ChangelogUpdatePopup+ variant={changelogPopupVariant}+ isOpen={isChangelogPopupOpen}+ onDismiss={dismissChangelogPopup}+ releaseSummary={latestChangelog?.popupSummary}+ releaseSlug={latestChangelog?.slug}+ layout={isMobile ? "dock" : "floating"}+ onHowItWorksClick={() => {+ return setIsHowItWorksDialogOpen(true);+ }}+ />+ ) : null;+/*** Reads the invoice form at click time: its current values, or `null` when it has* validation errors. A ref rather than state, because the answer is only needed inside@@ -794,22 +809,14 @@ export function AppPageClient({isMobile={isMobile}canShareInvoice={canShareInvoice}currentInvoiceFormDataRef={currentInvoiceFormDataRef}+ mobileDockNotice={isMobile ? changelogPopup : null}/></div></div></main></InvoicePdfInstanceProvider><Footer />- {changelogPopupVariant ? (- <ChangelogUpdatePopup- variant={changelogPopupVariant}- isOpen={isChangelogPopupOpen}- onDismiss={dismissChangelogPopup}- onHowItWorksClick={() => {- return setIsHowItWorksDialogOpen(true);- }}- />- ) : null}+ {isMobile ? null : changelogPopup}<HowItWorksVideoDialogopen={isHowItWorksDialogOpen}onOpenChange={setIsHowItWorksDialogOpen}diff --git a/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations-schema.ts b/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations-schema.tsindex 2d14245..a5b8e40 100644--- a/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations-schema.ts+++ b/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations-schema.ts@@ -1,6 +1,6 @@import { z } from "zod";-import { SUPPORTED_LANGUAGES } from "../../../schema/index";+import { SUPPORTED_INVOICE_PDF_LANGUAGES } from "../../../schema/index";const customTaxLabelInputSchema = z.object({@@ -180,7 +180,7 @@ export const translationSchema = z/** Schema for the complete PDF translation catalog. */export const invoicePDFTranslationsSchema = z.record(- z.enum(SUPPORTED_LANGUAGES),+ z.enum(SUPPORTED_INVOICE_PDF_LANGUAGES),translationSchema,);diff --git a/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations.ts b/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations.tsindex 8eb0d3f..809061f 100644--- a/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations.ts+++ b/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations.ts@@ -311,7 +311,7 @@ export const INVOICE_PDF_TRANSLATIONS = {dateDue: "Fälligkeitsdatum",servicePeriod: "Leistungszeitraum",billTo: "Rechnung an",- due: "fällig",+ due: "zahlbar bis",payOnline: "Online-Zahlung",description: "Beschreibung",qty: "Menge",@@ -322,13 +322,13 @@ export const INVOICE_PDF_TRANSLATIONS = {subtotal: "Zwischensumme",totalExcludingTax: "Gesamtbetrag ohne Steuer",total: "Gesamt",- amountDue: "Fälligkeitsbetrag",+ amountDue: "Zu zahlender Betrag",page: "Seite",of: "von",},},es: {- invoiceNumber: "Factura N°",+ invoiceNumber: "Factura n.º",dateOfIssue: "Fecha de emisión",dateOfService: "Fecha de venta/prestación del servicio",servicePeriod: "Periodo de servicio",@@ -346,7 +346,7 @@ export const INVOICE_PDF_TRANSLATIONS = {email: "Correo electrónico",},invoiceItemsTable: {- no: "N°",+ no: "N.º",nameOfGoodsService: "Descripción del producto/servicio",typeOfGTU: "Tipo\n GTU",amount: "Cantidad",@@ -399,7 +399,7 @@ export const INVOICE_PDF_TRANSLATIONS = {dateDue: "Fecha de vencimiento",servicePeriod: "Periodo de servicio",billTo: "Facturar a",- due: "vencimiento",+ due: "con vencimiento el",payOnline: "Pago en línea",description: "Descripción",qty: "Cant.",@@ -410,13 +410,13 @@ export const INVOICE_PDF_TRANSLATIONS = {subtotal: "Subtotal",totalExcludingTax: "Total sin impuestos",total: "Total",- amountDue: "Monto vencido",+ amountDue: "Monto a pagar",page: "Página",of: "de",},},pt: {- invoiceNumber: "Fatura N°",+ invoiceNumber: "Fatura n.º",dateOfIssue: "Data de emissão",dateOfService: "Data de venda/prestação do serviço",servicePeriod: "Período de serviço",@@ -434,7 +434,7 @@ export const INVOICE_PDF_TRANSLATIONS = {email: "E-mail",},invoiceItemsTable: {- no: "N°",+ no: "N.º",nameOfGoodsService: "Descrição do produto/serviço",typeOfGTU: "Tipo\n GTU",amount: "Quantidade",@@ -486,9 +486,104 @@ export const INVOICE_PDF_TRANSLATIONS = {dateOfIssue: "Data de emissão",dateDue: "Data de vencimento",servicePeriod: "Período de serviço",- billTo: "Cobrar de",- due: "vencimento",- payOnline: "Pagamento online",+ billTo: "Faturar a",+ due: "a pagar até",+ payOnline: "Pagar online",+ description: "Descrição",+ qty: "Qtd.",+ unit: "Unidade",+ unitPrice: "Preço unitário",+ amount: "Valor",+ tax: "Imposto",+ subtotal: "Subtotal",+ totalExcludingTax: "Total sem impostos",+ total: "Total",+ amountDue: "Valor a pagar",+ page: "Página",+ of: "de",+ },+ },+ /**+ * Brazilian Portuguese is a separate invoice rather than a different spelling of the+ * European one: Brazil has no IVA and no NIF, so the tax number is the "CNPJ/CPF" that+ * every nota fiscal carries, the tax column is the generic "Imposto" (the user renames it+ * to ICMS, ISS or whatever applies), its rate is an "Alíquota", and the parties are the+ * "Emitente" and "Destinatário" of the NF-e layout rather than a seller and a buyer.+ */+ "pt-BR": {+ invoiceNumber: "Fatura nº",+ dateOfIssue: "Data de emissão",+ dateOfService: "Data da venda/prestação do serviço",+ servicePeriod: "Período de serviço",+ invoiceType: "Tipo de fatura",+ seller: {+ name: "Emitente",+ vatNo: "CNPJ/CPF",+ email: "E-mail",+ accountNumber: "Conta bancária",+ swiftBic: "SWIFT/BIC",+ },+ buyer: {+ name: "Destinatário",+ vatNo: "CNPJ/CPF",+ email: "E-mail",+ },+ invoiceItemsTable: {+ no: "Nº",+ nameOfGoodsService: "Descrição do produto/serviço",+ typeOfGTU: "Tipo\n GTU",+ amount: "Quantidade",+ unit: "Unidade",+ netPrice: () => {+ return `Preço\n líquido`;+ },+ vat: "Imposto",+ netAmount: () => {+ return `Valor\n líquido`;+ },+ vatAmount: ({ customTaxLabel }) => {+ return `Valor do ${customTaxLabel || "imposto"}`;+ },+ preTaxAmount: () => {+ return `Valor bruto`;+ },+ sum: "TOTAL",+ },+ paymentInfo: {+ paymentMethod: "Forma de pagamento",+ paymentDate: "Data do pagamento",+ },+ vatSummaryTable: {+ vatRate: ({ customTaxLabel }) => {+ return `Alíquota do ${customTaxLabel || "imposto"}`;+ },+ net: () => {+ return `Líquido`;+ },+ vat: "Imposto",+ preTax: () => {+ return `Bruto`;+ },+ total: "Total",+ },+ paymentTotals: {+ toPay: "Total a pagar",+ paid: "Valor pago",+ leftToPay: "Saldo a pagar",+ amountInWords: "Valor por extenso",+ },+ personAuthorizedToReceive: "Pessoa autorizada a receber",+ personAuthorizedToIssue: "Pessoa autorizada a emitir",+ createdWith: "Criado com",+ stripe: {+ invoice: "Fatura",+ invoiceNumber: "Número da fatura",+ dateOfIssue: "Data de emissão",+ dateDue: "Data de vencimento",+ servicePeriod: "Período de serviço",+ billTo: "Faturar para",+ due: "com vencimento em",+ payOnline: "Pagar online",description: "Descrição",qty: "Qtd.",unit: "Unidade",@@ -498,7 +593,7 @@ export const INVOICE_PDF_TRANSLATIONS = {subtotal: "Subtotal",totalExcludingTax: "Total sem impostos",total: "Total",- amountDue: "Valor vencido",+ amountDue: "Valor a pagar",page: "Página",of: "de",},@@ -680,7 +775,7 @@ export const INVOICE_PDF_TRANSLATIONS = {},},fr: {- invoiceNumber: "Facture N°",+ invoiceNumber: "Facture n°",dateOfIssue: "Date d'émission",dateOfService: "Date de vente/prestation de service",servicePeriod: "Période de service",@@ -751,7 +846,7 @@ export const INVOICE_PDF_TRANSLATIONS = {dateDue: "Date d'échéance",servicePeriod: "Période de service",billTo: "Facturé à",- due: "échéance",+ due: "à payer avant le",payOnline: "Payer en ligne",description: "Description",qty: "Qté",@@ -762,13 +857,13 @@ export const INVOICE_PDF_TRANSLATIONS = {subtotal: "Sous-total",totalExcludingTax: "Total hors taxe",total: "Total",- amountDue: "Montant échéant",+ amountDue: "Montant dû",page: "Page",of: "de",},},it: {- invoiceNumber: "Fattura N°",+ invoiceNumber: "Fattura n°",dateOfIssue: "Data di emissione",dateOfService: "Data di vendita/prestazione del servizio",servicePeriod: "Periodo di servizio",@@ -839,7 +934,7 @@ export const INVOICE_PDF_TRANSLATIONS = {dateDue: "Data di scadenza",servicePeriod: "Periodo di servizio",billTo: "Fatturare a",- due: "scadenza",+ due: "da pagare entro il",payOnline: "Pagare online",description: "Descrizione",qty: "Qtà",@@ -850,7 +945,7 @@ export const INVOICE_PDF_TRANSLATIONS = {subtotal: "Totale parziale",totalExcludingTax: "Totale escluse imposte",total: "Totale",- amountDue: "Importo scaduto",+ amountDue: "Importo da pagare",page: "Pagina",of: "di",},@@ -927,18 +1022,18 @@ export const INVOICE_PDF_TRANSLATIONS = {dateDue: "Vervaldatum",servicePeriod: "Dienstverleningperiode",billTo: "Factuur aan",- due: "verval",+ due: "te betalen uiterlijk op",payOnline: "Online betalen",description: "Omschrijving",qty: "Aantal",unit: "Eenheid",- unitPrice: "Netto prijs",+ unitPrice: "Eenheidsprijs",amount: "Bedrag",tax: "Belasting",subtotal: "Subtotaal",totalExcludingTax: "Totaal exclusief belasting",total: "Totaal",- amountDue: "Bedrag te betalen",+ amountDue: "Te betalen bedrag",page: "Pagina",of: "van",},@@ -1020,7 +1115,7 @@ export const INVOICE_PDF_TRANSLATIONS = {dateDue: "Förfallodatum",servicePeriod: "Tjänsteperiod",billTo: "Faktureras till",- due: "förfaller",+ due: "att betala senast den",payOnline: "Betala online",description: "Beskrivning",qty: "Antal",@@ -1116,7 +1211,7 @@ export const INVOICE_PDF_TRANSLATIONS = {dateDue: "Forfallsdato",servicePeriod: "Tjenesteperiode",billTo: "Faktureres til",- due: "forfaller",+ due: "betales innen",payOnline: "Betal på nett",description: "Beskrivelse",qty: "Antall",diff --git a/src/app/(main)/(app)/utils/__tests__/format-amount.test.ts b/src/app/(main)/(app)/utils/__tests__/format-amount.test.tsnew file mode 100644index 0000000..71343b7--- /dev/null+++ b/src/app/(main)/(app)/utils/__tests__/format-amount.test.ts@@ -0,0 +1,269 @@+import { describe, expect, it } from "vitest";++import {+ formatAmount,+ formatAmountChunks,+ formatAmountInWordsWithCurrency,+} from "@/app/(main)/(app)/utils/format-amount";+import {+ SUPPORTED_INVOICE_PDF_LANGUAGES,+ SUPPORTED_NUMBER_FORMAT_LOCALES,+ type SupportedNumberFormatLocale,+} from "@/app/schema";++const AMOUNT = 321_200;++// Spelled out by codepoint for the same reason as in `format-currency.tsx`: `oxfmt` turns+// `\uXXXX` escapes into literal characters, and these ones are invisible in a diff.+const NBSP = String.fromCodePoint(0x00_a0);++/** U+202F NARROW NO-BREAK SPACE and U+2009 THIN SPACE, neither of which may survive. */+const NARROW_SPACES_REGEX = new RegExp(+ `[${String.fromCodePoint(0x20_2f)}${String.fromCodePoint(0x20_09)}]`,+);++/**+ * What each supported locale prints for {@link AMOUNT}, written out by hand.+ *+ * It has to be written out. `formatAmount` *is* `formatAmountChunks(...).join("")`, so+ * comparing the two compares a value with itself and passes however badly the formatter+ * behaves; and deriving the expectation from `Intl` here would have to repeat the narrow-space+ * rewrite and the `international` base locale, which are the two things most worth pinning.+ *+ * Typing it as a complete `Record` means a new entry in `SUPPORTED_NUMBER_FORMAT_LOCALES`+ * fails to compile until someone writes down what it prints.+ */+const AMOUNT_PER_LOCALE: Record<SupportedNumberFormatLocale, string> = {+ international: `321${NBSP}200.00`,+ en: "321,200.00",+ pl: `321${NBSP}200,00`,+ nl: "321.200,00",+ fr: `321${NBSP}200,00`,+ de: "321.200,00",+ it: "321.200,00",+ nb: `321${NBSP}200,00`,+ pt: "321.200,00",+ "pt-BR": "321.200,00",+ ru: `321${NBSP}200,00`,+ es: "321.200,00",+ sv: `321${NBSP}200,00`,+ uk: `321${NBSP}200,00`,+};++describe("formatAmount", () => {+ it("groups four-digit amounts in locales whose CLDR default skips them", () => {+ expect(formatAmount({ amount: 8111, numberFormatLocale: "pl" })).toBe(+ `8${NBSP}111,00`,+ );++ expect(formatAmount({ amount: 8111, numberFormatLocale: "es" })).toBe(+ "8.111,00",+ );++ expect(+ formatAmountChunks({ amount: 8111, numberFormatLocale: "pl" }),+ ).toEqual(["8", `${NBSP}111,00`]);+ });++ it("writes the number the way the given locale does", () => {+ expect(formatAmount({ amount: AMOUNT, numberFormatLocale: "en" })).toBe(+ "321,200.00",+ );++ expect(formatAmount({ amount: AMOUNT, numberFormatLocale: "de" })).toBe(+ "321.200,00",+ );++ expect(formatAmount({ amount: AMOUNT, numberFormatLocale: "pl" })).toBe(+ `321${NBSP}200,00`,+ );+ });++ describe("international", () => {+ it("groups with a no-break space and marks the decimal with a dot", () => {+ const formatted = formatAmount({+ amount: AMOUNT,+ numberFormatLocale: "international",+ });++ expect(formatted).toBe(`321${NBSP}200.00`);++ /**+ * The templates used to group with a plain U+0020, which let a total wrap across+ * lines in a narrow column.+ */+ expect(formatted).not.toContain(" ");+ expect(formatted).not.toContain(",");+ });+ });++ /**+ * French groups digits with U+202F NARROW NO-BREAK SPACE, which Open Sans -- the default+ * template's font -- has no glyph for. See the note in `format-currency.tsx`.+ */+ it.each(SUPPORTED_INVOICE_PDF_LANGUAGES)(+ "emits no narrow spaces for %s",+ (language) => {+ expect(+ formatAmount({ amount: AMOUNT, numberFormatLocale: language }),+ ).not.toMatch(NARROW_SPACES_REGEX);+ },+ );++ it("prints quantities with the decimals the caller asks for", () => {+ expect(+ formatAmount({+ amount: 1.5,+ numberFormatLocale: "international",+ minimumFractionDigits: 0,+ maximumFractionDigits: 3,+ }),+ ).toBe("1.5");++ expect(+ formatAmount({+ amount: 2,+ numberFormatLocale: "de",+ minimumFractionDigits: 0,+ maximumFractionDigits: 3,+ }),+ ).toBe("2");+ });++ it("writes zero when the amount is not a finite number", () => {+ expect(+ formatAmount({+ // @ts-expect-error -- the runtime guard exists for data restored from localStorage/share links+ amount: undefined,+ numberFormatLocale: "international",+ }),+ ).toBe("0.00");++ expect(formatAmount({ amount: Number.NaN, numberFormatLocale: "de" })).toBe(+ "0,00",+ );+ });+});++describe("formatAmountChunks", () => {+ it("cuts the number at its thousands boundaries, keeping a visible separator", () => {+ expect(+ formatAmountChunks({ amount: 1_000_000_000, numberFormatLocale: "en" }),+ ).toEqual(["1,", "000,", "000,", "000.00"]);++ expect(+ formatAmountChunks({ amount: 1_000_000_000, numberFormatLocale: "de" }),+ ).toEqual(["1.", "000.", "000.", "000,00"]);+ });++ /**+ * `WrappableAmount` right-aligns every line it lays out, so a piece that *ended* on the+ * space would hold it inside the line box and push the digits left of the column's edge.+ * At the head of the next piece the same space costs nothing.+ */+ it("hands a blank separator to the piece it opens rather than the one it closes", () => {+ expect(+ formatAmountChunks({+ amount: 1_000_000_000,+ numberFormatLocale: "international",+ }),+ ).toEqual(["1", `${NBSP}000`, `${NBSP}000`, `${NBSP}000.00`]);++ // ...and the locales that group with a space of their own go the same way+ expect(+ formatAmountChunks({ amount: 1_000_000_000, numberFormatLocale: "pl" }),+ ).toEqual(["1", `${NBSP}000`, `${NBSP}000`, `${NBSP}000,00`]);+ });++ it.each(SUPPORTED_NUMBER_FORMAT_LOCALES)(+ "never ends a piece on something you cannot see, in %s",+ (numberFormatLocale) => {+ const chunks = formatAmountChunks({+ amount: 1_000_000_000,+ numberFormatLocale,+ });++ for (const chunk of chunks) {+ expect(chunk).toBe(chunk.trimEnd());+ }+ },+ );++ /**+ * The cut follows what `Intl` calls a group, not what the digits look like: German writes+ * both its grouping and its decimals with a `.`, and only the first of the two may break.+ */+ it("never cuts at the decimal separator", () => {+ expect(+ formatAmountChunks({ amount: 1234.56, numberFormatLocale: "de" }),+ ).toEqual(["1.", "234,56"]);++ expect(+ formatAmountChunks({+ amount: 1.234,+ numberFormatLocale: "en",+ minimumFractionDigits: 0,+ maximumFractionDigits: 3,+ }),+ ).toEqual(["1.234"]);+ });++ it("leaves a number with nothing to group in one piece", () => {+ expect(+ formatAmountChunks({ amount: 999, numberFormatLocale: "en" }),+ ).toEqual(["999.00"]);+ });++ it.each(SUPPORTED_NUMBER_FORMAT_LOCALES)(+ "joins back up into the string %s prints",+ (numberFormatLocale) => {+ expect(+ formatAmountChunks({ amount: AMOUNT, numberFormatLocale }).join(""),+ ).toBe(AMOUNT_PER_LOCALE[numberFormatLocale]);+ },+ );++ it("writes zero when the amount is not a finite number", () => {+ expect(+ formatAmountChunks({ amount: Number.NaN, numberFormatLocale: "en" }),+ ).toEqual(["0.00"]);+ });+});++describe("formatAmountInWordsWithCurrency", () => {+ it("glues the currency to the fraction with a no-break space", () => {+ expect(+ formatAmountInWordsWithCurrency({+ amountInWords: "czternascie tysiecy dziewiecset siedemdziesiat cztery",+ currency: "EUR",+ fractionalPart: "00",+ }),+ ).toBe(+ `czternascie tysiecy dziewiecset siedemdziesiat cztery EUR${NBSP}00/100`,+ );+ });++ it("leaves the tail with no break opportunity in it", () => {+ // the regression this guards: with a plain U+0020 the totals column broke between the+ // currency and the fraction, stranding "00/100" alone on the line below+ const tail = formatAmountInWordsWithCurrency({+ amountInWords: "ten thousand",+ currency: "EUR",+ fractionalPart: "00",+ }).slice("ten thousand ".length);++ expect(tail).toBe(`EUR${NBSP}00/100`);+ expect(tail).not.toContain(" ");+ expect(tail).not.toMatch(NARROW_SPACES_REGEX);+ });++ it("keeps an ordinary space before the currency, so the prose can still wrap", () => {+ const formatted = formatAmountInWordsWithCurrency({+ amountInWords: "ten thousand",+ currency: "EUR",+ fractionalPart: "00",+ });++ expect(formatted.startsWith("ten thousand ")).toBe(true);+ });+});diff --git a/src/app/(main)/(app)/utils/__tests__/format-currency.test.ts b/src/app/(main)/(app)/utils/__tests__/format-currency.test.tsnew file mode 100644index 0000000..35d966b--- /dev/null+++ b/src/app/(main)/(app)/utils/__tests__/format-currency.test.ts@@ -0,0 +1,202 @@+import { describe, expect, it } from "vitest";++import {+ formatCurrency,+ formatCurrencyChunks,+} from "@/app/(main)/(app)/utils/format-currency";+import {+ SUPPORTED_INVOICE_PDF_LANGUAGES,+ SUPPORTED_NUMBER_FORMAT_LOCALES,+ type SupportedNumberFormatLocale,+} from "@/app/schema";++const AMOUNT = 321_200;++// Spelled out by codepoint for the same reason as in `format-currency.tsx`: `oxfmt` turns+// `\uXXXX` escapes into literal characters, and these ones are invisible in a diff.+const NBSP = String.fromCodePoint(0x00_a0);+const EURO = String.fromCodePoint(0x20_ac);++/** U+202F NARROW NO-BREAK SPACE and U+2009 THIN SPACE, neither of which may survive. */+const NARROW_SPACES_REGEX = new RegExp(+ `[${String.fromCodePoint(0x20_2f)}${String.fromCodePoint(0x20_09)}]`,+);++/**+ * What each supported locale prints for {@link AMOUNT} in EUR, written out by hand.+ *+ * It has to be written out, for the same reason as in `format-amount.test.ts`:+ * `formatCurrency` *is* `formatCurrencyChunks(...).join("")`, so comparing the two compares a+ * value with itself. The symbol's side and its spacing are the locale's own business, which is+ * why they differ so much here -- and why `uk` spells out the ISO code instead.+ *+ * Typing it as a complete `Record` means a new entry in `SUPPORTED_NUMBER_FORMAT_LOCALES`+ * fails to compile until someone writes down what it prints.+ */+const EUR_PER_LOCALE: Record<SupportedNumberFormatLocale, string> = {+ international: `${EURO}321${NBSP}200.00`,+ en: `${EURO}321,200.00`,+ pl: `321${NBSP}200,00${NBSP}${EURO}`,+ nl: `${EURO}${NBSP}321.200,00`,+ fr: `321${NBSP}200,00${NBSP}${EURO}`,+ de: `321.200,00${NBSP}${EURO}`,+ it: `321.200,00${NBSP}${EURO}`,+ nb: `321${NBSP}200,00${NBSP}${EURO}`,+ pt: `${EURO}${NBSP}321.200,00`,+ "pt-BR": `${EURO}${NBSP}321.200,00`,+ ru: `321${NBSP}200,00${NBSP}${EURO}`,+ es: `321.200,00${NBSP}${EURO}`,+ sv: `321${NBSP}200,00${NBSP}${EURO}`,+ uk: `321${NBSP}200,00${NBSP}EUR`,+};++describe("formatCurrency", () => {+ it("formats an amount in the given locale and currency", () => {+ expect(+ formatCurrency({+ amount: AMOUNT,+ currency: "USD",+ numberFormatLocale: "en",+ }),+ ).toBe("$321,200.00");++ expect(+ formatCurrency({+ amount: AMOUNT,+ currency: "EUR",+ numberFormatLocale: "de",+ }),+ ).toBe(`321.200,00${NBSP}${EURO}`);+ });++ it("falls back to 0.00 when the amount is not a number", () => {+ expect(+ formatCurrency({+ // @ts-expect-error — the runtime guard exists for data restored from localStorage/share links+ amount: undefined,+ currency: "EUR",+ numberFormatLocale: "fr",+ }),+ ).toBe(`0,00${NBSP}${EURO}`);+ });++ /**+ * French groups digits with U+202F NARROW NO-BREAK SPACE, which Open Sans (the default+ * template's font) has no glyph for — react-pdf emitted it in its Helvetica fallback, where+ * the byte renders as "/", so the invoice total read "321/200,00 €". See the note in+ * `format-currency.tsx`.+ */+ it("replaces narrow no-break spaces with regular no-break spaces in French", () => {+ const formatted = formatCurrency({+ amount: AMOUNT,+ currency: "EUR",+ numberFormatLocale: "fr",+ });++ expect(formatted).toBe(`321${NBSP}200,00${NBSP}${EURO}`);+ expect(formatted).not.toMatch(NARROW_SPACES_REGEX);+ });++ it.each(SUPPORTED_INVOICE_PDF_LANGUAGES)(+ "emits no narrow spaces for %s",+ (language) => {+ expect(+ formatCurrency({+ amount: AMOUNT,+ currency: "EUR",+ numberFormatLocale: language,+ }),+ ).not.toMatch(NARROW_SPACES_REGEX);+ },+ );++ /**+ * `international` belongs to no locale, so it is built from `en-US` -- symbol first --+ * with the grouping comma swapped for a no-break space, exactly as the default template's+ * bare amounts are.+ */+ it("groups the international format with a no-break space", () => {+ const formatted = formatCurrency({+ amount: AMOUNT,+ currency: "EUR",+ numberFormatLocale: "international",+ });++ expect(formatted).toBe(`${EURO}321${NBSP}200.00`);+ expect(formatted).not.toContain(",");+ });+});++describe("formatCurrencyChunks", () => {+ /**+ * The symbol rides along on the piece it sits next to, so a wrapped total can never leave+ * it stranded on a line of its own.+ */+ it("cuts at the thousands boundaries and keeps the symbol attached", () => {+ expect(+ formatCurrencyChunks({+ amount: 1_000_000,+ currency: "USD",+ numberFormatLocale: "en",+ }),+ ).toEqual(["$1,", "000,", "000.00"]);++ expect(+ formatCurrencyChunks({+ amount: 1_000_000,+ currency: "EUR",+ numberFormatLocale: "de",+ }),+ ).toEqual(["1.", "000.", `000,00${NBSP}${EURO}`]);+ });++ /** Same reason as in `format-amount.test.ts`: a right-aligned line may not end on a space. */+ it("hands a blank separator to the piece it opens rather than the one it closes", () => {+ expect(+ formatCurrencyChunks({+ amount: 1_000_000,+ currency: "EUR",+ numberFormatLocale: "fr",+ }),+ ).toEqual(["1", `${NBSP}000`, `${NBSP}000,00${NBSP}${EURO}`]);+ });++ it.each(SUPPORTED_NUMBER_FORMAT_LOCALES)(+ "never ends a piece on something you cannot see, in %s",+ (numberFormatLocale) => {+ const chunks = formatCurrencyChunks({+ amount: 1_000_000,+ currency: "EUR",+ numberFormatLocale,+ });++ for (const chunk of chunks) {+ expect(chunk).toBe(chunk.trimEnd());+ }+ },+ );++ it.each(SUPPORTED_NUMBER_FORMAT_LOCALES)(+ "joins back up into the string %s prints",+ (numberFormatLocale) => {+ expect(+ formatCurrencyChunks({+ amount: AMOUNT,+ currency: "EUR",+ numberFormatLocale,+ }).join(""),+ ).toBe(EUR_PER_LOCALE[numberFormatLocale]);+ },+ );++ it("falls back to a single 0.00 when the currency is not one Intl knows", () => {+ expect(+ formatCurrencyChunks({+ // @ts-expect-error -- the runtime guard exists for data restored from localStorage/share links+ currency: "NOT_A_CURRENCY",+ amount: AMOUNT,+ numberFormatLocale: "en",+ }),+ ).toEqual(["0.00"]);+ });+});diff --git a/src/app/(main)/(app)/utils/__tests__/format-date-with-locale.test.ts b/src/app/(main)/(app)/utils/__tests__/format-date-with-locale.test.tsindex 228e1e9..37e9628 100644--- a/src/app/(main)/(app)/utils/__tests__/format-date-with-locale.test.ts+++ b/src/app/(main)/(app)/utils/__tests__/format-date-with-locale.test.ts@@ -5,14 +5,17 @@ import {formatDateWithLocale,formatTodayWithLocale,} from "@/app/(main)/(app)/utils/format-date-with-locale";-import { SUPPORTED_LANGUAGES, type SupportedLanguages } from "@/app/schema";+import {+ SUPPORTED_INVOICE_PDF_LANGUAGES,+ type SupportedLanguages,+} from "@/app/schema";const DATE = "2026-09-01";/*** Expected rendering of {@link DATE} with the `MMMM D, YYYY` format in every* supported language. Typed as an exhaustive record, so adding a language to- * `SUPPORTED_LANGUAGES` without registering its dayjs locale fails to compile here.+ * `SUPPORTED_INVOICE_PDF_LANGUAGES` without registering its dayjs locale fails to compile here.*/const EXPECTED_LONG_DATE: Record<SupportedLanguages, string> = {en: "September 1, 2026",@@ -21,6 +24,7 @@ const EXPECTED_LONG_DATE: Record<SupportedLanguages, string> = {es: "septiembre 1, 2026",sv: "september 1, 2026",pt: "setembro 1, 2026",+ "pt-BR": "setembro 1, 2026",ru: "сентябрь 1, 2026",uk: "вересень 1, 2026",fr: "septembre 1, 2026",@@ -30,7 +34,7 @@ const EXPECTED_LONG_DATE: Record<SupportedLanguages, string> = {};describe("formatDateWithLocale", () => {- it.each(SUPPORTED_LANGUAGES)(+ it.each(SUPPORTED_INVOICE_PDF_LANGUAGES)("formats a date in %s, so the locale is actually registered",(language) => {expect(@@ -46,7 +50,7 @@ describe("formatDateWithLocale", () => {it("renders month names differently per language", () => {// Guards against the silent dayjs fallback: an unregistered locale keeps the// previous one, which would make every language render identically.- const rendered = SUPPORTED_LANGUAGES.map((language) => {+ const rendered = SUPPORTED_INVOICE_PDF_LANGUAGES.map((language) => {return formatDateWithLocale({date: DATE,selectedDateFormat: "D MMM YYYY",@@ -60,7 +64,7 @@ describe("formatDateWithLocale", () => {});it("leaves numeric formats untouched across languages", () => {- for (const language of SUPPORTED_LANGUAGES) {+ for (const language of SUPPORTED_INVOICE_PDF_LANGUAGES) {expect(formatDateWithLocale({date: DATE,diff --git a/src/app/(main)/(app)/utils/__tests__/invoice-number-breaking-change.test.ts b/src/app/(main)/(app)/utils/__tests__/invoice-number-breaking-change.test.tsindex ae55fe7..b74e469 100644--- a/src/app/(main)/(app)/utils/__tests__/invoice-number-breaking-change.test.ts+++ b/src/app/(main)/(app)/utils/__tests__/invoice-number-breaking-change.test.ts@@ -1,7 +1,10 @@import { describe, it, expect, vi, beforeEach } from "vitest";import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";-import { SUPPORTED_LANGUAGES, type InvoiceData } from "@/app/schema";+import {+ SUPPORTED_INVOICE_PDF_LANGUAGES,+ type InvoiceData,+} from "@/app/schema";import { handleInvoiceNumberBreakingChange } from "../invoice-number-breaking-change";@@ -125,7 +128,7 @@ describe("handleInvoiceNumberBreakingChange", () => {const result = handleInvoiceNumberBreakingChange(input);- const defaultLanguage = SUPPORTED_LANGUAGES[0];+ const defaultLanguage = SUPPORTED_INVOICE_PDF_LANGUAGES[0];expect(result).toEqual({language: "invalid-lang",invoiceNumberObject: {@@ -158,7 +161,7 @@ describe("handleInvoiceNumberBreakingChange", () => {const result = handleInvoiceNumberBreakingChange(input);- const defaultLanguage = SUPPORTED_LANGUAGES[0];+ const defaultLanguage = SUPPORTED_INVOICE_PDF_LANGUAGES[0];expect(result).toEqual({language: 123,invoiceNumberObject: {@@ -297,7 +300,7 @@ describe("handleInvoiceNumberBreakingChange", () => {});it("should handle all supported languages correctly", () => {- SUPPORTED_LANGUAGES.forEach((lang) => {+ SUPPORTED_INVOICE_PDF_LANGUAGES.forEach((lang) => {const input = {invoiceNumber: `INV-${lang}`,language: lang,@@ -315,7 +318,9 @@ describe("handleInvoiceNumberBreakingChange", () => {});// Should track one event per language- expect(umamiTrackEvent).toHaveBeenCalledTimes(SUPPORTED_LANGUAGES.length);+ expect(umamiTrackEvent).toHaveBeenCalledTimes(+ SUPPORTED_INVOICE_PDF_LANGUAGES.length,+ );});it("should handle special characters in invoiceNumber", () => {diff --git a/src/app/(main)/(app)/utils/format-amount.ts b/src/app/(main)/(app)/utils/format-amount.tsnew file mode 100644index 0000000..53f21ae--- /dev/null+++ b/src/app/(main)/(app)/utils/format-amount.ts@@ -0,0 +1,89 @@+import * as Sentry from "@sentry/nextjs";++import type {+ SupportedCurrencies,+ SupportedNumberFormatLocale,+} from "@/app/schema";++import {+ FALLBACK_AMOUNT,+ formatNumberChunksForPdf,+ NO_BREAK_SPACE,+} from "./format-currency";++interface FormatAmountArgs {+ /** The number to write. Anything that is not a finite number is written as zero. */+ amount: number;+ /**+ * The locale to write it in, already resolved against the invoice's language -- see+ * `resolveNumberFormatLocale`.+ */+ numberFormatLocale: SupportedNumberFormatLocale;+ /** Fewest decimals to print. Defaults to money's two; quantities pass zero. */+ minimumFractionDigits?: number;+ /** Most decimals to print. Defaults to money's two; quantities pass their own. */+ maximumFractionDigits?: number;+}++/**+ * {@link formatAmount} cut at its thousands boundaries, for a cell that may have to wrap.+ */+export function formatAmountChunks({+ amount,+ numberFormatLocale,+ minimumFractionDigits = 2,+ maximumFractionDigits = 2,+}: FormatAmountArgs) {+ try {+ return formatNumberChunksForPdf({+ amount,+ numberFormatLocale,+ options: {+ style: "decimal",+ minimumFractionDigits,+ maximumFractionDigits,+ },+ });+ } catch (error) {+ Sentry.captureException(error);++ return [FALLBACK_AMOUNT];+ }+}++/**+ * A bare number, for the columns that print no currency of their own -- the default+ * template's amounts, which carry an ISO code next to the totals instead of a symbol, and+ * both templates' quantities.+ */+export function formatAmount(args: FormatAmountArgs) {+ return formatAmountChunks(args).join("");+}++interface FormatAmountInWordsWithCurrencyArgs {+ /** The total spelled out, from `getAmountInWords`. */+ amountInWords: string;+ /** The invoice's ISO 4217 code. */+ currency: SupportedCurrencies;+ /** The total's fractional part, as the two digits printed over 100. */+ fractionalPart: string;+}++/**+ * The default template's amount-in-words line -- `czternascie tysiecy ... EUR 00/100`.+ *+ * The currency and the fraction are joined with a NO-BREAK SPACE. This is the one line in+ * the totals column long enough to wrap -- the amount is spelled out in full -- and with a+ * plain U+0020 the break landed between them often enough to be a coin flip: at 14 974 EUR+ * in Polish the line ended "... cztery EUR" and left "00/100" stranded alone underneath.+ *+ * The space before the currency stays an ordinary one on purpose. The spelled-out amount is+ * prose and has to keep wrapping; gluing there would only move the break one word earlier.+ */+export function formatAmountInWordsWithCurrency({+ amountInWords,+ currency,+ fractionalPart,+}: FormatAmountInWordsWithCurrencyArgs) {+ return `${amountInWords} ${currency}${NO_BREAK_SPACE}${fractionalPart}/100`;+}diff --git a/src/app/(main)/(app)/utils/format-currency.tsx b/src/app/(main)/(app)/utils/format-currency.tsxindex c91dc5d..f7ab47e 100644--- a/src/app/(main)/(app)/utils/format-currency.tsx+++ b/src/app/(main)/(app)/utils/format-currency.tsx@@ -1,30 +1,198 @@import * as Sentry from "@sentry/nextjs";-import type { SupportedCurrencies, SupportedLanguages } from "@/app/schema";+import type {+ SupportedCurrencies,+ SupportedNumberFormatLocale,+} from "@/app/schema";-export function formatCurrency({+/**+ * The space characters are spelled out by codepoint on purpose: `oxfmt` rewrites `\uXXXX`+ * escapes into the literal characters, and a literal U+202F in a regex is invisible in a diff.+ *+ * {@link NO_BREAK_SPACE} is exported for `formatAmountInWordsWithCurrency`, which joins a+ * currency to a fraction the same way the grouping below joins digits.+ */+export const NO_BREAK_SPACE = String.fromCodePoint(0x00_a0);+const NARROW_NO_BREAK_SPACE = String.fromCodePoint(0x20_2f);+const THIN_SPACE = String.fromCodePoint(0x20_09);++/**+ * Spaces that `Intl.NumberFormat` can emit but the PDF fonts do not all cover.+ *+ * French is the only supported locale that groups digits with U+202F NARROW NO-BREAK SPACE;+ * every other space-grouping locale (pl, ru, uk, sv, nb) uses U+00A0. Open Sans — the default+ * template's font — has no glyph for U+202F, so react-pdf splits the run and emits that one+ * character in its Helvetica fallback, where the byte lands on "/" in WinAnsiEncoding: the+ * French total rendered as "321/200,00 €". U+2009 THIN SPACE is mapped for safety — Open Sans+ * covers it today, but it is equally narrow and ICU could switch to it.+ *+ * Mapping both to U+00A0 keeps the separator non-breaking, and it renders in Open Sans (the+ * default template) and Inter (the Stripe template) alike.+ */+const NARROW_SPACES_REGEX = new RegExp(+ `[${NARROW_NO_BREAK_SPACE}${THIN_SPACE}]`,+ "g",+);++/**+ * Rewrites the narrow spaces `Intl` can emit into the no-break space every PDF font used+ * here covers. Any number that reaches a template goes through this.+ */+function toPdfSafeSpaces(value: string) {+ return value.replace(NARROW_SPACES_REGEX, NO_BREAK_SPACE);+}++/**+ * What a template prints when `Intl` refuses the amount outright -- an unsupported currency+ * or locale reaching it from a share link. The error goes to Sentry; the invoice still+ * renders.+ */+export const FALLBACK_AMOUNT = "0.00";++/**+ * The locale the international format borrows its digits from.+ *+ * No locale natively writes `321 200.00` -- every space-grouping locale marks the decimal+ * with a comma -- so the international format is built from `en-US` and has its comma+ * grouping swapped for a space afterwards.+ */+const INTERNATIONAL_FORMAT_BASE_LOCALE = "en-US";++/**+ * Group every amount from the thousands up, including four-digit ones.+ *+ * CLDR gives Polish, Spanish and Italian `minimumGroupingDigits: 2`, so by default `Intl`+ * leaves a four-digit amount ungrouped: `8111,00` next to `18 111,00` in the same column.+ * On an invoice, where amounts sit one above another and are read by their groups, that+ * looks like a missing space rather than a rule. `"always"` groups them all the same way.+ *+ * A browser that predates the string values reads `"always"` as `true`, which is the+ * locale default, so it falls back to today's output rather than failing.+ */+const ALWAYS_GROUP_THOUSANDS = "always";++interface FormatNumberForPdfArgs {+ /** The number to write. Anything that is not a finite number is written as zero. */+ amount: number;+ /** The locale, already resolved against the invoice's language. */+ numberFormatLocale: SupportedNumberFormatLocale;+ /** Passed straight to `Intl.NumberFormat`: the style, the currency, the decimals. */+ options: Intl.NumberFormatOptions;+}++/**+ * Writes a number the way an invoice's {@link SupportedNumberFormatLocale} writes it, cut+ * into the pieces a narrow cell may put on separate lines.+ *+ * Both templates go through here -- the default one for bare amounts, the Stripe one for+ * amounts carrying their currency -- so `international` cannot come out grouped one way in+ * one template and another way in the other. Its grouping space is a *no-break* one, so an+ * amount never wraps on the separator's terms; where it has to wrap, it wraps on the+ * template's, which is what the pieces are for.+ *+ * The cut is always at a thousands boundary, because that is the only place an amount may+ * be broken. `Intl` marks those boundaries itself, which is what keeps the cut right in+ * every locale: the `.` that groups a German amount and the `.` that marks its decimals are+ * told apart by the formatter rather than by guessing from the digits around them.+ *+ * Which side of the cut the separator lands on depends on whether you can see it:+ *+ * - a visible one closes the piece it belongs to, the way a number broken across two lines+ * is written -- `1,000,000,000.00` comes back as `["1,", "000,", "000,", "000.00"]`;+ * - a blank one opens the next piece instead -- `1 000 000 000.00` comes back as+ * `["1", " 000", " 000", " 000.00"]`. `WrappableAmount` right-aligns each line it lays+ * out, so a line that *ended* on the space would keep it inside its box and leave the+ * digits sitting short of the column's edge, out of line with every other amount in it.+ * At the head of a line the same space is simply invisible. Half the locales here group+ * with a space, `international` among them.+ *+ * Only `WrappableAmount` keeps the pieces apart, because it needs them as separate boxes to+ * lay out. Anything printing an amount into running text joins them back up, and that join+ * is the string `Intl` printed either way.+ */+export function formatNumberChunksForPdf({amount,- currency,- language,-}: {+ numberFormatLocale,+ options,+}: FormatNumberForPdfArgs) {+ const isInternational = numberFormatLocale === "international";+ const validAmount = Number.isFinite(amount) ? amount : 0;++ const parts = new Intl.NumberFormat(+ isInternational ? INTERNATIONAL_FORMAT_BASE_LOCALE : numberFormatLocale,+ { useGrouping: ALWAYS_GROUP_THOUSANDS, ...options },+ ).formatToParts(validAmount);++ const chunks: string[] = [];+ let chunk = "";++ for (const part of parts) {+ if (part.type !== "group") {+ chunk += toPdfSafeSpaces(part.value);+ continue;+ }++ const separator = toPdfSafeSpaces(+ isInternational ? NO_BREAK_SPACE : part.value,+ );++ if (separator.trim() === "") {+ chunks.push(chunk);+ chunk = separator;+ } else {+ chunks.push(chunk + separator);+ chunk = "";+ }+ }++ if (chunk) {+ chunks.push(chunk);+ }++ return chunks;+}++interface FormatCurrencyArgs {+ /** The number to write. Anything that is not a finite number is written as zero. */amount: number;+ /** The invoice's ISO 4217 code. */currency: SupportedCurrencies;- language: SupportedLanguages;-}) {- try {- const validAmount = typeof amount === "number" ? amount : 0;+ /** The locale, already resolved against the invoice's language. */+ numberFormatLocale: SupportedNumberFormatLocale;+}- const value = validAmount?.toLocaleString(language, {- style: "currency",- currency,- minimumFractionDigits: 2,- maximumFractionDigits: 2,+/**+ * {@link formatCurrency} cut at its thousands boundaries, for a cell that may have to wrap.+ */+export function formatCurrencyChunks({+ amount,+ currency,+ numberFormatLocale,+}: FormatCurrencyArgs) {+ try {+ return formatNumberChunksForPdf({+ amount,+ numberFormatLocale,+ options: {+ style: "currency",+ currency,+ minimumFractionDigits: 2,+ maximumFractionDigits: 2,+ },});-- return value;} catch (error) {Sentry.captureException(error);- return "0.00";+ return [FALLBACK_AMOUNT];}}++/**+ * An amount with its currency, for the Stripe template -- `$321,200.00`, `321.200,00 €`.+ *+ * The locale decides both how the number is punctuated and where the symbol sits, so an+ * invoice written in English can still print `10 000,00 zł` when it is formatted in Polish.+ */+export function formatCurrency(args: FormatCurrencyArgs) {+ return formatCurrencyChunks(args).join("");+}diff --git a/src/app/(main)/(app)/utils/format-date-with-locale.ts b/src/app/(main)/(app)/utils/format-date-with-locale.tsindex 4c0430a..2147a57 100644--- a/src/app/(main)/(app)/utils/format-date-with-locale.ts+++ b/src/app/(main)/(app)/utils/format-date-with-locale.ts@@ -6,6 +6,8 @@ import type { SupportedLanguages } from "@/app/schema";// dayjs singleton. `.locale("fr")` on an unregistered locale is a silent no-op// (the date keeps the previous locale), so every language we support has to be// imported here. This is the single place that does it for the invoice form.+//+// dayjs lowercases the name it is handed, so `"pt-BR"` finds `dayjs/locale/pt-br`.import "dayjs/locale/de";import "dayjs/locale/en";import "dayjs/locale/es";@@ -14,6 +16,7 @@ import "dayjs/locale/it";import "dayjs/locale/nb";import "dayjs/locale/nl";import "dayjs/locale/pl";+import "dayjs/locale/pt-br";import "dayjs/locale/pt";import "dayjs/locale/ru";import "dayjs/locale/sv";diff --git a/src/app/(main)/(app)/utils/invoice-number-breaking-change.ts b/src/app/(main)/(app)/utils/invoice-number-breaking-change.tsindex 5ea5d9e..164233f 100644--- a/src/app/(main)/(app)/utils/invoice-number-breaking-change.ts+++ b/src/app/(main)/(app)/utils/invoice-number-breaking-change.ts@@ -1,7 +1,7 @@import { z } from "zod";import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";-import { SUPPORTED_LANGUAGES } from "@/app/schema";+import { SUPPORTED_INVOICE_PDF_LANGUAGES } from "@/app/schema";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";/**@@ -29,14 +29,14 @@ export function handleInvoiceNumberBreakingChange(json: unknown) {let lang: keyof typeof INVOICE_PDF_TRANSLATIONS;const invoiceLanguage = z- .enum(SUPPORTED_LANGUAGES)+ .enum(SUPPORTED_INVOICE_PDF_LANGUAGES).safeParse(json.language);if (!invoiceLanguage.success) {console.error("Invalid invoice language:", invoiceLanguage.error);// fallback to default language- lang = SUPPORTED_LANGUAGES[0];+ lang = SUPPORTED_INVOICE_PDF_LANGUAGES[0];} else {lang = invoiceLanguage.data;}diff --git a/src/app/(main)/(app)/utils/welcome-popup-seen-storage.ts b/src/app/(main)/(app)/utils/welcome-popup-seen-storage.tsindex c1ec048..627ecfa 100644--- a/src/app/(main)/(app)/utils/welcome-popup-seen-storage.ts+++ b/src/app/(main)/(app)/utils/welcome-popup-seen-storage.ts@@ -4,9 +4,10 @@ import {getAppStorageItem,setAppStorageItem,} from "@/app/(main)/(app)/utils/app-local-storage";-import { WELCOME_POPUP_SEEN_STORAGE_KEY } from "@/app/schema";--const WELCOME_POPUP_SEEN_VALUE = "v1";+import {+ WELCOME_POPUP_SEEN_STORAGE_KEY,+ WELCOME_POPUP_SEEN_VALUE,+} from "@/app/schema";export function hasSeenWelcomePopup() {return (diff --git a/src/app/(main)/(seo-landings)/components/seo-landing-shell.tsx b/src/app/(main)/(seo-landings)/components/seo-landing-shell.tsxindex 334f8fb..eb92dc6 100644--- a/src/app/(main)/(seo-landings)/components/seo-landing-shell.tsx+++ b/src/app/(main)/(seo-landings)/components/seo-landing-shell.tsx@@ -6,6 +6,10 @@ import { BlackGoToAppButton } from "@/app/(components)/header/go-to-app-button-cimport { seoHeroCtaMarker } from "@/app/(main)/(seo-landings)/components/seo-cta-marker";import { StickySeoCta } from "@/app/(main)/(seo-landings)/components/sticky-seo-cta";import { GithubIcon } from "@/components/etc/github-logo";+import {+ type RoughAnnotationType,+ RoughAnnotation,+} from "@/components/rough-annotation";import { Button } from "@/components/ui/button";import { FaqAccordion, FaqAccordionItem } from "@/components/ui/faq-accordion";import { YouTubeEmbed } from "@/components/youtube-embed";@@ -129,8 +133,18 @@ export function SeoLandingShell({ definition }: SeoLandingShellProps) {className="border-b border-slate-100 py-6"data-testid="seo-landing-facts-table">- <h2 className="text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl">- {definition.factsTable.heading}+ <h2+ className="text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl"+ data-testid="seo-landing-section-facts-table-title"+ >+ <RoughAnnotation+ type="underline"+ // blue-500+ color="rgb(59 130 246)"+ strokeWidth={2.5}+ >+ {definition.factsTable.heading}+ </RoughAnnotation></h2><dl className="mt-6 divide-y divide-slate-100 border-y border-slate-100">{definition.factsTable.rows.map((row) => {@@ -169,8 +183,18 @@ export function SeoLandingShell({ definition }: SeoLandingShellProps) {) : null}{canShowComparisonTable && comparisonTable ? (<div className="py-6 md:py-8">- <h2 className="w-fit bg-rose-500 text-2xl font-semibold italic tracking-tight text-white dark:bg-cyan-600 dark:text-white md:text-3xl">- {comparisonTable?.heading ?? "Feature comparison"}+ <h2+ className="text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl"+ data-testid="seo-landing-section-comparison-table-title"+ >+ <RoughAnnotation+ type="highlight"+ // rose-300+ color="rgb(253 164 175)"+ className="font-bold italic"+ >+ {comparisonTable?.heading ?? "Feature comparison"}+ </RoughAnnotation></h2>{comparisonTable?.intro ? (<p className="mt-4 max-w-3xl text-lg leading-relaxed text-slate-600">@@ -255,27 +279,25 @@ function SeoInlineCta({ href, label }: { href: string; label: string }) {}function SeoSectionBlock({ section, id }: { section: SeoSection; id: number }) {- const colors = [- "bg-yellow-300/90 text-black dark:bg-yellow-600 dark:text-black",- "bg-purple-500/90 dark:bg-purple-500 text-white dark:text-white",- "bg-green-500/90 dark:bg-green-500 text-white dark:text-white",- "bg-blue-500/90 dark:bg-blue-500 text-white dark:text-white",- "bg-orange-500/90 dark:bg-orange-500 text-white dark:text-white",- "bg-teal-500/90 dark:bg-teal-500 text-white dark:text-white",- "bg-red-500/90 dark:bg-red-500 text-white dark:text-white",- ] as const;-- const color = colors[id % colors.length];+ const mark = SECTION_TITLE_MARKS[id % SECTION_TITLE_MARKS.length];return (<sectionclassName="border-b border-slate-100 py-6 last:border-b-0"data-testid={`seo-landing-section-${section.title}`}>- <h2 className="text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl">- <span className={`${color} px-3 font-bold italic`}>+ <h2+ className="text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl"+ data-testid={"seo-landing-section-title"}+ >+ <RoughAnnotation+ type={mark.type}+ color={mark.color}+ strokeWidth={mark.type === "highlight" ? undefined : 2.5}+ className="font-bold italic"+ >{section.title}- </span>+ </RoughAnnotation></h2>{section.lead ? (<p className="mt-4 max-w-3xl text-balance text-lg leading-relaxed text-slate-800">@@ -357,3 +379,19 @@ function SeoComparisonTable({ table }: { table: ComparisonTable }) {</div>);}++/**+ * The hand-drawn marks on the section titles, cycled in order so neighbouring+ * sections never repeat one. Each draws when its title scrolls into view. No `circle`:+ * on a title this long the ellipse cuts through the first and last letters.+ */+const SECTION_TITLE_MARKS = [+ // yellow-300+ { type: "highlight", color: "rgb(253 224 71)" },+ // purple-500+ { type: "underline", color: "rgb(168 85 247)" },+ // green-500+ { type: "box", color: "rgb(34 197 94)" },+ // orange-500+ { type: "bracket", color: "rgb(249 115 22)" },+] as const satisfies { type: RoughAnnotationType; color: string }[];diff --git a/src/app/(main)/(seo-landings)/seo-landing-definitions.ts b/src/app/(main)/(seo-landings)/seo-landing-definitions.tsindex 6ce1d22..334fc17 100644--- a/src/app/(main)/(seo-landings)/seo-landing-definitions.ts+++ b/src/app/(main)/(seo-landings)/seo-landing-definitions.ts@@ -120,7 +120,7 @@ export const SEO_LANDING_DEFINITIONS = {bullets: ["A finished PDF in about a minute","No account, no email, no credit card",- "12 languages and 122 currencies",+ "13 languages and 122 currencies","Free and open source under AGPL-3.0","No ads and no tracking pixels",],@@ -192,7 +192,7 @@ export const SEO_LANDING_DEFINITIONS = {"Two layouts: a plain default one and a Stripe-style one","Upload a logo as JPEG, PNG or WebP up to 3MB, and it prints on either","Rename the tax label to VAT, GST, Sales Tax, Moms or whatever applies to you",- "Pick from 12 languages for the PDF and 122 currencies, independently",+ "Pick from 13 languages for the PDF and 122 currencies, independently","Line items total themselves as you type, tax included","The total is written out in words, following the grammar of the language you picked",],@@ -311,7 +311,7 @@ export const SEO_LANDING_DEFINITIONS = {"AGPL-3.0, source public on GitHub","Fork it or host it yourself","PDF rendered in your browser",- "12 languages and 122 currencies",+ "13 languages and 122 currencies","No account, no ads",],ctaLabel: "Create and Download a PDF",@@ -480,7 +480,7 @@ export const SEO_LANDING_DEFINITIONS = {"The Stripe-style invoice layout","No Stripe account and no dashboard","Your logo on the invoice",- "122 currencies and 12 languages",+ "122 currencies and 13 languages","Free, with no signup",],ctaLabel: "Create a Stripe-Style Invoice",@@ -536,7 +536,7 @@ export const SEO_LANDING_DEFINITIONS = {"Long-form dates, such as December 17, 2025","Amounts formatted the way the invoice language writes them, so SEK prints as 1 234,56 kr","To pay, Paid and Left to pay, so a part-paid invoice is still legible",- "The total repeated in words, in whichever of the 12 languages you picked",+ "The total repeated in words, in whichever of the 13 languages you picked",],},{@@ -647,7 +647,7 @@ export const SEO_LANDING_DEFINITIONS = {"No formulas and no broken tables","Totals and tax calculate as you type","Two layouts, your logo on either",- "12 languages and 122 currencies",+ "13 languages and 122 currencies","Free, with no signup",],ctaLabel: "Fill In and Download a PDF",@@ -721,7 +721,7 @@ export const SEO_LANDING_DEFINITIONS = {bullets: ["Rename the tax label to VAT, GST, Sales Tax, Moms or MVA","Pick any of 122 currencies, each with its own symbol and separators",- "Pick any of 12 languages, and every printed label changes with it",+ "Pick any of 13 languages, and every printed label changes with it","Choose the date format, including ISO 2025-12-17 for cross-border work","Upload a logo up to 3MB as JPEG, PNG or WebP","Hide the fields you do not use, so the PDF has no empty rows",@@ -834,18 +834,18 @@ export const SEO_LANDING_DEFINITIONS = {"multi-language-invoice-generator": {slug: "multi-language-invoice-generator",metadata: {- title: "Multi-Language Invoice Generator - Free PDF, 12 Languages",+ title: "Multi-Language Invoice Generator - Free PDF, 13 Languages",description:- "Create a professional invoice in Swedish, Norwegian, German, Spanish, Polish and seven more languages. Labels, dates and the amount in words are all localized. Free, no signup.",+ "Create a professional invoice in Swedish, Norwegian, German, Spanish, Brazilian Portuguese and eight more languages. Labels, dates and the amount in words are all localized. Free, no signup.",keywords:- "multi language invoice generator, invoice in different languages, multilingual invoice template, swedish invoice generator, norwegian invoice generator, german invoice template, spanish invoice generator, invoice amount in words, foreign language invoice, international invoice PDF",+ "multi language invoice generator, invoice in different languages, multilingual invoice template, swedish invoice generator, norwegian invoice generator, german invoice template, spanish invoice generator, brazilian portuguese invoice generator, invoice amount in words, foreign language invoice, international invoice PDF",},hero: {- h1: "Invoice Generator in 12 Languages - Free PDF",+ h1: "Invoice Generator in 13 Languages - Free PDF",subheading:"Pick a language and the whole invoice follows: every label, the date format, the tax wording and the amount written out in words. Free, in your browser, with no signup.",bullets: [- "12 languages, including Swedish and Norwegian",+ "13 languages, including Brazilian Portuguese and Swedish","Dates and tax wording follow each language","Amount in words, grammatically correct","122 currencies, chosen separately",@@ -913,16 +913,16 @@ export const SEO_LANDING_DEFINITIONS = {lead: "VAT is called something different almost everywhere, and the invoice uses the local term automatically:",bullets: ["Moms in Swedish, MVA in Norwegian, MwSt. in German",- "TVA in French, IVA in Italian, Spanish and Portuguese",+ "TVA in French, IVA in Italian, Spanish and Portuguese, Imposto in Brazilian Portuguese","BTW in Dutch, НДС in Russian, ПДВ in Ukrainian","Or type your own: GST, Sales Tax, or whatever your jurisdiction uses",],},{- title: "All 12 languages",- lead: "English, Polski, Nederlands, Français, Deutsch, Italiano, Norsk bokmål, Português, Русский, Español, Svenska, Українська.",+ title: "All 13 languages",+ lead: "English, Polski, Nederlands, Français, Deutsch, Italiano, Norsk bokmål, Português, Português (Brasil), Русский, Español, Svenska, Українська.",paragraphs: [- "Swedish and Norwegian are the most recent additions, which makes the generator a practical option for Nordic freelancers who bill clients at home and abroad.",+ "Brazilian Portuguese is the most recent addition, and a separate entry rather than a spelling variant: it labels the tax number CNPJ/CPF instead of NIF, calls the tax Imposto and its rate Alíquota rather than IVA, and writes the total the way Brazil counts — um bilhão where Portugal says mil milhões.","The language of the PDF is independent of the language you use the app in, and of the currency. Invoice a German client in EUR while working in English, or send a Swedish invoice in USD.",],},@@ -963,7 +963,7 @@ export const SEO_LANDING_DEFINITIONS = {},{feature: "Amount in words",- thisTool: "✅ 12 languages",+ thisTool: "✅ 13 languages",other: "❌ Rarely",},{@@ -984,7 +984,7 @@ export const SEO_LANDING_DEFINITIONS = {{question: "Which languages can I create an invoice in?",answer:- "Twelve: English, Polish, Dutch, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, Swedish and Ukrainian. Swedish and Norwegian are the newest additions.",+ "Thirteen: English, Polish, Dutch, French, German, Italian, Norwegian, Portuguese, Brazilian Portuguese, Russian, Spanish, Swedish and Ukrainian. Brazilian Portuguese is the newest addition, and it prints a different invoice from the European one rather than the same one spelled differently.",},{question: "Does changing the language change the currency?",@@ -1004,7 +1004,7 @@ export const SEO_LANDING_DEFINITIONS = {{question: "Can I use my own word for VAT?",answer:- "Yes. The tax label defaults to the term the selected language uses: Moms, MVA, MwSt., TVA, IVA, BTW, НДС or ПДВ. You can replace it with GST, Sales Tax, or whatever your jurisdiction requires.",+ "Yes. The tax label defaults to the term the selected language uses: Moms, MVA, MwSt., TVA, IVA, Imposto, BTW, НДС or ПДВ. You can replace it with GST, Sales Tax, or whatever your jurisdiction requires.",},{question: "Do I need an account?",@@ -1102,7 +1102,7 @@ export const SEO_LANDING_DEFINITIONS = {lead: "Swedish invoices commonly repeat the total in words under the figure, and Swedish writes those words as a single compound.",paragraphs: ["The generator spells 1234 as ettusentvåhundratrettiofyra. That includes the detail Swedish spelling depends on. Ett and tusen join as ettusen, because Swedish writes a tripled consonant as two.",- "Most invoice tools that offer a Swedish interface still print this line in English, or skip it. Here it follows the grammar of whichever of the 12 languages you pick.",+ "Most invoice tools that offer a Swedish interface still print this line in English, or skip it. Here it follows the grammar of whichever of the 13 languages you pick.",],},{diff --git a/src/app/(main)/changelog/[slug]/page.tsx b/src/app/(main)/changelog/[slug]/page.tsxindex 8958ec1..5b4bc28 100644--- a/src/app/(main)/changelog/[slug]/page.tsx+++ b/src/app/(main)/changelog/[slug]/page.tsx@@ -264,7 +264,7 @@ export default async function ChangelogEntryPage({</div>{/* Entry content */}- <div className="prose-headings:mt-8 prose-headings:font-semibold prose-headings:text-black prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl prose-h4:text-lg prose-h5:text-base prose-h6:text-sm prose-p:text-gray-600 prose-blockquote:border-l-blue-500 prose-strong:text-gray-900 prose-code:rounded prose-code:bg-gray-100 prose-code:px-2 prose-code:py-1 prose-pre:bg-gray-100 prose-li:text-gray-600 prose-img:rounded-lg prose-img:shadow-lg dark:prose-headings:text-white dark:prose-p:text-gray-300 dark:prose-strong:text-gray-100 dark:prose-code:bg-gray-800 dark:prose-pre:bg-gray-800 dark:prose-li:text-gray-300">+ <div className="prose-headings:mt-8 prose-headings:font-semibold prose-headings:text-black prose-h1:text-3xl prose-h2:text-2xl prose-h3:text-xl prose-h4:text-lg prose-h5:text-base prose-h6:text-sm prose-p:text-gray-600 prose-blockquote:border-l-blue-500 prose-strong:text-gray-900 prose-pre:bg-gray-100 prose-li:text-gray-600 prose-img:rounded-lg prose-img:shadow-lg dark:prose-headings:text-white dark:prose-p:text-gray-300 dark:prose-strong:text-gray-100 dark:prose-pre:bg-gray-800 dark:prose-li:text-gray-300"><Suspensefallback={<div className="h-64 animate-pulse rounded bg-gray-200 dark:bg-gray-700"></div>diff --git a/src/app/(main)/changelog/content/faster-pdf-preview-and-mobile-polish.mdx b/src/app/(main)/changelog/content/faster-pdf-preview-and-mobile-polish.mdxindex 96ac2f3..d0e86bd 100644--- a/src/app/(main)/changelog/content/faster-pdf-preview-and-mobile-polish.mdx+++ b/src/app/(main)/changelog/content/faster-pdf-preview-and-mobile-polish.mdx@@ -8,16 +8,7 @@ export const metadata = {type: "minor",};-## ✨ Highlights--- **Faster, flicker-free preview** - the invoice PDF is generated **once** and shared by the desktop preview, the mobile viewer and the download button, instead of being rendered separately by each of them-- **Redesigned mobile tabs** - a pill-shaped track with a single indicator that slides between the invoice form and the preview-- **Dates in the form now match the PDF** - helper texts and the out-of-date banner render dates in the invoice's own language and date format, so what you see in the form is what the PDF will say-- **Fixed PDFs missing the first characters of labels** - `Cobrar de` no longer renders as `obrar de` in rare cases-------**No PDF flickering or unnecessary re-renders**+<h2>No PDF flickering or unnecessary re-renders</h2><videosrc="https://github.com/user-attachments/assets/3c87d026-a1c3-4d69-b161-f7d72616c394"@@ -25,7 +16,7 @@ export const metadata = {style={{ width: "100%", borderRadius: "8px" }}/>-**Better mobile tabs**+<h2>Better mobile tabs</h2><videosrc="https://github.com/user-attachments/assets/0226c46b-1f65-4027-b670-1f36fa7adb9f"@@ -33,6 +24,13 @@ export const metadata = {style={{ width: "100%", borderRadius: "8px" }}/>+## ✨ Highlights++- **Faster, flicker-free preview** - the invoice PDF is generated **once** and shared by the desktop preview, the mobile viewer and the download button, instead of being rendered separately by each of them+- **Redesigned mobile tabs** - a pill-shaped track with a single indicator that slides between the invoice form and the preview+- **Dates in the form now match the PDF** - helper texts and the out-of-date banner render dates in the invoice's own language and date format, so what you see in the form is what the PDF will say+- **Fixed PDFs missing the first characters of labels** - `Cobrar de` no longer renders as `obrar de` in rare cases+---### Changeddiff --git a/src/app/(main)/changelog/content/number-format-and-brazilian-portuguese.mdx b/src/app/(main)/changelog/content/number-format-and-brazilian-portuguese.mdxnew file mode 100644index 0000000..fb905c7--- /dev/null+++ b/src/app/(main)/changelog/content/number-format-and-brazilian-portuguese.mdx@@ -0,0 +1,69 @@+export const metadata = {+ title:+ "EasyInvoicePDF v1.0.5 - Number format setting, Brazilian Portuguese invoices, and large amounts that fit their columns",+ description:+ "Choose how amounts are punctuated independently of the invoice language, write invoices in Brazilian Portuguese, and large amounts now wrap inside their column instead of running over the next one.",+ date: "2026-09-24",+ version: "1.0.5",+ type: "minor",+ popupSummary:+ "Choose your preferred number format and create invoices in Brazilian Portuguese.",+};++<iframe+ src="https://www.youtube-nocookie.com/embed/hZM2DYXo63k"+ title="EasyInvoicePDF: Customize number formatting and create invoices in Brazilian Portuguese"+ allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"+ referrerPolicy="strict-origin-when-cross-origin"+ allowFullScreen+ loading="lazy"+ style={{+ width: "100%",+ aspectRatio: "16 / 9",+ border: 0,+ borderRadius: "8px",+ marginTop: "1.5rem",+ }}+/>++## ✨ Highlights++- **Number format setting** - pick how amounts are grouped and punctuated in the PDF, separately from the invoice language. An English invoice can print `10 000,00 EUR`, and a new **International** format prints `321 200.00`, which reads the same in every country. Each option previews your invoice's own total, so you see exactly what the PDF will show+- **Keep format when language changes** - a switch that pins the number format, so you can write an invoice in your client's language and keep your own number formatting+- **Brazilian Portuguese invoices** - a new `Portuguese (Brazil)` PDF language, with `CNPJ/CPF` for the tax number, `Imposto` for the tax column, and amounts in words counted the Brazilian way (`um bilhão`, not `mil milhões`)+- **Large amounts fit their columns** - an amount too wide for its cell now wraps onto a second line at a thousands boundary, instead of painting over the column next to it++---++### Changed++- **Amounts now follow the invoice language by default in the default template.** Before this release it printed every amount as `321 200.00`, whatever the language. It now punctuates them the way the language does: `321,200.00` in English, `321.200,00` in German, `321 200,00` in Polish. This also applies to invoices saved in your browser or shared by link before this release, so re-downloading one may print its numbers differently from the copy you sent. To keep the old look, pick **International** under **Number Format**. The Stripe template already followed the language+- Four-digit amounts are now grouped in Polish, Spanish and Italian (`8 111,00` rather than `8111,00`), so they line up with larger amounts in the same column+- The default template's footer now writes the total the same way as the rest of the invoice, with the currency code rather than a symbol+- The language pickers name the country for Portuguese: `Portuguese (Portugal)` and `Portuguese (Brazil)`+- Clearer Stripe-template wording for the due date and the amount due in German, Spanish, French, Italian and Portuguese+- The Stripe template's quantity column is wider, so four- and five-digit quantities stay on one line+- A new "How to customize tax" video in the "How it works" guide++### Fixed++- French amounts in the default template's footer printed a `/` in place of the thousands space (`321/200,00 €`)+- The amount in words no longer leaves `00/100` alone on the next line++---++<div className="rounded-lg border-2 border-blue-200 bg-blue-50 px-8 py-4 dark:border-blue-900 dark:bg-blue-950" data-testid="ready-to-start-invoicing-cta">+<h2 className="!mt-4">Create your next invoice</h2>++EasyInvoicePDF is free and open source. There's no sign-up, and you can go from blank form to downloaded PDF in under a minute.++<div className="mt-6">+ <a+ href="https://easyinvoicepdf.com?ref=changelog"+ className="inline-flex h-12 w-full items-center justify-center rounded-lg bg-slate-900 px-8 text-lg font-medium no-underline transition-all hover:bg-slate-800 active:scale-[0.98]"+ >+ <span className="text-white">Start Invoicing</span>+ </a>+</div>++</div>diff --git a/src/app/(main)/changelog/content/seller-buyer-improvements.mdx b/src/app/(main)/changelog/content/seller-buyer-improvements.mdxindex f970183..4cf44c3 100644--- a/src/app/(main)/changelog/content/seller-buyer-improvements.mdx+++ b/src/app/(main)/changelog/content/seller-buyer-improvements.mdx@@ -8,6 +8,12 @@ export const metadata = {type: "minor",};+<video+ src="https://github.com/user-attachments/assets/1b39eb6f-e2be-493f-9825-cbce3dc6fa16"+ controls+ style={{ width: "100%", borderRadius: "8px", marginTop: "1.5rem" }}+/>+## ✨ Highlights- **Seller & Buyer Email visibility toggle** - control whether the email address appears in the generated PDF@@ -16,12 +22,6 @@ export const metadata = {- **Auto-scroll the invoice form on mobile** when switching between tabs (UX improvement)- **Out-of-Date dates helper** shows outdated fields and provides a button to update all dates at once-<video- src="https://github.com/user-attachments/assets/1b39eb6f-e2be-493f-9825-cbce3dc6fa16"- controls- style={{ width: "100%", borderRadius: "8px" }}-/>----### Changeddiff --git a/src/app/(main)/changelog/content/stripe-pdf-template.mdx b/src/app/(main)/changelog/content/stripe-pdf-template.mdxindex 8b21572..fb59f75 100644--- a/src/app/(main)/changelog/content/stripe-pdf-template.mdx+++ b/src/app/(main)/changelog/content/stripe-pdf-template.mdx@@ -11,7 +11,7 @@ export const metadata = {<videosrc="https://github.com/user-attachments/assets/4eef2b90-678b-4a55-9ee5-8fcf195c993a"controls- style={{ width: "100%", borderRadius: "8px" }}+ style={{ width: "100%", borderRadius: "8px", marginTop: "1.5rem" }}/>### ✨ New Featuresdiff --git a/src/app/(main)/changelog/page.tsx b/src/app/(main)/changelog/page.tsxindex 07f3e35..2260195 100644--- a/src/app/(main)/changelog/page.tsx+++ b/src/app/(main)/changelog/page.tsx@@ -105,7 +105,7 @@ function ChangelogEntryCard({ entry }: { entry: ChangelogEntry }) {{/* Article Content */}<articledata-testid="changelog-entry-card"- className="prose prose-gray max-w-none transition-all dark:prose-invert prose-headings:relative prose-headings:mb-4 prose-headings:mt-6 prose-headings:scroll-mt-20 prose-headings:font-semibold prose-headings:text-gray-900 prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg prose-h4:text-base prose-p:leading-relaxed prose-p:text-gray-600 prose-a:font-medium prose-a:text-blue-600 prose-a:underline-offset-4 hover:prose-a:text-blue-600/80 prose-strong:text-gray-900 prose-code:rounded prose-code:bg-gray-100 prose-code:px-1.5 prose-code:py-0.5 prose-code:text-sm prose-pre:border prose-pre:border-gray-200 prose-pre:bg-gray-100 prose-li:text-gray-600 prose-img:rounded-lg prose-img:border prose-img:border-gray-200 prose-img:shadow-md dark:prose-headings:text-gray-100 dark:prose-p:text-gray-300 dark:prose-a:text-blue-400 dark:prose-strong:text-gray-100 dark:prose-code:bg-gray-800 dark:prose-pre:border-gray-700 dark:prose-pre:bg-gray-800 dark:prose-li:text-gray-300 dark:prose-img:border-gray-700"+ className="prose prose-gray max-w-none transition-all dark:prose-invert prose-headings:relative prose-headings:mb-4 prose-headings:mt-6 prose-headings:scroll-mt-20 prose-headings:font-semibold prose-headings:text-gray-900 prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg prose-h4:text-base prose-p:leading-relaxed prose-p:text-gray-600 prose-a:font-medium prose-a:text-blue-600 prose-a:underline-offset-4 hover:prose-a:text-blue-600/80 prose-strong:text-gray-900 prose-pre:border prose-pre:border-gray-200 prose-pre:bg-gray-100 prose-li:text-gray-600 prose-img:rounded-lg prose-img:border prose-img:border-gray-200 prose-img:shadow-md dark:prose-headings:text-gray-100 dark:prose-p:text-gray-300 dark:prose-a:text-blue-400 dark:prose-strong:text-gray-100 dark:prose-pre:border-gray-700 dark:prose-pre:bg-gray-800 dark:prose-li:text-gray-300 dark:prose-img:border-gray-700"><Suspensefallback={diff --git a/src/app/(main)/changelog/utils.ts b/src/app/(main)/changelog/utils.tsindex 10d08bc..f6be235 100644--- a/src/app/(main)/changelog/utils.ts+++ b/src/app/(main)/changelog/utils.ts@@ -11,6 +11,8 @@ export interface ChangelogSummary {description: string;version?: string;date: string;+ /** A few words about the release for the "What's new" popup, see `popupSummary` below. */+ popupSummary?: string;}/** Maps metadata `version` (e.g. "1.0.1") to the GitHub release tag name. */@@ -42,6 +44,12 @@ interface ChangelogMetadata {version?: string;type?: "major" | "minor" | "patch";slug?: string;+ /**+ * A few words about the release, shown in the "What's new" popup in place of its generic+ * line. The popup is small and shares its space with the mascot, so keep it to a short+ * sentence; leave it out and the popup falls back to the generic line.+ */+ popupSummary?: string;}export interface ChangelogEntry {@@ -57,6 +65,7 @@ const changelogEntryMetadataSchema = z.object({date: z.iso.date(),version: z.string().optional(),type: z.enum(["major", "minor", "patch"]).optional(),+ popupSummary: z.string().min(1).max(80).optional(),});/**@@ -77,6 +86,7 @@ export async function getLatestChangelogSummary(): Promise<ChangelogSummary | nudescription: metadata.description,version: metadata.version,date: metadata.date,+ popupSummary: metadata.popupSummary,};}diff --git a/src/app/(main)/how-it-works/build-how-it-works-json-ld.ts b/src/app/(main)/how-it-works/build-how-it-works-json-ld.tsindex aa9005b..4e82688 100644--- a/src/app/(main)/how-it-works/build-how-it-works-json-ld.ts+++ b/src/app/(main)/how-it-works/build-how-it-works-json-ld.ts@@ -11,7 +11,7 @@ import {const PAGE_TITLE = "How EasyInvoicePDF Works | Video Tutorials";const PAGE_DESCRIPTION =- "Watch step-by-step video tutorials on creating invoices, saving seller and buyer details, and generating weekly invoices with EasyInvoicePDF.";+ "Watch step-by-step video tutorials on creating invoices, saving seller and buyer details, customizing tax, and generating weekly invoices with EasyInvoicePDF.";export function buildHowItWorksJsonLd(baseUrl = PROD_WEBSITE_URL): Graph {const pageUrl = `${baseUrl}/how-it-works`;diff --git a/src/app/(main)/how-it-works/layout.tsx b/src/app/(main)/how-it-works/layout.tsxindex 0a98648..e84d706 100644--- a/src/app/(main)/how-it-works/layout.tsx+++ b/src/app/(main)/how-it-works/layout.tsx@@ -15,7 +15,7 @@ const HOW_IT_WORKS_PAGE_URL = "https://easyinvoicepdf.com/how-it-works";const PAGE_TITLE = "How EasyInvoicePDF Works | Video Tutorials";const PAGE_DESCRIPTION =- "Watch step-by-step video tutorials on creating invoices, saving seller and buyer details, and generating weekly invoices with EasyInvoicePDF.";+ "Watch step-by-step video tutorials on creating invoices, saving seller and buyer details, customizing tax, and generating weekly invoices with EasyInvoicePDF.";export const metadata: Metadata = {title: PAGE_TITLE,@@ -26,6 +26,8 @@ export const metadata: Metadata = {"create invoice video","add seller invoice","add buyer invoice",+ "custom tax invoice",+ "vat invoice tutorial","weekly invoices","easyinvoicepdf demo","pdf invoice generator guide",diff --git a/src/app/(main)/how-it-works/page.tsx b/src/app/(main)/how-it-works/page.tsxindex 01821c4..ea44170 100644--- a/src/app/(main)/how-it-works/page.tsx+++ b/src/app/(main)/how-it-works/page.tsx@@ -42,10 +42,10 @@ export default function HowItWorksPage() {<Link href="/" className={linkClassName}>free invoice generator</Link>- , save seller and buyer details, add branding, and prepare weekly- invoices. Whether you need an invoice maker for a one-off bill or a- small business invoice template you can reuse, you can start in- seconds.+ , save seller and buyer details, add branding, set up VAT or your+ own tax label, and prepare weekly invoices. Whether you need an+ invoice maker for a one-off bill or a small business invoice+ template you can reuse, you can start in seconds.</p></div></div>diff --git a/src/app/[locale]/about/page.tsx b/src/app/[locale]/about/page.tsxindex c1bd570..0225eff 100644--- a/src/app/[locale]/about/page.tsx+++ b/src/app/[locale]/about/page.tsx@@ -12,6 +12,10 @@ import { FeaturesCarousel } from "@/app/[locale]/about/components/features-carouimport { GithubStarCtaMarketingPageBody } from "@/app/[locale]/about/components/github-star-cta-body";import { HeroDemoVideo } from "@/app/[locale]/about/components/hero-demo-video";import { GithubIcon } from "@/components/etc/github-logo";+import {+ type RoughAnnotationType,+ RoughAnnotation,+} from "@/components/rough-annotation";import { Button } from "@/components/ui/button";import { FaqAccordion, FaqAccordionItem } from "@/components/ui/faq-accordion";import { TooltipProvider } from "@/components/ui/tooltip";@@ -80,7 +84,7 @@ export default function AboutPage() {* Renders the hero section of the About page with:* - CTA buttons to start invoicing and view on GitHub* - Video demo of the app- * - Localized title and description with colored text spans+ * - Localized title and description with hand-drawn marks on its spans, drawn one after another* - Responsive layout (single column on mobile, two columns on XL screens)**/@@ -117,33 +121,39 @@ function HeroSection() {</h1><div className="flex justify-center xl:justify-start">- <h2 className="text-pretty px-4 text-center text-base text-slate-600 md:max-w-[500px] md:text-lg lg:px-0 xl:text-left xl:text-lg">+ <p className="text-pretty px-4 text-center text-base text-slate-600 md:max-w-[500px] md:text-lg lg:px-0 xl:text-left xl:text-lg">{(() => {let colorIndex = 0;return t.rich("hero.description", {span: (chunks) => {- const colors = [- "bg-yellow-300 dark:bg-yellow-600 text-slate-900 dark:text-slate-900",- "bg-purple-500 dark:bg-purple-500 text-white dark:text-white",- "bg-blue-500 dark:bg-blue-500 text-white dark:text-white",- ] as const;-- // Get the current color from the array using modulo to cycle through colors- // colorIndex starts at 0 and increments with each <span> element- const color = colors[colorIndex % colors.length];- // Increment for the next span element+ // Cycle through the marks: colorIndex increments with each <span>+ const mark =+ HERO_DESCRIPTION_MARKS[+ colorIndex % HERO_DESCRIPTION_MARKS.length+ ];+ // Each mark starts once the previous one has finished drawing+ const delayMs =+ HERO_MARKS_START_MS ++ colorIndex * HERO_MARK_DURATION_MS;colorIndex++;return (- <span className={`${color} px-0.5 font-bold`}>+ <RoughAnnotation+ type={mark.type}+ color={mark.color}+ strokeWidth={mark.strokeWidth}+ delayMs={delayMs}+ animationDuration={HERO_MARK_DURATION_MS}+ className="font-bold text-slate-900"+ >{chunks}- </span>+ </RoughAnnotation>);},});})()}- </h2>+ </p></div></div>@@ -338,3 +348,21 @@ function CtaSection() {</section>);}++/** When the first hero mark starts drawing, after the page has settled. */+const HERO_MARKS_START_MS = 300;+/** How long each hero mark takes to draw; the next one starts when it ends. */+const HERO_MARK_DURATION_MS = 700;++/** The marks on the hero description's `<span>`s, in order. */+const HERO_DESCRIPTION_MARKS = [+ // yellow-300+ { type: "highlight", color: "rgb(253 224 71)", strokeWidth: undefined },+ // red-500+ { type: "underline", color: "rgb(248 113 113)", strokeWidth: 3 },+] as const satisfies {+ type: RoughAnnotationType;+ color: string;+ /** Pen width in px; `undefined` keeps the default (a highlight ignores it). */+ strokeWidth: number | undefined;+}[];diff --git a/src/app/constants/index.ts b/src/app/constants/index.tsindex 99b9a4c..fbef789 100644--- a/src/app/constants/index.ts+++ b/src/app/constants/index.ts@@ -6,7 +6,7 @@ import {} from "../(main)/(app)/pdf-i18n-translations/pdf-translations";import {SUPPORTED_CURRENCIES,- SUPPORTED_LANGUAGES,+ SUPPORTED_INVOICE_PDF_LANGUAGES,SUPPORTED_TEMPLATES,DEFAULT_DATE_FORMAT,type InvoiceData,@@ -44,7 +44,7 @@ const LAST_DAY_OF_MONTH = dayjs().endOf("month").format("YYYY-MM-DD");const PAYMENT_DUE = dayjs(TODAY).add(14, "days").format("YYYY-MM-DD");const EUR = SUPPORTED_CURRENCIES[0];-const EN = SUPPORTED_LANGUAGES[0];+const EN = SUPPORTED_INVOICE_PDF_LANGUAGES[0];const DEFAULT_TEMPLATE = SUPPORTED_TEMPLATES[0];/**diff --git a/src/app/robots.ts b/src/app/robots.tsindex 1d58c57..26d981f 100644--- a/src/app/robots.ts+++ b/src/app/robots.ts@@ -2,7 +2,7 @@ import { type MetadataRoute } from "next";import { APP_URL } from "@/config";-import { SUPPORTED_LANGUAGES } from "./schema";+import { SUPPORTED_I18N_LOCALES } from "./schema";export default function robots(): MetadataRoute.Robots {return {@@ -13,7 +13,7 @@ export default function robots(): MetadataRoute.Robots {// Allow main app page (now at /)"/",// Allow about pages in all languages- ...SUPPORTED_LANGUAGES.map((locale) => {+ ...SUPPORTED_I18N_LOCALES.map((locale) => {return `/${locale}/about`;}),// Allow template parameter URLsdiff --git a/src/app/schema/__tests__/get-default-date-format.test.ts b/src/app/schema/__tests__/get-default-date-format.test.tsindex d479cfb..01d326a 100644--- a/src/app/schema/__tests__/get-default-date-format.test.ts+++ b/src/app/schema/__tests__/get-default-date-format.test.ts@@ -5,14 +5,14 @@ import {DEFAULT_DATE_FORMAT,getDefaultDateFormat,STRIPE_DEFAULT_DATE_FORMAT,- SUPPORTED_LANGUAGES,+ SUPPORTED_INVOICE_PDF_LANGUAGES,} from "@/app/schema";/** A date whose day and month can never be confused for one another. */const DATE = "2025-12-17";describe("getDefaultDateFormat", () => {- it.each(SUPPORTED_LANGUAGES)(+ it.each(SUPPORTED_INVOICE_PDF_LANGUAGES)("keeps the default template on ISO in %s, whatever the language",(language) => {expect(getDefaultDateFormat({ language, template: "default" })).toBe(@@ -28,7 +28,7 @@ describe("getDefaultDateFormat", () => {});it.each(- SUPPORTED_LANGUAGES.filter((language) => {+ SUPPORTED_INVOICE_PDF_LANGUAGES.filter((language) => {return language !== "en";}),)("leads the Stripe template's date with the day in %s", (language) => {diff --git a/src/app/schema/__tests__/language-date-formats.test.ts b/src/app/schema/__tests__/language-date-formats.test.tsindex d1968ab..96d41a1 100644--- a/src/app/schema/__tests__/language-date-formats.test.ts+++ b/src/app/schema/__tests__/language-date-formats.test.ts@@ -6,7 +6,7 @@ import {getDefaultDateFormat,LANGUAGE_TO_LONG_DATE_FORMAT,SUPPORTED_DATE_FORMATS,- SUPPORTED_LANGUAGES,+ SUPPORTED_INVOICE_PDF_LANGUAGES,} from "@/app/schema";/** A date whose day and month can never be confused for one another. */@@ -24,11 +24,14 @@ const LANGUAGE_SPECIFIC = [] as const;describe("getDateFormatsForLanguage", () => {- it.each(SUPPORTED_LANGUAGES)("offers %s its own long format", (language) => {- expect(getDateFormatsForLanguage(language)).toContain(- LANGUAGE_TO_LONG_DATE_FORMAT[language],- );- });+ it.each(SUPPORTED_INVOICE_PDF_LANGUAGES)(+ "offers %s its own long format",+ (language) => {+ expect(getDateFormatsForLanguage(language)).toContain(+ LANGUAGE_TO_LONG_DATE_FORMAT[language],+ );+ },+ );/*** Spelled out per language rather than derived, so that pointing a language at a@@ -43,6 +46,7 @@ describe("getDateFormatsForLanguage", () => {["it", []],["nb", ["D. MMMM YYYY"]],["pt", ["D [de] MMMM [de] YYYY"]],+ ["pt-BR", ["D [de] MMMM [de] YYYY"]],["ru", ["D MMMM YYYY [г.]"]],["es", ["D [de] MMMM [de] YYYY"]],["sv", []],@@ -66,7 +70,7 @@ describe("getDateFormatsForLanguage", () => {return !languageSpecific.includes(format);});- for (const language of SUPPORTED_LANGUAGES) {+ for (const language of SUPPORTED_INVOICE_PDF_LANGUAGES) {expect(getDateFormatsForLanguage(language)).toEqual(expect.arrayContaining([...shared]),);@@ -74,7 +78,7 @@ describe("getDateFormatsForLanguage", () => {});it("preserves the order of the full list", () => {- for (const language of SUPPORTED_LANGUAGES) {+ for (const language of SUPPORTED_INVOICE_PDF_LANGUAGES) {const offered: readonly string[] = getDateFormatsForLanguage(language);expect(getDateFormatsForLanguage(language)).toEqual(@@ -91,6 +95,7 @@ describe("the Stripe default reads as a real date in every language", () => {["de", "17. Dezember 2025"],["es", "17 de diciembre de 2025"],["pt", "17 de dezembro de 2025"],+ ["pt-BR", "17 de dezembro de 2025"],["pl", "17 grudnia 2025"],["ru", "17 декабря 2025 г."],["uk", "17 грудня 2025 р."],diff --git a/src/app/schema/__tests__/resolve-number-format-locale.test.ts b/src/app/schema/__tests__/resolve-number-format-locale.test.tsnew file mode 100644index 0000000..de51d28--- /dev/null+++ b/src/app/schema/__tests__/resolve-number-format-locale.test.ts@@ -0,0 +1,105 @@+import { describe, expect, it } from "vitest";++import {+ getNumberFormatLocaleAfterLanguageChange,+ resolveNumberFormatLocale,+ SUPPORTED_INVOICE_PDF_LANGUAGES,+ invoiceSchema,+} from "@/app/schema";+import { MOCK_INVOICE_DATA } from "@/utils/__tests__/data";++describe("resolveNumberFormatLocale", () => {+ it.each(SUPPORTED_INVOICE_PDF_LANGUAGES)(+ "follows the invoice language (%s) when there is no override",+ (language) => {+ expect(resolveNumberFormatLocale({ language })).toBe(language);+ },+ );++ it("uses the override when the invoice carries one", () => {+ expect(+ resolveNumberFormatLocale({+ language: "en",+ numberFormatLocale: "pl",+ }),+ ).toBe("pl");++ expect(+ resolveNumberFormatLocale({+ language: "de",+ numberFormatLocale: "international",+ }),+ ).toBe("international");+ });++ /**+ * The field is deliberately not `.default()`ed: an invoice only carries it once someone+ * has picked one, which keeps it out of every share link and every `localStorage` entry+ * that predates the setting.+ */+ it("is not stored on an invoice that never picked one", () => {+ const parsed = invoiceSchema.parse(MOCK_INVOICE_DATA);++ expect(parsed.numberFormatLocale).toBeUndefined();++ // the key is absent, not undefined, so it never reaches localStorage or a share link+ expect(Object.hasOwn(parsed, "numberFormatLocale")).toBe(false);+ });+});++describe("getNumberFormatLocaleAfterLanguageChange", () => {+ it("follows the new language when the format is not pinned", () => {+ expect(+ getNumberFormatLocaleAfterLanguageChange({+ previousLanguage: "en",+ nextLanguage: "pl",+ numberFormatLocale: "en",+ }),+ ).toBe("pl");++ // explicitly off reads the same as absent+ expect(+ getNumberFormatLocaleAfterLanguageChange({+ previousLanguage: "en",+ nextLanguage: "pl",+ numberFormatLocale: "en",+ preserveNumberFormatOnLanguageChange: false,+ }),+ ).toBe("pl");+ });++ it("follows the new language even when the invoice never picked a format", () => {+ expect(+ getNumberFormatLocaleAfterLanguageChange({+ previousLanguage: "en",+ nextLanguage: "de",+ }),+ ).toBe("de");+ });++ it("keeps the picked format when it is pinned", () => {+ expect(+ getNumberFormatLocaleAfterLanguageChange({+ previousLanguage: "en",+ nextLanguage: "pl",+ numberFormatLocale: "international",+ preserveNumberFormatOnLanguageChange: true,+ }),+ ).toBe("international");+ });++ /**+ * The case the flag exists for: nothing is stored, so the numbers on screen are written+ * in the language being left behind. Pinning has to name that language, or the format+ * would follow the new one and preserve nothing.+ */+ it("pins the previous language when the invoice never picked a format", () => {+ expect(+ getNumberFormatLocaleAfterLanguageChange({+ previousLanguage: "de",+ nextLanguage: "en",+ preserveNumberFormatOnLanguageChange: true,+ }),+ ).toBe("de");+ });+});diff --git a/src/app/schema/index.ts b/src/app/schema/index.tsindex 05ed5f9..a6ab307 100644--- a/src/app/schema/index.ts+++ b/src/app/schema/index.ts@@ -671,10 +671,11 @@ export type TemplateLabels =* unsorted; adding a language means slotting its code in where its *name* belongs, and* mirroring the position in the maps that follow.*- * `en` has to stay first for a second reason: it is read as the default locale- * (`SUPPORTED_LANGUAGES[0]`) by the i18n routing and the invoice defaults.+ * `en` has to stay first for a second reason: it is the invoice's default language.+ *+ * This is the PDF's language, not the site's -- see {@link SUPPORTED_I18N_LOCALES}.*/-export const SUPPORTED_LANGUAGES = [+export const SUPPORTED_INVOICE_PDF_LANGUAGES = ["en","pl","nl",@@ -683,12 +684,45 @@ export const SUPPORTED_LANGUAGES = ["it","nb","pt",+ "pt-BR","ru","es","sv","uk",] as const;-export type SupportedLanguages = (typeof SUPPORTED_LANGUAGES)[number];+export type SupportedLanguages =+ (typeof SUPPORTED_INVOICE_PDF_LANGUAGES)[number];++/**+ * The languages the *interface* is translated into.+ *+ * Every one of these is a route (`/pt/about`), a `messages/<locale>.json`, a+ * `public/<locale>/about.md`, a sitemap entry and a footer link, so a locale costs a page+ * to write and keep up to date. An invoice language costs a column of labels, which is why+ * the two lists are allowed to differ: `pt-BR` prints a Brazilian invoice without+ * committing the site to a second Portuguese translation.+ *+ * `satisfies` keeps it a subset -- a locale has to be a language the PDF can be written in+ * too, since the about page links straight into the generator.+ *+ * `en` has to stay first: it is read as the default locale (`SUPPORTED_I18N_LOCALES[0]`) by the+ * i18n routing.+ */+export const SUPPORTED_I18N_LOCALES = [+ "en",+ "pl",+ "nl",+ "fr",+ "de",+ "it",+ "nb",+ "pt",+ "ru",+ "es",+ "sv",+ "uk",+] as const satisfies readonly SupportedLanguages[];+export type SupportedLocale = (typeof SUPPORTED_I18N_LOCALES)[number];export const MAX_INVOICE_ITEMS = 100;@@ -701,12 +735,33 @@ export const LANGUAGE_TO_LABEL = {it: "Italian",nb: "Norwegian",pt: "Portuguese",+ "pt-BR": "Portuguese (BR)",ru: "Russian",es: "Spanish",sv: "Swedish",uk: "Ukrainian",} as const satisfies Record<SupportedLanguages, string>;+/**+ * The same names as {@link LANGUAGE_TO_LABEL}, with the region spelled out for the+ * languages that are written differently in more than one country.+ *+ * Only Portuguese needs it today, and the two are separate invoices rather than separate+ * spellings: `pt` labels the tax number "NIF" and the tax "IVA", spells "dezasseis" and+ * counts in the long scale ("mil milhões"); `pt-BR` labels them "CNPJ/CPF" and "Imposto",+ * spells "dezesseis" and counts in the short one ("bilhões"). Naming the country lets a+ * reader pick the right one up front, instead of finding out after generating the PDF.+ *+ * This is for pickers only. Everywhere the language is merely stated rather than chosen --+ * the download button, where the name sits inside a fixed-width label -- keeps the short+ * {@link LANGUAGE_TO_LABEL} name.+ */+export const LANGUAGE_TO_LABEL_WITH_REGION = {+ ...LANGUAGE_TO_LABEL,+ pt: "Portuguese (Portugal)",+ "pt-BR": "Portuguese (Brazil)",+} as const satisfies Record<SupportedLanguages, string>;+/*** Mapping from language code to its native language label.* Used for language selectors, footer, and UI where displaying the language in its native form is preferred.@@ -721,6 +776,7 @@ export const LANGUAGE_TO_NATIVE_LABEL = {it: "Italiano",nb: "Norsk bokmål",pt: "Português",+ "pt-BR": "Português (Brasil)",ru: "Русский",es: "Español",sv: "Svenska",@@ -778,6 +834,7 @@ export const LANGUAGE_TO_LONG_DATE_FORMAT = {it: "D MMMM YYYY",nb: "D. MMMM YYYY",pt: "D [de] MMMM [de] YYYY",+ "pt-BR": "D [de] MMMM [de] YYYY",ru: "D MMMM YYYY [г.]",es: "D [de] MMMM [de] YYYY",sv: "D MMMM YYYY",@@ -852,6 +909,101 @@ export function getDefaultDateFormat({*/export type SupportedDateFormat = (typeof SUPPORTED_DATE_FORMATS)[number];+/**+ * The locales an invoice's numbers can be written in, on top of the invoice's own language.+ *+ * `international` is what the default template printed before this setting existed:+ * thousands grouped with a no-break space, the decimal marked with a dot (`321 200.00`). It+ * belongs to no locale on purpose -- `321.200` reads as three hundred thousand in the US and+ * as a fraction of one in Germany, while a space reads the same everywhere, which is what an+ * invoice that crosses a border wants.+ *+ * Every other value is one of the languages the PDF can be written in, because the language+ * of the labels and the way the numbers are punctuated are separate concerns: a Polish+ * issuer writing an English invoice may well want `10 000,00 EUR` under English headings.+ *+ * None of it changes which currency the invoice is in. It does change how that currency is+ * written: the default template prints an ISO 4217 code next to the amount whatever the+ * locale, while the Stripe template prints the symbol where the locale puts it -- `$321,200.00`+ * formatted in English, `321.200,00 $` formatted in German.+ */+export const SUPPORTED_NUMBER_FORMAT_LOCALES = [+ "international",+ ...SUPPORTED_INVOICE_PDF_LANGUAGES,+] as const;++export type SupportedNumberFormatLocale =+ (typeof SUPPORTED_NUMBER_FORMAT_LOCALES)[number];++interface ResolveNumberFormatLocaleArgs {+ /** The invoice PDF language. */+ language: SupportedLanguages;+ /** The override, on the invoices that carry one. */+ numberFormatLocale?: SupportedNumberFormatLocale;+}++/**+ * The locale an invoice writes its numbers in.+ *+ * The form keeps the stored value in step with the invoice language -- picking a language+ * picks its number format too -- so this fallback is for an invoice that carries no value:+ * one saved before the setting existed, or a new one nobody has touched. It is written in+ * its own language, so an English invoice reads `321,200.00`.+ *+ * That is a deliberate change for the default template, which printed every amount+ * `international` (`321 200.00`) whatever the language before this setting existed: such+ * an invoice, re-downloaded, now follows its language instead. The Stripe template always+ * did, so it prints what it always printed.+ */+export function resolveNumberFormatLocale({+ language,+ numberFormatLocale,+}: ResolveNumberFormatLocaleArgs) {+ return numberFormatLocale ?? language;+}++interface GetNumberFormatLocaleAfterLanguageChangeArgs {+ /** The language the invoice is being switched away from. */+ previousLanguage: SupportedLanguages;+ /** The language the invoice is being switched to. */+ nextLanguage: SupportedLanguages;+ /** The format the invoice carries, on the invoices that carry one. */+ numberFormatLocale?: SupportedNumberFormatLocale;+ /**+ * Whether the invoice pins its number format, see+ * {@link invoiceObjectSchema.shape.preserveNumberFormatOnLanguageChange}.+ */+ preserveNumberFormatOnLanguageChange?: boolean;+}++/**+ * The number format an invoice should carry once its language changes.+ *+ * Unpinned, the format follows the language: most invoices want Polish numbers under+ * Polish headings, and the form has moved the two together since the setting shipped.+ *+ * Pinned, it returns the *resolved* previous format rather than the stored one. The+ * difference matters on an invoice that never picked a format: it carries none and+ * {@link resolveNumberFormatLocale} falls back to its language, so returning `undefined`+ * would let the format follow the new language -- the opposite of preserving it. Naming+ * the language being left behind is what actually keeps the numbers on screen unchanged.+ */+export function getNumberFormatLocaleAfterLanguageChange({+ previousLanguage,+ nextLanguage,+ numberFormatLocale,+ preserveNumberFormatOnLanguageChange,+}: GetNumberFormatLocaleAfterLanguageChangeArgs): SupportedNumberFormatLocale {+ if (!preserveNumberFormatOnLanguageChange) {+ return nextLanguage;+ }++ return resolveNumberFormatLocale({+ language: previousLanguage,+ numberFormatLocale,+ });+}+/**** This is the version of the app and the schema of the app's data model@@ -1159,9 +1311,31 @@ export const BUYERS_LOCAL_STORAGE_KEY = "EASY_INVOICE_PDF_BUYERS";* Exported for tests that need access to `.shape` (e.g. URL compression key map).*/export const invoiceObjectSchema = z.object({- language: z.enum(SUPPORTED_LANGUAGES).default("en"),+ language: z.enum(SUPPORTED_INVOICE_PDF_LANGUAGES).default("en"),dateFormat: z.enum(SUPPORTED_DATE_FORMATS).default("YYYY-MM-DD"),currency: z.enum(SUPPORTED_CURRENCIES).default("EUR"),+ /**+ * The locale the numbers are punctuated in. The form writes it alongside `language` and+ * lets it be changed on its own afterwards, so the two can differ; it is absent only on+ * invoices saved before the setting existed, see {@link resolveNumberFormatLocale}.+ *+ * Whether a later language switch overwrites it is up to+ * {@link invoiceObjectSchema.shape.preserveNumberFormatOnLanguageChange}.+ */+ numberFormatLocale: z.enum(SUPPORTED_NUMBER_FORMAT_LOCALES).optional(),+ /**+ * Keep `numberFormatLocale` as it is when the invoice language changes.+ *+ * Off, which is the absence of the field, the two move together: picking Polish picks+ * Polish number formatting, which is what most invoices want. On, the format is pinned+ * and only the labels follow the language -- for the issuer who writes the same+ * `10 000,00` whoever is reading it.+ *+ * Like `numberFormatLocale` it is deliberately not `.default()`ed, so an invoice carries+ * it only once someone has turned it on, and it stays out of every share link and+ * `localStorage` entry that predates the setting.+ */+ preserveNumberFormatOnLanguageChange: z.boolean().optional(),template: z.enum(SUPPORTED_TEMPLATES).default("default"),/**@@ -1528,6 +1702,12 @@ export const METADATA_LOCAL_STORAGE_KEY = "EASY_INVOICE_METADATA";*/export const WELCOME_POPUP_SEEN_STORAGE_KEY = "EASY_INVOICE_WELCOME_POPUP_SEEN";+/**+ * The value {@link WELCOME_POPUP_SEEN_STORAGE_KEY} holds once the welcome popup has been+ * seen. Exported for `playwright.config.ts`, which marks it seen for every e2e run.+ */+export const WELCOME_POPUP_SEEN_VALUE = "v1";+/** The slug of the newest changelog entry the user has seen. */export const CHANGELOG_SEEN_STORAGE_KEY ="EASY_INVOICE_LAST_SEEN_CHANGELOG_SLUG";diff --git a/src/app/sitemap.ts b/src/app/sitemap.tsindex 77c3811..5967aae 100644--- a/src/app/sitemap.ts+++ b/src/app/sitemap.ts@@ -4,7 +4,7 @@ import { SEO_LANDING_SLUGS } from "@/app/(main)/(seo-landings)/seo-landing-definimport { APP_URL } from "@/config";import { getChangelogEntries } from "./(main)/changelog/utils";-import { SUPPORTED_LANGUAGES } from "./schema";+import { SUPPORTED_I18N_LOCALES } from "./schema";export default async function sitemap(): Promise<MetadataRoute.Sitemap> {const lastModified = new Date();@@ -27,7 +27,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {priority: 1,},// About pages in all languages- ...SUPPORTED_LANGUAGES.map((locale) => {+ ...SUPPORTED_I18N_LOCALES.map((locale) => {return {url: `${APP_URL}/${locale}/about`,lastModified,diff --git a/src/components/rough-annotation.tsx b/src/components/rough-annotation.tsxnew file mode 100644index 0000000..3c6097f--- /dev/null+++ b/src/components/rough-annotation.tsx@@ -0,0 +1,117 @@+"use client";++import { useEffect, useRef } from "react";+import { annotate } from "rough-notation";++import { cn } from "@/lib/utils";++/**+ * Draws a hand-drawn rough-notation mark (highlight, underline, box, ...) around its+ * children once they are on screen.+ *+ * rough-notation inserts its SVG as a sibling of the annotated element, so the element+ * it gets is an inner span: the outer span is the one React renders into the page, and+ * the SVG lands inside it instead of between nodes React manages.+ *+ * With `prefers-reduced-motion: reduce` the mark appears at once, without the drawing.+ */+export function RoughAnnotation({+ children,+ type,+ color,+ delayMs = 0,+ animationDuration = 800,+ strokeWidth = 1.5,+ padding = 5,+ iterations = 2,+ className,+}: RoughAnnotationProps) {+ const ref = useRef<HTMLSpanElement>(null);++ useEffect(() => {+ const element = ref.current;+ if (!element) {+ return;+ }++ const reduceMotion = window.matchMedia(+ "(prefers-reduced-motion: reduce)",+ ).matches;++ const annotation = annotate(element, {+ type,+ color,+ animate: !reduceMotion,+ animationDuration,+ strokeWidth,+ padding,+ iterations,+ // One mark per line when the text wraps; boxes and brackets frame the whole block instead+ multiline: type !== "bracket" && type !== "box",+ brackets: type === "bracket" ? ["left", "right"] : undefined,+ });++ let timeout: number | undefined;++ // Starts the delay only once the element is visible, so marks further down the+ // page still draw in front of the reader instead of finishing off-screen.+ const observer = new IntersectionObserver(+ ([entry]) => {+ if (!entry?.isIntersecting) {+ return;+ }+ observer.disconnect();+ timeout = window.setTimeout(+ () => {+ annotation.show();+ },+ reduceMotion ? 0 : delayMs,+ );+ },+ { rootMargin: "0px 0px -20% 0px" },+ );+ observer.observe(element);++ return () => {+ observer.disconnect();+ window.clearTimeout(timeout);+ annotation.remove();+ };+ }, [+ type,+ color,+ delayMs,+ animationDuration,+ strokeWidth,+ padding,+ iterations,+ ]);++ return (+ <span className={cn("relative", className)}>+ <span ref={ref}>{children}</span>+ </span>+ );+}++export type RoughAnnotationType = Parameters<typeof annotate>[1]["type"];++interface RoughAnnotationProps {+ children: React.ReactNode;+ /** The kind of mark; `bracket` draws a bracket on both sides. */+ type: RoughAnnotationType;+ /** Any CSS colour. Highlights sit behind the text, so give them some transparency. */+ color: string;+ /** Wait after the element comes into view before drawing, to sequence several marks. */+ delayMs?: number;+ /** How long the drawing takes, in ms. */+ animationDuration?: number;+ /** Line width of the mark, in px. Ignored by `highlight`. */+ strokeWidth?: number;+ /** Space between the text and the mark, in px. */+ padding?: number;+ /** How many passes the pen makes. 1 is cleaner, 2 looks more hand-drawn. */+ iterations?: number;+ /** Classes for the outer span, e.g. font weight or text colour. */+ className?: string;+}diff --git a/src/config.ts b/src/config.tsindex 10f2f5f..a6bd04d 100644--- a/src/config.ts+++ b/src/config.ts@@ -54,6 +54,9 @@ export const YOUTUBE_VIDEO_HOW_TO_ADD_BUYER =const YOUTUBE_VIDEO_HOW_TO_ADD_INVOICE_FOR_ONE_WEEK ="https://www.youtube.com/embed/6KzDBBiAJmg";+const YOUTUBE_VIDEO_HOW_TO_CUSTOMIZE_TAX =+ "https://www.youtube.com/embed/F_iJxZ3PHbk";+/*** Video catalog for the "How it works" dialog*/@@ -106,6 +109,19 @@ export const HOW_IT_WORKS_VIDEOS = [thumbnailUrl: "https://i.ytimg.com/vi/6KzDBBiAJmg/maxresdefault.jpg",iframeTitle: "How to create weekly invoices - EasyInvoicePDF",},+ {+ id: "custom-tax",+ tabLabel: "Customizable tax",+ tabLabelShort: "Tax",+ title: "How to customize tax",+ description:+ "Rename VAT to GST, Sales Tax, or any label, and set a rate per item.",+ embedUrl: YOUTUBE_VIDEO_HOW_TO_CUSTOMIZE_TAX,+ watchUrl: "https://www.youtube.com/watch?v=F_iJxZ3PHbk",+ uploadDate: "2026-09-08T16:22:57-07:00",+ thumbnailUrl: "https://i.ytimg.com/vi/F_iJxZ3PHbk/maxresdefault.jpg",+ iframeTitle: "How to customize tax on an invoice - EasyInvoicePDF",+ },] as const satisfies {id: string;tabLabel: string;diff --git a/src/i18n/routing.ts b/src/i18n/routing.tsindex 42fa6f1..4d22b97 100644--- a/src/i18n/routing.ts+++ b/src/i18n/routing.ts@@ -1,12 +1,12 @@import { defineRouting } from "next-intl/routing";-import { SUPPORTED_LANGUAGES } from "@/app/schema";+import { SUPPORTED_I18N_LOCALES } from "@/app/schema";-const defaultLocaleEN = SUPPORTED_LANGUAGES[0];+const defaultLocaleEN = SUPPORTED_I18N_LOCALES[0];export const routing = defineRouting({// A list of all locales that are supported- locales: SUPPORTED_LANGUAGES,+ locales: SUPPORTED_I18N_LOCALES,// Used when no locale matchesdefaultLocale: defaultLocaleEN,diff --git a/src/lib/seo/__tests__/llms-markdown-pages.test.ts b/src/lib/seo/__tests__/llms-markdown-pages.test.tsindex 0d02f95..783ba35 100644--- a/src/lib/seo/__tests__/llms-markdown-pages.test.ts+++ b/src/lib/seo/__tests__/llms-markdown-pages.test.ts@@ -4,18 +4,18 @@ import { resolve } from "node:path";import { assert, describe, expect, it } from "vitest";import { z } from "zod";-import { SUPPORTED_LANGUAGES, type SupportedLanguages } from "@/app/schema";+import { SUPPORTED_I18N_LOCALES, type SupportedLocale } from "@/app/schema";/**- * Derived from {@link SUPPORTED_LANGUAGES} rather than hand-listed: the about+ * Derived from {@link SUPPORTED_I18N_LOCALES} rather than hand-listed: the about* page advertises `<link rel="alternate" type="text/markdown">` for every- * locale, so a language added without its Markdown page ships a 404 that a+ * locale, so a locale added without its Markdown page ships a 404 that a* hardcoded list here would never notice.*/const MARKDOWN_PATHS = ["invoice-generator.md","how-it-works.md",- ...SUPPORTED_LANGUAGES.map((locale) => {+ ...SUPPORTED_I18N_LOCALES.map((locale) => {return `${locale}/about.md`;}),] as const;@@ -33,7 +33,7 @@ const UPDATE_DATE_LABELS = {nl: "Laatst bijgewerkt",sv: "Senast uppdaterad",nb: "Sist oppdatert",-} as const satisfies Record<SupportedLanguages, string>;+} as const satisfies Record<SupportedLocale, string>;const UPDATE_DATE_SCHEMA = z.iso.date().transform((value) => {return new Date(`${value}T00:00:00.000Z`);diff --git a/src/lib/seo/__tests__/locale-utils.test.ts b/src/lib/seo/__tests__/locale-utils.test.tsindex 2b60c9d..eff864d 100644--- a/src/lib/seo/__tests__/locale-utils.test.ts+++ b/src/lib/seo/__tests__/locale-utils.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from "vitest";-import { SUPPORTED_LANGUAGES } from "@/app/schema";+import { SUPPORTED_I18N_LOCALES } from "@/app/schema";import { APP_URL } from "@/config";import {buildHreflangAlternates,@@ -8,16 +8,16 @@ import {} from "@/lib/seo/locale-utils";describe("buildHreflangAlternates", () => {- it("annotates every supported language plus x-default", () => {+ it("annotates every supported locale plus x-default", () => {const alternates = buildHreflangAlternates("about");expect(Object.keys(alternates).toSorted()).toEqual(- ["x-default", ...SUPPORTED_LANGUAGES].toSorted(),+ ["x-default", ...SUPPORTED_I18N_LOCALES].toSorted(),);expect(alternates["x-default"]).toBe(`${APP_URL}/en/about`);});- it.each(SUPPORTED_LANGUAGES)(+ it.each(SUPPORTED_I18N_LOCALES)("gives /%s/about a self-referencing annotation",(locale) => {// Google discards an hreflang cluster whose pages are not listed in it,@@ -28,9 +28,9 @@ describe("buildHreflangAlternates", () => {},);- it("covers every supported language with an Open Graph locale", () => {+ it("covers every supported locale with an Open Graph locale", () => {expect(Object.keys(OPEN_GRAPH_LOCALE_BY_LOCALE).toSorted()).toEqual(- [...SUPPORTED_LANGUAGES].toSorted(),+ [...SUPPORTED_I18N_LOCALES].toSorted(),);});});diff --git a/src/mdx-components.tsx b/src/mdx-components.tsxindex e3e7ecd..eb253ce 100644--- a/src/mdx-components.tsx+++ b/src/mdx-components.tsx@@ -39,17 +39,7 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {);},- // Enhanced inline code styling- code: ({ children, ...props }) => {- return (- <code- {...props}- className="rounded bg-gray-100 px-1.5 py-0.5 font-mono text-sm text-gray-800 dark:bg-gray-800 dark:text-gray-200"- >- {children}- </code>- );- },+ // Inline `code` is styled by the typography theme in `tailwind.config.ts`// Custom blockquote with accent colorblockquote: ({ children, ...props }) => {diff --git a/src/proxy.ts b/src/proxy.tsindex f71ad44..88c4cae 100644--- a/src/proxy.ts+++ b/src/proxy.ts@@ -19,6 +19,6 @@ export const config = {// `/api/*` and assets are untouched.//// Next.js requires a static literal here, so this list cannot be derived from- // `routing.locales` — keep it in sync with SUPPORTED_LANGUAGES.+ // `routing.locales` — keep it in sync with SUPPORTED_I18N_LOCALES.matcher: ["/(en|pl|nl|fr|de|it|nb|pt|ru|es|sv|uk)/:path*"],};diff --git a/src/utils/__tests__/invoice-utils.test.ts b/src/utils/__tests__/invoice-utils.test.tsindex 93298c4..f66df86 100644--- a/src/utils/__tests__/invoice-utils.test.ts+++ b/src/utils/__tests__/invoice-utils.test.ts@@ -2,7 +2,7 @@ import * as Sentry from "@sentry/nextjs";import { toast } from "sonner";import { beforeEach, describe, expect, it, vi } from "vitest";-import { SUPPORTED_LANGUAGES } from "@/app/schema";+import { SUPPORTED_INVOICE_PDF_LANGUAGES } from "@/app/schema";import { MAX_SPELLABLE } from "@/utils/number-to-words";import { getAmountInWords } from "../invoice.utils";@@ -30,24 +30,31 @@ const AMOUNT_IN_WORDS_BY_LANGUAGE = {es: "mil doscientos treinta y cuatro",sv: "ettusentvåhundratrettiofyra",pt: "mil duzentos e trinta e quatro",+ "pt-BR": "mil duzentos e trinta e quatro",ru: "одна тысяча двести тридцать четыре",uk: "одна тисяча двiстi тридцять чотири",fr: "mille deux cent trente-quatre",it: "milleduecentotrentaquattro",nb: "ett tusen to hundre og trettifire",nl: "twaalfhonderd vierendertig",-} as const satisfies Record<(typeof SUPPORTED_LANGUAGES)[number], string>;+} as const satisfies Record<+ (typeof SUPPORTED_INVOICE_PDF_LANGUAGES)[number],+ string+>;describe("getAmountInWords", () => {- it.each(SUPPORTED_LANGUAGES)("converts 1234 in %s", (language) => {- expect(getAmountInWords({ amount: 1234, language })).toBe(- AMOUNT_IN_WORDS_BY_LANGUAGE[language],- );- });+ it.each(SUPPORTED_INVOICE_PDF_LANGUAGES)(+ "converts 1234 in %s",+ (language) => {+ expect(getAmountInWords({ amount: 1234, language })).toBe(+ AMOUNT_IN_WORDS_BY_LANGUAGE[language],+ );+ },+ );it("covers every supported language", () => {expect(Object.keys(AMOUNT_IN_WORDS_BY_LANGUAGE).sort()).toEqual(- [...SUPPORTED_LANGUAGES].sort(),+ [...SUPPORTED_INVOICE_PDF_LANGUAGES].sort(),);});diff --git a/src/utils/invoice.utils.ts b/src/utils/invoice.utils.tsindex ac73df3..10a28a5 100644--- a/src/utils/invoice.utils.ts+++ b/src/utils/invoice.utils.ts@@ -2,7 +2,10 @@ import * as Sentry from "@sentry/nextjs";import { toast } from "sonner";import { z } from "zod";-import { SUPPORTED_LANGUAGES, type SupportedLanguages } from "@/app/schema";+import {+ SUPPORTED_INVOICE_PDF_LANGUAGES,+ type SupportedLanguages,+} from "@/app/schema";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";import { numberToWords } from "@/utils/number-to-words";@@ -42,7 +45,7 @@ export function getAmountInWords({.nonnegative("Amount must be non-negative").transform(Math.floor);- const languageSchema = z.enum(SUPPORTED_LANGUAGES).default("en");+ const languageSchema = z.enum(SUPPORTED_INVOICE_PDF_LANGUAGES).default("en");const result = z.object({diff --git a/src/utils/number-to-words/__tests__/number-to-words.test.ts b/src/utils/number-to-words/__tests__/number-to-words.test.tsindex 64fd8d3..11bb4e9 100644--- a/src/utils/number-to-words/__tests__/number-to-words.test.ts+++ b/src/utils/number-to-words/__tests__/number-to-words.test.ts@@ -1,6 +1,9 @@import { describe, expect, it } from "vitest";-import { SUPPORTED_LANGUAGES, type SupportedLanguages } from "@/app/schema";+import {+ SUPPORTED_INVOICE_PDF_LANGUAGES,+ type SupportedLanguages,+} from "@/app/schema";import { MAX_SPELLABLE, numberToWords } from "..";@@ -199,6 +202,47 @@ const EXPECTED = {"novecentos e noventa e nove mil novecentos e noventa e nove milhões novecentos e noventa e nove mil novecentos e noventa e nove",],],+ // The rows `pt` and `pt-BR` disagree on are the point of this table: the teens+ // ("dezesseis", not "dezasseis") and every value from 10^9 up, where Brazil counts on+ // the short scale -- "um bilhão" against Portugal's "mil milhões".+ "pt-BR": [+ [0, "zero"],+ [1, "um"],+ [11, "onze"],+ [14, "quatorze"],+ [16, "dezesseis"],+ [17, "dezessete"],+ [19, "dezenove"],+ [21, "vinte e um"],+ [42, "quarenta e dois"],+ [80, "oitenta"],+ [81, "oitenta e um"],+ [99, "noventa e nove"],+ [100, "cem"],+ [101, "cento e um"],+ [111, "cento e onze"],+ [200, "duzentos"],+ [700, "setecentos"],+ [999, "novecentos e noventa e nove"],+ [1000, "mil"],+ [1100, "mil e cem"],+ [1234, "mil duzentos e trinta e quatro"],+ [2021, "dois mil e vinte e um"],+ [9999, "nove mil novecentos e noventa e nove"],+ [123_456, "cento e vinte e três mil quatrocentos e cinquenta e seis"],+ [1_000_000, "um milhão"],+ [2_000_000, "dois milhões"],+ [+ 1_234_567,+ "um milhão duzentos e trinta e quatro mil quinhentos e sessenta e sete",+ ],+ [1_000_000_000, "um bilhão"],+ [2_000_000_000, "dois bilhões"],+ [+ 999_999_999_999,+ "novecentos e noventa e nove bilhões novecentos e noventa e nove milhões novecentos e noventa e nove mil novecentos e noventa e nove",+ ],+ ],ru: [[0, "ноль"],[1, "один"],@@ -447,28 +491,31 @@ const EXPECTED = {],} satisfies Record<SupportedLanguages, readonly (readonly [number, string])[]>;-describe.each(SUPPORTED_LANGUAGES)("numberToWords in %s", (language) => {- it.each(EXPECTED[language])("spells out %i", (value, words) => {- expect(numberToWords({ value, language })).toBe(words);- });+describe.each(SUPPORTED_INVOICE_PDF_LANGUAGES)(+ "numberToWords in %s",+ (language) => {+ it.each(EXPECTED[language])("spells out %i", (value, words) => {+ expect(numberToWords({ value, language })).toBe(words);+ });- it("never returns an empty string", () => {- for (let value = 0; value <= 2000; value++) {- expect(numberToWords({ value, language })).not.toBe("");- }- });+ it("never returns an empty string", () => {+ for (let value = 0; value <= 2000; value++) {+ expect(numberToWords({ value, language })).not.toBe("");+ }+ });- it("spells out every value up to the cap", () => {- for (let value = 0; value <= 2000; value++) {- expect(numberToWords({ value, language })).not.toBeNull();- }- });-});+ it("spells out every value up to the cap", () => {+ for (let value = 0; value <= 2000; value++) {+ expect(numberToWords({ value, language })).not.toBeNull();+ }+ });+ },+);describe("numberToWords", () => {it("covers every supported language", () => {expect(Object.keys(EXPECTED).sort()).toEqual(- [...SUPPORTED_LANGUAGES].sort(),+ [...SUPPORTED_INVOICE_PDF_LANGUAGES].sort(),);});diff --git a/src/utils/number-to-words/index.ts b/src/utils/number-to-words/index.tsindex 1294b48..e2b065c 100644--- a/src/utils/number-to-words/index.ts+++ b/src/utils/number-to-words/index.ts@@ -1,4 +1,7 @@-import { SUPPORTED_LANGUAGES, type SupportedLanguages } from "@/app/schema";+import {+ SUPPORTED_INVOICE_PDF_LANGUAGES,+ type SupportedLanguages,+} from "@/app/schema";import { toWords as toWordsDE } from "./de";import { toWords as toWordsEN } from "./en";@@ -9,6 +12,7 @@ import { toWords as toWordsNB } from "./nb";import { toWords as toWordsNL } from "./nl";import { toWords as toWordsPL } from "./pl";import { toWords as toWordsPT } from "./pt";+import { toWords as toWordsPTBR } from "./pt-br";import { toWords as toWordsRU } from "./ru";import { toWords as toWordsSV } from "./sv";import { toWords as toWordsUK } from "./uk";@@ -16,7 +20,7 @@ import { toWords as toWordsUK } from "./uk";/*** The number-to-words converter for each language the app offers.*- * `satisfies` is what keeps this honest: adding a language to `SUPPORTED_LANGUAGES`+ * `satisfies` is what keeps this honest: adding a language to `SUPPORTED_INVOICE_PDF_LANGUAGES`* without a converter here is a type error rather than a runtime hole.*/const CONVERTERS = {@@ -28,6 +32,7 @@ const CONVERTERS = {it: toWordsIT,nb: toWordsNB,pt: toWordsPT,+ "pt-BR": toWordsPTBR,ru: toWordsRU,es: toWordsES,sv: toWordsSV,@@ -81,7 +86,7 @@ export function numberToWords({if (!convert) {throw new Error(- `No converter for language "${language}". Supported: ${SUPPORTED_LANGUAGES.join(", ")}.`,+ `No converter for language "${language}". Supported: ${SUPPORTED_INVOICE_PDF_LANGUAGES.join(", ")}.`,);}diff --git a/src/utils/number-to-words/pt-br.ts b/src/utils/number-to-words/pt-br.tsnew file mode 100644index 0000000..e3b484d--- /dev/null+++ b/src/utils/number-to-words/pt-br.ts@@ -0,0 +1,123 @@+import { cardsToWords, type CardLanguage } from "./cards";++const HUNDREDS: Record<number, string | undefined> = {+ 1: "cento",+ 2: "duzentos",+ 3: "trezentos",+ 4: "quatrocentos",+ 5: "quinhentos",+ 6: "seiscentos",+ 7: "setecentos",+ 8: "oitocentos",+ 9: "novecentos",+};++/**+ * Portuguese joins almost everything with "e", but drops it between a scale word and a+ * following hundreds word when yet another "e" comes later -- "mil duzentos e trinta",+ * not "mil e duzentos e trinta".+ */+const DROP_E_AFTER = ["mil", "milhão", "milhões", "bilhão", "bilhões"];++/**+ * Brazilian Portuguese, which differs from the European spelling in `./pt.ts` twice over.+ *+ * The teens are written with an "s" where Portugal writes a double one -- "dezesseis",+ * "dezessete", "dezenove" -- and 14 is "quatorze" rather than "catorze".+ *+ * More importantly Brazil counts on the short scale: 10^9 is "um bilhão", where Portugal+ * says "mil milhões" and saves "bilião" for 10^12. That is a difference in *value*, not in+ * spelling, so the two cannot share a table: the same invoice total would otherwise be+ * spelled out as a thousand times itself.+ */+const BRAZILIAN_PORTUGUESE: CardLanguage = {+ cards: [+ [1_000_000_000, "bilhão"],+ [1_000_000, "milhão"],+ [1000, "mil"],+ [100, "cem"],+ [90, "noventa"],+ [80, "oitenta"],+ [70, "setenta"],+ [60, "sessenta"],+ [50, "cinquenta"],+ [40, "quarenta"],+ [30, "trinta"],+ [20, "vinte"],+ [19, "dezenove"],+ [18, "dezoito"],+ [17, "dezessete"],+ [16, "dezesseis"],+ [15, "quinze"],+ [14, "quatorze"],+ [13, "treze"],+ [12, "doze"],+ [11, "onze"],+ [10, "dez"],+ [9, "nove"],+ [8, "oito"],+ [7, "sete"],+ [6, "seis"],+ [5, "cinco"],+ [4, "quatro"],+ [3, "três"],+ [2, "dois"],+ [1, "um"],+ [0, "zero"],+ ],+ merge({ left, right }) {+ let leftText = left.text;+ let rightText = right.text;++ if (left.value === 1) {+ if (right.value < 1_000_000) {+ return right;+ }++ leftText = "um";+ } else if (left.value === 100 && right.value % 1000 !== 0) {+ leftText = "cento";+ }++ if (right.value < left.value) {+ return {+ text: `${leftText} e ${rightText}`,+ value: left.value + right.value,+ };+ }++ // "dois milhão" -> "dois milhões". Only the scale words end in "-ão" here, so this+ // cannot catch anything else.+ if (right.value >= 1_000_000 && left.value > 1) {+ rightText = `${rightText.slice(0, -2)}ões`;+ }++ if (right.value === 100) {+ leftText = HUNDREDS[left.value] ?? leftText;+ rightText = "";+ } else {+ rightText = ` ${rightText}`;+ }++ return {+ text: `${leftText}${rightText}`,+ value: left.value * right.value,+ };+ },+ postClean(words) {+ let out = words;++ for (const scale of DROP_E_AFTER) {+ if (new RegExp(`.*${scale} e \\w*entos? (?=.*e)`).test(out)) {+ // oxlint-disable-next-line unicorn/prefer-string-replace-all -- `String#replaceAll` is Safari 13.1; `.browserslistrc` targets Safari 12, and SWC lowers syntax but never polyfills a built-in+ out = out.replace(new RegExp(`${scale} e`, "g"), scale);+ }+ }++ return out;+ },+};++export function toWords(value: number): string {+ return cardsToWords({ value, language: BRAZILIAN_PORTUGUESE });+}diff --git a/src/utils/url-compression.ts b/src/utils/url-compression.tsindex 8a24412..6fd4d12 100644--- a/src/utils/url-compression.ts+++ b/src/utils/url-compression.ts@@ -43,6 +43,8 @@ export const INVOICE_KEY_COMPRESSION_MAP = {language: "a",dateFormat: "b",currency: "c",+ numberFormatLocale: "%",+ preserveNumberFormatOnLanguageChange: "^",template: "d",logo: "e",invoiceNumberObject: "f",diff --git a/tailwind.config.ts b/tailwind.config.tsindex ac6ff61..abf6959 100644--- a/tailwind.config.ts+++ b/tailwind.config.ts@@ -14,6 +14,39 @@ const config: Config = {],theme: {extend: {+ // Inline `code` in prose (changelog posts): drop the plugin's literal backtick+ // pseudo-elements and render it as a quiet chip instead.+ typography: ({ theme }: { theme: (path: string) => string }) => {+ return {+ DEFAULT: {+ css: {+ code: {+ fontWeight: "500",+ color: theme("colors.gray.900"),+ fontSize: "0.875em",+ backgroundColor: theme("colors.gray.100"),+ border: `1px solid ${theme("colors.gray.300")}`,+ borderRadius: "0.375rem",+ padding: "0.125rem 0.375rem",+ // keeps the padding and border on both halves when a chip wraps+ boxDecorationBreak: "clone",+ WebkitBoxDecorationBreak: "clone",+ },+ "code::before": { content: "none" },+ "code::after": { content: "none" },+ },+ },+ invert: {+ css: {+ code: {+ backgroundColor: theme("colors.gray.800"),+ color: theme("colors.gray.50"),+ borderColor: theme("colors.gray.700"),+ },+ },+ },+ };+ },colors: {background: "var(--background)",foreground: "var(--foreground)",