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: Update to Next 16, next/root-params for next-intl, perf optimizations (#264)
Vlad Sazonaucbe6689f4e05
diff --git a/.browserslistrc b/.browserslistrcnew file mode 100644index 0000000..98efade--- /dev/null+++ b/.browserslistrc@@ -0,0 +1,31 @@+# Browser targets for the client bundle (SWC syntax lowering, Lightning CSS and+# autoprefixer all read this file).+#+# Next.js 16 raised its built-in default from Next 15's+# `chrome 64, edge 79, firefox 67, opera 51, safari 12` to "baseline widely+# available" -- `chrome 111, edge 111, firefox 111, safari 16.4`. That silently+# drops everything older than iOS 16.4 / Safari 16.4 (March 2023), which is a+# real slice of the traffic for a tool people open on whatever phone they have.+#+# So we keep Next 15's list explicitly. Next only falls back to its own default+# when no browserslist config resolves, so this file is what restores it.+#+# It is also what makes `transpilePackages: ["pdfjs-dist"]` in `next.config.mjs`+# do anything: that entry exists to lower pdf.js's ES2022 syntax for older+# Safari, and under the Next 16 default targets there was nothing left to lower.+#+# Caveat: this only lowers *syntax*. Missing built-ins (`Object.hasOwn`,+# `Array.prototype.at`, `structuredClone`, ...) are not polyfilled -- exactly as+# in Next 15. If we ever need those, add+# `experimental.swcEnvOptions: { mode: "usage", coreJs: "3.x" }`.++chrome 64+edge 79+firefox 67+opera 51+safari 12++# Next 15's list only named desktop `safari`, and browserslist does not treat+# that as implying iOS. Spelled out here because this app is opened on phones+# more than on desktops: iOS 12 is the last release for the iPhone 5s/6/6 Plus.+ios_saf 12diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.ymlindex c2aeaee..1005bfc 100644--- a/.github/workflows/e2e.yml+++ b/.github/workflows/e2e.yml@@ -19,8 +19,19 @@ jobs:name: Run e2e tests via ${{ github.event_name == 'deployment_status' && 'Vercel deployment' }}timeout-minutes: 50- # we use macos-latest because I am using mac os locally and generating snapshots (screenshots) for the PDF tests locally, so we need to use the same OS on the CI. https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/choose-the-runner-for-a-job#choosing-github-hosted-runners- runs-on: macos-14+ # We pin a macOS runner because the PDF snapshots (screenshots) are generated locally on+ # macOS, so CI has to rasterize on the same OS family to match them.+ # https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/choose-the-runner-for-a-job#choosing-github-hosted-runners+ #+ # NOT `macos-14`: Playwright freezes WebKit on that image (`revisionOverrides` in+ # `playwright-core/browsers.json` pins mac14/mac14-arm64 to an old revision), so the+ # `Desktop Safari` / `Mobile Safari` projects would silently test a stale engine and+ # every run logs "You are using a frozen webkit browser which does not receive updates+ # anymore on mac14-arm64". `macos-15` gets the current WebKit build.+ #+ # NOT `macos-latest` either - it follows GitHub's newest stable image, and an image bump+ # would invalidate the PDF snapshot baselines without a commit to point at.+ runs-on: macos-15env:TZ: Europe/Warsaw # we use Europe/Warsaw timezone for consistent date handling across local machines and CIsteps:diff --git a/.cursor/mcp.json b/.mcp.jsonsimilarity index 64%rename from .cursor/mcp.jsonrename to .mcp.jsonindex 0d7c2bc..cad8749 100644--- a/.cursor/mcp.json+++ b/.mcp.json@@ -1,11 +1,11 @@{"mcpServers": {- "playwright": {- "args": ["@playwright/mcp@latest"],+ "next-devtools": {+ "args": ["-y", "[email protected]"],"command": "npx"},- "shadcn": {- "args": ["shadcn@latest", "mcp"],+ "playwright": {+ "args": ["@playwright/[email protected]"],"command": "npx"},"trigger": {diff --git a/.oxlintrc.json b/.oxlintrc.jsonindex a760a4d..9e27fbd 100644--- a/.oxlintrc.json+++ b/.oxlintrc.json@@ -81,7 +81,7 @@"error",{"name": "localStorage",- "message": "Please use **getAppStorageItem / setAppStorageItem** from @/app/(app)/utils/app-local-storage instead - direct access throws in iOS in-app webviews and in Safari with cookies blocked, and those only accept a key declared in LOCAL_STORAGE_KEYS. To branch on availability during render, use **useIsLocalStorageAvailable** from @/lib/use-is-local-storage-available."+ "message": "Please use **getAppStorageItem / setAppStorageItem** from @/app/(main)/(app)/utils/app-local-storage instead - direct access throws in iOS in-app webviews and in Safari with cookies blocked, and those only accept a key declared in LOCAL_STORAGE_KEYS. To branch on availability during render, use **useIsLocalStorageAvailable** from @/lib/use-is-local-storage-available."}],"no-restricted-properties": [@@ -89,12 +89,12 @@{"object": "window","property": "localStorage",- "message": "Please use **getAppStorageItem / setAppStorageItem** from @/app/(app)/utils/app-local-storage instead - direct access throws in iOS in-app webviews and in Safari with cookies blocked, and those only accept a key declared in LOCAL_STORAGE_KEYS. To branch on availability during render, use **useIsLocalStorageAvailable** from @/lib/use-is-local-storage-available."+ "message": "Please use **getAppStorageItem / setAppStorageItem** from @/app/(main)/(app)/utils/app-local-storage instead - direct access throws in iOS in-app webviews and in Safari with cookies blocked, and those only accept a key declared in LOCAL_STORAGE_KEYS. To branch on availability during render, use **useIsLocalStorageAvailable** from @/lib/use-is-local-storage-available."},{"object": "globalThis","property": "localStorage",- "message": "Please use **getAppStorageItem / setAppStorageItem** from @/app/(app)/utils/app-local-storage instead - direct access throws in iOS in-app webviews and in Safari with cookies blocked, and those only accept a key declared in LOCAL_STORAGE_KEYS. To branch on availability during render, use **useIsLocalStorageAvailable** from @/lib/use-is-local-storage-available."+ "message": "Please use **getAppStorageItem / setAppStorageItem** from @/app/(main)/(app)/utils/app-local-storage instead - direct access throws in iOS in-app webviews and in Safari with cookies blocked, and those only accept a key declared in LOCAL_STORAGE_KEYS. To branch on availability during render, use **useIsLocalStorageAvailable** from @/lib/use-is-local-storage-available."}],"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],diff --git a/AGENTS.md b/AGENTS.mdnew file mode 100644index 0000000..643577d--- /dev/null+++ b/AGENTS.md@@ -0,0 +1,9 @@+<!-- BEGIN:nextjs-agent-rules -->++# This is NOT the Next.js you know++This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.++This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.++<!-- END:nextjs-agent-rules -->diff --git a/CLAUDE.md b/CLAUDE.mdindex 9b6d71d..2164a99 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -27,9 +27,9 @@ mkdir -p .claude/skills && for src in .agents/skills .cursor/skills; do for d in## Commands```bash-pnpm dev # next dev --turbopack, port 3000-pnpm build # never run while a dev server is up (shared .next)-pnpm type-check # next typegen + tsc --noEmit+pnpm dev # next dev (Turbopack), port 3000, writes to .next/dev+pnpm build # next build (Turbopack); writes to .next, separate from .next/dev+pnpm type-check # next typegen + tsc --noEmit (TypeScript 7 native tsc)pnpm type-check:fast # oxlint --type-check (faster, tsgolint)pnpm lint # oxlint --type-aware (replaces eslint)pnpm format # oxfmt (replaces prettier)@@ -60,16 +60,16 @@ The pre-commit hook (`lint-staged.config.js`) runs `type-check:fast`, `lint`, `z`src/app/schema/index.ts` (~1450 lines) is the single source of truth: zod schemas plus every supported currency, language, date format and template, and the `localStorage` key constants. Everything downstream (form, PDF templates, share links, API route) derives its types from it.-1. `src/app/(app)/page.client.tsx` owns `invoiceDataState`. On mount it hydrates from `?data=` (shared link) or `localStorage`, validating with `invoiceSchema`.-2. `src/app/(app)/components/invoice-form/` is a `react-hook-form` form resolved against `invoiceSchema`. Changes are debounced (`DEBOUNCE_TIMEOUT = 500ms`) before being pushed up and written to `localStorage` — e2e helpers wait on this debounce.-3. `InvoicePdfInstanceProvider` (`src/app/(app)/contexts/invoice-pdf-instance-context.tsx`) renders the PDF **once** via `usePDF` and shares the blob/URL with the desktop preview, the mobile viewer and the download link. Do not add a second `usePDF`/`<PDFViewer>`/`<BlobProvider>` on the page — react-pdf's module-level listener registry makes every instance re-render on any commit (flicker + duplicate work).+1. `src/app/(main)/(app)/page.client.tsx` owns `invoiceDataState`. On mount it hydrates from `?data=` (shared link) or `localStorage`, validating with `invoiceSchema`.+2. `src/app/(main)/(app)/components/invoice-form/` is a `react-hook-form` form resolved against `invoiceSchema`. Changes are debounced (`DEBOUNCE_TIMEOUT = 500ms`) before being pushed up and written to `localStorage` — e2e helpers wait on this debounce.+3. `InvoicePdfInstanceProvider` (`src/app/(main)/(app)/contexts/invoice-pdf-instance-context.tsx`) renders the PDF **once** via `usePDF` and shares the blob/URL with the desktop preview, the mobile viewer and the download link. Do not add a second `usePDF`/`<PDFViewer>`/`<BlobProvider>` on the page — react-pdf's module-level listener registry makes every instance re-render on any commit (flicker + duplicate work).4. Sharing: `src/utils/url-compression.ts` remaps long JSON keys to one-character keys, then `lz-string` encodes it into `?data=`. Adding a schema field means adding it to `INVOICE_KEY_COMPRESSION_MAP` (the map is type-checked against the schema keys).Use `zodResolverForOutput` (`src/lib/zod-resolver-for-output.ts`) instead of `zodResolver` — form state is typed on the schema's _output_ type.### PDF templates-Two templates under `src/app/(app)/components/invoice-templates/`: `invoice-pdf-default-template/` and `invoice-pdf-stripe-template/`, selected by `invoiceData.template`. A change to one usually needs the mirrored change in the other, plus new snapshots.+Two templates under `src/app/(main)/(app)/components/invoice-templates/`: `invoice-pdf-default-template/` and `invoice-pdf-stripe-template/`, selected by `invoiceData.template`. A change to one usually needs the mirrored change in the other, plus new snapshots.- Always import from `@react-pdf/renderer/lib/react-pdf.browser`, never `@react-pdf/renderer` (lint-enforced).- Fonts are self-hosted and registered per template via `INVOICE_PDF_FONTS` in `src/config.ts`; `src` must stay an absolute URL.@@ -77,21 +77,21 @@ Two templates under `src/app/(app)/components/invoice-templates/`: `invoice-pdf-### fontkit patch (do not remove)-`patches/[email protected]` fixes dropped leading characters in generated PDFs (`"Cobrar de"` → `"obrar de"`). The version is baked into the patch filename, so **bumping fontkit silently drops the fix**. `patches/README.md` has the full root cause, and `src/app/(app)/components/invoice-templates/__tests__/fontkit-glyph-cache-patch.test.ts` fails if the patch is not actually applied to the resolved copy.+`patches/[email protected]` fixes dropped leading characters in generated PDFs (`"Cobrar de"` → `"obrar de"`). The version is baked into the patch filename, so **bumping fontkit silently drops the fix**. `patches/README.md` has the full root cause, and `src/app/(main)/(app)/components/invoice-templates/__tests__/fontkit-glyph-cache-patch.test.ts` fails if the patch is not actually applied to the resolved copy.### i18n — two separate systems-- **UI/marketing copy**: `next-intl`, messages in `messages/*.json`, locale-prefixed routes under `src/app/[locale]/` (`src/middleware.ts` matches only those). The locale matcher is a static literal — keep it in sync with `SUPPORTED_LANGUAGES`.-- **PDF content**: a hand-rolled catalog, `src/app/(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.+- **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`.+- **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`.### Routing groups-- `src/app/(app)/` — the invoice generator itself, served at `/`.-- `src/app/(seo-landings)/` — data-driven landing pages; content lives in `seo-landing-definitions.ts` and pages are built by `seo-landing-route.tsx`. Add a slug to `SEO_LANDING_SLUGS` plus a directory, don't hand-write the page.-- `src/app/[locale]/` — the localized `/about` page and catch-all.-- `src/app/changelog/` — MDX posts in `content/`, rendered via `@next/mdx`.+There are **two root layouts**, both rendering the shared `<html>`/`<body>` shell from `src/app/(components)/root-document.tsx` (navigating between them is a full page load):++- `src/app/(main)/` — root layout for the unprefixed, English-only routes. `(app)/` is the invoice generator itself, served at `/`; `(seo-landings)/` are data-driven landing pages (content in `seo-landing-definitions.ts`, pages built by `seo-landing-route.tsx` — add a slug to `SEO_LANDING_SLUGS` plus a directory, don't hand-write the page); `changelog/` renders MDX posts from `content/` via `@next/mdx`; plus `founder/`, `how-it-works/`, `tos/` and `not-found.tsx`.+- `src/app/[locale]/` — root layout for the localized `/about` page and catch-all. Because nothing sits above it, `locale` is a **root param**: `src/i18n/request.ts` reads it with `next/root-params`, so components use `useLocale()`/`getLocale()` and never `setRequestLocale()` or `params.locale`. Unknown locales fall back to the default in `request.ts`; `about/layout.tsx` turns them into a 404. The about page is prerendered per locale: `generateStaticParams` in the `[locale]` layout plus `dynamic = "force-static"` in `about/layout.tsx`, which is what lets the root document's `headers()`-based device detection run at build time (the same pattern as `/changelog`, `/tos`, ...).- `src/app/api/generate-invoice/` — Bearer-token + Upstash rate-limited route that renders a PDF server-side, emails it (Resend) and uploads it to Google Drive. Scheduled by the Trigger.dev task in `src/trigger/monthly-recurring-invoice.ts`.## Testing@@ -125,4 +125,4 @@ Beyond `.cursor/rules/`:formatDateWithLocale(date, selectedDateFormat, language);```- Call sites say what each value means without opening the signature, two same-typed parameters can't be swapped by accident, and adding a parameter doesn't touch every caller. Type the object as a named `interface` above the function and document each field with a doc comment on the property rather than `@param` tags — see `src/app/(app)/utils/format-date-with-locale.ts`. One-parameter functions stay positional.+ Call sites say what each value means without opening the signature, two same-typed parameters can't be swapped by accident, and adding a parameter doesn't touch every caller. Type the object as a named `interface` above the function and document each field with a doc comment on the property rather than `@param` tags — see `src/app/(main)/(app)/utils/format-date-with-locale.ts`. One-parameter functions stay positional.diff --git a/TODO.md b/TODO.mdindex ace30d2..f3d2d4e 100644--- a/TODO.md+++ b/TODO.md@@ -1,7 +1,5 @@TODO list-- Update to Next js 16 and latest next-intl-DISCOUNTS FEATURE:- should be per item based discount, not total based discountdiff --git a/e2e/default-invoice-template/default-invoice-template.test.ts b/e2e/default-invoice-template/default-invoice-template.test.tsindex c7efbd1..aa074b1 100644--- a/e2e/default-invoice-template/default-invoice-template.test.ts+++ b/e2e/default-invoice-template/default-invoice-template.test.ts@@ -1,4 +1,4 @@-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { INITIAL_INVOICE_DATA } from "@/app/constants";import { uploadLogoFile } from "../stripe-invoice-template/utils";diff --git a/e2e/invoice-form.test.ts b/e2e/invoice-form.test.tsindex 981225d..245e66f 100644--- a/e2e/invoice-form.test.ts+++ b/e2e/invoice-form.test.ts@@ -1,7 +1,7 @@import { expect, test } from "@playwright/test";import dayjs from "dayjs";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import {ACCORDION_STATE_LOCAL_STORAGE_KEY,CURRENCY_SYMBOLS,diff --git a/e2e/invoice-templates-common/shared-template-features.test.ts b/e2e/invoice-templates-common/shared-template-features.test.tsindex f22fb7e..a05a6b5 100644--- a/e2e/invoice-templates-common/shared-template-features.test.ts+++ b/e2e/invoice-templates-common/shared-template-features.test.ts@@ -1,6 +1,6 @@import type { Locator, Page } from "@playwright/test";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import type { SupportedTemplates } from "@/app/schema";// IMPORTANT: we use custom extended test fixture that provides a temporary download directory for each testdiff --git a/e2e/invoice-templates-common/template-languages.test.ts b/e2e/invoice-templates-common/template-languages.test.tsindex 2e4d50c..6f29e30 100644--- a/e2e/invoice-templates-common/template-languages.test.ts+++ b/e2e/invoice-templates-common/template-languages.test.ts@@ -3,7 +3,7 @@ import type { Page } from "@playwright/test";import {getDefaultInvoiceNumberLabel,INVOICE_PDF_TRANSLATIONS,-} from "@/app/(app)/pdf-i18n-translations/pdf-translations";+} from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import {CURRENCY_SYMBOLS,CURRENCY_TO_LABEL,diff --git a/e2e/locales.test.ts b/e2e/locales.test.tsindex dbba744..3004e41 100644--- a/e2e/locales.test.ts+++ b/e2e/locales.test.ts@@ -13,8 +13,8 @@ import { SUPPORTED_LANGUAGES } from "@/app/schema";* locale is actually wired up — the page is served and the translations of that* locale (not the English fallback) are rendered.*- * NOTE: `<html lang>` is hardcoded to "en" in the root layout, so it is not- * asserted here.+ * `<html lang>` is rendered by the `[locale]` root layout from the locale resolved+ * through `next/root-params`, so it is asserted too.*/type Messages = { About: { tagline: string } };@@ -48,6 +48,7 @@ test.describe("Localized about page", () => {expect(response?.status()).toBe(200);await expect(page).toHaveURL(`/${locale}/about`);+ await expect(page.locator("html")).toHaveAttribute("lang", locale);// the page renders this locale's translations, not the English fallbackawait expect(diff --git a/e2e/seo-landings.test.ts b/e2e/seo-landings.test.tsindex 6f2d7db..f38ecb1 100644--- a/e2e/seo-landings.test.ts+++ b/e2e/seo-landings.test.ts@@ -3,7 +3,7 @@ import { expect, test } from "@playwright/test";import {SEO_LANDING_DEFINITIONS,type SeoLandingSlug,-} from "@/app/(seo-landings)/seo-landing-definitions";+} from "@/app/(main)/(seo-landings)/seo-landing-definitions";const SLUGS = Object.keys(SEO_LANDING_DEFINITIONS) as SeoLandingSlug[];diff --git a/knip.ts b/knip.tsindex 2516eb4..6e3eb2f 100644--- a/knip.ts+++ b/knip.ts@@ -16,10 +16,9 @@ const config: KnipConfig = {"file-saver","jszip","@types/file-saver",- // loaded by oxlint through `jsPlugins` in .oxlintrc.json, never imported- "eslint-plugin-playwright",- "eslint-plugin-react",- "eslint-plugin-react-you-might-not-need-an-effect",+ // knip's react-email plugin assumes `email dev` needs this package on react-email+ // < 6, but 4.x bundles its preview server and has no @react-email/* dependency.+ "@react-email/preview-server",// Sentry resolves these directly when instrumenting Next.js in development."import-in-the-middle","require-in-the-middle",@@ -30,14 +29,16 @@ const config: KnipConfig = {"global.ts","src/i18n/**/*","src/app/schema/**/*",- "src/app/changelog/content/**/*",- "src/app/(app)/pdf-i18n-translations/pdf-translations-schema.ts",+ // `*` instead of the literal route-group names: parentheses are glob syntax+ // loaded with a dynamic `import(\`./content/${filename}\`)` in changelog/utils.ts+ "src/app/*/changelog/content/**/*",+ "src/app/*/*/pdf-i18n-translations/pdf-translations-schema.ts",],includeEntryExports: true,// ignore tags// https://knip.dev/reference/configuration#tagstags: ["-@lintignore"],- ignoreBinaries: ["act", "zizmor", "printf", "cloudflared"],+ ignoreBinaries: ["act", "zizmor", "cloudflared"],};export default config;diff --git a/lint-staged.config.js b/lint-staged.config.jsindex 9d699da..28dff88 100644--- a/lint-staged.config.js+++ b/lint-staged.config.js@@ -1,14 +1,25 @@module.exports = {// Run type-check, lint, security check, knip, format, and vitest on all changes to files// https://github.com/okonet/lint-staged- "*": () => {- return [- `pnpm run type-check:fast`,+ "*": (stagedFiles) => {+ const tasks = [+ // Format first: everything below then verifies what actually gets committed.+ `pnpm run format`,+ `pnpm run type-check`,`pnpm run lint`,- `pnpm run check-github-actions-security`, // zizmor is used to check the security of the GitHub Actions workflows https://docs.zizmor.sh/`pnpm run knip`,`pnpm run vitest --run --reporter=verbose`,- `pnpm run format`,];++ // zizmor checks GitHub Actions workflows https://docs.zizmor.sh/+ if (+ stagedFiles.some((file) => {+ return file.includes("/.github/");+ })+ ) {+ tasks.push(`pnpm run check-github-actions-security`);+ }++ return tasks;},};diff --git a/messages/de.json b/messages/de.jsonindex a423594..44ae019 100644--- a/messages/de.json+++ b/messages/de.json@@ -129,5 +129,15 @@"answer": "Anders als herkömmliche Rechnungsplattformen erfordert EasyInvoicePDF kein Konto und verarbeitet Ihre Rechnung vollständig in Ihrem Browser."}}+ },+ "BrowserSupport": {+ "outdated": {+ "title": "Ihr Browser ist veraltet",+ "description": "{browser} {version} ist über drei Jahre alt. Aktualisieren Sie auf die neueste Version, damit alles richtig funktioniert."+ },+ "unsupported": {+ "title": "Ihr Browser wird nicht mehr unterstützt",+ "description": "{browser} {version} ist zu alt, um diese App zuverlässig auszuführen. Bitte aktualisieren Sie auf die neueste Version."+ }}}diff --git a/messages/en.json b/messages/en.jsonindex 19631e5..931c673 100644--- a/messages/en.json+++ b/messages/en.json@@ -129,5 +129,15 @@"answer": "Unlike traditional invoicing platforms, EasyInvoicePDF requires no account and processes your invoice entirely inside your browser."}}+ },+ "BrowserSupport": {+ "outdated": {+ "title": "Your browser is out of date",+ "description": "{browser} {version} is more than three years old. Update to the latest version for the best experience."+ },+ "unsupported": {+ "title": "Your browser is no longer supported",+ "description": "{browser} {version} is too old to run this app reliably. Please update to the latest version."+ }}}diff --git a/messages/es.json b/messages/es.jsonindex 1720a59..b55ad05 100644--- a/messages/es.json+++ b/messages/es.json@@ -129,5 +129,15 @@"answer": "A diferencia de las plataformas de facturación tradicionales, EasyInvoicePDF no requiere una cuenta y procesa la factura íntegramente en su navegador."}}+ },+ "BrowserSupport": {+ "outdated": {+ "title": "Su navegador está desactualizado",+ "description": "{browser} {version} tiene más de tres años. Actualícelo a la última versión para que todo funcione correctamente."+ },+ "unsupported": {+ "title": "Su navegador ya no es compatible",+ "description": "{browser} {version} es demasiado antiguo para ejecutar esta aplicación de forma fiable. Actualícelo a la última versión."+ }}}diff --git a/messages/fr.json b/messages/fr.jsonindex 76ae094..cb6a71b 100644--- a/messages/fr.json+++ b/messages/fr.json@@ -129,5 +129,15 @@"answer": "Contrairement aux plateformes de facturation traditionnelles, EasyInvoicePDF ne nécessite aucun compte et traite votre facture entièrement dans votre navigateur."}}+ },+ "BrowserSupport": {+ "outdated": {+ "title": "Votre navigateur n'est plus à jour",+ "description": "{browser} {version} a plus de trois ans. Mettez-le à jour vers la dernière version pour que tout fonctionne correctement."+ },+ "unsupported": {+ "title": "Votre navigateur n'est plus pris en charge",+ "description": "{browser} {version} est trop ancien pour faire fonctionner cette application de manière fiable. Veuillez le mettre à jour vers la dernière version."+ }}}diff --git a/messages/it.json b/messages/it.jsonindex 5a3364a..13c01e7 100644--- a/messages/it.json+++ b/messages/it.json@@ -129,5 +129,15 @@"answer": "A differenza delle piattaforme di fatturazione tradizionali, EasyInvoicePDF non richiede un account ed elabora la fattura interamente nel tuo browser."}}+ },+ "BrowserSupport": {+ "outdated": {+ "title": "Il tuo browser non è aggiornato",+ "description": "{browser} {version} ha più di tre anni. Aggiornalo all'ultima versione per far funzionare tutto correttamente."+ },+ "unsupported": {+ "title": "Il tuo browser non è più supportato",+ "description": "{browser} {version} è troppo vecchio per far funzionare questa app in modo affidabile. Aggiornalo all'ultima versione."+ }}}diff --git a/messages/nl.json b/messages/nl.jsonindex bcb3c21..6437a97 100644--- a/messages/nl.json+++ b/messages/nl.json@@ -129,5 +129,15 @@"answer": "In tegenstelling tot traditionele facturatieplatforms heb je voor EasyInvoicePDF geen account nodig en wordt je factuur volledig in je browser verwerkt."}}+ },+ "BrowserSupport": {+ "outdated": {+ "title": "Je browser is verouderd",+ "description": "{browser} {version} is meer dan drie jaar oud. Werk hem bij naar de nieuwste versie zodat alles goed werkt."+ },+ "unsupported": {+ "title": "Je browser wordt niet meer ondersteund",+ "description": "{browser} {version} is te oud om deze app betrouwbaar te draaien. Werk hem bij naar de nieuwste versie."+ }}}diff --git a/messages/pl.json b/messages/pl.jsonindex 678286b..8446aa9 100644--- a/messages/pl.json+++ b/messages/pl.json@@ -129,5 +129,15 @@"answer": "W przeciwieństwie do tradycyjnych platform do fakturowania EasyInvoicePDF nie wymaga konta i przetwarza fakturę w całości w Twojej przeglądarce."}}+ },+ "BrowserSupport": {+ "outdated": {+ "title": "Twoja przeglądarka jest nieaktualna",+ "description": "{browser} {version} ma ponad trzy lata. Zaktualizuj ją do najnowszej wersji, aby wszystko działało poprawnie."+ },+ "unsupported": {+ "title": "Twoja przeglądarka nie jest już obsługiwana",+ "description": "{browser} {version} jest zbyt stara, aby aplikacja działała poprawnie. Zaktualizuj ją do najnowszej wersji."+ }}}diff --git a/messages/pt.json b/messages/pt.jsonindex cbc4f2c..0bdde8d 100644--- a/messages/pt.json+++ b/messages/pt.json@@ -129,5 +129,15 @@"answer": "Ao contrário das plataformas de faturamento tradicionais, o EasyInvoicePDF não exige conta e processa sua fatura inteiramente no navegador."}}+ },+ "BrowserSupport": {+ "outdated": {+ "title": "O seu navegador está desatualizado",+ "description": "{browser} {version} tem mais de três anos. Atualize para a versão mais recente para que tudo funcione corretamente."+ },+ "unsupported": {+ "title": "O seu navegador já não é suportado",+ "description": "{browser} {version} é demasiado antigo para executar esta aplicação de forma fiável. Atualize para a versão mais recente."+ }}}diff --git a/messages/ru.json b/messages/ru.jsonindex 447e186..b00f676 100644--- a/messages/ru.json+++ b/messages/ru.json@@ -129,5 +129,15 @@"answer": "В отличие от традиционных платформ для выставления счетов, EasyInvoicePDF не требует аккаунта и полностью генерирует ваш счет в браузере."}}+ },+ "BrowserSupport": {+ "outdated": {+ "title": "Ваш браузер устарел",+ "description": "{browser} {version} вышел более трёх лет назад. Обновите его до последней версии, чтобы всё работало корректно."+ },+ "unsupported": {+ "title": "Ваш браузер больше не поддерживается",+ "description": "{browser} {version} слишком старый для стабильной работы приложения. Пожалуйста, обновите его до последней версии."+ }}}diff --git a/messages/uk.json b/messages/uk.jsonindex 7a1cba6..852ed7f 100644--- a/messages/uk.json+++ b/messages/uk.json@@ -129,5 +129,15 @@"answer": "На відміну від традиційних платформ для виставлення рахунків, EasyInvoicePDF не потребує облікового запису та повністю генерує ваш інвойс у браузері."}}+ },+ "BrowserSupport": {+ "outdated": {+ "title": "Ваш браузер застарів",+ "description": "{browser} {version} вийшов понад три роки тому. Оновіть його до останньої версії, щоб усе працювало коректно."+ },+ "unsupported": {+ "title": "Ваш браузер більше не підтримується",+ "description": "{browser} {version} застарий для стабільної роботи застосунку. Будь ласка, оновіть його до останньої версії."+ }}}diff --git a/next.config.mjs b/next.config.mjsindex 28f74f5..18cb869 100644--- a/next.config.mjs+++ b/next.config.mjs@@ -21,11 +21,11 @@ async function validatei18nAndInvoicePDFTranslationFiles() {// Import the translations schema and catalog using jiti// @ts-ignoreconst { invoicePDFTranslationsSchema } = await loadTsFileViaJiti.import(- "./src/app/(app)/pdf-i18n-translations/pdf-translations-schema.ts",+ "./src/app/(main)/(app)/pdf-i18n-translations/pdf-translations-schema.ts",);// @ts-ignoreconst { INVOICE_PDF_TRANSLATIONS } = await loadTsFileViaJiti.import(- "./src/app/(app)/pdf-i18n-translations/pdf-translations.ts",+ "./src/app/(main)/(app)/pdf-i18n-translations/pdf-translations.ts",);const result = invoicePDFTranslationsSchema.safeParse(@@ -141,11 +141,19 @@ const nextConfig = {// browser as-is and any Safari < 16.4 dies parsing it with// "SyntaxError: Unexpected token '{'". Running it through SWC with our// browser targets lowers that syntax.+ //+ // Those targets come from `.browserslistrc`, which pins the Next 15 list --+ // Next 16's built-in default is `safari 16.4`, under which there would be+ // nothing left for this entry to lower.transpilePackages: ["pdfjs-dist"],// Configure the file extensions that Next.js should handlepageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],compiler: {- removeConsole: process.env.VERCEL_ENV === "production",+ // `console.error` survives: the traces that used to make the production console+ // unreadable are gated behind `debugLog` now, so what is left is genuine failures --+ // worth having in a user's console when they send a screenshot of one.+ removeConsole:+ process.env.VERCEL_ENV === "production" ? { exclude: ["error"] } : false,},logging: {fetches: {@@ -161,23 +169,14 @@ const nextConfig = {// polyfills. We point the browser bundle at it (the worker is imported by its// legacy path directly in `mobile-pdf-viewer.tsx`).//- // Turbopack powers `next dev`, webpack powers `next build`, so both need the alias.+ // Turbopack powers both `next dev` and `next build` since Next.js 16 (a `webpack`+ // key here would make `next build` refuse to run). Only the bare specifier is+ // aliased; deep imports (`pdfjs-dist/legacy/build/...`) are left alone.turbopack: {resolveAlias: {"pdfjs-dist": { browser: "pdfjs-dist/legacy/build/pdf.mjs" },},},- webpack: (config, { isServer }) => {- config.resolve.alias.canvas = false;-- if (!isServer) {- // `$` = exact match only, so deep imports (`pdfjs-dist/legacy/build/...`) are- // left alone.- config.resolve.alias["pdfjs-dist$"] = "pdfjs-dist/legacy/build/pdf.mjs";- }-- return config;- },async rewrites() {return [{@@ -215,15 +214,18 @@ export default withSentryConfig(withNextIntl(withMDX(nextConfig)), {// Upload a larger set of source maps for prettier stack traces (increases build time)widenClientFileUpload: true,- webpack: {- // Automatically annotate React components to show their full name in breadcrumbs and session replay- reactComponentAnnotation: {- enabled: true,- },+ bundleSizeOptimizations: {+ // Automatically tree-shake Sentry logger statements to reduce bundle size+ // (bundler-agnostic replacement for `webpack.treeshake.removeDebugLogging`)+ excludeDebugStatements: true,+ },- treeshake: {- // Automatically tree-shake Sentry logger statements to reduce bundle size- removeDebugLogging: true,+ _experimental: {+ // Automatically annotate React components to show their full name in breadcrumbs+ // and session replay. `webpack.reactComponentAnnotation` is a no-op under+ // Turbopack; this is its Turbopack counterpart (Next.js 16+).+ turbopackReactComponentAnnotation: {+ enabled: true,},},diff --git a/package.json b/package.jsonindex 95c4e19..a446eb3 100644--- a/package.json+++ b/package.json@@ -18,12 +18,12 @@"homepage": "https://easyinvoicepdf.com","author": "Vlad Sazonau (https://vladsazon.com)","scripts": {- "dev": "next dev --turbopack",+ "dev": "next dev","build": "next build","start": "next start","type-check": "next typegen && tsc --noEmit --diagnostics","type-check:fast": "next typegen && oxlint . --type-check --quiet",- "lint": "next typegen && oxlint . --type-aware",+ "lint": "next typegen && oxlint . --type-check --type-aware","lint:fix": "oxlint . --fix","format": "oxfmt .","format:check": "oxfmt --check .",@@ -53,7 +53,7 @@"@hookform/resolvers": "5.9.1","@mdx-js/loader": "3.1.0","@mdx-js/react": "3.1.0",- "@next/mdx": "15.5.23",+ "@next/mdx": "16.3.4","@radix-ui/react-accordion": "1.2.3","@radix-ui/react-alert-dialog": "1.1.6","@radix-ui/react-dialog": "1.1.6",@@ -69,7 +69,7 @@"@sentry/nextjs": "10.70.0","@t3-oss/env-nextjs": "0.13.4","@tailwindcss/typography": "0.5.16",- "@trigger.dev/sdk": "4.5.6",+ "@trigger.dev/sdk": "4.5.16","@types/mdx": "2.0.13","@types/qrcode": "1.5.6","@types/ua-parser-js": "0.7.39",@@ -91,8 +91,7 @@"lucide-react": "0.477.0","lz-string": "1.5.0","motion": "12.38.0",- "n2words": "1.21.0",- "next": "15.5.24",+ "next": "16.3.4","next-intl": "4.13.7","pdfjs-dist": "5.4.296","qrcode": "1.5.4",@@ -128,7 +127,7 @@"eslint-plugin-react-you-might-not-need-an-effect": "1.0.2","happy-dom": "20.10.6","husky": "9.1.7",- "knip": "5.85.0",+ "knip": "6.34.0","lint-staged": "15.5.0","oxfmt": "0.64.0","oxlint": "1.79.0",@@ -138,7 +137,7 @@"schema-dts": "1.1.5","shadcn": "3.2.1","tailwindcss": "3.4.14",- "typescript": "6.0.3",+ "typescript": "7.0.2","vitest": "3.2.4"},"packageManager": "[email protected]+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800"diff --git a/patches/README.md b/patches/README.mdindex ae3bb55..bf584fc 100644--- a/patches/README.md+++ b/patches/README.md@@ -96,7 +96,7 @@ https://github.com/foliojs/fontkit/issues/154#issuecomment-4187174366.## Automated guard-`src/app/(app)/components/invoice-templates/__tests__/fontkit-glyph-cache-patch.test.ts`+`src/app/(main)/(app)/components/invoice-templates/__tests__/fontkit-glyph-cache-patch.test.ts`fails if the patch stops being applied. It resolves the exact fontkit instance`@react-pdf/renderer` renders with, and reproduces the poisoning against a realTTF that ships with `pdfjs-dist` (no committed asset, no network).diff --git a/playwright.config.ts b/playwright.config.tsindex 5d85e4e..cff27e6 100644--- a/playwright.config.ts+++ b/playwright.config.ts@@ -90,6 +90,20 @@ export default defineConfig({// set timezone to Europe/Warsaw by default for consistent date handling across local machines and CI inside browsertimezoneId: "Europe/Warsaw",+ /**+ * Emulate `prefers-reduced-motion: reduce`, which switches off the smooth scrolling+ * in `src/app/globals.css`.+ *+ * Playwright's scroll-into-view honours `scroll-behavior` on WebKit (Chromium's is+ * always instant), so with smooth scrolling on, a click could be measured mid+ * animation: the element drifted out from under the cursor between mousedown and+ * mouseup and the browser dispatched the `click` on an ancestor, while Playwright+ * still reported "click action done". Only Mobile Safari ever flaked on it.+ */+ contextOptions: {+ reducedMotion: "reduce",+ },+// applies to: page.goto(), redirects, page.waitForURL(), clicking links that trigger navigation, form submits that navigatenavigationTimeout: 45_000,// Applies to interactions: locator.click(), fill(), check(), hover(), press(), dragTo()diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex c980ec9..832e87b 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -38,8 +38,8 @@ importers:specifier: 3.1.0version: 3.1.0(@types/[email protected])([email protected])'@next/mdx':- specifier: 15.5.23- version: 15.5.23(@mdx-js/[email protected]([email protected])([email protected]))(@mdx-js/[email protected](@types/[email protected])([email protected]))+ specifier: 16.3.4+ version: 16.3.4(@mdx-js/[email protected]([email protected])([email protected]))(@mdx-js/[email protected](@types/[email protected])([email protected]))'@radix-ui/react-accordion':specifier: 1.2.3version: 1.2.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])@@ -78,16 +78,16 @@ importers:version: 4.6.1([email protected])'@sentry/nextjs':specifier: 10.70.0- version: 10.70.0(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected])+ version: 10.70.0(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected])'@t3-oss/env-nextjs':specifier: 0.13.4'@tailwindcss/typography':specifier: 0.5.16version: 0.5.16([email protected])'@trigger.dev/sdk':- specifier: 4.5.6- version: 4.5.6([email protected])([email protected])+ specifier: 4.5.16+ version: 4.5.16([email protected])([email protected])'@types/mdx':specifier: 2.0.13version: 2.0.13@@ -108,7 +108,7 @@ importers:version: 3.5.1'@vercel/speed-insights':specifier: 1.2.0- version: 1.2.0([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected]))([email protected])+ version: 1.2.0([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]))([email protected])class-variance-authority:specifier: 0.7.1version: 0.7.1@@ -151,15 +151,12 @@ importers:motion:specifier: 12.38.0- n2words:- specifier: 1.21.0- version: 1.21.0next:- specifier: 15.5.24- version: 15.5.24(@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected])+ specifier: 16.3.4+ version: 16.3.4(@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])next-intl:specifier: 4.13.7- version: 4.13.7([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected])+ version: 4.13.7(@swc/[email protected])([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected])pdfjs-dist:specifier: 5.4.296version: 5.4.296@@ -258,8 +255,8 @@ importers:specifier: 9.1.7version: 9.1.7knip:- specifier: 5.85.0- version: 5.85.0(@types/[email protected])([email protected])+ specifier: 6.34.0+ version: 6.34.0lint-staged:specifier: 15.5.0version: 15.5.0@@ -283,16 +280,16 @@ importers:version: 1.1.5shadcn:specifier: 3.2.1- version: 3.2.1(@types/[email protected])([email protected])+ version: 3.2.1(@types/[email protected])([email protected])tailwindcss:specifier: 3.4.14version: 3.4.14typescript:- specifier: 6.0.3- version: 6.0.3+ specifier: 7.0.2+ version: 7.0.2vitest:specifier: 3.2.4- version: 3.2.4(@types/[email protected])(@types/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected])+ version: 3.2.4(@types/[email protected])(@types/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected])packages:@@ -503,17 +500,20 @@ packages:'@electric-sql/[email protected]':resolution: {integrity: sha512-LtPAfeMxXRiYS0hyDQ5hue2PjljUiK9stvzsVyVb4nwxWQxfOWTSF42bHTs/o5i3x1T4kAQ7mwHpxa4A+f8X7Q==}- '@emnapi/[email protected]':- resolution: {integrity: sha512-AvT9QFpxK0Zd8J0jopedNm+w/2fIzvtPKPjqyw9jwvBaReTTqPBk9Hixaz7KbjimP+QNz605/XnjFcDAL2pqBg==}+ '@emnapi/[email protected]':+ resolution: {integrity: sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA==}++ '@emnapi/[email protected]':+ resolution: {integrity: sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA==}++ '@emnapi/[email protected]':+ resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==}'@emnapi/[email protected]':resolution: {integrity: sha512-++LApOtY0pEEz1zrd9vy1/zXVaVJJ/EbAF3u0fXIzPJEDtnITsBGbbK0EkM72amhl/R5b+5xx0Y/QhcVOpuulg==}- '@emnapi/[email protected]':- resolution: {integrity: sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==}-- '@emnapi/[email protected]':- resolution: {integrity: sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==}+ '@emnapi/[email protected]':+ resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==}'@esbuild/[email protected]':resolution: {integrity: sha512-O7vun9Sf8DFjH2UtqK8Ku3LkquL9SZL8OLY1T5NZkA34+wG3OQF7cl4Ql8vdNzM6fzBbYfLaiRLIOZ+2FOCgBQ==}@@ -834,9 +834,9 @@ packages:cpu: [arm64]os: [darwin]- '@img/[email protected]':- resolution: {integrity: sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA==}+ engines: {node: '>=20.9.0'}cpu: [arm64]os: [darwin]@@ -846,19 +846,24 @@ packages:cpu: [x64]os: [darwin]- '@img/[email protected]':- resolution: {integrity: sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw==}+ engines: {node: '>=20.9.0'}cpu: [x64]os: [darwin]+ '@img/[email protected]':+ resolution: {integrity: sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA==}+ engines: {node: '>=20.9.0'}+ os: [freebsd]+'@img/[email protected]':resolution: {integrity: sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==}cpu: [arm64]os: [darwin]- '@img/[email protected]':- resolution: {integrity: sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==}+ '@img/[email protected]':+ resolution: {integrity: sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg==}cpu: [arm64]os: [darwin]@@ -867,8 +872,8 @@ packages:cpu: [x64]os: [darwin]- '@img/[email protected]':- resolution: {integrity: sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==}+ '@img/[email protected]':+ resolution: {integrity: sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw==}cpu: [x64]os: [darwin]@@ -878,8 +883,8 @@ packages:os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==}+ '@img/[email protected]':+ resolution: {integrity: sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A==}cpu: [arm64]os: [linux]libc: [glibc]@@ -890,20 +895,20 @@ packages:os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==}+ '@img/[email protected]':+ resolution: {integrity: sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA==}cpu: [arm]os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==}+ '@img/[email protected]':+ resolution: {integrity: sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w==}cpu: [ppc64]os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==}+ '@img/[email protected]':+ resolution: {integrity: sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ==}cpu: [riscv64]os: [linux]libc: [glibc]@@ -914,8 +919,8 @@ packages:os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==}+ '@img/[email protected]':+ resolution: {integrity: sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q==}cpu: [s390x]os: [linux]libc: [glibc]@@ -926,8 +931,8 @@ packages:os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==}+ '@img/[email protected]':+ resolution: {integrity: sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA==}cpu: [x64]os: [linux]libc: [glibc]@@ -938,8 +943,8 @@ packages:os: [linux]libc: [musl]- '@img/[email protected]':- resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==}+ '@img/[email protected]':+ resolution: {integrity: sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw==}cpu: [arm64]os: [linux]libc: [musl]@@ -950,8 +955,8 @@ packages:os: [linux]libc: [musl]- '@img/[email protected]':- resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==}+ '@img/[email protected]':+ resolution: {integrity: sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw==}cpu: [x64]os: [linux]libc: [musl]@@ -963,9 +968,9 @@ packages:os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ==}+ engines: {node: '>=20.9.0'}cpu: [arm64]os: [linux]libc: [glibc]@@ -977,23 +982,23 @@ packages:os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A==}+ engines: {node: '>=20.9.0'}cpu: [arm]os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ==}+ engines: {node: '>=20.9.0'}cpu: [ppc64]os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA==}+ engines: {node: '>=20.9.0'}cpu: [riscv64]os: [linux]libc: [glibc]@@ -1005,9 +1010,9 @@ packages:os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ==}+ engines: {node: '>=20.9.0'}cpu: [s390x]os: [linux]libc: [glibc]@@ -1019,9 +1024,9 @@ packages:os: [linux]libc: [glibc]- '@img/[email protected]':- resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA==}+ engines: {node: '>=20.9.0'}cpu: [x64]os: [linux]libc: [glibc]@@ -1033,9 +1038,9 @@ packages:os: [linux]libc: [musl]- '@img/[email protected]':- resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA==}+ engines: {node: '>=20.9.0'}cpu: [arm64]os: [linux]libc: [musl]@@ -1047,9 +1052,9 @@ packages:os: [linux]libc: [musl]- '@img/[email protected]':- resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg==}+ engines: {node: '>=20.9.0'}cpu: [x64]os: [linux]libc: [musl]@@ -1059,14 +1064,18 @@ packages:engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}cpu: [wasm32]- '@img/[email protected]':- resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA==}+ engines: {node: '>=20.9.0'}++ '@img/[email protected]':+ resolution: {integrity: sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA==}+ engines: {node: '>=20.9.0'}cpu: [wasm32]- '@img/[email protected]':- resolution: {integrity: sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw==}+ engines: {node: '>=20.9.0'}cpu: [arm64]os: [win32]@@ -1076,9 +1085,9 @@ packages:cpu: [ia32]os: [win32]- '@img/[email protected]':- resolution: {integrity: sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw==}+ engines: {node: ^20.9.0}cpu: [ia32]os: [win32]@@ -1088,9 +1097,9 @@ packages:cpu: [x64]os: [win32]- '@img/[email protected]':- resolution: {integrity: sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ '@img/[email protected]':+ resolution: {integrity: sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg==}+ engines: {node: '>=20.9.0'}cpu: [x64]os: [win32]@@ -1261,17 +1270,21 @@ packages:os: [linux]libc: [glibc]- '@napi-rs/[email protected]':- resolution: {integrity: sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}+ peerDependencies:+ '@emnapi/core': ^1.7.1 || ^2.0.0-alpha.4+ '@emnapi/runtime': ^1.7.1 || ^2.0.0-alpha.4'@next/[email protected]':resolution: {integrity: sha512-a26KnbW9DFEUsSxAxKBORR/uD9THoYoKbkpFywMN/AFvboTt94b8+g/07T8J6ACsdLag8/PDU60ov4rPxRAixw==}- '@next/[email protected]':- resolution: {integrity: sha512-mBDF7T0XKZjs9SpUAl0buizVO+O02ULjOvWX8o/AZo/5AGw/UAS1Zzcylmd4pqbftzmKQi+L/nB4jgBYKEAl5Q==}+ '@next/[email protected]':+ resolution: {integrity: sha512-cjWZnUUa6jZq2kFaNe/ZyJdZonOZ/QoN0Zka2nz/FLOrfx14pQuM9c5RaSVkWMqgdt4ksgPAMWPyHSs/CyV48Q==}- '@next/[email protected]':- resolution: {integrity: sha512-k3Xuve1X9w5B5lcOcR9wkLJrfTkx6F+zZsR1cO5v8AqFxZ1bBv4Hc/45l/eUPMEZ7tfg1eAtQ2fvV8qcaQPMzQ==}+ '@next/[email protected]':+ resolution: {integrity: sha512-XEmW3ccWWNybofVOmgIEVhXtmNXM0u423iqkVXwPf29fht/tdpUiMDuMHQ4hMerE1477nOJrv5kM/F6qMcEMwA==}peerDependencies:'@mdx-js/loader': '>=0.15.0''@mdx-js/react': '>=0.15.0'@@ -1287,8 +1300,8 @@ packages:cpu: [arm64]os: [darwin]- '@next/[email protected]':- resolution: {integrity: sha512-AGdNLvxZNY6eR2iSnV+6wUa8CiHTMr4F7g3uHH7fT4ICIJBE00R9u4tzN/Vuwsw0cOi8MTD2HJcTCb6siMH88Q==}+ '@next/[email protected]':+ resolution: {integrity: sha512-iBr3I5LZNk5/bgl5//iTgD2tcym14MX0Xo7fD//u9dYAEgGzza1y9oywluPtf74YnOswVdH1908aK9xVz7zQTw==}engines: {node: '>= 10'}cpu: [arm64]os: [darwin]@@ -1299,8 +1312,8 @@ packages:cpu: [x64]os: [darwin]- '@next/[email protected]':- resolution: {integrity: sha512-9HrQajBMmGcrrrvDfRimiCrbAPh3E6uHJmwBovYr6Yrmi9p9PZqI876BrXX280wICh3o2XwUlp4blkB0NNBqFg==}+ '@next/[email protected]':+ resolution: {integrity: sha512-2dpiSyl2Jw/NrBPaU2MAKGSa+2MR82pJIn4Sm5Rjr+gxAeuh0z158Su3Z2O8zn7UNNq+ej4bToed6RcRN/Lydg==}engines: {node: '>= 10'}cpu: [x64]os: [darwin]@@ -1312,8 +1325,8 @@ packages:os: [linux]libc: [glibc]- '@next/[email protected]':- resolution: {integrity: sha512-rl9LSfE75si0WT3cDgdUC1XYCKS+TgxC+/IjitmeycrAG18X/plIP1/vy8dd/HPycYcIvE688PD7FuvEAiEAew==}+ '@next/[email protected]':+ resolution: {integrity: sha512-+t+U8HZT+fApePCS5h89CSH3datz29MkzyfCn+6fpsZBG/oiEOhINcb9rtkv6sdpToLGFn2e6146NzaKCXkqrA==}engines: {node: '>= 10'}cpu: [arm64]os: [linux]@@ -1326,8 +1339,8 @@ packages:os: [linux]libc: [musl]- '@next/[email protected]':- resolution: {integrity: sha512-TlNAnpsjxSF3aAUtqnfmtXXf8m9sIDBlmF3c7bTAlnshUYu2U0OxN2uf5d0gcFwqHVEdivJNBcCaqNOwPGNimw==}+ '@next/[email protected]':+ resolution: {integrity: sha512-mx03GNs1ocQA5JQ4FxDMmIsNkdrZh8cuezKCrId28e5/gIPU/l7Kcy2+vmCCzdjnnmXJy+iOAu+7K0QppO6Urg==}engines: {node: '>= 10'}cpu: [arm64]os: [linux]@@ -1340,8 +1353,8 @@ packages:os: [linux]libc: [glibc]- '@next/[email protected]':- resolution: {integrity: sha512-7dwtlhr0SLndqTG1z9ncRkbJswDZiKWlxzFyXDvJ2RDZRDRHp8zyMJ4D9UH/FgnQeXxxB6gZy2pMcIUoNKQ4pA==}+ '@next/[email protected]':+ resolution: {integrity: sha512-YIhGY6fSMfha52bnVxnzc9zaVBzJg+cqQTOD8tXIBSx4fuv0pVMxQTE0PaS59YhnMOiYiG09IMwxJAf/CFm/Dw==}engines: {node: '>= 10'}cpu: [x64]os: [linux]@@ -1354,8 +1367,8 @@ packages:os: [linux]libc: [musl]- '@next/[email protected]':- resolution: {integrity: sha512-kGZxM+WhkYs0276lFrMkj7PRtXT3Btp6cwvfSO/cCVLxJJttB5Ccnl2niaCgUja8HgSbEVnMHpg3FJWoOJ9e/g==}+ '@next/[email protected]':+ resolution: {integrity: sha512-+eaaX6axpDb0yF1GCpiERe6njplvdC+nks/fKfcHu3XPGRrald8P3/X7yv7QLdjA51knnxwl9pxdIJsg+w1L+Q==}engines: {node: '>= 10'}cpu: [x64]os: [linux]@@ -1367,8 +1380,8 @@ packages:cpu: [arm64]os: [win32]- '@next/[email protected]':- resolution: {integrity: sha512-jBDDkZ/qKAqkWivWDMkJSXUzbzV0QKRBKJjEHUAvSB97Hzw7NLzJ6yV56Lts/wjir7s4P31GYgpbS6ZL+hasAA==}+ '@next/[email protected]':+ resolution: {integrity: sha512-0jcXW7Xs/uzICrmgV3MhDYDeRy++1CqnpDIerlPIqYO4bhzB4WNbX/aRnQclustsAyTkFKB0z6rbcjmNg5tR8A==}engines: {node: '>= 10'}cpu: [arm64]os: [win32]@@ -1379,8 +1392,8 @@ packages:cpu: [x64]os: [win32]- '@next/[email protected]':- resolution: {integrity: sha512-JqtwjvvorjacQ0spgjmUJoxySoYgPwdT1sFdQ0/zmW4iMlP2hjYlCoJIyS7o6Epb4Fug8eco3HXFoBDUCDeH7Q==}+ '@next/[email protected]':+ resolution: {integrity: sha512-vvBzwu1pYQCp92maZCFCIw/XgOTMR5tur9GjakwIo2cmwRTMKajRZZDS9+e4KsUZWKu1E007WUeAFXRRjZeuzw==}engines: {node: '>= 10'}cpu: [x64]os: [win32]@@ -1548,111 +1561,231 @@ packages:resolution: {integrity: sha512-/UhIkaZgPutTFmQ7RnIJGgDXZmtEJ7Dvi86xNTFWcnRxVRNk/aotsqDJYeEvDP+FSMB2SdW+pQzNMcWP0rwuNA==}engines: {node: '>=14'}- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-aUs47y+xyXHUKlbhqHUjBABjvycq6YSD7bpxSW7vplUmdzAlJ93yXY6ZR0c1o1x5A/QKbENCvs3+NlY8IpIVzg==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-fOtoGvIoirkvxQVw9J1WJPxz571XPgLsPf9uhRD+PJteUnvrJHMDmK9pw2yZEGGyismtRoEsp+JcXUdF/JDMDw==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm]os: [android]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-oolbkRX+m7Pq2LNjr/kKgYeC7bRDMVTWPgxBGMjSpZi/+UskVo4jsMU3MLheZV55jL6c3rNelPl4oD60ggYmqA==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-emjQHOYJaomo4ykaXQ1EItunr/I94Nk01oqBmU4dSkKSTupIDx6OysVDf2e8Eytm77rb+4ZxzgElyWP7rcEX7A==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [android]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-nUC6d2i3R5B12sUW4O646qD5cnMXf2oBGPLIIeaRfU9doJRORAbE2SGv4eW6rMqhD+G7nf2Y8TTJTLiiO3Q/dQ==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-kXvBPJL7RmDPJ2mze/vXPPVQimCDtFr9OFLjf7dyhV5Dx64cgcXh9KKrA1sMWvCObvJll9CZZUO0FBlFwD0l6A==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [darwin]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-cV50vE5+uAgNcFa3QY1JOeKDSkM/9ReIcc/9wn4TavhW/itkDGrXhw9jaKnkQnGbjJ198Yh5nbX/Gr2mr4Z5jQ==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-mgFF8pLU6R64LbT27lSrtVRspVC/3IcZ0qyIikzmi78Y3Ik2OPnlAHHI0UEBRcC3qmNgtjaef7zkFt7/uPxIcw==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [darwin]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-xZOQiYGFxtk48PBKff+Zwoym7ScPAIVp4c14lfLxizO2LTTTJe5sx9vQNGrBymrf/vatSPNMD4FgsaaRigPkqw==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-v38aiF11qufOTBcCAKL4skgQf0zJ4NEvRlivq7B5kHrlyvjCLjvNrMtNWDTz1SDUL6/xVsJRmLDxv2e+Cp4oWw==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [freebsd]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-lXZYWAC6kaGe/ky2su94e9jN9t6M0/6c+GrSlCqL//XO1cxi5lpAhnJYdyrKfm0ZEr/c7RNyAx3P7FSBcBd5+A==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-AeIiBbwUaP0H1+4/qGW9l5qHecS/+XA5iMuieVcGb1T+tyc2dVGspFW13BWk/XrLsiGP/CiDJTJqAPLLCzZHkw==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm]os: [linux]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-veG1kKsuK5+t2IsO9q0DErYVSw2azvCVvWHnfTOS73WE0STdLLB7Q1bB9WR+yHPQM76ASkFyRbogWo1GR1+WbQ==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-/41MKPW4RgPY4DJco0NCF0RYX3IMZaVlRNMNzvhaxRavc7tN3Txm+qllZbh0aMRs0VHdgUlbI8TcAOiTai4TKg==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm]os: [linux]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-heV2+jmXyYnUrpUXSPugqWDRpnsQcDm2AX4wzTuvgdlZfoNYO0O3W2AVpJYaDn9AG4JdM6Kxom8+foE7/BcSig==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-bmpw/RPhVXgZbtb3xBDuwW5s8+LvZYdqcDSX/sP2ltL77aTio3DP/B5ZTwwgoJ6Mr9vJs4RrmgEKW9XkLNUU1g==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [linux]libc: [glibc]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-jvo2Pjs1c9KPxMuMPIeQsgu0mOJF9rEb3y3TdpsrqwxRM+AN6/nDDwv45n5ZrUnQMsdBy5gIabioMKnQfWo9ew==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-gd7VX/FDVOw6mjQcu45iIcp4QkgybgJwh3a0OFG2NxmPCj628mQWD96QGu1kK8+mZF9qK4b/gIEyC63vQoB7+Q==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [linux]libc: [musl]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-vLmdNxWCdN7Uo5suays6A/+ywBby2PWBBPXctWPg5V0+eVuzsJxgAn6MMB4mPlshskYbppjpN2Zg83ArHze9gQ==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-HnAzcfki7dSUNHf510Q2NmbJlz8Ys7rn8l9l588Pkx0tYe1BHLZnmELIgqizJ4WPhHGSwN8Ce+B/menVxS3odA==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [ppc64]os: [linux]libc: [glibc]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-/b+WgR+VTSBxzgOhDO7TlMXC1ufPIMR6Vj1zN+/x+MnyXGW7prTLzU9eW85Aj7Th7CCEG9ArCbTeqxCzFWdg2w==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-qlkOL6wT44U+fT5s/+sR6Shx0OdwvQF83JyIPZUxG/ovqZF5/7atOtjH+JPZ5/7ATQLbFBBSmghcy/+2NVB/ew==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [riscv64]os: [linux]libc: [glibc]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-YlRdeWb9j42p29ROh+h4eg/OQ3dTJlpHSa+84pUM9+p6i3djtPz1q55yLJhgW9XfDch7FN1pQ/Vd6YP+xfRIuw==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-DlefD7L7sMXs/3hIBH23Egk0phj8kG0SA81dVGOQ3S1ekjOlmTLH2E+F2Thwfh1slKx6aH+lNc5fQYAw0GU7/g==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [riscv64]os: [linux]libc: [musl]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-EDpafVOQWF8/MJynsjOGFThcqhRHy417sRyLfQmeiamJ8qVhSKAn2Dn2VVKUGCjVB9C46VGjhNo7nOPUi1x6uA==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-Xqpagk/031IvZ4svrk2FF01YEqM/iN3MJV3SVZadKg/CsGlDCGoREqKHXYnoV5+8SfGe/m6RM1szXFLusTu/Uw==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [s390x]os: [linux]libc: [glibc]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-NxjZe+rqWhr+RT8/Ik+5ptA3oz7tUw361Wa5RWQXKnfqwSSHdHyrw6IdcTfYuml9dM856AlKWZIUXDmA9kkiBQ==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-QioQOeUbI4ATUr0S2z88uA3Cds2R3Mm5Ge7U8XNYtlTb2GJF3rWlcj70z0AJhhOlbdm0YgVjqPBldUNbFylDIg==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [linux]libc: [glibc]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-cM/hQwsO3ReJg5kR+SpI69DMfvNCp+A/eVR4b4YClE5bVZwz8rh2Nh05InhwI5HR/9cArbEkzMjcKgTHS6UaNw==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-NXy1tv/OdC+pPTwf9RiCZWPK53V/Xq/2cjSnjOSyKopajdaDqMIkgtDY+jXZemp2e8px5FeWfY2L2LwhKZQovg==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [x64]os: [linux]libc: [musl]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-QF080IowFB0+9Rh6RcD19bdgh49BpQHUW5TajG1qvWHvmrQznTZZjYlgE2ltLXyKY+qs4F/v5xuX1XS7Is+3qA==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-GpGWZ6oKz4bjCWW9Mz5pCaGPyk2Aaze6zEoaslIQqpSLtpx5pXj/ap5gUNb5Jn2LIbqWyjkGLX9yv3NMuNcBVQ==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [openharmony]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-w8UCKhX826cP/ZLokXDS6+milN8y4X7zidsAttEdWlVoamTNf6lhBJldaWr3ukTDiye7s4HRcuPEPOXNC432Vg==}- engines: {node: '>=14.0.0'}- cpu: [wasm32]-- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-nJ4AsUVZrVKwnU/QRdzPCCrO0TrabBqgJ8pJhXITdZGYOV28TIYystV1VFLbQ7DtAcaBHpocT5/ZJnF78YJPtQ==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-a8mlt7CC8z7LUdCfaxhff4kCd+vSjE+NEFL0cxA8ukfuSnvAto/pWTjytW4BuVLnQGcCVdHJwcRKOfs++H+tjw==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [arm64]os: [win32]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-EW+ND5q2Tl+a3pH81l1QbfgbF3HmqgwLfDfVithRFheac8OTcnbXt/JxqD2GbDkb7xYEqy1zNaVFRr3oeG8npA==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-M5ViVDBcFLnl2632AuuWuP35zEL5oikK1jTx8r3+902VEDeSNHxFZAB6RZyfZ7MU6Oi5QTOG8MmMkIeHsudSaw==}+ engines: {node: ^20.19.0 || >=22.12.0}cpu: [ia32]os: [win32]- '@oxc-resolver/[email protected]':- resolution: {integrity: sha512-6hIU3RQu45B+VNTY4Ru8ppFwjVS/S5qwYyGhBotmjxfEKk41I2DlGtRfGJndZ5+6lneE2pwloqunlOyZuX/XAw==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-DUaE13OwnUSlHpLZNcC/nuT10ivlWqc5EZgsfgXuAmWYw0r3nDxGeLD1zlGwYwIgVk1/ZMAxoXpV+05stvbHaA==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [win32]++ '@oxc-project/[email protected]':+ resolution: {integrity: sha512-IJ3s6ltHLp45S0bh7phkX+gJO7A1Wuz2EaqpAhb8WjqDwbzMiWKHhyyT42tskaWjEYXtHtVCPpnBJVT9+dcRLg==}++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-y09e0L0SRI2OA2tUIrjBgoV3eH5hvUKXNkJqXmNo5V2WxIjyC7I7aJfRLMEVpA8yi95f90gFDvO0VMgrDw+vwA==}+ cpu: [arm]+ os: [android]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-cl4icWaZFnLdg8m6qtnh5rBMuGbxc/ptStFHLeCNwr+2cZjkjNwQu/jYRS0CHlnPecOJMpuS5M6/BH+0J/YkEg==}+ cpu: [arm64]+ os: [android]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-At29QEMF6HajbQvgY8K6OXnHD1x9rad74xBEfmCB6ZqCGsdq75aK7tOYcTbOanMy8qdIBrfL3SMr3p/lfSlb9w==}+ cpu: [arm64]+ os: [darwin]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-A5Kqr1EUj4oIL5CF4WRssq/o5P0Y11cwoFouMRmQ7YnC/A8V93nv1nb7aSU8HwcgmXropjLNkVTl4MN87cu28Q==}+ cpu: [x64]+ os: [darwin]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-R5xkRBRRz7ceH/P5Jrc6G7FmdUdgpLYyESFAUDVTNQ9K0sGPxcp4ljiwEwEqsvNcQ4sYbMRrWcHHBCu7ksAJVw==}+ cpu: [x64]+ os: [freebsd]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-k/RuYL4L/R58IBn3wT5ma3Wh4k62bp1eYCFRWCmMsasUOqL+H6sW0VGFadEzKWXFFlz+2uIMoeMk9ySSZJHgbg==}+ cpu: [arm]+ os: [linux]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-bnHAak3ujYfH5pKk4NieFNbvYvernfoQDgwLddbZ3OtMYrem87/qjlA+u+aKG0oZcqSLGCful/6/CEA+aeAgaA==}+ cpu: [arm]+ os: [linux]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-vDT3KHgzYp47gmtNOqL2VNhCyl5Zv643eyxm//A68J8DeUGXrvD1pZFiaT4jSfe+RInfnn1R2yVHye4enx6RnA==}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-+kMlQvbzfyEYtu5FcjE4p+ttBLpKW4d/AsAsuE69BxV6V4twZJeIQZFfD8gh/wqglY0MkPSezWXQH0jBV13MUw==}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-shjfMhmZ3gq9fv/w7bi3PnZlgOPG+2QAOFf0BJF0EgBSIGZ6PMLN2zbGEblTUYB/NKVDRyYhE2ff3dJ1QqNPkA==}+ cpu: [ppc64]+ os: [linux]+ libc: [glibc]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-zGelwFR5oRo+b69k8Lrzun86DyUHzfKN6cnjbR9l7Z7NIRznOE/2ZvPa1IUKqAL2PzAXOdwkfVqNvO1H2RlpAw==}+ cpu: [riscv64]+ os: [linux]+ libc: [glibc]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-qxZ1SWCXJY0eyhAlP6Lmo9F2Nrtx7EkYj9oCgL8apDPCwXwCEDA2U697bbT81JIc2IrVjxO4KX6WU2N+oN9Z4w==}+ cpu: [riscv64]+ os: [linux]+ libc: [musl]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-sGCecF3cx2DFlH4t/z7ApnOnXqN48p5p5mlHDEnHTAukQa2P+qMVE4CwyWE9W+q/m3QJ7kKfGrIjax31f44oFQ==}+ cpu: [s390x]+ os: [linux]+ libc: [glibc]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-k/VlMMcSzMlahb3/fENM4rTlsJ0s3fFROA0KXPBmKggqmTSaE383sl8F3KCOXPLmVsYfW6hCitMhXCEtNeZxxg==}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-8hbnZyNi97b/8wapYaIF9+t9GmZKBW2vunaOc3h9HGJptH7b7XpvZqOTBSm/MpTjr7H497BlgOaSfLUdhmy2bw==}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-MvyGik3a6pVgZ0t/kWlbmFxFLmXQJwgLsY2eYFHLpy0wGwRbfzeIGgDwQ3kXqE30z+kSXennRkCrT7TUvkptNg==}+ cpu: [arm64]+ os: [openharmony]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-vHcssMPwO08RTvj/c0iOBz90attxyG3wQJ0dTcyEQK43LRpcdLWZlV5feBhv6Isn6ahbQIzHbCgfa81+RiML0Q==}+ engines: {node: '>=14.0.0'}+ cpu: [wasm32]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-uokJqro2iBqkFvJdKQLP7d8/BUmFwESQFVmIJUQKj1Xn1a/LysJoe1vmeECLF5b3jsV8CAL5sEMJXX6SdK9Nhg==}+ cpu: [arm64]+ os: [win32]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-UqGPmo56KDfLlfXFAFIrNflHT8tFxWGEivWg3Zeyp4Uy2NlKN1FGPr6/BxcLGG3+kZ6Wp14g5Uj+n71boqZfiw==}cpu: [x64]os: [win32]@@ -2912,8 +3045,8 @@ packages:cpu: [x64]os: [win32]- '@s2-dev/[email protected]':- resolution: {integrity: sha512-dtm+oFHVE8szINwOUoNQdx9xpGSJOrcAEvsxspPFvomjYKGnmhIRmU4OX8o6kxcPoiK76S1tPeU0smjZdmOngA==}+ '@s2-dev/[email protected]':+ resolution: {integrity: sha512-oB8OJObT/s2Q68Tr01NLfDnQPFJp/Kn2pP3seWybgP7VrjQ+j1efXReOsyVCDsUBVMxkyPlzt75o/+GuL5Q3vg==}'@schummar/[email protected]':resolution: {integrity: sha512-bXHSaW5jRTmke9Vd0h5P7BtWZG9Znqb8gSDxZnxaGSJnGwPLDPfS+3g0BKzeWqzgZPsIVZkM7m2tbo18cm5HBw==}@@ -3186,6 +3319,9 @@ packages:'@swc/[email protected]':resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}+ '@swc/[email protected]':+ resolution: {integrity: sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==}+'@swc/[email protected]':resolution: {integrity: sha512-V6Mnml8v09QALx6K0elJ7o9K/MkVDtW3t6L+7Ou/JcWtb3xwId2AH4FeOceySd2JaO87IMw4+6vSZxLm34LPbw==}@@ -3252,12 +3388,12 @@ packages:peerDependencies:'@testing-library/dom': '>=7.21.4'- '@trigger.dev/[email protected]':- resolution: {integrity: sha512-G4moEUr3UeQ44AcbEoW8picaWBO+akw89u4fNDfIqXlR3LVCVgrDx2BGdCeopMSKuNVKfdCtmfZf8LphK8gIvg==}+ '@trigger.dev/[email protected]':+ resolution: {integrity: sha512-7Gcv8rl+DnPxvguiWSp+KUeA7HVM9Xp46YYEeBGgViahL/Ml3WIv2hXXEiHrP8L3aM9C9YtStmmRmz5yOzW4fw==}engines: {node: '>=18.20.0'}- '@trigger.dev/[email protected]':- resolution: {integrity: sha512-RktMdYsJkZgOZaemhWax6i0sCiDAUNPOMej41DZlC73NISBFkRNutIL91ngt0TjD733Xe+a+wKD7Ei+u8uvsVA==}+ '@trigger.dev/[email protected]':+ resolution: {integrity: sha512-YjHz3Zv/yyLAS6tqFZMTVD2yTP6FopbPaLgtECLUqYx/pV2LQftgs7XI5o6NvtJxaDDLEz2wHqegCte1Ww2lKg==}engines: {node: '>=18.20.0'}peerDependencies:'@ai-sdk/otel': '>=1.0.0-0 <2'@@ -3275,8 +3411,8 @@ packages:'@ts-morph/[email protected]':resolution: {integrity: sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ==}- '@tybys/[email protected]':- resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==}+ '@tybys/[email protected]':+ resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==}'@types/[email protected]':resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==}@@ -3284,9 +3420,6 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==}- '@types/[email protected]':- resolution: {integrity: sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==}-'@types/[email protected]':resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==}@@ -3373,6 +3506,126 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==}+ '@typescript/[email protected]':+ resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==}+ engines: {node: '>=16.20.0'}+ cpu: [ppc64]+ os: [aix]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [darwin]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [darwin]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [freebsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [freebsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==}+ engines: {node: '>=16.20.0'}+ cpu: [arm]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==}+ engines: {node: '>=16.20.0'}+ cpu: [loong64]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==}+ engines: {node: '>=16.20.0'}+ cpu: [mips64el]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==}+ engines: {node: '>=16.20.0'}+ cpu: [ppc64]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==}+ engines: {node: '>=16.20.0'}+ cpu: [riscv64]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==}+ engines: {node: '>=16.20.0'}+ cpu: [s390x]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [linux]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [netbsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [netbsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [openbsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [openbsd]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [sunos]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==}+ engines: {node: '>=16.20.0'}+ cpu: [arm64]+ os: [win32]++ '@typescript/[email protected]':+ resolution: {integrity: sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==}+ engines: {node: '>=16.20.0'}+ cpu: [x64]+ os: [win32]+'@ungap/[email protected]':resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}@@ -3707,6 +3960,11 @@ packages:resolution: {integrity: sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==}engines: {node: ^4.5.0 || >= 5.9}+ resolution: {integrity: sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw==}+ engines: {node: '>=6.0.0'}+ hasBin: true+resolution: {integrity: sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==}@@ -3980,10 +4238,6 @@ packages:resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==}engines: {node: '>=6.6.0'}- resolution: {integrity: sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==}- engines: {node: '>= 0.6'}-resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}engines: {node: '>= 0.6'}@@ -4004,10 +4258,6 @@ packages:typescript:optional: true- resolution: {integrity: sha512-YKGmAy84hKH+hHIIER07VCAHf9u0Ldelx1uU6EBxsRPDXIA1m5fsKmJfyC3xBhw6cVC/1i83VdbL4PvepTrt8A==}- hasBin: true-resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}engines: {node: '>= 8'}@@ -4250,10 +4500,6 @@ packages:resolution: {integrity: sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==}engines: {node: '>=10.0.0'}- resolution: {integrity: sha512-C5Pn8Wk+1vKBoHghJODM63yk8MvrO9EWZUfkAt5HAqIgPE4/8FF0PEGHXtEd40l223+cE5ABWuPzm38PHFXfMA==}- engines: {node: '>=10.2.0'}-resolution: {integrity: sha512-ZCkIjSYNDyGn0R6ewHDtXgns/Zre/NT6Agvq1/WobF7JXgFff4SeDroKiCO3fNJreU9YG429Sc81o4w5ok/W5g==}engines: {node: '>=10.2.0'}@@ -4473,9 +4719,6 @@ packages:resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==}engines: {node: '>=18.0.0'}- resolution: {integrity: sha512-GpjX476FSlttEGWHT8BdVMoI8wGXQGbEOtKcP4E+kggg+yJzXBZN2n4x7TS/zPBJ1DZqWI+rguZZApjjzQ0HpA==}-resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==}engines: {node: '>=10'}@@ -4603,8 +4846,8 @@ packages:resolution: {integrity: sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==}engines: {node: '>= 6'}- resolution: {integrity: sha512-9XNj/o4wrRFyhSMJOvsuyMwy8aUfBaZ1VrqHVfohyXf0Sw0e+yfKG+xZaY3arGCOMdwFsqObtzVOc1gU9KiT9w==}+ resolution: {integrity: sha512-7CXJtIIA0zy/u12StsYk25qVKxvdLA2ep2sTNxK3ov0mGNIIDqIvAXDSgTnAfDJFsPfWjuz0WjfYSdpvnLA5Tg==}engines: {node: '>=18.3.0'}hasBin: true@@ -4723,8 +4966,8 @@ packages:resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==}engines: {node: '>= 0.4'}- resolution: {integrity: sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==}+ resolution: {integrity: sha512-++QEw4DIY7WGoukz+/+A/8dGYPT9l9yIadnmSgZ8Rjr3YVSVDipQSO9CdnJo9ePqFqUUqh+wk9uIaoiAwsiPkA==}resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}@@ -5186,8 +5429,8 @@ packages:resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==}hasBin: true- resolution: {integrity: sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==}+ resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==}hasBin: true@@ -5206,10 +5449,6 @@ packages:resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}hasBin: true- resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==}- hasBin: true-resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==}engines: {node: '>=6'}@@ -5265,13 +5504,10 @@ packages:resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==}engines: {node: '>=6'}- resolution: {integrity: sha512-V2kyON+DZiYdNNdY6GALseiNCwX7dYdpz9Pv85AUn69Gk0UKCts+glOKWfe5KmaMByRjM9q17Mzj/KinTVOyxg==}- engines: {node: '>=18.18.0'}+ resolution: {integrity: sha512-bbHIrnGspYwe4EBPjjx+lvkUor0F2qfKQc5BPzPI4SOAImYA+k2ueVpIcF7d/W1LEVT7XoJUPt6zELeGZhXBgA==}+ engines: {node: ^20.19.0 || >=22.12.0}hasBin: true- peerDependencies:- '@types/node': '>=18'- typescript: '>=5.0.4 <7'resolution: {integrity: sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==}@@ -5610,9 +5846,6 @@ packages:resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==}engines: {node: '>=4'}- resolution: {integrity: sha512-oxdmJ9cL+xV72h0xYxp4tP2d5/fTBpP45H8DIOn9pASuF8a3IYTf+25fMGDYGiWW+MFsuog6KD6nfmhZJQ+uUw==}-resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==}engines: {node: 18 || 20 || >=22}@@ -5678,17 +5911,13 @@ packages:resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}- resolution: {integrity: sha512-R+HAae+qVpgDsV2XFnELNmBk8fILv/epGVoCjvnF1+QfOlzX92Pe/zN4B1tOA17uOuR6A8ARSUbUpjUtTyiiNg==}- engines: {node: ^18 || >=20}-resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==}engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}hasBin: true- resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==}+ resolution: {integrity: sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==}engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}hasBin: true@@ -5744,9 +5973,9 @@ packages:sass:optional: true- resolution: {integrity: sha512-Y+xn8EQCoC3ZbsFPyzE+tE8XOdrWeUdUF7NeXbmg9DsgAxl5UYxlsrvgVESHTyTGigoTa1bCUrxn70F5bqt0Gw==}- engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0}+ resolution: {integrity: sha512-/Ztf6CeRH+ejEXUrYtqI4gkS66eFIHuSwqi60RgcpWKodxFZx2/dqVCMKBwILfAHXQ+F1b1vAudgj3mnxqtoIA==}+ engines: {node: '>=20.9.0'}hasBin: truepeerDependencies:'@opentelemetry/api': ^1.1.0@@ -5890,8 +6119,12 @@ packages:resolution: {integrity: sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==}engines: {node: '>= 0.4'}- resolution: {integrity: sha512-qE/CIg/spwrTBFt5aKmwe3ifeDdLfA2NESN30E42X/lII5ClF8V7Wt6WIJhcGZjp0/Q+nQ+9vgxGk//xZNX2hg==}+ resolution: {integrity: sha512-5xaug6t7GfV3BO5Iv+xHW1rmQkDEQ3BEu3L8g3InsvWO5i8CYGc4tCZ2X985QcwWNycFJam+aOns6Nr2XAThTA==}+ engines: {node: ^20.19.0 || >=22.12.0}++ resolution: {integrity: sha512-FY91FiDBj7ls5MsFS9jN3tjz2o0/zsdSsymlakySaBwVJZorHhkWyICLZMKxlu1R9vYo+sd3z1jwb4J8x7bNDw==}resolution: {integrity: sha512-XZ4GFBN/PLbXKq+0zrgpQfPKYuJlUuj+nzZJY7UpIbFMNyefNLCdN9EwViycNqnYcv0wrn0jXcQLlqJp8RCKBg==}@@ -5949,6 +6182,9 @@ packages:resolution: {integrity: sha512-ZsEbbZORsyHuO00lY1kV3/t72yp6Ysay6Pd17ZAlNGuGwmWDLCJxFpRs0IzfXfj1o4icJOkUEioexFHzyPurSQ==}+ resolution: {integrity: sha512-yQA4H19AmPEoMUeavPMDIe1higySl/gH/yaQrkT/s07Qp+7pp2hYz30N3z2l5BkjVkF9Ow6o0wjJamm2y7Sn0A==}+resolution: {integrity: sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==}@@ -6041,6 +6277,10 @@ packages:resolution: {integrity: sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==}engines: {node: '>=12'}+ resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==}engines: {node: '>=0.10'}@@ -6127,6 +6367,10 @@ packages:resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==}engines: {node: ^10 || ^12 || >=14}+ resolution: {integrity: sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg==}+ engines: {node: ^10 || ^12 || >=14}+resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==}engines: {node: ^10 || ^12 || >=14}@@ -6162,6 +6406,7 @@ packages:resolution: {integrity: sha512-6ZiOBfCywsD4k1BN9IX0uZhF+tJkV8q8llP64G5Hajs4JOeVLPCwpPVcpXy3BwYiUGgyJzsJJQeOIv7+hDSq8g==}engines: {node: ^16 || ^18 || >=20}+ deprecated: prom-client has been replaced by @prometheus-io/clientresolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==}@@ -6433,9 +6678,6 @@ packages:resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}engines: {node: '>= 18'}- resolution: {integrity: sha512-K3mdoAi7tjJ/qT7Flj90L7QyPozwUaAG+CVhkdDje4HLKXUYC3N/Jzkau3flHVDLQVhiHBtcimVodMjN9egYbA==}-resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}@@ -6488,6 +6730,11 @@ packages:engines: {node: '>=10'}hasBin: true+ resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==}+ engines: {node: '>=10'}+ hasBin: true+resolution: {integrity: sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==}engines: {node: '>= 18'}@@ -6528,9 +6775,14 @@ packages:resolution: {integrity: sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==}engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}- resolution: {integrity: sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==}- engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}+ resolution: {integrity: sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA==}+ engines: {node: '>=20.9.0'}+ peerDependencies:+ '@types/node': '*'+ peerDependenciesMeta:+ '@types/node':+ optional: trueresolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}@@ -6580,11 +6832,8 @@ packages:resolution: {integrity: sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==}engines: {node: '>=18'}- resolution: {integrity: sha512-x6vLHCMasg4DR2LPiyFGI0gJJhywY6DTiGhCrOMzb3SOk/0JVLIaL4UhyFSHu04SD3uAavrKY/K3zZ3i6iRcgA==}-- resolution: {integrity: sha512-4zemZi0HvTnYwLfrpk/CF9LOd9Lt87kAt50GnqhMpyF9U3poDAP2+iukq2bZsO/ufegbYehBkqINbsWxj4l4cw==}+ resolution: {integrity: sha512-kCZr2V3ch9i00x8zXRhjUNVcjG9ijES5dDudkXvUVCT5QlJNQWElSJdZqyPemffHoLNUYwOcou0Fy+ojN0uHSQ==}engines: {node: '>= 18'}@@ -6598,10 +6847,6 @@ packages:resolution: {integrity: sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==}engines: {node: '>=10.0.0'}- resolution: {integrity: sha512-DcotgfP1Zg9iP/dH9zvAQcWrE0TtbMVwXmlV4T4mqsvY+gw+LqUGPfx2AoVyRk0FLME+GQhufDMyacFmw7ksqw==}- engines: {node: '>=10.2.0'}-resolution: {integrity: sha512-oZ7iUCxph8WYRHHcjBEc9unw3adt5CmSNlppj/5Q4k2RIrhl8Z5yY2Xr4j9zj0+wzVZ0bxmYoGSzKJnRl6A4yg==}engines: {node: '>=10.2.0'}@@ -6858,6 +7103,10 @@ packages:resolution: {integrity: sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==}engines: {node: '>=12.0.0'}+ resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}+ engines: {node: '>=12.0.0'}+resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==}engines: {node: ^18.0.0 || >=20.0.0}@@ -6908,9 +7157,6 @@ packages:resolution: {integrity: sha512-ztMO++owQnz8c/gIENcM9XfCEzgoGphTv+nKpYNM1bgsdOVC/jRZuEBf6N+mLLDNg68Kl+GgUZfOySaRiG1/Ug==}- resolution: {integrity: sha512-nFRqW0ttu/2o6XTXsHiVZWJBCOaxhVqZLg7dgs3coZNsCMPXPfwz+zPHAQA+70fNnVJLAPg1EgGIqK9Q84tvAw==}-resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==}engines: {node: '>=6'}@@ -6959,9 +7205,9 @@ packages:resolution: {integrity: sha512-phPGCwqr2+Qo0fwniCE8e4pKnGu/yFb5nD5Y8bf0EEeiI5GklnACYA9GFy/DrAeRrKHXvHn+1SUsOWgJp6RO+g==}engines: {node: '>= 0.4'}- resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}- engines: {node: '>=14.17'}+ resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==}+ engines: {node: '>=16.20.0'}hasBin: true@@ -6971,9 +7217,9 @@ packages:resolution: {integrity: sha512-LZyXZdNttONW8LjzEH3Z8+6TE7RfrEiJqDKyh0R11p/kxvrV2o9DrT2FGZO+KVNs3k+drcIQ6C3En6wLnzJGpw==}hasBin: true- resolution: {integrity: sha512-fIRiVTJNcSRmXKPZtGzFQv9WRrZ3M9eoptl/teFJvjOzmpU+/K/JH6HZ8deBfb5vMEpicJcLn7JmvdknlMq7Zg==}- hasBin: true+ resolution: {integrity: sha512-FoSOKV7NEofQSkAefMVHam4ZPKYMxjAydxiV72UFEDNV/YofxjGfiZ2A9pZjdL/lRJzTjcu4PABo1JYJX8N5iQ==}+ engines: {node: '>=14'}resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==}@@ -7344,9 +7590,6 @@ packages:resolution: {integrity: sha512-0LPOt3AxKqMdFBZA3HBAt/t/8vIKq7VaQYbuA8WxCgung+p9TVyKRYdpvCb80HcdTN2NkbIKbhNwKUfm3tQywQ==}- resolution: {integrity: sha512-zzopKZ/skI9iXpqCEPj+iLCKl9b88E43ehcU+sbRoHuwGd9F1IDVGQ70TyO6kmfiRL1g4IXkjsXK+g1gLYl4WQ==}-resolution: {integrity: sha512-h/z3PKvcTcTetyjl1fkj79MHNEjm+HpD6NXheWjzOekY7kV+lwDYnHw+ivHkijnCSMz1yJaWBD9vu/Fcmk+vEg==}peerDependencies:@@ -7660,25 +7903,30 @@ snapshots:dependencies:'@microsoft/fetch-event-source': 2.0.1optionalDependencies:- '@rollup/rollup-darwin-arm64': 4.41.0+ '@rollup/rollup-darwin-arm64': 4.62.4- '@emnapi/[email protected]':+ '@emnapi/[email protected]':dependencies:- '@emnapi/wasi-threads': 1.1.0+ '@emnapi/wasi-threads': 1.2.2tslib: 2.8.1optional: true- '@emnapi/[email protected]':+ '@emnapi/[email protected]':dependencies:tslib: 2.8.1optional: true- '@emnapi/[email protected]':+ '@emnapi/[email protected]':dependencies:tslib: 2.8.1optional: true- '@emnapi/[email protected]':+ '@emnapi/[email protected]':+ dependencies:+ tslib: 2.8.1+ optional: true++ '@emnapi/[email protected]':dependencies:tslib: 2.8.1optional: true@@ -7850,9 +8098,9 @@ snapshots:'@img/sharp-libvips-darwin-arm64': 1.0.4optional: true- '@img/[email protected]':+ '@img/[email protected]':optionalDependencies:- '@img/sharp-libvips-darwin-arm64': 1.2.4+ '@img/sharp-libvips-darwin-arm64': 1.3.3optional: true'@img/[email protected]':@@ -7860,63 +8108,68 @@ snapshots:'@img/sharp-libvips-darwin-x64': 1.0.4optional: true- '@img/[email protected]':+ '@img/[email protected]':optionalDependencies:- '@img/sharp-libvips-darwin-x64': 1.2.4+ '@img/sharp-libvips-darwin-x64': 1.3.3+ optional: true++ '@img/[email protected]':+ dependencies:+ '@img/sharp-wasm32': 0.35.4optional: true'@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true'@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true'@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true'@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true'@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true'@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true'@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true'@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true'@img/[email protected]':@@ -7924,9 +8177,9 @@ snapshots:'@img/sharp-libvips-linux-arm64': 1.0.4optional: true- '@img/[email protected]':+ '@img/[email protected]':optionalDependencies:- '@img/sharp-libvips-linux-arm64': 1.2.4+ '@img/sharp-libvips-linux-arm64': 1.3.3optional: true'@img/[email protected]':@@ -7934,19 +8187,19 @@ snapshots:'@img/sharp-libvips-linux-arm': 1.0.5optional: true- '@img/[email protected]':+ '@img/[email protected]':optionalDependencies:- '@img/sharp-libvips-linux-arm': 1.2.4+ '@img/sharp-libvips-linux-arm': 1.3.3optional: true- '@img/[email protected]':+ '@img/[email protected]':optionalDependencies:- '@img/sharp-libvips-linux-ppc64': 1.2.4+ '@img/sharp-libvips-linux-ppc64': 1.3.3optional: true- '@img/[email protected]':+ '@img/[email protected]':optionalDependencies:- '@img/sharp-libvips-linux-riscv64': 1.2.4+ '@img/sharp-libvips-linux-riscv64': 1.3.3optional: true'@img/[email protected]':@@ -7954,9 +8207,9 @@ snapshots:'@img/sharp-libvips-linux-s390x': 1.0.4optional: true- '@img/[email protected]':+ '@img/[email protected]':optionalDependencies:- '@img/sharp-libvips-linux-s390x': 1.2.4+ '@img/sharp-libvips-linux-s390x': 1.3.3optional: true'@img/[email protected]':@@ -7964,9 +8217,9 @@ snapshots:'@img/sharp-libvips-linux-x64': 1.0.4optional: true- '@img/[email protected]':+ '@img/[email protected]':optionalDependencies:- '@img/sharp-libvips-linux-x64': 1.2.4+ '@img/sharp-libvips-linux-x64': 1.3.3optional: true'@img/[email protected]':@@ -7974,9 +8227,9 @@ snapshots:'@img/sharp-libvips-linuxmusl-arm64': 1.0.4optional: true- '@img/[email protected]':+ '@img/[email protected]':optionalDependencies:- '@img/sharp-libvips-linuxmusl-arm64': 1.2.4+ '@img/sharp-libvips-linuxmusl-arm64': 1.3.3optional: true'@img/[email protected]':@@ -7984,9 +8237,9 @@ snapshots:'@img/sharp-libvips-linuxmusl-x64': 1.0.4optional: true- '@img/[email protected]':+ '@img/[email protected]':optionalDependencies:- '@img/sharp-libvips-linuxmusl-x64': 1.2.4+ '@img/sharp-libvips-linuxmusl-x64': 1.3.3optional: true'@img/[email protected]':@@ -7994,24 +8247,29 @@ snapshots:'@emnapi/runtime': 1.4.5optional: true- '@img/[email protected]':+ '@img/[email protected]':dependencies:- '@emnapi/runtime': 1.8.1+ '@emnapi/runtime': 1.11.3optional: true- '@img/[email protected]':+ '@img/[email protected]':+ dependencies:+ '@img/sharp-wasm32': 0.35.4+ optional: true++ '@img/[email protected]':optional: true'@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true'@img/[email protected]':optional: true- '@img/[email protected]':+ '@img/[email protected]':optional: true'@inquirer/[email protected](@types/[email protected])':@@ -8197,18 +8455,18 @@ snapshots:'@napi-rs/[email protected]':optional: true- '@napi-rs/[email protected]':dependencies:- '@emnapi/core': 1.8.1- '@emnapi/runtime': 1.8.1- '@tybys/wasm-util': 0.10.1+ '@emnapi/core': 1.11.2+ '@emnapi/runtime': 1.11.2+ '@tybys/wasm-util': 0.10.3optional: true'@next/[email protected]': {}- '@next/[email protected]': {}+ '@next/[email protected]': {}- '@next/[email protected](@mdx-js/[email protected]([email protected])([email protected]))(@mdx-js/[email protected](@types/[email protected])([email protected]))':+ '@next/[email protected](@mdx-js/[email protected]([email protected])([email protected]))(@mdx-js/[email protected](@types/[email protected])([email protected]))':dependencies:source-map: 0.7.4optionalDependencies:@@ -8218,49 +8476,49 @@ snapshots:'@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true'@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true'@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true'@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true'@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true'@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true'@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true'@next/[email protected]':optional: true- '@next/[email protected]':+ '@next/[email protected]':optional: true'@noble/[email protected]': {}@@ -8439,66 +8697,124 @@ snapshots:'@opentelemetry/[email protected]': {}- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-parser/[email protected]':optional: true- '@oxc-resolver/[email protected]':- dependencies:- '@napi-rs/wasm-runtime': 1.1.1+ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-project/[email protected]': {}++ '@oxc-resolver/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-resolver/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-resolver/[email protected]':optional: true- '@oxc-resolver/[email protected]':+ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ dependencies:+ '@emnapi/core': 1.11.2+ '@emnapi/runtime': 1.11.2+ '@napi-rs/wasm-runtime': 1.2.3(@emnapi/[email protected])(@emnapi/[email protected])+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':optional: true'@oxfmt/[email protected]':@@ -9384,7 +9700,7 @@ snapshots:dependencies:'@types/estree': 1.0.8estree-walker: 2.0.2- picomatch: 4.0.3+ picomatch: 4.0.5optionalDependencies:rollup: 4.62.4@@ -9523,7 +9839,7 @@ snapshots:'@rollup/[email protected]':optional: true- '@s2-dev/[email protected]':+ '@s2-dev/[email protected]':dependencies:'@protobuf-ts/runtime': 2.11.1debug: 4.4.3@@ -9638,7 +9954,7 @@ snapshots:dependencies:'@sentry/core': 10.70.0- '@sentry/[email protected](@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected])':+ '@sentry/[email protected](@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected])':dependencies:'@opentelemetry/api': 1.9.1'@rollup/plugin-commonjs': 28.0.1([email protected])@@ -9652,7 +9968,7 @@ snapshots:'@sentry/server-utils': 10.70.0'@sentry/vercel-edge': 10.70.0'@sentry/webpack-plugin': 5.4.0([email protected])([email protected])- next: 15.5.24(@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected])+ next: 16.3.4(@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])rollup: 4.62.4stacktrace-parser: 0.1.11transitivePeerDependencies:@@ -9784,7 +10100,7 @@ snapshots:'@swc/[email protected]':optional: true- '@swc/[email protected]':+ '@swc/[email protected](@swc/[email protected])':dependencies:'@swc/counter': 0.1.3'@swc/types': 0.1.28@@ -9801,6 +10117,7 @@ snapshots:'@swc/core-win32-arm64-msvc': 1.15.47'@swc/core-win32-ia32-msvc': 1.15.47'@swc/core-win32-x64-msvc': 1.15.47+ '@swc/helpers': 0.5.23'@swc/[email protected]': {}@@ -9808,22 +10125,26 @@ snapshots:dependencies:tslib: 2.8.1+ '@swc/[email protected]':+ dependencies:+ tslib: 2.8.1+'@swc/[email protected]':dependencies:'@swc/counter': 0.1.3dependencies:arktype: 2.1.20optionalDependencies:- typescript: 6.0.3+ typescript: 7.0.2zod: 4.5.4dependencies:optionalDependencies:- typescript: 6.0.3+ typescript: 7.0.2zod: 4.5.4transitivePeerDependencies:- arktype@@ -9870,7 +10191,7 @@ snapshots:dependencies:'@testing-library/dom': 10.4.1- '@trigger.dev/[email protected]':+ '@trigger.dev/[email protected]':dependencies:'@bugsnag/cuid': 3.2.2'@electric-sql/client': 1.0.14@@ -9889,42 +10210,31 @@ snapshots:'@opentelemetry/sdk-metrics': 2.7.1(@opentelemetry/[email protected])'@opentelemetry/sdk-trace-base': 2.7.1(@opentelemetry/[email protected])'@opentelemetry/sdk-trace-node': 2.7.1(@opentelemetry/[email protected])- '@opentelemetry/semantic-conventions': 1.41.1- '@s2-dev/streamstore': 0.22.10+ '@s2-dev/streamstore': 0.25.0dequal: 2.0.3eventsource: 3.0.7eventsource-parser: 3.0.6- execa: 8.0.1humanize-duration: 3.34.0jose: 5.10.0- nanoid: 3.3.8+ nanoid: 3.3.18prom-client: 15.1.3- socket.io: 4.7.4socket.io-client: 4.7.5std-env: 3.9.0tinyexec: 0.3.2uncrypto: 0.1.3zod: 3.25.76- zod-error: 1.5.0zod-validation-error: 1.5.0([email protected])transitivePeerDependencies:- bufferutil- supports-color- utf-8-validatedependencies:'@opentelemetry/api': 1.9.1'@opentelemetry/semantic-conventions': 1.41.1- '@trigger.dev/core': 4.5.6- chalk: 5.4.1- cronstrue: 2.59.0- debug: 4.4.3- evt: 2.5.9- slug: 6.1.0- ulid: 2.4.0+ '@trigger.dev/core': 4.5.16uncrypto: 0.1.3- ws: 8.21.0zod: 4.5.4optionalDependencies:react: 19.2.8@@ -9939,7 +10249,7 @@ snapshots:minimatch: 10.2.6path-browserify: 1.0.1- '@tybys/[email protected]':+ '@tybys/[email protected]':dependencies:tslib: 2.8.1optional: true@@ -9950,8 +10260,6 @@ snapshots:dependencies:'@types/deep-eql': 4.0.2- '@types/[email protected]': {}-'@types/[email protected]': {}'@types/[email protected]':@@ -10037,6 +10345,66 @@ snapshots:dependencies:'@types/node': 22.8.1+ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true++ '@typescript/[email protected]':+ optional: true+'@ungap/[email protected]': {}'@upstash/[email protected]':@@ -10058,9 +10426,9 @@ snapshots:'@vercel/[email protected]': {}- '@vercel/[email protected]([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected]))([email protected])':+ '@vercel/[email protected]([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]))([email protected])':optionalDependencies:- next: 15.5.24(@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected])+ next: 16.3.4(@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])react: 19.2.8'@vitest/[email protected]':@@ -10071,13 +10439,13 @@ snapshots:chai: 5.2.1tinyrainbow: 2.0.0- '@vitest/[email protected]([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':+ '@vitest/[email protected]([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@vitest/spy': 3.2.4estree-walker: 3.0.3magic-string: 0.30.17optionalDependencies:- msw: 2.11.1(@types/[email protected])([email protected])+ msw: 2.11.1(@types/[email protected])([email protected])vite: 6.3.5(@types/[email protected])([email protected])([email protected])([email protected])([email protected])'@vitest/[email protected]':@@ -10402,6 +10770,8 @@ snapshots:+ [email protected]: {}+dependencies:require-from-string: 2.0.2@@ -10666,8 +11036,6 @@ snapshots:- [email protected]: {}-@@ -10677,16 +11045,14 @@ snapshots:object-assign: 4.1.1vary: 1.1.2dependencies:env-paths: 2.2.1import-fresh: 3.3.0js-yaml: 4.1.0parse-json: 5.2.0optionalDependencies:- typescript: 6.0.3-- [email protected]: {}+ typescript: 7.0.2dependencies:@@ -10889,23 +11255,6 @@ snapshots:- dependencies:- '@types/cookie': 0.4.1- '@types/cors': 2.8.17- '@types/node': 22.8.1- accepts: 1.3.8- base64id: 2.0.0- cookie: 0.4.2- cors: 2.8.5- debug: 4.3.7- engine.io-parser: 5.2.3- ws: 8.17.1- transitivePeerDependencies:- - bufferutil- - supports-color- - utf-8-validate-dependencies:'@types/cors': 2.8.17@@ -11267,12 +11616,6 @@ snapshots:dependencies:eventsource-parser: 3.0.6- dependencies:- minimal-polyfills: 2.2.3- run-exclusive: 2.2.19- tsafe: 1.8.12-dependencies:cross-spawn: 7.0.6@@ -11386,6 +11729,10 @@ snapshots:optionalDependencies:picomatch: 4.0.3+ optionalDependencies:+ picomatch: 4.0.7+dependencies:node-domexception: 1.0.0@@ -11463,9 +11810,10 @@ snapshots:es-set-tostringtag: 2.1.0mime-types: 2.1.35dependencies:fd-package-json: 2.0.0+ package-manager-detector: 1.8.0dependencies:@@ -11583,10 +11931,9 @@ snapshots:es-errors: 1.3.0get-intrinsic: 1.3.0dependencies:resolve-pkg-maps: 1.0.0- optional: truedependencies:@@ -12092,7 +12439,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}@@ -12106,10 +12453,6 @@ snapshots:dependencies:argparse: 2.0.1- dependencies:- argparse: 2.0.1-@@ -12167,21 +12510,20 @@ snapshots:dependencies:- '@nodelib/fs.walk': 1.2.8- '@types/node': 22.8.1- fast-glob: 3.3.3- formatly: 0.3.0- jiti: 2.6.1- js-yaml: 4.1.1- minimist: 1.2.8- oxc-resolver: 11.19.1- picocolors: 1.1.1- picomatch: 4.0.3- smol-toml: 1.6.0+ fdir: 6.5.0([email protected])+ formatly: 0.7.0+ get-tsconfig: 4.14.3+ jiti: 2.7.0+ oxc-parser: 0.147.0+ oxc-resolver: 11.24.2+ picomatch: 4.0.7+ smol-toml: 1.8.0strip-json-comments: 5.0.3- typescript: 6.0.3+ tinyglobby: 0.2.17+ unbash: 4.0.11+ yaml: 2.9.0zod: 4.5.4@@ -12772,8 +13114,6 @@ snapshots:- [email protected]: {}-dependencies:brace-expansion: 5.0.9@@ -12810,7 +13150,7 @@ snapshots:dependencies:'@bundled-es-modules/cookie': 2.0.1'@bundled-es-modules/statuses': 1.0.1@@ -12831,7 +13171,7 @@ snapshots:type-fest: 4.41.0yargs: 17.7.2optionalDependencies:- typescript: 6.0.3+ typescript: 7.0.2transitivePeerDependencies:- '@types/node'@@ -12843,11 +13183,9 @@ snapshots:object-assign: 4.1.1thenify-all: 1.6.0- [email protected]: {}-- [email protected]: {}+ [email protected]: {}dependencies:@@ -12863,20 +13201,20 @@ snapshots:- [email protected]([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]):+ [email protected](@swc/[email protected])([email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]))([email protected])([email protected]):dependencies:'@formatjs/intl-localematcher': 0.8.13'@parcel/watcher': 2.6.0- '@swc/core': 1.15.47+ '@swc/core': 1.15.47(@swc/[email protected])icu-minify: 4.13.7negotiator: 1.0.0- next: 15.5.24(@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected])+ next: 16.3.4(@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])next-intl-swc-plugin-extractor: 4.13.7po-parser: 2.2.0react: 19.2.8use-intl: 4.13.7([email protected])optionalDependencies:- typescript: 6.0.3+ typescript: 7.0.2transitivePeerDependencies:- '@swc/helpers'@@ -12907,29 +13245,31 @@ snapshots:- '@babel/core'- babel-plugin-macros- [email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])([email protected]([email protected]))([email protected]):+ [email protected](@babel/[email protected])(@opentelemetry/[email protected])(@playwright/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]):dependencies:- '@next/env': 15.5.24- '@swc/helpers': 0.5.15+ '@next/env': 16.3.4+ '@swc/helpers': 0.5.23+ baseline-browser-mapping: 2.11.20caniuse-lite: 1.0.30001733- postcss: 8.4.31+ postcss: 8.5.23react: 19.2.8react-dom: 19.2.8([email protected])styled-jsx: 5.1.6(@babel/[email protected])([email protected])optionalDependencies:- '@next/swc-darwin-arm64': 15.5.24- '@next/swc-darwin-x64': 15.5.24- '@next/swc-linux-arm64-gnu': 15.5.24- '@next/swc-linux-arm64-musl': 15.5.24- '@next/swc-linux-x64-gnu': 15.5.24- '@next/swc-linux-x64-musl': 15.5.24- '@next/swc-win32-arm64-msvc': 15.5.24- '@next/swc-win32-x64-msvc': 15.5.24+ '@next/swc-darwin-arm64': 16.3.4+ '@next/swc-darwin-x64': 16.3.4+ '@next/swc-linux-arm64-gnu': 16.3.4+ '@next/swc-linux-arm64-musl': 16.3.4+ '@next/swc-linux-x64-gnu': 16.3.4+ '@next/swc-linux-x64-musl': 16.3.4+ '@next/swc-win32-arm64-msvc': 16.3.4+ '@next/swc-win32-x64-msvc': 16.3.4'@opentelemetry/api': 1.9.1'@playwright/test': 1.60.0- sharp: 0.34.5+ sharp: 0.35.4(@types/[email protected])transitivePeerDependencies:- '@babel/core'+ - '@types/node'- babel-plugin-macros@@ -13078,28 +13418,51 @@ snapshots:object-keys: 1.1.1safe-push-apply: 1.0.0- optionalDependencies:- '@oxc-resolver/binding-android-arm-eabi': 11.19.1- '@oxc-resolver/binding-android-arm64': 11.19.1- '@oxc-resolver/binding-darwin-arm64': 11.19.1- '@oxc-resolver/binding-darwin-x64': 11.19.1- '@oxc-resolver/binding-freebsd-x64': 11.19.1- '@oxc-resolver/binding-linux-arm-gnueabihf': 11.19.1- '@oxc-resolver/binding-linux-arm-musleabihf': 11.19.1- '@oxc-resolver/binding-linux-arm64-gnu': 11.19.1- '@oxc-resolver/binding-linux-arm64-musl': 11.19.1- '@oxc-resolver/binding-linux-ppc64-gnu': 11.19.1- '@oxc-resolver/binding-linux-riscv64-gnu': 11.19.1- '@oxc-resolver/binding-linux-riscv64-musl': 11.19.1- '@oxc-resolver/binding-linux-s390x-gnu': 11.19.1- '@oxc-resolver/binding-linux-x64-gnu': 11.19.1- '@oxc-resolver/binding-linux-x64-musl': 11.19.1- '@oxc-resolver/binding-openharmony-arm64': 11.19.1- '@oxc-resolver/binding-wasm32-wasi': 11.19.1- '@oxc-resolver/binding-win32-arm64-msvc': 11.19.1- '@oxc-resolver/binding-win32-ia32-msvc': 11.19.1- '@oxc-resolver/binding-win32-x64-msvc': 11.19.1+ dependencies:+ '@oxc-project/types': 0.147.0+ optionalDependencies:+ '@oxc-parser/binding-android-arm-eabi': 0.147.0+ '@oxc-parser/binding-android-arm64': 0.147.0+ '@oxc-parser/binding-darwin-arm64': 0.147.0+ '@oxc-parser/binding-darwin-x64': 0.147.0+ '@oxc-parser/binding-freebsd-x64': 0.147.0+ '@oxc-parser/binding-linux-arm-gnueabihf': 0.147.0+ '@oxc-parser/binding-linux-arm-musleabihf': 0.147.0+ '@oxc-parser/binding-linux-arm64-gnu': 0.147.0+ '@oxc-parser/binding-linux-arm64-musl': 0.147.0+ '@oxc-parser/binding-linux-ppc64-gnu': 0.147.0+ '@oxc-parser/binding-linux-riscv64-gnu': 0.147.0+ '@oxc-parser/binding-linux-riscv64-musl': 0.147.0+ '@oxc-parser/binding-linux-s390x-gnu': 0.147.0+ '@oxc-parser/binding-linux-x64-gnu': 0.147.0+ '@oxc-parser/binding-linux-x64-musl': 0.147.0+ '@oxc-parser/binding-openharmony-arm64': 0.147.0+ '@oxc-parser/binding-win32-arm64-msvc': 0.147.0+ '@oxc-parser/binding-win32-ia32-msvc': 0.147.0+ '@oxc-parser/binding-win32-x64-msvc': 0.147.0++ optionalDependencies:+ '@oxc-resolver/binding-android-arm-eabi': 11.24.2+ '@oxc-resolver/binding-android-arm64': 11.24.2+ '@oxc-resolver/binding-darwin-arm64': 11.24.2+ '@oxc-resolver/binding-darwin-x64': 11.24.2+ '@oxc-resolver/binding-freebsd-x64': 11.24.2+ '@oxc-resolver/binding-linux-arm-gnueabihf': 11.24.2+ '@oxc-resolver/binding-linux-arm-musleabihf': 11.24.2+ '@oxc-resolver/binding-linux-arm64-gnu': 11.24.2+ '@oxc-resolver/binding-linux-arm64-musl': 11.24.2+ '@oxc-resolver/binding-linux-ppc64-gnu': 11.24.2+ '@oxc-resolver/binding-linux-riscv64-gnu': 11.24.2+ '@oxc-resolver/binding-linux-riscv64-musl': 11.24.2+ '@oxc-resolver/binding-linux-s390x-gnu': 11.24.2+ '@oxc-resolver/binding-linux-x64-gnu': 11.24.2+ '@oxc-resolver/binding-linux-x64-musl': 11.24.2+ '@oxc-resolver/binding-openharmony-arm64': 11.24.2+ '@oxc-resolver/binding-wasm32-wasi': 11.24.2+ '@oxc-resolver/binding-win32-arm64-msvc': 11.24.2+ '@oxc-resolver/binding-win32-x64-msvc': 11.24.2dependencies:@@ -13179,6 +13542,8 @@ snapshots:+ [email protected]: {}+@@ -13257,6 +13622,8 @@ snapshots:+ [email protected]: {}+@@ -13325,6 +13692,12 @@ snapshots:picocolors: 1.1.1source-map-js: 1.2.1+ dependencies:+ nanoid: 3.3.18+ picocolors: 1.1.1+ source-map-js: 1.2.1+dependencies:nanoid: 3.3.11@@ -13680,8 +14053,7 @@ snapshots:- optional: true+ [email protected]: {}dependencies:@@ -13782,10 +14154,6 @@ snapshots:transitivePeerDependencies:- supports-color- dependencies:- minimal-polyfills: 2.2.3-dependencies:queue-microtask: 1.2.3@@ -13838,6 +14206,9 @@ snapshots:+ optional: true+dependencies:debug: 4.4.3@@ -13895,7 +14266,7 @@ snapshots:dependencies:'@antfu/ni': 25.0.0'@babel/core': 7.28.3@@ -13904,7 +14275,7 @@ snapshots:'@dotenvx/dotenvx': 1.49.0'@modelcontextprotocol/sdk': 1.17.5commander: 14.0.0- cosmiconfig: 9.0.0([email protected])+ cosmiconfig: 9.0.0([email protected])dedent: 1.7.0deepmerge: 4.3.1diff: 8.0.2@@ -13914,7 +14285,7 @@ snapshots:fuzzysort: 3.1.0https-proxy-agent: 7.0.6kleur: 4.1.5- msw: 2.11.1(@types/[email protected])([email protected])+ msw: 2.11.1(@types/[email protected])([email protected])node-fetch: 3.3.2ora: 8.2.0postcss: 8.5.6@@ -13958,36 +14329,38 @@ snapshots:'@img/sharp-win32-x64': 0.33.5optional: true+ [email protected](@types/[email protected]):dependencies:'@img/colour': 1.1.0detect-libc: 2.1.2- semver: 7.8.1- optionalDependencies:- '@img/sharp-darwin-arm64': 0.34.5- '@img/sharp-darwin-x64': 0.34.5- '@img/sharp-libvips-darwin-arm64': 1.2.4- '@img/sharp-libvips-darwin-x64': 1.2.4- '@img/sharp-libvips-linux-arm': 1.2.4- '@img/sharp-libvips-linux-arm64': 1.2.4- '@img/sharp-libvips-linux-ppc64': 1.2.4- '@img/sharp-libvips-linux-riscv64': 1.2.4- '@img/sharp-libvips-linux-s390x': 1.2.4- '@img/sharp-libvips-linux-x64': 1.2.4- '@img/sharp-libvips-linuxmusl-arm64': 1.2.4- '@img/sharp-libvips-linuxmusl-x64': 1.2.4- '@img/sharp-linux-arm': 0.34.5- '@img/sharp-linux-arm64': 0.34.5- '@img/sharp-linux-ppc64': 0.34.5- '@img/sharp-linux-riscv64': 0.34.5- '@img/sharp-linux-s390x': 0.34.5- '@img/sharp-linux-x64': 0.34.5- '@img/sharp-linuxmusl-arm64': 0.34.5- '@img/sharp-linuxmusl-x64': 0.34.5- '@img/sharp-wasm32': 0.34.5- '@img/sharp-win32-arm64': 0.34.5- '@img/sharp-win32-ia32': 0.34.5- '@img/sharp-win32-x64': 0.34.5+ semver: 7.8.5+ optionalDependencies:+ '@img/sharp-darwin-arm64': 0.35.4+ '@img/sharp-darwin-x64': 0.35.4+ '@img/sharp-freebsd-wasm32': 0.35.4+ '@img/sharp-libvips-darwin-arm64': 1.3.3+ '@img/sharp-libvips-darwin-x64': 1.3.3+ '@img/sharp-libvips-linux-arm': 1.3.3+ '@img/sharp-libvips-linux-arm64': 1.3.3+ '@img/sharp-libvips-linux-ppc64': 1.3.3+ '@img/sharp-libvips-linux-riscv64': 1.3.3+ '@img/sharp-libvips-linux-s390x': 1.3.3+ '@img/sharp-libvips-linux-x64': 1.3.3+ '@img/sharp-libvips-linuxmusl-arm64': 1.3.3+ '@img/sharp-libvips-linuxmusl-x64': 1.3.3+ '@img/sharp-linux-arm': 0.35.4+ '@img/sharp-linux-arm64': 0.35.4+ '@img/sharp-linux-ppc64': 0.35.4+ '@img/sharp-linux-riscv64': 0.35.4+ '@img/sharp-linux-s390x': 0.35.4+ '@img/sharp-linux-x64': 0.35.4+ '@img/sharp-linuxmusl-arm64': 0.35.4+ '@img/sharp-linuxmusl-x64': 0.35.4+ '@img/sharp-webcontainers-wasm32': 0.35.4+ '@img/sharp-win32-arm64': 0.35.4+ '@img/sharp-win32-ia32': 0.35.4+ '@img/sharp-win32-x64': 0.35.4+ '@types/node': 22.8.1optional: true@@ -14047,9 +14420,7 @@ snapshots:ansi-styles: 6.2.1is-fullwidth-code-point: 5.0.0- [email protected]: {}-- [email protected]: {}+ [email protected]: {}dependencies:@@ -14078,20 +14449,6 @@ snapshots:transitivePeerDependencies:- supports-color- dependencies:- accepts: 1.3.8- base64id: 2.0.0- cors: 2.8.5- debug: 4.3.7- engine.io: 6.5.5- socket.io-adapter: 2.5.5- socket.io-parser: 4.2.4- transitivePeerDependencies:- - bufferutil- - supports-color- - utf-8-validate-dependencies:accepts: 1.3.8@@ -14374,6 +14731,11 @@ snapshots:fdir: 6.4.4([email protected])picomatch: 4.0.3+ dependencies:+ fdir: 6.5.0([email protected])+ picomatch: 4.0.7+@@ -14411,8 +14773,6 @@ snapshots:'@ts-morph/common': 0.27.0code-block-writer: 13.0.3- [email protected]: {}-dependencies:json5: 2.2.3@@ -14424,7 +14784,7 @@ snapshots:dependencies:esbuild: 0.25.0- get-tsconfig: 4.10.1+ get-tsconfig: 4.14.3optionalDependencies:fsevents: 2.3.3optional: true@@ -14478,7 +14838,28 @@ snapshots:possible-typed-array-names: 1.1.0reflect.getprototypeof: 1.0.10- [email protected]: {}+ optionalDependencies:+ '@typescript/typescript-aix-ppc64': 7.0.2+ '@typescript/typescript-darwin-arm64': 7.0.2+ '@typescript/typescript-darwin-x64': 7.0.2+ '@typescript/typescript-freebsd-arm64': 7.0.2+ '@typescript/typescript-freebsd-x64': 7.0.2+ '@typescript/typescript-linux-arm': 7.0.2+ '@typescript/typescript-linux-arm64': 7.0.2+ '@typescript/typescript-linux-loong64': 7.0.2+ '@typescript/typescript-linux-mips64el': 7.0.2+ '@typescript/typescript-linux-ppc64': 7.0.2+ '@typescript/typescript-linux-riscv64': 7.0.2+ '@typescript/typescript-linux-s390x': 7.0.2+ '@typescript/typescript-linux-x64': 7.0.2+ '@typescript/typescript-netbsd-arm64': 7.0.2+ '@typescript/typescript-netbsd-x64': 7.0.2+ '@typescript/typescript-openbsd-arm64': 7.0.2+ '@typescript/typescript-openbsd-x64': 7.0.2+ '@typescript/typescript-sunos-x64': 7.0.2+ '@typescript/typescript-win32-arm64': 7.0.2+ '@typescript/typescript-win32-x64': 7.0.2@@ -14492,7 +14873,7 @@ snapshots:transitivePeerDependencies:- encoding- [email protected]: {}+ [email protected]: {}dependencies:@@ -14656,11 +15037,11 @@ snapshots:tsx: 4.19.4yaml: 2.9.0- [email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected]):+ [email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected]):dependencies:'@types/chai': 5.2.2'@vitest/expect': 3.2.4- '@vitest/mocker': 3.2.4([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))+ '@vitest/mocker': 3.2.4([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))'@vitest/pretty-format': 3.2.4'@vitest/runner': 3.2.4'@vitest/snapshot': 3.2.4@@ -14898,10 +15279,6 @@ snapshots:- dependencies:- zod: 3.25.76-dependencies:zod: 3.25.76diff --git a/src/actions/fetch-github-stars.ts b/src/actions/fetch-github-stars.tsindex 64ba3d5..baa3508 100644--- a/src/actions/fetch-github-stars.ts+++ b/src/actions/fetch-github-stars.ts@@ -9,7 +9,13 @@ import { env } from "@/env";* Fetches the current star count for the GitHub repository.** This function is cached using React's `cache()` to prevent duplicate requests- * during the same render cycle. The data is revalidated every 60 seconds.+ * during the same render cycle. The data is revalidated every hour.+ *+ * NOTE: `<Header />` renders on nearly every static page, so this `revalidate`+ * becomes the ISR revalidate time for those routes too -- Next.js takes the+ * *minimum* of all fetch revalidates in a route's tree, and a page-level+ * `export const revalidate` cannot raise it above this value. Lowering this+ * number re-renders (and re-bills) every landing page at that cadence.**/export const fetchGithubStars = cache(async (): Promise<number> => {@@ -20,7 +26,7 @@ export const fetchGithubStars = cache(async (): Promise<number> => {headers: {Authorization: `Bearer ${env.GITHUB_TOKEN}`,},- next: { revalidate: 60 }, // revalidate every 1 minute (60 seconds)+ next: { revalidate: 3600 }, // revalidate every 1 hour (3600 seconds)},);diff --git a/src/app/(components)/footer.tsx b/src/app/(components)/footer.tsxindex 3207ca8..6c80beb 100644--- a/src/app/(components)/footer.tsx+++ b/src/app/(components)/footer.tsx@@ -2,7 +2,7 @@ import Link from "next/link";/* eslint-disable @next/next/no-html-link-for-pages */import { FooterLaunchBadges } from "@/app/(components)/footer-launch-badges";-import { SEO_FOOTER_SOLUTION_LINKS } from "@/app/(seo-landings)/seo-landing-footer-links";+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 { ProjectLogo } from "@/components/etc/project-logo";import {diff --git a/src/app/not-found.tsx b/src/app/(components)/not-found-page.tsxsimilarity index 73%rename from src/app/not-found.tsxrename to src/app/(components)/not-found-page.tsxindex 3e5ef10..dec81c4 100644--- a/src/app/not-found.tsx+++ b/src/app/(components)/not-found-page.tsx@@ -1,9 +1,13 @@"use client";-// page needs to be "use client" here to prevent an error: https://nextjs.org/docs/messages/dynamic-server-error+// needs to be "use client" here to prevent an error: https://nextjs.org/docs/messages/dynamic-server-errorimport Link from "next/link";-export default function NotFound() {+/**+ * The 404 page. Rendered by the `not-found.tsx` of both root layouts+ * (`src/app/(main)` and `src/app/[locale]`), so it stays in one place.+ */+export function NotFoundPage() {return (<div className="flex h-screen w-full items-center justify-center font-sans"><div className="flex flex-col items-center justify-center">diff --git a/src/app/(components)/root-document.tsx b/src/app/(components)/root-document.tsxnew file mode 100644index 0000000..cf76eb0--- /dev/null+++ b/src/app/(components)/root-document.tsx@@ -0,0 +1,135 @@+import { SpeedInsights } from "@vercel/speed-insights/next";+import type { Metadata, Viewport } from "next";+import { NextIntlClientProvider, type Locale } from "next-intl";+import Script from "next/script";+import { Toaster } from "sonner";++import { BrowserSupportNotice } from "@/components/browser-support-notice";+import { ResponsiveIndicator } from "@/components/dev/responsive-indicator";+import { SentryIndicator } from "@/components/dev/sentry-indicator";+import { PERSONAL_WEBSITE_URL, STATIC_ASSETS_URL } from "@/config";+import { JsonLdScript } from "@/lib/seo/render-json-ld";+import { buildSiteWideJsonLdGraph } from "@/lib/seo/site-entities";++import "@/app/globals.css";+import "react-pdf/dist/Page/AnnotationLayer.css";+import "react-pdf/dist/Page/TextLayer.css";++interface RootDocumentProps {+ /** Value of the `<html lang>` attribute: the locale the document is rendered in. */+ lang: Locale;+ children: React.ReactNode;+}++/**+ * The `<html>`/`<body>` shell shared by both root layouts.+ *+ * The app has two root layouts: `src/app/(main)/layout.tsx` for the unprefixed+ * English routes (`/`, `/changelog`, ...) and `src/app/[locale]/layout.tsx` for the+ * localized ones. `[locale]` has to be a root layout so that `locale` is a *root+ * param* (`next/root-params`), which is how next-intl resolves the locale without+ * `setRequestLocale()`. Everything that used to live in the single root layout+ * is here so the two shells cannot drift apart.+ *+ * Deliberately free of dynamic APIs (`headers()`, `cookies()`, `searchParams`): it+ * sits above *every* route, so anything request-bound here opts the whole app out of+ * static rendering. Server-side device detection is the reason this used to matter —+ * it now lives in `src/app/(main)/(app)/layout.tsx`, next to the only routes that+ * read it.+ */+export function RootDocument({ lang, children }: RootDocumentProps) {+ const siteWideJsonLd = buildSiteWideJsonLdGraph();++ // `data-scroll-behavior` keeps the Next.js 15 behaviour: `scroll-behavior: smooth`+ // (globals.css) is suspended during route transitions so navigations jump to the+ // top instantly. Next.js 16 only does this when the attribute is present.+ return (+ <html lang={lang} data-scroll-behavior="smooth">+ <body>+ <NextIntlClientProvider>+ {children}++ {/* https://sonner.emilkowal.ski/ */}+ <Toaster visibleToasts={1} richColors closeButton />+ {/* toasts visitors on a browser older than the `.browserslistrc` floor,+ or simply older than three years, into updating it */}+ <BrowserSupportNotice />+ {/* show responsive indicator(tailwind breakpoint) for debugging responsive designs */}+ {process.env.NODE_ENV === "development" ? (+ <>+ <ResponsiveIndicator />+ {/* only renders while the browser Sentry SDK is actually live */}+ <SentryIndicator />+ </>+ ) : null}+ {/* should only be enabled in production */}+ {process.env.VERCEL_ENV === "production" ? (+ <>+ <SpeedInsights+ sampleRate={0.3} // send only x% of the requests to Speed Insights (for cost-saving)+ />+ {/* https://eu.umami.is/dashboard */}+ <Script+ // we proxy umami check next.config.mjs rewrites+ src="/stats/script.js"+ data-website-id="1914352c-5ebb-4806-bfc3-f494712bb4a4"+ defer+ />+ </>+ ) : null}+ <JsonLdScript id="site-wide-json-ld" data={siteWideJsonLd} />+ </NextIntlClientProvider>+ </body>+ </html>+ );+}++/** Base `viewport` export, re-exported by every root layout. */+export const rootViewport: Viewport = {+ initialScale: 1, // Sets the default zoom level to 1 (100%)+ width: "device-width", // Ensures the viewport width matches the device's screen width+ maximumScale: 1, // Prevents users from zooming in+ viewportFit: "cover", // Enables edge-to-edge content display on devices with rounded corners (like iPhones with a notch)+};++/** Base `metadata` export, re-exported by every root layout; nested routes merge into it. */+export const rootMetadata: Metadata = {+ // metadataBase: new URL(APP_URL),+ title: "Create Invoice — EasyInvoicePDF",+ description:+ "Create and download professional invoices instantly with EasyInvoicePDF.com. Free and open-source. No signup required.",+ keywords: [+ "invoice pdf generator",+ "free invoice pdf",+ "create invoice pdf",+ "invoice generator open source",+ "pdf invoice template",+ "invoice generator",+ "free invoice generator",+ "online invoice generator",+ "invoice maker pdf",+ "professional invoice generator",+ ],+ authors: [{ name: "Vlad Sazonau", url: PERSONAL_WEBSITE_URL }],+ creator: "Vlad Sazonau",+ publisher: "Vlad Sazonau",+ icons: {+ icon: [+ {+ url: `${STATIC_ASSETS_URL}/favicon.ico`,+ },+ {+ url: `${STATIC_ASSETS_URL}/icon.png`,+ type: "image/png",+ sizes: "96x96",+ },+ ],+ apple: [+ {+ url: `${STATIC_ASSETS_URL}/apple-icon.png`,+ type: "image/png",+ sizes: "180x180",+ },+ ],+ },+};diff --git a/src/app/(app)/components/__tests__/invoice-pdf-download-link.test.tsx b/src/app/(main)/(app)/components/__tests__/invoice-pdf-download-link.test.tsxsimilarity index 94%rename from src/app/(app)/components/__tests__/invoice-pdf-download-link.test.tsxrename to src/app/(main)/(app)/components/__tests__/invoice-pdf-download-link.test.tsxindex 2ed7df2..dc4fb20 100644--- a/src/app/(app)/components/__tests__/invoice-pdf-download-link.test.tsx+++ b/src/app/(main)/(app)/components/__tests__/invoice-pdf-download-link.test.tsx@@ -14,10 +14,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import {CTA_TOAST_TIMEOUT,showCTAToast,-} from "@/app/(app)/components/cta-toasts";-import { CTAToastProvider } from "@/app/(app)/contexts/cta-toast-context";-import { InvoicePdfInstanceProvider } from "@/app/(app)/contexts/invoice-pdf-instance-context";-import { updateAppMetadata } from "@/app/(app)/utils/get-app-metadata";+} from "@/app/(main)/(app)/components/cta-toasts";+import { CTAToastProvider } from "@/app/(main)/(app)/contexts/cta-toast-context";+import { InvoicePdfInstanceProvider } from "@/app/(main)/(app)/contexts/invoice-pdf-instance-context";+import { updateAppMetadata } from "@/app/(main)/(app)/utils/get-app-metadata";import { getInitialInvoiceData } from "@/app/constants";import { CTA_TOAST_STORAGE_KEY, type InvoiceData } from "@/app/schema";import { TooltipProvider } from "@/components/ui/tooltip";@@ -87,14 +87,16 @@ vi.mock("@/utils/is-telegram-in-app-browser", () => {};});-vi.mock("@/app/(app)/utils/get-app-metadata", () => {+vi.mock("@/app/(main)/(app)/utils/get-app-metadata", () => {return {updateAppMetadata: vi.fn(),};});-vi.mock("@/app/(app)/components/cta-toasts", async () => {- const actual = await vi.importActual("@/app/(app)/components/cta-toasts");+vi.mock("@/app/(main)/(app)/components/cta-toasts", async () => {+ const actual = await vi.importActual(+ "@/app/(main)/(app)/components/cta-toasts",+ );return {...(actual as object),diff --git a/src/app/(app)/components/changelog-update-popup.tsx b/src/app/(main)/(app)/components/changelog-update-popup.tsxsimilarity index 98%rename from src/app/(app)/components/changelog-update-popup.tsxrename to src/app/(main)/(app)/components/changelog-update-popup.tsxindex 76c1348..a59021e 100644--- a/src/app/(app)/components/changelog-update-popup.tsx+++ b/src/app/(main)/(app)/components/changelog-update-popup.tsx@@ -4,7 +4,7 @@ import { XIcon } from "lucide-react";import Link from "next/link";import { useEffect } from "react";-import type { AppUpdatePopupVariant } from "@/app/(app)/hooks/use-changelog-update-popup";+import type { AppUpdatePopupVariant } from "@/app/(main)/(app)/hooks/use-changelog-update-popup";import { Button } from "@/components/ui/button";import { DISCORD_COMMUNITY_URL, REDDIT_COMMUNITY_URL } from "@/config";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";diff --git a/src/app/(app)/components/cta-toasts/index.tsx b/src/app/(main)/(app)/components/cta-toasts/index.tsxsimilarity index 100%rename from src/app/(app)/components/cta-toasts/index.tsxrename to src/app/(main)/(app)/components/cta-toasts/index.tsxdiff --git a/src/app/(app)/components/how-it-works-video-dialog.tsx b/src/app/(main)/(app)/components/how-it-works-video-dialog.tsxsimilarity index 94%rename from src/app/(app)/components/how-it-works-video-dialog.tsxrename to src/app/(main)/(app)/components/how-it-works-video-dialog.tsxindex d03dd28..33fce75 100644--- a/src/app/(app)/components/how-it-works-video-dialog.tsx+++ b/src/app/(main)/(app)/components/how-it-works-video-dialog.tsx@@ -1,6 +1,6 @@"use client";-import { HowItWorksVideos } from "@/app/(app)/components/how-it-works-videos";+import { HowItWorksVideos } from "@/app/(main)/(app)/components/how-it-works-videos";import {Dialog,DialogContent,diff --git a/src/app/(app)/components/how-it-works-videos.tsx b/src/app/(main)/(app)/components/how-it-works-videos.tsxsimilarity index 95%rename from src/app/(app)/components/how-it-works-videos.tsxrename to src/app/(main)/(app)/components/how-it-works-videos.tsxindex d64b9bd..efafe2e 100644--- a/src/app/(app)/components/how-it-works-videos.tsx+++ b/src/app/(main)/(app)/components/how-it-works-videos.tsx@@ -4,6 +4,7 @@ import { useSearchParams } from "next/navigation";import { useState } from "react";import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";+import { YouTubeEmbed } from "@/components/youtube-embed";import {DISCORD_COMMUNITY_URL,HOW_IT_WORKS_VIDEOS,@@ -139,15 +140,11 @@ export function HowItWorksVideos({<div className="aspect-video min-h-[300px] w-full shrink-0 overflow-hidden">{showIframe ? (- <iframe+ <YouTubeEmbedkey={activeVideoId}src={activeVideo.embedUrl}title={activeVideo.iframeTitle}- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"- referrerPolicy="strict-origin-when-cross-origin"- allowFullScreen- className="h-full w-full border-0"- data-testid="how-it-works-video"+ testId="how-it-works-video"/>) : null}</div>diff --git a/src/app/(app)/components/index.tsx b/src/app/(main)/(app)/components/index.tsxsimilarity index 77%rename from src/app/(app)/components/index.tsxrename to src/app/(main)/(app)/components/index.tsxindex d2b4e5c..855a8e5 100644--- a/src/app/(app)/components/index.tsx+++ b/src/app/(main)/(app)/components/index.tsx@@ -1,10 +1,5 @@import dayjs from "dayjs";-import {- AlertCircleIcon,- FileTextIcon,- LinkIcon,- PencilIcon,-} from "lucide-react";+import { FileTextIcon, PencilIcon } from "lucide-react";import dynamic from "next/dynamic";import Link from "next/link";import { useRef, useState, type RefObject } from "react";@@ -15,15 +10,16 @@ import {DEFAULT_MOBILE_TAB,MOBILE_TABS_VALUES,} from "@/app/schema";-import { Button } from "@/components/ui/button";import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";import { CustomTooltip } from "@/components/ui/tooltip";import { cn } from "@/lib/utils";-import { getAppMetadata, updateAppMetadata } from "../utils/get-app-metadata";+import { useAppMetadata } from "../hooks/use-app-metadata";+import { updateAppMetadata } from "../utils/get-app-metadata";import { InvoiceForm } from "./invoice-form";import { InvoicePDFDownloadLink } from "./invoice-pdf-download-link";import { MobileFormScrollContainer } from "./mobile-form-scroll-container";+import { ShareInvoiceButton } from "./share-invoice-button";const DesktopPDFViewerModuleLoading = () => {return (@@ -95,6 +91,41 @@ const PdfViewer = ({ isMobile }: { isMobile: boolean }) => {const TAB_INVOICE_FORM = MOBILE_TABS_VALUES[0];const TAB_INVOICE_PREVIEW = MOBILE_TABS_VALUES[1];+/**+ * "Made by Vlad Sazonau" with the avatar, linking to `/founder`.+ *+ * The mobile dock and the desktop column render the same credit; before this they held two+ * copies of the same markup, differing only in a shade of grey and a top margin.+ */+function FounderCredit({ className }: { className?: string }) {+ return (+ <div+ className={cn(+ "flex items-center gap-1.5 text-xs text-zinc-700 duration-500 animate-in fade-in slide-in-from-bottom-2",+ className,+ )}+ >+ <a href={"/founder"}>+ <img+ src="https://ik.imagekit.io/fl2lbswwo/avatar.jpeg?updatedAt=1757456439459"+ alt="Vlad Sazonau"+ className="size-6 rounded-full"+ height="24"+ width="24"+ loading="lazy"+ decoding="async"+ />+ </a>+ <span>+ Made by{" "}+ <a href={"/founder"} className="underline hover:text-black">+ Vlad Sazonau+ </a>+ </span>+ </div>+ );+}+function LocalStorageNotice() {return (<CustomTooltip@@ -129,7 +160,7 @@ export function InvoiceClientPage({canShareInvoice: boolean;currentInvoiceFormDataRef: RefObject<(() => InvoiceData | null) | null>;}) {- const appMetadata = getAppMetadata();+ const appMetadata = useAppMetadata();const invoiceLastUpdatedAtFormatted = appMetadata?.invoiceLastUpdatedAt? dayjs(appMetadata.invoiceLastUpdatedAt)@@ -252,6 +283,21 @@ export function InvoiceClientPage({slightly off its label. With no gap, a trigger and the indicator are bothexactly half the track minus the 4px inset.*/}+ {/*+ The track is 40px tall and inset by 4px, so a trigger's own box is only+ 32px high and stops 4px short of the pill's edge — under the 44px thumb+ target, with dead pixels around it that swallow a tap. `hit-area-*` grows+ each trigger's tap zone with an invisible pseudo-element instead of a+ bigger box, so nothing moves:++ - `hit-area-y-1.5` adds 6px above and below (32px -> 44px), half of the+ 12px that separates the track from the dock's top edge and from the+ share button, so neither is stolen from.+ - `hit-area-l-4` / `hit-area-r-4` reach 16px outward — the 4px track inset+ plus the dock's 12px of padding — so the two tabs cover the dock's full+ width. Only the outer side of each is grown: they already meet in the+ middle, and growing both inward would overlap them there.+ */}<TabsList className="relative h-10 w-full gap-0 rounded-full bg-slate-200 p-1"><spanaria-hidden="true"@@ -267,7 +313,7 @@ export function InvoiceClientPage({value={TAB_INVOICE_FORM}// `bg-transparent` and `shadow-none` are load-bearing: without them the// trigger paints its own white pill on top of the sliding indicator- className="z-10 flex-1 rounded-full text-slate-600 hover:bg-transparent hover:text-slate-900 data-[state=active]:bg-transparent data-[state=active]:text-slate-900 data-[state=active]:shadow-none"+ className="z-10 flex-1 rounded-full text-slate-600 hit-area-l-4 hit-area-y-1.5 hover:bg-transparent hover:text-slate-900 data-[state=active]:bg-transparent data-[state=active]:text-slate-900 data-[state=active]:shadow-none"data-testid="edit-invoice-tab"><span className="flex items-center gap-1">@@ -277,7 +323,7 @@ export function InvoiceClientPage({</TabsTrigger><TabsTriggervalue={TAB_INVOICE_PREVIEW}- className="z-10 flex-1 rounded-full text-slate-600 hover:bg-transparent hover:text-slate-900 data-[state=active]:bg-transparent data-[state=active]:text-slate-900 data-[state=active]:shadow-none"+ className="z-10 flex-1 rounded-full text-slate-600 hit-area-r-4 hit-area-y-1.5 hover:bg-transparent hover:text-slate-900 data-[state=active]:bg-transparent data-[state=active]:text-slate-900 data-[state=active]:shadow-none"data-testid="preview-pdf-tab"><span className="flex items-center gap-1">@@ -286,52 +332,10 @@ export function InvoiceClientPage({</span></TabsTrigger></TabsList>- <CustomTooltip- className={cn(!canShareInvoice && "bg-red-50")}- trigger={- <Button- data-disabled={!canShareInvoice} // for better UX than 'disabled'- onClick={handleShareInvoice}- variant="outline"- className={cn("mx-2 w-full")}- >- <LinkIcon className="mr-1.5 size-4" />- Get link- </Button>- }- content={- canShareInvoice ? (- <div className="flex items-center gap-3 p-2">- <div className="space-y-1">- <p className="text-sm font-semibold text-slate-900">- Share Invoice Online- </p>- <p className="text-pretty text-xs leading-relaxed text-slate-700">- Generate a link to share this invoice with your- clients. They can view and download it directly from- their browser.- </p>- </div>- </div>- ) : (- <div- data-testid="share-invoice-tooltip-content"- className="flex items-center gap-3 bg-red-50 p-3"- >- <AlertCircleIcon className="h-5 w-5 flex-shrink-0 fill-red-600 text-white" />- <div className="space-y-1">- <p className="text-sm font-semibold text-red-800">- Unable to Share Invoice- </p>- <p className="text-pretty text-xs leading-relaxed text-red-700">- Invoices with logos cannot be shared. Please remove- the logo to generate a shareable link. You can still- download the invoice as PDF and share it.- </p>- </div>- </div>- )- }+ <ShareInvoiceButton+ canShareInvoice={canShareInvoice}+ handleShareInvoice={handleShareInvoice}+ className="mx-2 w-full"/><InvoicePDFDownloadLinkinvoiceData={invoiceDataState}@@ -368,25 +372,7 @@ export function InvoiceClientPage({</div>{/* Founders info section (Mobile version) */}<div className="mt-5 flex w-full justify-center">- <div className="flex items-center gap-1.5 text-xs text-zinc-700 duration-500 animate-in fade-in slide-in-from-bottom-2">- <a href={"/founder"}>- <img- src="https://ik.imagekit.io/fl2lbswwo/avatar.jpeg?updatedAt=1757456439459"- alt="Vlad Sazonau"- className="size-6 rounded-full"- height="24"- width="24"- loading="lazy"- decoding="async"- />- </a>- <span>- Made by{" "}- <a href={"/founder"} className="underline hover:text-black">- Vlad Sazonau- </a>- </span>- </div>+ <FounderCredit /></div></div>) : (@@ -403,25 +389,7 @@ export function InvoiceClientPage({</div>{/* Founders info section (Desktop version) */}- <div className="mt-1 flex items-center gap-1.5 text-xs text-zinc-800 duration-500 animate-in fade-in slide-in-from-bottom-2">- <a href={"/founder"}>- <img- src="https://ik.imagekit.io/fl2lbswwo/avatar.jpeg?updatedAt=1757456439459"- alt="Vlad Sazonau"- className="size-6 rounded-full"- height="24"- width="24"- loading="lazy"- decoding="async"- />- </a>- <span>- Made by{" "}- <a href={"/founder"} className="underline hover:text-black">- Vlad Sazonau- </a>- </span>- </div>+ <FounderCredit className="mt-1 text-zinc-800" /></div>{/* Invoice preview section i.e. right column (Desktop version) */}<div className="relative col-span-8 h-[620px] w-full max-w-full 2xl:h-[700px]">diff --git a/src/app/(app)/components/invoice-form/__tests__/form-errors-to-toast.test.tsx b/src/app/(main)/(app)/components/invoice-form/__tests__/form-errors-to-toast.test.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/__tests__/form-errors-to-toast.test.tsxrename to src/app/(main)/(app)/components/invoice-form/__tests__/form-errors-to-toast.test.tsxdiff --git a/src/app/(app)/components/invoice-form/__tests__/local-storage-unavailable.test.tsx b/src/app/(main)/(app)/components/invoice-form/__tests__/local-storage-unavailable.test.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/__tests__/local-storage-unavailable.test.tsxrename to src/app/(main)/(app)/components/invoice-form/__tests__/local-storage-unavailable.test.tsxdiff --git a/src/app/(app)/components/invoice-form/__tests__/payment-due-helpers.test.tsx b/src/app/(main)/(app)/components/invoice-form/__tests__/payment-due-helpers.test.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/__tests__/payment-due-helpers.test.tsxrename to src/app/(main)/(app)/components/invoice-form/__tests__/payment-due-helpers.test.tsxdiff --git a/src/app/(app)/components/invoice-form/common.tsx b/src/app/(main)/(app)/components/invoice-form/common.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/common.tsxrename to src/app/(main)/(app)/components/invoice-form/common.tsxdiff --git a/src/app/(app)/components/invoice-form/index.tsx b/src/app/(main)/(app)/components/invoice-form/index.tsxsimilarity index 97%rename from src/app/(app)/components/invoice-form/index.tsxrename to src/app/(main)/(app)/components/invoice-form/index.tsxindex 500f254..24e0487 100644--- a/src/app/(app)/components/invoice-form/index.tsx+++ b/src/app/(main)/(app)/components/invoice-form/index.tsx@@ -10,9 +10,9 @@ import { useDebouncedCallback } from "use-debounce";import {getAppStorageItem,setAppStorageItem,-} from "@/app/(app)/utils/app-local-storage";-import { formatDateWithLocale } from "@/app/(app)/utils/format-date-with-locale";-import { updateAppMetadata } from "@/app/(app)/utils/get-app-metadata";+} from "@/app/(main)/(app)/utils/app-local-storage";+import { formatDateWithLocale } from "@/app/(main)/(app)/utils/format-date-with-locale";+import { updateAppMetadata } from "@/app/(main)/(app)/utils/get-app-metadata";import {ACCORDION_STATE_LOCAL_STORAGE_KEY,accordionSchema,@@ -37,6 +37,7 @@ import { ReadOnlyMoneyInput } from "@/components/ui/money-input";import { Switch } from "@/components/ui/switch";import { Textarea } from "@/components/ui/textarea";import { CustomTooltip } from "@/components/ui/tooltip";+import { debugLog } from "@/lib/debug-log";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";import { zodResolverForOutput } from "@/lib/zod-resolver-for-output";import type { NonReadonly, Prettify } from "@/types";@@ -161,24 +162,21 @@ export const InvoiceForm = memo(function InvoiceForm({const validatedItemsResult = parseValidatedInvoiceItems(invoiceItems);if (!validatedItemsResult.success) {- // Not reported to Sentry on purpose: this branch is the expected state while- // someone is still typing (a cleared amount field, a half-entered VAT), so it- // fires constantly and says nothing about a broken app.- console.error("Invalid items:", validatedItemsResult.error);+ // Not reported to Sentry on purpose, and not a `console.error` either: this branch is+ // the expected state while someone is still typing (a cleared amount field, a+ // half-entered VAT), so it fires constantly and says nothing about a broken app.+ debugLog("Invalid items:", validatedItemsResult.error);return;}const total = calculateInvoiceTotal(invoiceItems);- console.info(- "[useEffect] recalculating totals because invoice items changed",- {- invoiceItems,- validatedItemsResult,- total,- },- );+ debugLog("[useEffect] recalculating totals because invoice items changed", {+ invoiceItems,+ validatedItemsResult,+ total,+ });// Update total firstsetValue("total", total, { shouldValidate: true });diff --git a/src/app/(app)/components/invoice-form/sections/__tests__/general-information.test.tsx b/src/app/(main)/(app)/components/invoice-form/sections/__tests__/general-information.test.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/sections/__tests__/general-information.test.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/__tests__/general-information.test.tsxdiff --git a/src/app/(app)/components/invoice-form/sections/__tests__/invoice-items.test.tsx b/src/app/(main)/(app)/components/invoice-form/sections/__tests__/invoice-items.test.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/sections/__tests__/invoice-items.test.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/__tests__/invoice-items.test.tsxdiff --git a/src/app/(app)/components/invoice-form/sections/buyer-information.tsx b/src/app/(main)/(app)/components/invoice-form/sections/buyer-information.tsxsimilarity index 98%rename from src/app/(app)/components/invoice-form/sections/buyer-information.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/buyer-information.tsxindex ec72600..9b2da5b 100644--- a/src/app/(app)/components/invoice-form/sections/buyer-information.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/buyer-information.tsx@@ -9,8 +9,8 @@ import {type UseFormSetValue,} from "react-hook-form";-import { inputErrorClassName } from "@/app/(app)/components/invoice-form/common";-import { BuyerManagement } from "@/app/(app)/components/invoice-form/sections/components/buyer/buyer-management";+import { inputErrorClassName } from "@/app/(main)/(app)/components/invoice-form/common";+import { BuyerManagement } from "@/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-management";import { type BuyerData, type InvoiceData } from "@/app/schema";import { AccordionContent } from "@/components/ui/accordion";import { Input } from "@/components/ui/input";diff --git a/src/app/(app)/components/invoice-form/sections/components/__tests__/stale-dates-banner.test.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/__tests__/stale-dates-banner.test.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/sections/components/__tests__/stale-dates-banner.test.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/components/__tests__/stale-dates-banner.test.tsxdiff --git a/src/app/(app)/components/invoice-form/sections/components/buyer/buyer-dialog.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-dialog.tsxsimilarity index 98%rename from src/app/(app)/components/invoice-form/sections/components/buyer/buyer-dialog.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-dialog.tsxindex dcbaceb..a431a14 100644--- a/src/app/(app)/components/invoice-form/sections/components/buyer/buyer-dialog.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-dialog.tsx@@ -3,11 +3,11 @@ import { useState } from "react";import { useForm } from "react-hook-form";import { toast } from "sonner";-import { useConfirmDiscard } from "@/app/(app)/components/invoice-form/sections/hooks/use-confirm-discard";+import { useConfirmDiscard } from "@/app/(main)/(app)/components/invoice-form/sections/hooks/use-confirm-discard";import {getAppStorageItem,setAppStorageItem,-} from "@/app/(app)/utils/app-local-storage";+} from "@/app/(main)/(app)/utils/app-local-storage";import {BUYERS_LOCAL_STORAGE_KEY,buyerSchema,@@ -31,13 +31,13 @@ import {FormMessage,} from "@/components/ui/form";import { Input } from "@/components/ui/input";+import { InputHelperMessage } from "@/components/ui/input-helper-message";import { Label } from "@/components/ui/label";import { Switch } from "@/components/ui/switch";import { Textarea } from "@/components/ui/textarea";import { CustomTooltip } from "@/components/ui/tooltip";import { zodResolverForOutput } from "@/lib/zod-resolver-for-output";-import { InputHelperMessage } from "../../../../../../../components/ui/input-helper-message";import { ConfirmDiscardDialog } from "../confirm-discard-dialog";const BUYER_FORM_ID = "buyer-form";diff --git a/src/app/(app)/components/invoice-form/sections/components/buyer/buyer-management.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-management.tsxsimilarity index 99%rename from src/app/(app)/components/invoice-form/sections/components/buyer/buyer-management.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-management.tsxindex 0d7a06e..dba8d08 100644--- a/src/app/(app)/components/invoice-form/sections/components/buyer/buyer-management.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/buyer/buyer-management.tsx@@ -7,7 +7,7 @@ import { toast } from "sonner";import {getAppStorageItem,setAppStorageItem,-} from "@/app/(app)/utils/app-local-storage";+} from "@/app/(main)/(app)/utils/app-local-storage";import { DEFAULT_BUYER_DATA } from "@/app/constants";import {BUYERS_LOCAL_STORAGE_KEY,diff --git a/src/app/(app)/components/invoice-form/sections/components/confirm-discard-dialog.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/confirm-discard-dialog.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/sections/components/confirm-discard-dialog.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/components/confirm-discard-dialog.tsxdiff --git a/src/app/(app)/components/invoice-form/sections/components/seller/__tests__/seller-management-storage.test.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/seller/__tests__/seller-management-storage.test.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/sections/components/seller/__tests__/seller-management-storage.test.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/components/seller/__tests__/seller-management-storage.test.tsxdiff --git a/src/app/(app)/components/invoice-form/sections/components/seller/seller-dialog.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-dialog.tsxsimilarity index 99%rename from src/app/(app)/components/invoice-form/sections/components/seller/seller-dialog.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-dialog.tsxindex 75c97de..f8b0c46 100644--- a/src/app/(app)/components/invoice-form/sections/components/seller/seller-dialog.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-dialog.tsx@@ -3,11 +3,11 @@ import { useState } from "react";import { useForm } from "react-hook-form";import { toast } from "sonner";-import { useConfirmDiscard } from "@/app/(app)/components/invoice-form/sections/hooks/use-confirm-discard";+import { useConfirmDiscard } from "@/app/(main)/(app)/components/invoice-form/sections/hooks/use-confirm-discard";import {getAppStorageItem,setAppStorageItem,-} from "@/app/(app)/utils/app-local-storage";+} from "@/app/(main)/(app)/utils/app-local-storage";import {SELLERS_LOCAL_STORAGE_KEY,sellerSchema,@@ -31,13 +31,13 @@ import {FormMessage,} from "@/components/ui/form";import { Input } from "@/components/ui/input";+import { InputHelperMessage } from "@/components/ui/input-helper-message";import { Label } from "@/components/ui/label";import { Switch } from "@/components/ui/switch";import { Textarea } from "@/components/ui/textarea";import { CustomTooltip } from "@/components/ui/tooltip";import { zodResolverForOutput } from "@/lib/zod-resolver-for-output";-import { InputHelperMessage } from "../../../../../../../components/ui/input-helper-message";import { ConfirmDiscardDialog } from "../confirm-discard-dialog";const SELLER_FORM_ID = "seller-form";diff --git a/src/app/(app)/components/invoice-form/sections/components/seller/seller-management.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-management.tsxsimilarity index 99%rename from src/app/(app)/components/invoice-form/sections/components/seller/seller-management.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-management.tsxindex b8aa254..7a4f31f 100644--- a/src/app/(app)/components/invoice-form/sections/components/seller/seller-management.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-management.tsx@@ -10,11 +10,11 @@ import {import type { UseFormSetValue } from "react-hook-form";import { toast } from "sonner";-import { SellerDialog } from "@/app/(app)/components/invoice-form/sections/components/seller/seller-dialog";+import { SellerDialog } from "@/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-dialog";import {getAppStorageItem,setAppStorageItem,-} from "@/app/(app)/utils/app-local-storage";+} from "@/app/(main)/(app)/utils/app-local-storage";import { DEFAULT_SELLER_DATA } from "@/app/constants";import {SELLERS_LOCAL_STORAGE_KEY,diff --git a/src/app/(app)/components/invoice-form/sections/components/stale-dates-banner.tsx b/src/app/(main)/(app)/components/invoice-form/sections/components/stale-dates-banner.tsxsimilarity index 92%rename from src/app/(app)/components/invoice-form/sections/components/stale-dates-banner.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/components/stale-dates-banner.tsxindex 61ea816..15f344a 100644--- a/src/app/(app)/components/invoice-form/sections/components/stale-dates-banner.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/components/stale-dates-banner.tsx@@ -3,11 +3,11 @@ import { AlertTriangle, RefreshCw } from "lucide-react";import type { UseFormSetValue } from "react-hook-form";import { toast } from "sonner";-import { formatDateWithLocale } from "@/app/(app)/utils/format-date-with-locale";+import { formatDateWithLocale } from "@/app/(main)/(app)/utils/format-date-with-locale";import {getCurrentMonthAndYear,isServicePeriodStartInCurrentMonth,-} from "@/app/(app)/utils/format-service-period";+} from "@/app/(main)/(app)/utils/format-service-period";import type { InvoiceData, SupportedLanguages } from "@/app/schema";import { Button } from "@/components/ui/button";@@ -197,6 +197,14 @@ export function StaleDatesBanner({type="button"size="sm"className="mt-3.5 gap-1.5 bg-amber-600 text-white shadow-sm hover:bg-amber-600/95"+ // The banner sits under the date fields, so this is nearly always tapped straight+ // from a focused input -- the case where Safari moves focus to the nearest+ // focusable ancestor, scrolls it into view and retargets the click away from the+ // button. Keeping focus put makes the tap land. See the same note in+ // `sections/invoice-items.tsx`.+ onMouseDown={(event) => {+ event.preventDefault();+ }}onClick={() => {const today = dayjs().format("YYYY-MM-DD");diff --git a/src/app/(app)/components/invoice-form/sections/general-information.tsx b/src/app/(main)/(app)/components/invoice-form/sections/general-information.tsxsimilarity index 99%rename from src/app/(app)/components/invoice-form/sections/general-information.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/general-information.tsxindex 7ad5f37..7aeb46f 100644--- a/src/app/(app)/components/invoice-form/sections/general-information.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/general-information.tsx@@ -14,16 +14,16 @@ import {AlertIcon,ErrorMessage,inputErrorClassName,-} from "@/app/(app)/components/invoice-form/common";+} from "@/app/(main)/(app)/components/invoice-form/common";import {getDefaultInvoiceNumberLabel,INVOICE_PDF_TRANSLATIONS,-} from "@/app/(app)/pdf-i18n-translations/pdf-translations";-import { formatTodayWithLocale } from "@/app/(app)/utils/format-date-with-locale";+} from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";+import { formatTodayWithLocale } from "@/app/(main)/(app)/utils/format-date-with-locale";import {getCurrentMonthAndYear,isServicePeriodStartInCurrentMonth,-} from "@/app/(app)/utils/format-service-period";+} from "@/app/(main)/(app)/utils/format-service-period";import {DEFAULT_DATE_FORMAT,type InvoiceData,diff --git a/src/app/(app)/components/invoice-form/sections/hooks/use-confirm-discard.tsx b/src/app/(main)/(app)/components/invoice-form/sections/hooks/use-confirm-discard.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/sections/hooks/use-confirm-discard.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/hooks/use-confirm-discard.tsxdiff --git a/src/app/(app)/components/invoice-form/sections/invoice-items.tsx b/src/app/(main)/(app)/components/invoice-form/sections/invoice-items.tsxsimilarity index 97%rename from src/app/(app)/components/invoice-form/sections/invoice-items.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/invoice-items.tsxindex b05f472..58de358 100644--- a/src/app/(app)/components/invoice-form/sections/invoice-items.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/invoice-items.tsx@@ -8,8 +8,8 @@ import {type UseFieldArrayAppend,} from "react-hook-form";-import { inputErrorClassName } from "@/app/(app)/components/invoice-form/common";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { inputErrorClassName } from "@/app/(main)/(app)/components/invoice-form/common";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import {type InvoiceData,type SupportedCurrencies,@@ -92,6 +92,16 @@ export const InvoiceItems = memo(function InvoiceItems({trigger={<buttontype="button"+ // Safari does not focus a button on mousedown, so focus leaves the+ // field the user was editing and lands on the nearest focusable+ // ancestor -- on mobile that is Radix's tab panel, which Safari then+ // scrolls into view (smoothly, see `globals.css`). The button drifts+ // out from under the finger between mousedown and mouseup, and the+ // browser dispatches the `click` on the common ancestor instead: the+ // tap does nothing. Keeping focus where it is avoids the scroll.+ onMouseDown={(event) => {+ event.preventDefault();+ }}onClick={() => {return setDeleteItemIndex(index);}}diff --git a/src/app/(app)/components/invoice-form/sections/seller-information.tsx b/src/app/(main)/(app)/components/invoice-form/sections/seller-information.tsxsimilarity index 98%rename from src/app/(app)/components/invoice-form/sections/seller-information.tsxrename to src/app/(main)/(app)/components/invoice-form/sections/seller-information.tsxindex a89be90..8798ce8 100644--- a/src/app/(app)/components/invoice-form/sections/seller-information.tsx+++ b/src/app/(main)/(app)/components/invoice-form/sections/seller-information.tsx@@ -7,8 +7,8 @@ import {type UseFormSetValue,} from "react-hook-form";-import { inputErrorClassName } from "@/app/(app)/components/invoice-form/common";-import { SellerManagement } from "@/app/(app)/components/invoice-form/sections/components/seller/seller-management";+import { inputErrorClassName } from "@/app/(main)/(app)/components/invoice-form/common";+import { SellerManagement } from "@/app/(main)/(app)/components/invoice-form/sections/components/seller/seller-management";import { type InvoiceData, type SellerData } from "@/app/schema";import { AccordionContent } from "@/components/ui/accordion";import { Input } from "@/components/ui/input";diff --git a/src/app/(app)/components/invoice-form/utils/__tests__/calculate-invoice-total.test.ts b/src/app/(main)/(app)/components/invoice-form/utils/__tests__/calculate-invoice-total.test.tssimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/__tests__/calculate-invoice-total.test.tsrename to src/app/(main)/(app)/components/invoice-form/utils/__tests__/calculate-invoice-total.test.tsdiff --git a/src/app/(app)/components/invoice-form/utils/__tests__/calculate-item-totals.test.ts b/src/app/(main)/(app)/components/invoice-form/utils/__tests__/calculate-item-totals.test.tssimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/__tests__/calculate-item-totals.test.tsrename to src/app/(main)/(app)/components/invoice-form/utils/__tests__/calculate-item-totals.test.tsdiff --git a/src/app/(app)/components/invoice-form/utils/__tests__/has-item-totals-changed.test.ts b/src/app/(main)/(app)/components/invoice-form/utils/__tests__/has-item-totals-changed.test.tssimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/__tests__/has-item-totals-changed.test.tsrename to src/app/(main)/(app)/components/invoice-form/utils/__tests__/has-item-totals-changed.test.tsdiff --git a/src/app/(app)/components/invoice-form/utils/__tests__/logo-upload.test.ts b/src/app/(main)/(app)/components/invoice-form/utils/__tests__/logo-upload.test.tssimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/__tests__/logo-upload.test.tsrename to src/app/(main)/(app)/components/invoice-form/utils/__tests__/logo-upload.test.tsdiff --git a/src/app/(app)/components/invoice-form/utils/__tests__/validated-invoice-items.test.ts b/src/app/(main)/(app)/components/invoice-form/utils/__tests__/validated-invoice-items.test.tssimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/__tests__/validated-invoice-items.test.tsrename to src/app/(main)/(app)/components/invoice-form/utils/__tests__/validated-invoice-items.test.tsdiff --git a/src/app/(app)/components/invoice-form/utils/calculate-invoice-total.ts b/src/app/(main)/(app)/components/invoice-form/utils/calculate-invoice-total.tssimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/calculate-invoice-total.tsrename to src/app/(main)/(app)/components/invoice-form/utils/calculate-invoice-total.tsdiff --git a/src/app/(app)/components/invoice-form/utils/calculate-item-totals.ts b/src/app/(main)/(app)/components/invoice-form/utils/calculate-item-totals.tssimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/calculate-item-totals.tsrename to src/app/(main)/(app)/components/invoice-form/utils/calculate-item-totals.tsdiff --git a/src/app/(app)/components/invoice-form/utils/form-errors-to-toast.tsx b/src/app/(main)/(app)/components/invoice-form/utils/form-errors-to-toast.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/form-errors-to-toast.tsxrename to src/app/(main)/(app)/components/invoice-form/utils/form-errors-to-toast.tsxdiff --git a/src/app/(app)/components/invoice-form/utils/has-item-totals-changed.ts b/src/app/(main)/(app)/components/invoice-form/utils/has-item-totals-changed.tssimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/has-item-totals-changed.tsrename to src/app/(main)/(app)/components/invoice-form/utils/has-item-totals-changed.tsdiff --git a/src/app/(app)/components/invoice-form/utils/logo-upload.ts b/src/app/(main)/(app)/components/invoice-form/utils/logo-upload.tssimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/logo-upload.tsrename to src/app/(main)/(app)/components/invoice-form/utils/logo-upload.tsdiff --git a/src/app/(app)/components/invoice-form/utils/validated-invoice-items.ts b/src/app/(main)/(app)/components/invoice-form/utils/validated-invoice-items.tssimilarity index 100%rename from src/app/(app)/components/invoice-form/utils/validated-invoice-items.tsrename to src/app/(main)/(app)/components/invoice-form/utils/validated-invoice-items.tsdiff --git a/src/app/(app)/components/invoice-page-header.tsx b/src/app/(main)/(app)/components/invoice-page-header.tsxsimilarity index 72%rename from src/app/(app)/components/invoice-page-header.tsxrename to src/app/(main)/(app)/components/invoice-page-header.tsxindex 602a231..f30d2a2 100644--- a/src/app/(app)/components/invoice-page-header.tsx+++ b/src/app/(main)/(app)/components/invoice-page-header.tsx@@ -1,19 +1,18 @@"use client";-import { AlertCircleIcon, LinkIcon } from "lucide-react";+import { LinkIcon } from "lucide-react";import { useState } from "react";-import { HowItWorksVideoDialog } from "@/app/(app)/components/how-it-works-video-dialog";-import { InvoicePDFDownloadLink } from "@/app/(app)/components/invoice-pdf-download-link";import { ProjectLogoDescription } from "@/app/(components)/project-logo-description";+import { HowItWorksVideoDialog } from "@/app/(main)/(app)/components/how-it-works-video-dialog";+import { InvoicePDFDownloadLink } from "@/app/(main)/(app)/components/invoice-pdf-download-link";+import { ShareInvoiceButton } from "@/app/(main)/(app)/components/share-invoice-button";import { type InvoiceData } from "@/app/schema";import { GithubIcon } from "@/components/etc/github-logo";import { ProjectLogo } from "@/components/etc/project-logo";-import { Button } from "@/components/ui/button";import { CustomTooltip } from "@/components/ui/tooltip";import { DISCORD_COMMUNITY_URL, GITHUB_URL } from "@/config";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";-import { cn } from "@/lib/utils";/*** Header component for the invoice page.@@ -82,52 +81,10 @@ export function InvoicePageHeader({{/* On mobile version, we show it in different place (bottom of the page)*/}{isDesktop ? (<>- <CustomTooltip- className={cn(!canShareInvoice && "bg-red-50")}- trigger={- <Button- data-disabled={!canShareInvoice} // better UX than 'disabled'- onClick={handleShareInvoice}- variant="outline"- className={cn("mx-2 mb-2 w-full lg:mx-0 lg:mb-0 lg:w-auto")}- >- <LinkIcon className="mr-1.5 size-4" />- Get link- </Button>- }- content={- canShareInvoice ? (- <div className="flex items-center gap-3 p-2">- <div className="space-y-1">- <p className="text-sm font-semibold text-slate-900">- Share Invoice Online- </p>- <p className="text-pretty text-xs leading-relaxed text-slate-700">- Generate a link to share this invoice with your- clients. They can view and download it directly from- their browser.- </p>- </div>- </div>- ) : (- <div- data-testid="share-invoice-tooltip-content"- className="flex items-center gap-3 bg-red-50 p-3"- >- <AlertCircleIcon className="h-5 w-5 flex-shrink-0 fill-red-600 text-white" />- <div className="space-y-1">- <p className="text-sm font-semibold text-red-800">- Unable to Share Invoice- </p>- <p className="text-pretty text-xs leading-relaxed text-red-700">- Invoices with logos cannot be shared. Please remove- the logo to generate a shareable link. You can still- download the invoice as PDF and share it.- </p>- </div>- </div>- )- }+ <ShareInvoiceButton+ canShareInvoice={canShareInvoice}+ handleShareInvoice={handleShareInvoice}+ className="mx-2 mb-2 w-full lg:mx-0 lg:mb-0 lg:w-auto"/><InvoicePDFDownloadLinkinvoiceData={invoiceDataState}diff --git a/src/app/(app)/components/invoice-pdf-download-link.tsx b/src/app/(main)/(app)/components/invoice-pdf-download-link.tsxsimilarity index 98%rename from src/app/(app)/components/invoice-pdf-download-link.tsxrename to src/app/(main)/(app)/components/invoice-pdf-download-link.tsxindex f1a369b..3673057 100644--- a/src/app/(app)/components/invoice-pdf-download-link.tsx+++ b/src/app/(main)/(app)/components/invoice-pdf-download-link.tsx@@ -3,7 +3,7 @@ import { DownloadIcon, Loader2 } from "lucide-react";import { useCallback, useEffect, useState } from "react";import { toast } from "sonner";-import { useInvoicePdfInstance } from "@/app/(app)/contexts/invoice-pdf-instance-context";+import { useInvoicePdfInstance } from "@/app/(main)/(app)/contexts/invoice-pdf-instance-context";import {LANGUAGE_TO_LABEL,type InvoiceData,diff --git a/src/app/(app)/components/invoice-pdf-download-multiple-languages.tsx b/src/app/(main)/(app)/components/invoice-pdf-download-multiple-languages.tsxsimilarity index 97%rename from src/app/(app)/components/invoice-pdf-download-multiple-languages.tsxrename to src/app/(main)/(app)/components/invoice-pdf-download-multiple-languages.tsxindex fd55226..624b9ca 100644--- a/src/app/(app)/components/invoice-pdf-download-multiple-languages.tsx+++ b/src/app/(main)/(app)/components/invoice-pdf-download-multiple-languages.tsx@@ -6,7 +6,7 @@ import JSZip from "jszip";import { useState } from "react";import { toast } from "sonner";-import { InvoicePdfTemplate } from "@/app/(app)/components/invoice-templates/invoice-pdf-default-template";+import { InvoicePdfTemplate } from "@/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template";import {LANGUAGE_TO_LABEL,SUPPORTED_LANGUAGES,diff --git a/src/app/(app)/components/invoice-pdf-preview/desktop-pdf-viewer.tsx b/src/app/(main)/(app)/components/invoice-pdf-preview/desktop-pdf-viewer.tsxsimilarity index 93%rename from src/app/(app)/components/invoice-pdf-preview/desktop-pdf-viewer.tsxrename to src/app/(main)/(app)/components/invoice-pdf-preview/desktop-pdf-viewer.tsxindex 12b5315..bc68e70 100644--- a/src/app/(app)/components/invoice-pdf-preview/desktop-pdf-viewer.tsx+++ b/src/app/(main)/(app)/components/invoice-pdf-preview/desktop-pdf-viewer.tsx@@ -1,6 +1,6 @@"use client";-import { useInvoicePdfInstance } from "@/app/(app)/contexts/invoice-pdf-instance-context";+import { useInvoicePdfInstance } from "@/app/(main)/(app)/contexts/invoice-pdf-instance-context";import { BUG_REPORT_URL } from "@/config";export function DesktopInvoicePDFViewer() {diff --git a/src/app/(app)/components/invoice-pdf-preview/mobile-pdf-viewer.tsx b/src/app/(main)/(app)/components/invoice-pdf-preview/mobile-pdf-viewer.tsxsimilarity index 98%rename from src/app/(app)/components/invoice-pdf-preview/mobile-pdf-viewer.tsxrename to src/app/(main)/(app)/components/invoice-pdf-preview/mobile-pdf-viewer.tsxindex b72b5df..4e2e36c 100644--- a/src/app/(app)/components/invoice-pdf-preview/mobile-pdf-viewer.tsx+++ b/src/app/(main)/(app)/components/invoice-pdf-preview/mobile-pdf-viewer.tsx@@ -2,7 +2,7 @@ import * as Sentry from "@sentry/nextjs";import { useState } from "react";import { Document, Page } from "react-pdf";-import { useInvoicePdfInstance } from "@/app/(app)/contexts/invoice-pdf-instance-context";+import { useInvoicePdfInstance } from "@/app/(main)/(app)/contexts/invoice-pdf-instance-context";import { BUG_REPORT_URL } from "@/config";// This import registers the PDF.js worker globally so that react-pdf can render PDFs in the browser.diff --git a/src/app/(app)/components/invoice-templates/__tests__/fontkit-glyph-cache-patch.test.ts b/src/app/(main)/(app)/components/invoice-templates/__tests__/fontkit-glyph-cache-patch.test.tssimilarity index 100%rename from src/app/(app)/components/invoice-templates/__tests__/fontkit-glyph-cache-patch.test.tsrename to src/app/(main)/(app)/components/invoice-templates/__tests__/fontkit-glyph-cache-patch.test.tsdiff --git a/src/app/(app)/components/invoice-templates/common/invoice-qr-code.tsx b/src/app/(main)/(app)/components/invoice-templates/common/invoice-qr-code.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-templates/common/invoice-qr-code.tsxrename to src/app/(main)/(app)/components/invoice-templates/common/invoice-qr-code.tsxdiff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/index.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/index.tsxsimilarity index 100%rename from src/app/(app)/components/invoice-templates/invoice-pdf-default-template/index.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/index.tsxdiff --git a/src/app/(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.tsxsimilarity index 96%rename from src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-body.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-body.tsxindex dc5aa0a..8a697dc 100644--- a/src/app/(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@@ -1,8 +1,8 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";-import { InvoiceQRCode } from "@/app/(app)/components/invoice-templates/common/invoice-qr-code";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+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 { PDF_DEFAULT_TEMPLATE_STYLES } from ".";diff --git a/src/app/(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.tsxsimilarity index 95%rename from src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-footer.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-footer.tsxindex 80e5559..648ddf6 100644--- a/src/app/(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@@ -1,7 +1,7 @@import { Link, Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { type InvoiceData } from "@/app/schema";import { PROD_WEBSITE_URL } from "@/config";diff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-header.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-header.tsxsimilarity index 96%rename from src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-header.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-header.tsxindex 89bcde3..ba54a64 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-header.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-header.tsx@@ -1,11 +1,11 @@import { Image, Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import {formatDateOfServiceEnd,formatServicePeriodRange,-} from "@/app/(app)/utils/format-service-period";+} from "@/app/(main)/(app)/utils/format-service-period";import { type InvoiceData } from "@/app/schema";import type { PDF_DEFAULT_TEMPLATE_STYLES } from ".";diff --git a/src/app/(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.tsxsimilarity index 99%rename from src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-items-table.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-items-table.tsxindex 12809bd..cf20630 100644--- a/src/app/(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,6 +1,6 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import type { InvoiceData } from "@/app/schema";import type { PDF_DEFAULT_TEMPLATE_STYLES } from ".";diff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-info.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-info.tsxsimilarity index 92%rename from src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-info.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-info.tsxindex 32f4ec1..cdd7741 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-info.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-info.tsx@@ -1,7 +1,7 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import type { InvoiceData } from "@/app/schema";import type { PDF_DEFAULT_TEMPLATE_STYLES } from ".";diff --git a/src/app/(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.tsxsimilarity index 95%rename from src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-totals.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-payment-totals.tsxindex 404a31d..b04fd77 100644--- a/src/app/(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,6 +1,6 @@import { View, Text } from "@react-pdf/renderer/lib/react-pdf.browser";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import type { InvoiceData } from "@/app/schema";import {getAmountInWords,diff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-seller-buyer-info.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-seller-buyer-info.tsxsimilarity index 97%rename from src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-seller-buyer-info.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-seller-buyer-info.tsxindex 582007a..20d1c89 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-seller-buyer-info.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-seller-buyer-info.tsx@@ -1,6 +1,6 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import type { InvoiceData } from "@/app/schema";import type { PDF_DEFAULT_TEMPLATE_STYLES } from ".";diff --git a/src/app/(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.tsxsimilarity index 98%rename from src/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-vat-summary-table.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-vat-summary-table.tsxindex b2be61d..347c1b1 100644--- a/src/app/(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,6 +1,6 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import type { InvoiceData } from "@/app/schema";import type { PDF_DEFAULT_TEMPLATE_STYLES } from ".";diff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/index.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/index.tsxsimilarity index 97%rename from src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/index.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/index.tsxindex ac3fa6e..204f02f 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/index.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/index.tsx@@ -11,8 +11,8 @@ import {} from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";-import { InvoiceQRCode } from "@/app/(app)/components/invoice-templates/common/invoice-qr-code";-import { formatCurrency } from "@/app/(app)/utils/format-currency";+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 { INVOICE_PDF_FONTS } from "@/config";diff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-due-amount.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-due-amount.tsxsimilarity index 94%rename from src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-due-amount.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-due-amount.tsxindex 73a63d7..b2df7f0 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-due-amount.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-due-amount.tsx@@ -1,7 +1,7 @@import { Text, View, Link } from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { type InvoiceData } from "@/app/schema";import type { STRIPE_TEMPLATE_STYLES } from ".";diff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-footer.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-footer.tsxsimilarity index 94%rename from src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-footer.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-footer.tsxindex 71ec87b..2e0bec4 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-footer.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-footer.tsx@@ -1,7 +1,7 @@import { Link, Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { type InvoiceData } from "@/app/schema";import { PROD_WEBSITE_URL } from "@/config";diff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-header.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-header.tsxsimilarity index 94%rename from src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-header.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-header.tsxindex b9c69fa..ca59d1a 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-header.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-header.tsx@@ -1,6 +1,6 @@import { Image, Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { type InvoiceData } from "@/app/schema";import type { STRIPE_TEMPLATE_STYLES } from ".";diff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-info.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-info.tsxsimilarity index 96%rename from src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-info.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-info.tsxindex 686d310..523b6be 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-info.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-invoice-info.tsx@@ -1,7 +1,7 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { type InvoiceData } from "@/app/schema";import type { STRIPE_TEMPLATE_STYLES } from ".";diff --git a/src/app/(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.tsxsimilarity index 92%rename from src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-items-table.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-items-table.tsxindex 0350088..9cc78a9 100644--- a/src/app/(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,10 +1,10 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";import dayjs from "dayjs";-import type { STRIPE_TEMPLATE_STYLES } from "@/app/(app)/components/invoice-templates/invoice-pdf-stripe-template";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";-import { formatCurrency } from "@/app/(app)/utils/format-currency";-import { formatServicePeriodRange } from "@/app/(app)/utils/format-service-period";+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 { formatServicePeriodRange } from "@/app/(main)/(app)/utils/format-service-period";import type { InvoiceData } from "@/app/schema";import "dayjs/locale/de";diff --git a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-seller-buyer-info.tsx b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-seller-buyer-info.tsxsimilarity index 96%rename from src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-seller-buyer-info.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-seller-buyer-info.tsxindex 8d3b637..7e40517 100644--- a/src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-seller-buyer-info.tsx+++ b/src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-seller-buyer-info.tsx@@ -1,6 +1,6 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import type { InvoiceData } from "@/app/schema";import type { STRIPE_TEMPLATE_STYLES } from ".";diff --git a/src/app/(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.tsxsimilarity index 94%rename from src/app/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-totals.tsxrename to src/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template/stripe-totals.tsxindex 3ca97b3..79962d0 100644--- a/src/app/(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,8 +1,8 @@import { Text, View } from "@react-pdf/renderer/lib/react-pdf.browser";-import type { STRIPE_TEMPLATE_STYLES } from "@/app/(app)/components/invoice-templates/invoice-pdf-stripe-template";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";-import { formatCurrency } from "@/app/(app)/utils/format-currency";+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";/**diff --git a/src/app/(app)/components/mobile-form-scroll-container.tsx b/src/app/(main)/(app)/components/mobile-form-scroll-container.tsxsimilarity index 100%rename from src/app/(app)/components/mobile-form-scroll-container.tsxrename to src/app/(main)/(app)/components/mobile-form-scroll-container.tsxdiff --git a/src/app/(main)/(app)/components/share-invoice-button.tsx b/src/app/(main)/(app)/components/share-invoice-button.tsxnew file mode 100644index 0000000..f9d9267--- /dev/null+++ b/src/app/(main)/(app)/components/share-invoice-button.tsx@@ -0,0 +1,83 @@+"use client";++import { AlertCircleIcon, LinkIcon } from "lucide-react";++import { Button } from "@/components/ui/button";+import { CustomTooltip } from "@/components/ui/tooltip";+import { cn } from "@/lib/utils";++/**+ * Why an invoice carrying a logo cannot be turned into a link.+ *+ * Shared with the toast `handleShareInvoice` raises when the button is pressed anyway, so the+ * tooltip and the toast cannot drift into telling the user two different things.+ */+export const CANNOT_SHARE_INVOICE_DESCRIPTION =+ "Invoices with logos cannot be shared. Please remove the logo to generate a shareable link. You can still download the invoice as PDF and share it.";++/**+ * The "Get link" button and the tooltip explaining what it will (or will not) do.+ *+ * Rendered twice on the page -- in the desktop header and in the mobile dock -- which used to+ * mean two copies of the same forty lines of tooltip, and two places to update when the copy+ * changed. Only the button's own spacing actually differs between them.+ */+export function ShareInvoiceButton({+ canShareInvoice,+ handleShareInvoice,+ className,+}: {+ /** `false` when the invoice carries a logo, which no share link can encode. */+ canShareInvoice: boolean;+ /** Generates the link and puts it on the clipboard (or into the native share sheet). */+ handleShareInvoice: () => void;+ /** Layout classes for the button itself: the header and the dock space it differently. */+ className?: string;+}) {+ return (+ <CustomTooltip+ className={cn(!canShareInvoice && "bg-red-50")}+ trigger={+ <Button+ data-disabled={!canShareInvoice} // for better UX than 'disabled'+ onClick={handleShareInvoice}+ variant="outline"+ className={cn(className)}+ >+ <LinkIcon className="mr-1.5 size-4" />+ Get link+ </Button>+ }+ content={+ canShareInvoice ? (+ <div className="flex items-center gap-3 p-2">+ <div className="space-y-1">+ <p className="text-sm font-semibold text-slate-900">+ Share Invoice Online+ </p>+ <p className="text-pretty text-xs leading-relaxed text-slate-700">+ Generate a link to share this invoice with your clients. They+ can view and download it directly from their browser.+ </p>+ </div>+ </div>+ ) : (+ <div+ data-testid="share-invoice-tooltip-content"+ className="flex items-center gap-3 bg-red-50 p-3"+ >+ <AlertCircleIcon className="h-5 w-5 flex-shrink-0 fill-red-600 text-white" />+ <div className="space-y-1">+ <p className="text-sm font-semibold text-red-800">+ Unable to Share Invoice+ </p>+ <p className="text-pretty text-xs leading-relaxed text-red-700">+ {CANNOT_SHARE_INVOICE_DESCRIPTION}+ </p>+ </div>+ </div>+ )+ }+ />+ );+}diff --git a/src/app/(app)/contexts/__tests__/invoice-pdf-instance-context.test.tsx b/src/app/(main)/(app)/contexts/__tests__/invoice-pdf-instance-context.test.tsxsimilarity index 100%rename from src/app/(app)/contexts/__tests__/invoice-pdf-instance-context.test.tsxrename to src/app/(main)/(app)/contexts/__tests__/invoice-pdf-instance-context.test.tsxdiff --git a/src/app/(app)/contexts/cta-toast-context.tsx b/src/app/(main)/(app)/contexts/cta-toast-context.tsxsimilarity index 97%rename from src/app/(app)/contexts/cta-toast-context.tsxrename to src/app/(main)/(app)/contexts/cta-toast-context.tsxindex e876d11..dca3d98 100644--- a/src/app/(app)/contexts/cta-toast-context.tsx+++ b/src/app/(main)/(app)/contexts/cta-toast-context.tsx@@ -5,7 +5,7 @@ import { createContext, useContext, useState, useCallback } from "react";import {getAppStorageItem,setAppStorageItem,-} from "@/app/(app)/utils/app-local-storage";+} from "@/app/(main)/(app)/utils/app-local-storage";import { CTA_TOAST_STORAGE_KEY } from "@/app/schema";const CTA_TOAST_COOLDOWN_MS = 24 * 60 * 60 * 1000; // 1 daydiff --git a/src/app/(app)/contexts/invoice-pdf-instance-context.tsx b/src/app/(main)/(app)/contexts/invoice-pdf-instance-context.tsxsimilarity index 94%rename from src/app/(app)/contexts/invoice-pdf-instance-context.tsxrename to src/app/(main)/(app)/contexts/invoice-pdf-instance-context.tsxindex dfc5da1..a52642f 100644--- a/src/app/(app)/contexts/invoice-pdf-instance-context.tsx+++ b/src/app/(main)/(app)/contexts/invoice-pdf-instance-context.tsx@@ -4,8 +4,8 @@ import { usePDF } from "@react-pdf/renderer/lib/react-pdf.browser";import * as Sentry from "@sentry/nextjs";import { createContext, useContext, useEffect, useMemo, useRef } from "react";-import { InvoicePdfTemplate } from "@/app/(app)/components/invoice-templates/invoice-pdf-default-template";-import { StripeInvoicePdfTemplate } from "@/app/(app)/components/invoice-templates/invoice-pdf-stripe-template";+import { InvoicePdfTemplate } from "@/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template";+import { StripeInvoicePdfTemplate } from "@/app/(main)/(app)/components/invoice-templates/invoice-pdf-stripe-template";import type { InvoiceData } from "@/app/schema";import { ErrorGeneratingPdfToast } from "@/components/ui/toasts/error-generating-pdf-toast";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";diff --git a/src/app/(app)/error.tsx b/src/app/(main)/(app)/error.tsxsimilarity index 90%rename from src/app/(app)/error.tsxrename to src/app/(main)/(app)/error.tsxindex 4f0f098..6c4a3e4 100644--- a/src/app/(app)/error.tsx+++ b/src/app/(main)/(app)/error.tsx@@ -4,12 +4,10 @@ import * as Sentry from "@sentry/nextjs";import { useEffect } from "react";import { toast } from "sonner";-import { setAppStorageItem } from "@/app/(app)/utils/app-local-storage";-import { DEFAULT_METADATA } from "@/app/(app)/utils/get-app-metadata";-import {- METADATA_LOCAL_STORAGE_KEY,- PDF_DATA_LOCAL_STORAGE_KEY,-} from "@/app/schema";+import { setAppStorageItem } from "@/app/(main)/(app)/utils/app-local-storage";+import { resetAppMetadata } from "@/app/(main)/(app)/utils/get-app-metadata";+import { getInitialInvoiceData } from "@/app/constants";+import { PDF_DATA_LOCAL_STORAGE_KEY } from "@/app/schema";import { ErrorMessage } from "@/components/etc/error-message";import {AlertDialog,@@ -26,8 +24,6 @@ import { Button } from "@/components/ui/button";import { BUG_REPORT_URL } from "@/config";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";-import { getInitialInvoiceData } from "../constants";-export default function Error({error,reset,@@ -106,10 +102,7 @@ export default function Error({value: JSON.stringify(getInitialInvoiceData()),});- setAppStorageItem({- key: METADATA_LOCAL_STORAGE_KEY,- value: JSON.stringify(DEFAULT_METADATA),- });+ resetAppMetadata();reset();diff --git a/src/app/(app)/home-json-ld.tsx b/src/app/(main)/(app)/home-json-ld.tsxsimilarity index 100%rename from src/app/(app)/home-json-ld.tsxrename to src/app/(main)/(app)/home-json-ld.tsxdiff --git a/src/app/(app)/hooks/__tests__/use-changelog-update-popup.test.ts b/src/app/(main)/(app)/hooks/__tests__/use-changelog-update-popup.test.tssimilarity index 95%rename from src/app/(app)/hooks/__tests__/use-changelog-update-popup.test.tsrename to src/app/(main)/(app)/hooks/__tests__/use-changelog-update-popup.test.tsindex ac98829..8655efa 100644--- a/src/app/(app)/hooks/__tests__/use-changelog-update-popup.test.ts+++ b/src/app/(main)/(app)/hooks/__tests__/use-changelog-update-popup.test.ts@@ -6,23 +6,23 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import {markChangelogAsSeen,shouldShowChangelogPopup,-} from "@/app/(app)/utils/changelog-seen-storage";+} from "@/app/(main)/(app)/utils/changelog-seen-storage";import {hasSeenWelcomePopup,markWelcomePopupSeen,-} from "@/app/(app)/utils/welcome-popup-seen-storage";-import type { ChangelogSummary } from "@/app/changelog/utils";+} from "@/app/(main)/(app)/utils/welcome-popup-seen-storage";+import type { ChangelogSummary } from "@/app/(main)/changelog/utils";import { useChangelogUpdatePopup } from "../use-changelog-update-popup";-vi.mock("@/app/(app)/utils/welcome-popup-seen-storage", () => {+vi.mock("@/app/(main)/(app)/utils/welcome-popup-seen-storage", () => {return {hasSeenWelcomePopup: vi.fn(),markWelcomePopupSeen: vi.fn(),};});-vi.mock("@/app/(app)/utils/changelog-seen-storage", () => {+vi.mock("@/app/(main)/(app)/utils/changelog-seen-storage", () => {return {shouldShowChangelogPopup: vi.fn(),markChangelogAsSeen: vi.fn(),diff --git a/src/app/(app)/hooks/__tests__/use-in-app-browser-notice.test.tsx b/src/app/(main)/(app)/hooks/__tests__/use-in-app-browser-notice.test.tsxsimilarity index 100%rename from src/app/(app)/hooks/__tests__/use-in-app-browser-notice.test.tsxrename to src/app/(main)/(app)/hooks/__tests__/use-in-app-browser-notice.test.tsxdiff --git a/src/app/(main)/(app)/hooks/use-app-metadata.ts b/src/app/(main)/(app)/hooks/use-app-metadata.tsnew file mode 100644index 0000000..1e327d9--- /dev/null+++ b/src/app/(main)/(app)/hooks/use-app-metadata.ts@@ -0,0 +1,31 @@+"use client";++import { useSyncExternalStore } from "react";++import {+ getAppMetadataSnapshot,+ getServerAppMetadataSnapshot,+ subscribeToAppMetadata,+} from "@/app/(main)/(app)/utils/get-app-metadata";++/**+ * The app metadata held in `localStorage`, as reactive state.+ *+ * Components used to call `getAppMetadata()` straight from their render, which read, parsed+ * and validated the stored JSON on every single render, and read a mutable store from a+ * place React expects to be pure. That it stayed fresh at all was incidental: it only+ * updated because something else happened to re-render the component at the same time.+ *+ * Subscribing instead makes the refresh causal -- a write through `updateAppMetadata`+ * re-renders exactly the components displaying it -- and the parse happens once per change+ * rather than once per render.+ *+ * @returns The current metadata, or `null` when nothing is stored yet (or on the server).+ */+export function useAppMetadata() {+ return useSyncExternalStore(+ subscribeToAppMetadata,+ getAppMetadataSnapshot,+ getServerAppMetadataSnapshot,+ );+}diff --git a/src/app/(app)/hooks/use-changelog-update-popup.ts b/src/app/(main)/(app)/hooks/use-changelog-update-popup.tssimilarity index 94%rename from src/app/(app)/hooks/use-changelog-update-popup.tsrename to src/app/(main)/(app)/hooks/use-changelog-update-popup.tsindex 8a93cc8..8c89339 100644--- a/src/app/(app)/hooks/use-changelog-update-popup.ts+++ b/src/app/(main)/(app)/hooks/use-changelog-update-popup.ts@@ -5,12 +5,12 @@ import { useCallback, useEffect, useRef, useState } from "react";import {markChangelogAsSeen,shouldShowChangelogPopup,-} from "@/app/(app)/utils/changelog-seen-storage";+} from "@/app/(main)/(app)/utils/changelog-seen-storage";import {hasSeenWelcomePopup,markWelcomePopupSeen,-} from "@/app/(app)/utils/welcome-popup-seen-storage";-import type { ChangelogSummary } from "@/app/changelog/utils";+} from "@/app/(main)/(app)/utils/welcome-popup-seen-storage";+import type { ChangelogSummary } from "@/app/(main)/changelog/utils";/** Wait before showing so the page can settle first */const SHOW_DELAY_MS = 1500;diff --git a/src/app/(app)/hooks/use-in-app-browser-notice.tsx b/src/app/(main)/(app)/hooks/use-in-app-browser-notice.tsxsimilarity index 100%rename from src/app/(app)/hooks/use-in-app-browser-notice.tsxrename to src/app/(main)/(app)/hooks/use-in-app-browser-notice.tsxdiff --git a/src/app/(main)/(app)/layout.tsx b/src/app/(main)/(app)/layout.tsxnew file mode 100644index 0000000..479997f--- /dev/null+++ b/src/app/(main)/(app)/layout.tsx@@ -0,0 +1,33 @@+import { DeviceContextProvider } from "@/contexts/device-context";+import { checkDeviceUserAgent } from "@/lib/check-device.server";++/**+ * Layout of the invoice generator itself (`/`).+ *+ * Server-side device detection lives here rather than in the shared root document+ * (`src/app/(components)/root-document.tsx`): `checkDeviceUserAgent()` reads+ * `headers()`, and from the root that made *every* route request-bound — which is+ * why the marketing pages all needed `export const dynamic = "force-static"` to stay+ * prerendered. `useDeviceContext()` is only consumed under this route group, and `/`+ * is rendered per request anyway (`page.tsx` reads `searchParams`), so nothing is+ * lost by scoping the header read to it.+ */+export default async function AppLayout({ children }: LayoutProps<"/">) {+ const {+ isDesktop: isDesktopServer,+ isAndroid,+ isMobile,+ inAppInfo,+ } = await checkDeviceUserAgent();++ return (+ <DeviceContextProvider+ isDesktop={isDesktopServer}+ isAndroid={isAndroid}+ isMobile={isMobile}+ inAppInfo={inAppInfo}+ >+ {children}+ </DeviceContextProvider>+ );+}diff --git a/src/app/(app)/loading.tsx b/src/app/(main)/(app)/loading.tsxsimilarity index 99%rename from src/app/(app)/loading.tsxrename to src/app/(main)/(app)/loading.tsxindex 9516201..c78aa91 100644--- a/src/app/(app)/loading.tsx+++ b/src/app/(main)/(app)/loading.tsx@@ -14,7 +14,7 @@ export default function Loading() {export function InvoicePageLoadingSkeleton() {return (<>- <div+ <mainclassName="flex flex-col items-center justify-start bg-gray-100 pb-4 sm:p-4 md:justify-center lg:min-h-screen"aria-busy="true"aria-label="Loading invoice editor"@@ -27,7 +27,7 @@ export function InvoicePageLoadingSkeleton() {<DesktopEditorLoading /></div></div>- </div>+ </main><Footer /></>);diff --git a/src/app/(app)/page.client.tsx b/src/app/(main)/(app)/page.client.tsxsimilarity index 77%rename from src/app/(app)/page.client.tsxrename to src/app/(main)/(app)/page.client.tsxindex ba06921..35652d1 100644--- a/src/app/(app)/page.client.tsx+++ b/src/app/(main)/(app)/page.client.tsx@@ -5,29 +5,24 @@ import {compressToEncodedURIComponent,decompressFromEncodedURIComponent,} from "lz-string";-import { useRouter, useSearchParams } from "next/navigation";-import { useCallback, useEffect, useRef, useState } from "react";+import { useSearchParams } from "next/navigation";+import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { toast } from "sonner";import { z } from "zod";-import { InvoicePageHeader } from "@/app/(app)/components/invoice-page-header";-import { InvoicePdfInstanceProvider } from "@/app/(app)/contexts/invoice-pdf-instance-context";-import { InvoicePageLoadingSkeleton } from "@/app/(app)/loading";-import {- getAppStorageItem,- setAppStorageItem,-} from "@/app/(app)/utils/app-local-storage";+import { Footer } from "@/app/(components)/footer";+import { InvoicePageHeader } from "@/app/(main)/(app)/components/invoice-page-header";+import { InvoicePdfInstanceProvider } from "@/app/(main)/(app)/contexts/invoice-pdf-instance-context";+import { InvoicePageLoadingSkeleton } from "@/app/(main)/(app)/loading";+import { getAppStorageItem } from "@/app/(main)/(app)/utils/app-local-storage";import {- DEFAULT_METADATA,- getAppMetadata,+ ensureAppMetadata,updateAppMetadata,-} from "@/app/(app)/utils/get-app-metadata";-import { Footer } from "@/app/(components)/footer";-import type { ChangelogSummary } from "@/app/changelog/utils";+} from "@/app/(main)/(app)/utils/get-app-metadata";+import type { ChangelogSummary } from "@/app/(main)/changelog/utils";import { getInitialInvoiceData } from "@/app/constants";import {invoiceSchema,- METADATA_LOCAL_STORAGE_KEY,PDF_DATA_LOCAL_STORAGE_KEY,SUPPORTED_TEMPLATES,type InvoiceData,@@ -36,6 +31,7 @@ import { GitHubStarCTA } from "@/components/github-star-cta";import { Button } from "@/components/ui/button";import { TooltipProvider } from "@/components/ui/tooltip";import { useDeviceContext } from "@/contexts/device-context";+import { debugLog } from "@/lib/debug-log";import { haptic } from "@/lib/haptic";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";import {@@ -46,6 +42,7 @@ import {import { InvoiceClientPage } from "./components";import { ChangelogUpdatePopup } from "./components/changelog-update-popup";import { HowItWorksVideoDialog } from "./components/how-it-works-video-dialog";+import { CANNOT_SHARE_INVOICE_DESCRIPTION } from "./components/share-invoice-button";import { useChangelogUpdatePopup } from "./hooks/use-changelog-update-popup";import { useInAppBrowserNotice } from "./hooks/use-in-app-browser-notice";import { generateQrCodeDataUrl } from "./utils/generate-qr-code-data-url";@@ -55,6 +52,28 @@ import { selectInvoiceTemplate } from "./utils/select-invoice-template";// TODO: enable later when PRO version is released, this is PRO FEATURE =)// import { InvoicePDFDownloadMultipleLanguages } from "./components/invoice-pdf-download-multiple-languages";+/**+ * Rewrites the query string of `/` in place.+ *+ * Every URL rewrite on this page is cosmetic -- keeping `?template=` in sync, adding or+ * dropping `?data=` -- and lands on the page that is already rendered. `router.replace`+ * treats each one as a navigation and refetches the RSC payload for `/`, so a plain page+ * load spent a whole extra server round trip just to append `?template=default`. Next's+ * router syncs with the native History API, so `useSearchParams()` still updates and+ * nothing is refetched.+ *+ * @param params - The complete query string to put in the address bar.+ */+function replaceUrlQuery(params: URLSearchParams) {+ const query = params.toString();++ window.history.replaceState(+ null,+ "",+ query ? `?${query}` : window.location.pathname,+ );+}+/*** Main client component for the invoice application page.*@@ -76,16 +95,23 @@ export function AppPageClient({githubStarsCount: number;latestChangelog: ChangelogSummary | null;}) {- const router = useRouter();const searchParams = useSearchParams();const urlTemplateSearchParam = searchParams.get("template");- // Validate template parameter with zod- const templateValidation = z- .enum(SUPPORTED_TEMPLATES)- .default("default")- .safeParse(urlTemplateSearchParam);+ /**+ * The `?template=` parameter, validated.+ *+ * Memoized so the parse happens once per URL rather than once per render, and so the result+ * keeps its identity -- `loadFromLocalStorage` below closes over it, and a fresh object every+ * render would make that callback (and everything keyed on it) unstable for no reason.+ */+ const templateValidation = useMemo(() => {+ return z+ .enum(SUPPORTED_TEMPLATES)+ .default("default")+ .safeParse(urlTemplateSearchParam);+ }, [urlTemplateSearchParam]);const { isDesktop, isUADesktop } = useDeviceContext();const isMobile = !isDesktop;@@ -186,15 +212,8 @@ export function AppPageClient({// Helper function to load from localStorageconst loadFromLocalStorage = useCallback(() => {try {- const appMetadata = getAppMetadata();-// add metadata with default values if missing for all users- if (!appMetadata) {- setAppStorageItem({- key: METADATA_LOCAL_STORAGE_KEY,- value: JSON.stringify(DEFAULT_METADATA),- });- }+ ensureAppMetadata();const savedData = getAppStorageItem(PDF_DATA_LOCAL_STORAGE_KEY);@@ -252,8 +271,8 @@ export function AppPageClient({useEffect(() => {// Run only once per page load.//- // This effect depends on `searchParams`, and the app rewrites the URL with- // `router.replace` on its own (e.g. to keep ?template= in sync, or to add ?data=+ // This effect depends on `searchParams`, and the app rewrites the URL on its own+ // (e.g. to keep ?template= in sync, or to add ?data=// when a share link is generated). Without this guard, every one of those rewrites// re-ran the initialization, re-read localStorage and called `setInvoiceDataState`// with a brand new (but identical) object. That extra state update makes react-pdf@@ -266,17 +285,10 @@ export function AppPageClient({hasInitializedInvoiceDataRef.current = true;const compressedInvoiceDataInUrl = searchParams.get("data");- const urlTemplateSearchParam = searchParams.get("template");-- // Validate template parameter with zod- const templateValidation = z- .enum(SUPPORTED_TEMPLATES)- .default("default")- .safeParse(urlTemplateSearchParam);// first try to load from url i.e. if user has shared invoice linkif (compressedInvoiceDataInUrl) {- console.warn("[useEffect] [initialize invoice data from ** URL **]");+ debugLog("[useEffect] [initialize invoice data from ** URL **]");try {const decompressedData = decompressFromEncodedURIComponent(@@ -295,7 +307,7 @@ export function AppPageClient({const validatedDataFromURL = invoiceSchema.parse(updatedJson);- console.warn(+ debugLog("[useEffect] [initialize invoice data from ** URL **] validatedDataFromURL",validatedDataFromURL,);@@ -313,15 +325,8 @@ export function AppPageClient({// Store the original URL invoice data for change detectionoriginalUrlInvoiceDataRef.current = selectedInvoiceData;- const appMetadata = getAppMetadata();-// add metadata with default values if missing for all users- if (!appMetadata) {- setAppStorageItem({- key: METADATA_LOCAL_STORAGE_KEY,- value: JSON.stringify(DEFAULT_METADATA),- });- }+ ensureAppMetadata();} catch (error) {console.error("[useEffect] [initialize invoice data from ** URL **] Failed to parse URL data:",@@ -345,11 +350,17 @@ export function AppPageClient({variant="outline"size="sm"onClick={() => {- const currentTemplate =- searchParams.get("template") || "default";- router.replace(`/?template=${currentTemplate}`, {- scroll: false,- });+ // drop the corrupted `?data=`, keep everything else the visitor arrived with+ const clearedParams = new URLSearchParams(+ window.location.search,+ );+ clearedParams.delete("data");+ clearedParams.set(+ "template",+ clearedParams.get("template") || "default",+ );++ replaceUrlQuery(clearedParams);toast.dismiss();}}@@ -365,14 +376,14 @@ export function AppPageClient({Sentry.captureException(error);}} else {- console.warn(+ debugLog("[useEffect] [initialize invoice data from ** LOCAL STORAGE **]",);// if no data in url, load from local storageloadFromLocalStorage();}- }, [loadFromLocalStorage, router, searchParams]);+ }, [loadFromLocalStorage, searchParams, templateValidation]);/*** Ensures the template query parameter is present in the URL (for better user experience)@@ -381,17 +392,17 @@ export function AppPageClient({useEffect(() => {// Only run if we have invoice data and no template in URL.//- // `no-event-handler` wants this written where the invoice data is set, but `router.replace`- // is dropped when it is called from the initialization effect while the App Router is still- // mounting -- under load the shared-link e2e tests then sit on a URL that never grows its- // `?template=`. Reacting to `invoiceDataState` defers the call by one render, which is what- // makes it land.+ // `no-event-handler` wants this written where the invoice data is set, but the template+ // being written *is* `invoiceDataState.template`, which the initialization effect has not+ // resolved yet at that point. (It was also load-bearing back when this used+ // `router.replace`, which the App Router dropped when called mid-mount -- under load the+ // shared-link e2e tests then sat on a URL that never grew its `?template=`.)// oxlint-disable-next-line react-you-might-not-need-an-effect/no-event-handlerif (!invoiceDataState || searchParams.get("template")) {return;}- console.warn("[useEffect] [add missing template to URL]", {+ debugLog("[useEffect] [add missing template to URL]", {template: invoiceDataState.template,});@@ -402,8 +413,8 @@ export function AppPageClient({currentParams.set("template", invoiceDataState.template);// Update the browser URL without triggering a page reload or scroll- router.replace(`?${currentParams.toString()}`, { scroll: false });- }, [invoiceDataState, searchParams, router]);+ replaceUrlQuery(currentParams);+ }, [invoiceDataState, searchParams]);/*** Checks if the invoice has changed from the original shared URL version.@@ -411,7 +422,7 @@ export function AppPageClient({*/const checkForInvoiceChanges = useCallback((currentData: InvoiceData) => {- console.warn("[checkForInvoiceChanges]", currentData.template, {+ debugLog("[checkForInvoiceChanges]", currentData.template, {originalUrlInvoiceDataRef: originalUrlInvoiceDataRef.current,});@@ -420,7 +431,7 @@ export function AppPageClient({// Skip if no original URL data or no data in urlif (!originalUrlInvoiceDataRef.current || !urlData) {- console.warn("[checkForInvoiceChanges] skipping");+ debugLog("[checkForInvoiceChanges] skipping");return;}@@ -431,7 +442,7 @@ export function AppPageClient({JSON.stringify(currentData);if (invoiceHasChanged) {- console.warn("[checkForInvoiceChanges] invoice has changed");+ debugLog("[checkForInvoiceChanges] invoice has changed");toast.info(<div className="space-y-2">@@ -462,10 +473,10 @@ export function AppPageClient({// Update the browser URL without triggering a page reload or scroll// This keeps the URL in sync with the invoice state while maintaining user position- router.replace(`?${currentParams.toString()}`, { scroll: false });+ replaceUrlQuery(currentParams);}},- [router, isMobile, searchParams],+ [isMobile, searchParams],);/**@@ -476,81 +487,95 @@ export function AppPageClient({* - Handles invoice URL corruption by clearing invalid URL parameters and notifying the user* - Triggers change detection to show toast if invoice is modified from the URL-loaded version*+ * Stable across renders on purpose: `InvoiceForm` is wrapped in `memo`, and this function+ * is one of its props. As a fresh closure on every render it made that `memo` unable to+ * ever hold, so re-renders that have nothing to do with the invoice -- opening the "How it+ * works" dialog, the changelog popup, a regenerated QR code -- re-rendered the whole form.+ * The form still re-renders when its own edit comes back through `invoiceDataState`, which+ * is inherent to that round trip.*/- const handleInvoiceDataChange = (updatedData: InvoiceData) => {- console.warn("[handleInvoiceDataChange]");+ const handleInvoiceDataChange = useCallback(+ (updatedData: InvoiceData) => {+ debugLog("[handleInvoiceDataChange]");- if (isInvoiceUrlCorrupted) {- console.warn("[handleInvoiceDataChange] clearing url due to corruption");+ if (isInvoiceUrlCorrupted) {+ debugLog("[handleInvoiceDataChange] clearing url due to corruption");- /** CLEAR URL IN CASE OF CORRUPTED INVOICE URL (i.e. "/?data=") for better UX and consistency */+ /** CLEAR URL IN CASE OF CORRUPTED INVOICE URL (i.e. "/?data=") for better UX and consistency */- // Remove the ?data parameter from URL since the invoice has been modified (clean url, because it's no longer valid)- const currentParams = new URLSearchParams(searchParams.toString());- currentParams.delete("data");+ // Remove the ?data parameter from URL since the invoice has been modified (clean url, because it's no longer valid)+ const currentParams = new URLSearchParams(searchParams.toString());+ currentParams.delete("data");- // update the url- router.replace(`?${currentParams.toString()}`, { scroll: false });+ // update the url+ replaceUrlQuery(currentParams);- // Show notification that URL was cleared due to corruption- toast.info(- <div className="space-y-2">- <p className="text-sm font-semibold">Corrupted URL Cleared</p>- <p className="text-muted-foreground text-pretty leading-relaxed">- The invalid invoice URL has been removed from the address bar.- </p>- <p className="text-muted-foreground text-pretty leading-relaxed">- Click{" "}- <span className="font-semibold text-foreground">- 'Get link'- </span>{" "}- to create a new shareable link.- </p>- </div>,- {- id: "corrupted-url-cleared-toast",- duration: 15_000,- closeButton: true,- position: isMobile ? "top-center" : "bottom-right",- },- );+ // Show notification that URL was cleared due to corruption+ toast.info(+ <div className="space-y-2">+ <p className="text-sm font-semibold">Corrupted URL Cleared</p>+ <p className="text-muted-foreground text-pretty leading-relaxed">+ The invalid invoice URL has been removed from the address bar.+ </p>+ <p className="text-muted-foreground text-pretty leading-relaxed">+ Click{" "}+ <span className="font-semibold text-foreground">+ 'Get link'+ </span>{" "}+ to create a new shareable link.+ </p>+ </div>,+ {+ id: "corrupted-url-cleared-toast",+ duration: 15_000,+ closeButton: true,+ position: isMobile ? "top-center" : "bottom-right",+ },+ );- // Reset the invoice url corruption state- setIsInvoiceUrlCorrupted(false);- }+ // Reset the invoice url corruption state+ setIsInvoiceUrlCorrupted(false);+ }- setInvoiceDataState(updatedData);- checkForInvoiceChanges(updatedData);+ setInvoiceDataState(updatedData);+ checkForInvoiceChanges(updatedData);- const currentTemplate = searchParams.get("template");+ const currentTemplate = searchParams.get("template");- // update the url with the new template- if (currentTemplate !== updatedData.template) {- console.warn("[handleInvoiceDataChange] update url with new template", {- currentTemplate,- updatedDataTemplate: updatedData.template,- });+ // update the url with the new template+ if (currentTemplate !== updatedData.template) {+ debugLog("[handleInvoiceDataChange] update url with new template", {+ currentTemplate,+ updatedDataTemplate: updatedData.template,+ });- router.replace(`/?template=${updatedData.template}`, { scroll: false });- } else {- console.warn("[handleInvoiceDataChange] invoice template did not change");- }- };+ // Rebuilt from the current params rather than replacing the whole query string:+ // this used to be a bare `/?template=...`, which also threw away anything else the+ // visitor arrived with (utm tags and the like). `data` is still dropped on purpose --+ // a template switch is a change from the shared version, which is exactly what+ // `checkForInvoiceChanges` above has just told the user about.+ const templateParams = new URLSearchParams(searchParams.toString());+ templateParams.set("template", updatedData.template);+ templateParams.delete("data");++ replaceUrlQuery(templateParams);+ } else {+ debugLog("[handleInvoiceDataChange] invoice template did not change");+ }+ },+ [checkForInvoiceChanges, isInvoiceUrlCorrupted, isMobile, searchParams],+ );/** Generate a shareable invoice link */- const handleShareInvoice = async () => {+ const handleShareInvoice = useCallback(async () => {if (!canShareInvoice) {toast.error("Unable to Share Invoice", {id: "unable-to-share-invoice-error-toast",duration: 10_000,description: (- <>- <p className="text-pretty text-xs leading-relaxed text-red-700">- Invoices with logos cannot be shared. Please remove the logo to- generate a shareable link. You can still download the invoice as- PDF and share it.- </p>- </>+ <p className="text-pretty text-xs leading-relaxed text-red-700">+ {CANNOT_SHARE_INVOICE_DESCRIPTION}+ </p>),});@@ -622,7 +647,7 @@ export function AppPageClient({currentParams.set("template", newInvoiceDataValidated.template);currentParams.set("data", compressedData);- router.replace(`?${currentParams.toString()}`, { scroll: false });+ replaceUrlQuery(currentParams);// Remember the invoice that was just shared, so later edits are detected and the// "Invoice Updated" toast is shown. Previously this ref was (re)populated as a@@ -737,7 +762,7 @@ export function AppPageClient({Sentry.captureException(error);}}- };+ }, [canShareInvoice, invoiceDataState, isMobile, isUADesktop, searchParams]);// we only want to render the page on client sideif (!invoiceDataState) {@@ -751,7 +776,7 @@ export function AppPageClient({invoiceData={invoiceDataState}qrCodeDataUrl={qrCodeDataUrl}>- <div className="flex flex-col items-center justify-start bg-gray-100 pb-4 sm:p-4 md:justify-center lg:min-h-screen">+ <main className="flex flex-col items-center justify-start bg-gray-100 pb-4 sm:p-4 md:justify-center lg:min-h-screen"><div className="w-full max-w-[62rem] bg-white p-3 shadow-lg sm:mb-0 sm:rounded-lg sm:p-6 sm:pb-1 min-[1400px]:max-w-7xl 2xl:max-w-[1480px]"><InvoicePageHeadercanShareInvoice={canShareInvoice}@@ -772,7 +797,7 @@ export function AppPageClient({/></div></div>- </div>+ </main></InvoicePdfInstanceProvider><Footer />{changelogPopupVariant ? (diff --git a/src/app/(app)/page.tsx b/src/app/(main)/(app)/page.tsxsimilarity index 98%rename from src/app/(app)/page.tsxrename to src/app/(main)/(app)/page.tsxindex d06faf3..3a25105 100644--- a/src/app/(app)/page.tsx+++ b/src/app/(main)/(app)/page.tsx@@ -2,7 +2,7 @@ import * as Sentry from "@sentry/nextjs";import type { Metadata } from "next";import { fetchGithubStars } from "@/actions/fetch-github-stars";-import { getLatestChangelogSummary } from "@/app/changelog/utils";+import { getLatestChangelogSummary } from "@/app/(main)/changelog/utils";import { APP_URL, STATIC_ASSETS_URL, TWITTER_CREATOR } from "@/config";import { computeIndexingFlags } from "@/lib/seo/indexing-utils";diff --git a/src/app/(app)/pdf-i18n-translations/pdf-translations-schema.ts b/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations-schema.tssimilarity index 98%rename from src/app/(app)/pdf-i18n-translations/pdf-translations-schema.tsrename to src/app/(main)/(app)/pdf-i18n-translations/pdf-translations-schema.tsindex 4d568ed..2d14245 100644--- a/src/app/(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_LANGUAGES } from "../../../schema/index";const customTaxLabelInputSchema = z.object({diff --git a/src/app/(app)/pdf-i18n-translations/pdf-translations.ts b/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations.tssimilarity index 99%rename from src/app/(app)/pdf-i18n-translations/pdf-translations.tsrename to src/app/(main)/(app)/pdf-i18n-translations/pdf-translations.tsindex a1c7f85..c09740e 100644--- a/src/app/(app)/pdf-i18n-translations/pdf-translations.ts+++ b/src/app/(main)/(app)/pdf-i18n-translations/pdf-translations.ts@@ -1,7 +1,7 @@import {type SupportedLanguages,type SupportedTemplates,-} from "../../schema/index";+} from "../../../schema/index";import type { TranslationSchema } from "./pdf-translations-schema";export const INVOICE_PDF_TRANSLATIONS = {diff --git a/src/app/(app)/utils/__tests__/format-date-with-locale.test.ts b/src/app/(main)/(app)/utils/__tests__/format-date-with-locale.test.tssimilarity index 98%rename from src/app/(app)/utils/__tests__/format-date-with-locale.test.tsrename to src/app/(main)/(app)/utils/__tests__/format-date-with-locale.test.tsindex 568e980..78cb0ae 100644--- a/src/app/(app)/utils/__tests__/format-date-with-locale.test.ts+++ b/src/app/(main)/(app)/utils/__tests__/format-date-with-locale.test.ts@@ -4,7 +4,7 @@ import { describe, expect, it } from "vitest";import {formatDateWithLocale,formatTodayWithLocale,-} from "@/app/(app)/utils/format-date-with-locale";+} from "@/app/(main)/(app)/utils/format-date-with-locale";import { SUPPORTED_LANGUAGES, type SupportedLanguages } from "@/app/schema";const DATE = "2026-09-01";diff --git a/src/app/(app)/utils/__tests__/format-service-period.test.ts b/src/app/(main)/(app)/utils/__tests__/format-service-period.test.tssimilarity index 98%rename from src/app/(app)/utils/__tests__/format-service-period.test.tsrename to src/app/(main)/(app)/utils/__tests__/format-service-period.test.tsindex 0acabc5..a855229 100644--- a/src/app/(app)/utils/__tests__/format-service-period.test.ts+++ b/src/app/(main)/(app)/utils/__tests__/format-service-period.test.ts@@ -6,7 +6,7 @@ import {getCurrentMonthAndYear,getServicePeriod,isServicePeriodStartInCurrentMonth,-} from "@/app/(app)/utils/format-service-period";+} from "@/app/(main)/(app)/utils/format-service-period";import type { InvoiceData } from "@/app/schema";const baseInvoiceData = {diff --git a/src/app/(main)/(app)/utils/__tests__/get-app-metadata.test.ts b/src/app/(main)/(app)/utils/__tests__/get-app-metadata.test.tsnew file mode 100644index 0000000..b3bde4b--- /dev/null+++ b/src/app/(main)/(app)/utils/__tests__/get-app-metadata.test.ts@@ -0,0 +1,140 @@+// @vitest-environment happy-dom++import { beforeEach, describe, expect, it, vi } from "vitest";++import { METADATA_LOCAL_STORAGE_KEY } from "@/app/schema";++/**+ * A fresh copy of the module for every test.+ *+ * The snapshot cache and the listener set live at module scope, which is the point of them --+ * but it also means one test's subscribers and cached value would otherwise leak into the next.+ */+async function loadStore() {+ vi.resetModules();++ return await import("../get-app-metadata");+}++beforeEach(() => {+ localStorage.clear();+});++describe("app metadata store", () => {+ it("seeds the defaults when nothing is stored, and tells subscribers", async () => {+ const { ensureAppMetadata, subscribeToAppMetadata } = await loadStore();+ const onChange = vi.fn();+ subscribeToAppMetadata(onChange);++ expect(localStorage.getItem(METADATA_LOCAL_STORAGE_KEY)).toBeNull();++ ensureAppMetadata();++ expect(localStorage.getItem(METADATA_LOCAL_STORAGE_KEY)).not.toBeNull();+ expect(onChange).toHaveBeenCalledTimes(1);+ });++ it("leaves metadata that is already there alone", async () => {+ const {+ ensureAppMetadata,+ getAppMetadata,+ subscribeToAppMetadata,+ updateAppMetadata,+ } = await loadStore();++ ensureAppMetadata();+ updateAppMetadata((current) => {+ return { ...current, invoiceDownloadCount: 7 };+ });++ // subscribed only now, so the seeding above cannot account for a call+ const onChange = vi.fn();+ subscribeToAppMetadata(onChange);++ ensureAppMetadata();++ expect(getAppMetadata()?.invoiceDownloadCount).toBe(7);+ expect(onChange).not.toHaveBeenCalled();+ });++ it("tells subscribers about an update", async () => {+ const { ensureAppMetadata, subscribeToAppMetadata, updateAppMetadata } =+ await loadStore();+ ensureAppMetadata();++ const onChange = vi.fn();+ subscribeToAppMetadata(onChange);++ updateAppMetadata((current) => {+ return { ...current, invoiceSharedCount: 3 };+ });++ expect(onChange).toHaveBeenCalledTimes(1);+ });++ it("tells subscribers about a reset, and overwrites what was there", async () => {+ const {+ ensureAppMetadata,+ getAppMetadata,+ resetAppMetadata,+ subscribeToAppMetadata,+ updateAppMetadata,+ } = await loadStore();+ ensureAppMetadata();+ updateAppMetadata((current) => {+ return { ...current, invoiceSharedCount: 5 };+ });++ const onChange = vi.fn();+ subscribeToAppMetadata(onChange);++ resetAppMetadata();++ expect(getAppMetadata()?.invoiceSharedCount).toBe(0);+ expect(onChange).toHaveBeenCalledTimes(1);+ });++ it("stops telling a subscriber that unsubscribed", async () => {+ const { ensureAppMetadata, subscribeToAppMetadata, updateAppMetadata } =+ await loadStore();+ ensureAppMetadata();++ const onChange = vi.fn();+ const unsubscribe = subscribeToAppMetadata(onChange);+ unsubscribe();++ updateAppMetadata((current) => {+ return { ...current, invoiceSharedCount: 1 };+ });++ expect(onChange).not.toHaveBeenCalled();+ });++ // `useSyncExternalStore` re-renders whenever the snapshot's identity changes, so a getter+ // that parsed afresh on every call would loop forever.+ it("hands back the same snapshot until the stored value changes", async () => {+ const { ensureAppMetadata, getAppMetadataSnapshot, updateAppMetadata } =+ await loadStore();+ ensureAppMetadata();++ const first = getAppMetadataSnapshot();++ expect(getAppMetadataSnapshot()).toBe(first);+ expect(getAppMetadataSnapshot()).toBe(first);++ updateAppMetadata((current) => {+ return { ...current, invoiceDownloadCount: 2 };+ });++ const second = getAppMetadataSnapshot();++ expect(second).not.toBe(first);+ expect(second?.invoiceDownloadCount).toBe(2);+ });++ it("reports no metadata when the store is empty", async () => {+ const { getAppMetadataSnapshot } = await loadStore();++ expect(getAppMetadataSnapshot()).toBeNull();+ });+});diff --git a/src/app/(app)/utils/__tests__/invoice-number-breaking-change.test.ts b/src/app/(main)/(app)/utils/__tests__/invoice-number-breaking-change.test.tssimilarity index 99%rename from src/app/(app)/utils/__tests__/invoice-number-breaking-change.test.tsrename to src/app/(main)/(app)/utils/__tests__/invoice-number-breaking-change.test.tsindex 4a5f65e..ae55fe7 100644--- a/src/app/(app)/utils/__tests__/invoice-number-breaking-change.test.ts+++ b/src/app/(main)/(app)/utils/__tests__/invoice-number-breaking-change.test.ts@@ -1,6 +1,6 @@import { describe, it, expect, vi, beforeEach } from "vitest";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { SUPPORTED_LANGUAGES, type InvoiceData } from "@/app/schema";import { handleInvoiceNumberBreakingChange } from "../invoice-number-breaking-change";diff --git a/src/app/(app)/utils/__tests__/select-invoice-template.test.ts b/src/app/(main)/(app)/utils/__tests__/select-invoice-template.test.tssimilarity index 97%rename from src/app/(app)/utils/__tests__/select-invoice-template.test.tsrename to src/app/(main)/(app)/utils/__tests__/select-invoice-template.test.tsindex c7f42eb..c1558b7 100644--- a/src/app/(app)/utils/__tests__/select-invoice-template.test.ts+++ b/src/app/(main)/(app)/utils/__tests__/select-invoice-template.test.ts@@ -3,7 +3,7 @@ import { describe, it, expect } from "vitest";import {getDefaultInvoiceNumberLabel,INVOICE_PDF_TRANSLATIONS,-} from "@/app/(app)/pdf-i18n-translations/pdf-translations";+} from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { getInitialInvoiceData, INITIAL_INVOICE_DATA } from "@/app/constants";import type { InvoiceData } from "@/app/schema";diff --git a/src/app/(app)/utils/app-local-storage.ts b/src/app/(main)/(app)/utils/app-local-storage.tssimilarity index 100%rename from src/app/(app)/utils/app-local-storage.tsrename to src/app/(main)/(app)/utils/app-local-storage.tsdiff --git a/src/app/(app)/utils/changelog-seen-storage.ts b/src/app/(main)/(app)/utils/changelog-seen-storage.tssimilarity index 93%rename from src/app/(app)/utils/changelog-seen-storage.tsrename to src/app/(main)/(app)/utils/changelog-seen-storage.tsindex 654d29c..df23d6a 100644--- a/src/app/(app)/utils/changelog-seen-storage.ts+++ b/src/app/(main)/(app)/utils/changelog-seen-storage.ts@@ -3,7 +3,7 @@import {getAppStorageItem,setAppStorageItem,-} from "@/app/(app)/utils/app-local-storage";+} from "@/app/(main)/(app)/utils/app-local-storage";import { CHANGELOG_SEEN_STORAGE_KEY } from "@/app/schema";/**diff --git a/src/app/(app)/utils/format-currency.tsx b/src/app/(main)/(app)/utils/format-currency.tsxsimilarity index 100%rename from src/app/(app)/utils/format-currency.tsxrename to src/app/(main)/(app)/utils/format-currency.tsxdiff --git a/src/app/(app)/utils/format-date-with-locale.ts b/src/app/(main)/(app)/utils/format-date-with-locale.tssimilarity index 100%rename from src/app/(app)/utils/format-date-with-locale.tsrename to src/app/(main)/(app)/utils/format-date-with-locale.tsdiff --git a/src/app/(app)/utils/format-service-period.ts b/src/app/(main)/(app)/utils/format-service-period.tssimilarity index 100%rename from src/app/(app)/utils/format-service-period.tsrename to src/app/(main)/(app)/utils/format-service-period.tsdiff --git a/src/app/(app)/utils/generate-qr-code-data-url.ts b/src/app/(main)/(app)/utils/generate-qr-code-data-url.tssimilarity index 100%rename from src/app/(app)/utils/generate-qr-code-data-url.tsrename to src/app/(main)/(app)/utils/generate-qr-code-data-url.tsdiff --git a/src/app/(app)/utils/get-app-metadata.tsx b/src/app/(main)/(app)/utils/get-app-metadata.tsxsimilarity index 51%rename from src/app/(app)/utils/get-app-metadata.tsxrename to src/app/(main)/(app)/utils/get-app-metadata.tsxindex d0dfb34..341e23e 100644--- a/src/app/(app)/utils/get-app-metadata.tsx+++ b/src/app/(main)/(app)/utils/get-app-metadata.tsx@@ -6,7 +6,7 @@ import dayjs from "dayjs";import {getAppStorageItem,setAppStorageItem,-} from "@/app/(app)/utils/app-local-storage";+} from "@/app/(main)/(app)/utils/app-local-storage";import {METADATA_LOCAL_STORAGE_KEY,metadataSchema,@@ -30,6 +30,72 @@ export const DEFAULT_METADATA = {invoiceSharedCount: 0,} as const satisfies Metadata;+/**+ * Subscribers to the metadata store, notified after every successful write.+ *+ * `localStorage` has no change event for the tab that wrote it, so a component reading+ * metadata has no way of hearing about its own app's updates. This is that event.+ */+const appMetadataListeners = new Set<() => void>();++function notifyAppMetadataListeners() {+ for (const listener of appMetadataListeners) {+ listener();+ }+}++/**+ * Subscribes to app metadata writes. Shaped for `useSyncExternalStore`.+ *+ * @param onStoreChange - Called after every write made through {@link updateAppMetadata}.+ * @returns The unsubscribe function.+ */+export function subscribeToAppMetadata(onStoreChange: () => void) {+ appMetadataListeners.add(onStoreChange);++ return () => {+ appMetadataListeners.delete(onStoreChange);+ };+}++/** The last value {@link getAppMetadataSnapshot} returned, and the raw string it came from. */+let cachedRawMetadata: string | null = null;+let cachedMetadata: Metadata | null = null;+let hasCachedMetadata = false;++/**+ * The current metadata, as a value that keeps its identity until the stored string changes.+ *+ * {@link getAppMetadata} parses and validates on every call and so hands back a new object+ * each time -- fine for a one-off read in an effect, but `useSyncExternalStore` compares+ * snapshots by identity and would spin forever on it. Caching against the raw string also+ * means the `JSON.parse` and the zod validation only run when the metadata actually changed,+ * rather than on every render of every component that displays it.+ */+export function getAppMetadataSnapshot(): Metadata | null {+ const raw = getAppStorageItem(METADATA_LOCAL_STORAGE_KEY);++ if (hasCachedMetadata && raw === cachedRawMetadata) {+ return cachedMetadata;+ }++ cachedRawMetadata = raw;+ cachedMetadata = getAppMetadata();+ hasCachedMetadata = true;++ return cachedMetadata;+}++/**+ * Metadata as seen while server rendering: there is no `localStorage` there.+ *+ * A separate function from the client snapshot because React requires a server snapshot to+ * be constant, and it must not be the cached client value.+ */+export function getServerAppMetadataSnapshot(): Metadata | null {+ return null;+}+/*** Retrieves and validates the app metadata from **local storage**.*@@ -69,6 +135,39 @@ export function getAppMetadata() {return null;}}+/**+ * Overwrites the stored metadata with the defaults.+ *+ * Note this is *not* expressible as an `updateAppMetadata` call: that one reads the current+ * metadata first and bails when there is none, which is exactly the situation both callers of+ * {@link ensureAppMetadata} are in.+ */+export function resetAppMetadata() {+ setAppStorageItem({+ key: METADATA_LOCAL_STORAGE_KEY,+ value: JSON.stringify(DEFAULT_METADATA),+ });++ notifyAppMetadataListeners();+}++/**+ * Seeds the defaults for anyone who has none stored yet -- a first-time visitor, or someone+ * who used the app before metadata existed.+ *+ * Lives here rather than at the call sites so that every write to the metadata key goes+ * through this module and therefore notifies {@link subscribeToAppMetadata}. The call sites+ * used to write `localStorage` directly, which was invisible to subscribers; harmless while+ * both of them ran before anything had subscribed, but only by accident.+ */+export function ensureAppMetadata() {+ if (getAppMetadata()) {+ return;+ }++ resetAppMetadata();+}+/*** Updates the app metadata in **local storage** using an updater function.*@@ -107,10 +206,7 @@ export function updateAppMetadata(updater: (current: Metadata) => Metadata) {console.error("[updateAppMetadata] Validation error:", parsed.error);// reset the metadata to default if validation fails, we want to fail silently and not block the app- setAppStorageItem({- key: METADATA_LOCAL_STORAGE_KEY,- value: JSON.stringify(DEFAULT_METADATA),- });+ resetAppMetadata();Sentry.captureException(parsed.error);@@ -122,6 +218,8 @@ export function updateAppMetadata(updater: (current: Metadata) => Metadata) {key: METADATA_LOCAL_STORAGE_KEY,value: JSON.stringify(parsed.data),});++ notifyAppMetadataListeners();} catch (error) {console.error("[updateAppMetadata] Failed to save metadata:", error);Sentry.captureException(error);diff --git a/src/app/(app)/utils/invoice-number-breaking-change.ts b/src/app/(main)/(app)/utils/invoice-number-breaking-change.tssimilarity index 94%rename from src/app/(app)/utils/invoice-number-breaking-change.tsrename to src/app/(main)/(app)/utils/invoice-number-breaking-change.tsindex 7c58496..5ea5d9e 100644--- a/src/app/(app)/utils/invoice-number-breaking-change.ts+++ b/src/app/(main)/(app)/utils/invoice-number-breaking-change.ts@@ -1,6 +1,6 @@import { z } from "zod";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { SUPPORTED_LANGUAGES } from "@/app/schema";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";diff --git a/src/app/(app)/utils/select-invoice-template.ts b/src/app/(main)/(app)/utils/select-invoice-template.tssimilarity index 93%rename from src/app/(app)/utils/select-invoice-template.tsrename to src/app/(main)/(app)/utils/select-invoice-template.tsindex 81f7ac9..ec06ff3 100644--- a/src/app/(app)/utils/select-invoice-template.ts+++ b/src/app/(main)/(app)/utils/select-invoice-template.ts@@ -1,4 +1,4 @@-import { getDefaultInvoiceNumberLabel } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { getDefaultInvoiceNumberLabel } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import {SUPPORTED_TEMPLATES,type InvoiceData,diff --git a/src/app/(app)/utils/welcome-popup-seen-storage.ts b/src/app/(main)/(app)/utils/welcome-popup-seen-storage.tssimilarity index 89%rename from src/app/(app)/utils/welcome-popup-seen-storage.tsrename to src/app/(main)/(app)/utils/welcome-popup-seen-storage.tsindex bf919ad..c1ec048 100644--- a/src/app/(app)/utils/welcome-popup-seen-storage.ts+++ b/src/app/(main)/(app)/utils/welcome-popup-seen-storage.ts@@ -3,7 +3,7 @@import {getAppStorageItem,setAppStorageItem,-} from "@/app/(app)/utils/app-local-storage";+} from "@/app/(main)/(app)/utils/app-local-storage";import { WELCOME_POPUP_SEEN_STORAGE_KEY } from "@/app/schema";const WELCOME_POPUP_SEEN_VALUE = "v1";diff --git a/src/app/(seo-landings)/__tests__/build-seo-landing-json-ld.test.ts b/src/app/(main)/(seo-landings)/__tests__/build-seo-landing-json-ld.test.tssimilarity index 100%rename from src/app/(seo-landings)/__tests__/build-seo-landing-json-ld.test.tsrename to src/app/(main)/(seo-landings)/__tests__/build-seo-landing-json-ld.test.tsdiff --git a/src/app/(seo-landings)/build-seo-landing-json-ld.ts b/src/app/(main)/(seo-landings)/build-seo-landing-json-ld.tssimilarity index 100%rename from src/app/(seo-landings)/build-seo-landing-json-ld.tsrename to src/app/(main)/(seo-landings)/build-seo-landing-json-ld.tsdiff --git a/src/app/(seo-landings)/components/seo-landing-json-ld.tsx b/src/app/(main)/(seo-landings)/components/seo-landing-json-ld.tsxsimilarity index 100%rename from src/app/(seo-landings)/components/seo-landing-json-ld.tsxrename to src/app/(main)/(seo-landings)/components/seo-landing-json-ld.tsxdiff --git a/src/app/(seo-landings)/components/seo-landing-shell.tsx b/src/app/(main)/(seo-landings)/components/seo-landing-shell.tsxsimilarity index 99%rename from src/app/(seo-landings)/components/seo-landing-shell.tsxrename to src/app/(main)/(seo-landings)/components/seo-landing-shell.tsxindex e3348f3..5f5109f 100644--- a/src/app/(seo-landings)/components/seo-landing-shell.tsx+++ b/src/app/(main)/(seo-landings)/components/seo-landing-shell.tsx@@ -3,7 +3,7 @@ import Link from "next/link";import { Footer } from "@/app/(components)/footer";import { Header } from "@/app/(components)/header";import { BlackGoToAppButton } from "@/app/(components)/header/go-to-app-button-cta";-import { StickySeoCta } from "@/app/(seo-landings)/components/sticky-seo-cta";+import { StickySeoCta } from "@/app/(main)/(seo-landings)/components/sticky-seo-cta";import { GithubIcon } from "@/components/etc/github-logo";import { Button } from "@/components/ui/button";import { FaqAccordion, FaqAccordionItem } from "@/components/ui/faq-accordion";diff --git a/src/app/(seo-landings)/components/sticky-seo-cta.tsx b/src/app/(main)/(seo-landings)/components/sticky-seo-cta.tsxsimilarity index 100%rename from src/app/(seo-landings)/components/sticky-seo-cta.tsxrename to src/app/(main)/(seo-landings)/components/sticky-seo-cta.tsxdiff --git a/src/app/(seo-landings)/invoice-generator-no-login/page.tsx b/src/app/(main)/(seo-landings)/invoice-generator-no-login/page.tsxsimilarity index 76%rename from src/app/(seo-landings)/invoice-generator-no-login/page.tsxrename to src/app/(main)/(seo-landings)/invoice-generator-no-login/page.tsxindex 2a098c8..3eb8440 100644--- a/src/app/(seo-landings)/invoice-generator-no-login/page.tsx+++ b/src/app/(main)/(seo-landings)/invoice-generator-no-login/page.tsx@@ -1,9 +1,7 @@import {buildSeoLandingMetadata,SeoLandingRoutePage,-} from "@/app/(seo-landings)/seo-landing-route";--export const dynamic = "force-static";+} from "@/app/(main)/(seo-landings)/seo-landing-route";export const generateMetadata = () => {return buildSeoLandingMetadata("invoice-generator-no-login");diff --git a/src/app/(seo-landings)/invoice-template-pdf/page.tsx b/src/app/(main)/(seo-landings)/invoice-template-pdf/page.tsxsimilarity index 75%rename from src/app/(seo-landings)/invoice-template-pdf/page.tsxrename to src/app/(main)/(seo-landings)/invoice-template-pdf/page.tsxindex e71860f..197a9cc 100644--- a/src/app/(seo-landings)/invoice-template-pdf/page.tsx+++ b/src/app/(main)/(seo-landings)/invoice-template-pdf/page.tsx@@ -1,9 +1,7 @@import {buildSeoLandingMetadata,SeoLandingRoutePage,-} from "@/app/(seo-landings)/seo-landing-route";--export const dynamic = "force-static";+} from "@/app/(main)/(seo-landings)/seo-landing-route";export const generateMetadata = () => {return buildSeoLandingMetadata("invoice-template-pdf");diff --git a/src/app/(seo-landings)/layout.tsx b/src/app/(main)/(seo-landings)/layout.tsxsimilarity index 100%rename from src/app/(seo-landings)/layout.tsxrename to src/app/(main)/(seo-landings)/layout.tsxdiff --git a/src/app/(seo-landings)/open-source-invoice-generator/page.tsx b/src/app/(main)/(seo-landings)/open-source-invoice-generator/page.tsxsimilarity index 77%rename from src/app/(seo-landings)/open-source-invoice-generator/page.tsxrename to src/app/(main)/(seo-landings)/open-source-invoice-generator/page.tsxindex 2a199ef..0fe4ea4 100644--- a/src/app/(seo-landings)/open-source-invoice-generator/page.tsx+++ b/src/app/(main)/(seo-landings)/open-source-invoice-generator/page.tsx@@ -1,9 +1,7 @@import {buildSeoLandingMetadata,SeoLandingRoutePage,-} from "@/app/(seo-landings)/seo-landing-route";--export const dynamic = "force-static";+} from "@/app/(main)/(seo-landings)/seo-landing-route";export const generateMetadata = () => {return buildSeoLandingMetadata("open-source-invoice-generator");diff --git a/src/app/(seo-landings)/seo-landing-definitions.ts b/src/app/(main)/(seo-landings)/seo-landing-definitions.tssimilarity index 99%rename from src/app/(seo-landings)/seo-landing-definitions.tsrename to src/app/(main)/(seo-landings)/seo-landing-definitions.tsindex c2c9f00..475e6b0 100644--- a/src/app/(seo-landings)/seo-landing-definitions.ts+++ b/src/app/(main)/(seo-landings)/seo-landing-definitions.ts@@ -9,7 +9,7 @@ export const SEO_LANDING_SLUGS = [export type SeoLandingSlug = (typeof SEO_LANDING_SLUGS)[number];-export interface SeoFaqItem {+interface SeoFaqItem {question: string;answer: string;}diff --git a/src/app/(seo-landings)/seo-landing-footer-links.ts b/src/app/(main)/(seo-landings)/seo-landing-footer-links.tssimilarity index 100%rename from src/app/(seo-landings)/seo-landing-footer-links.tsrename to src/app/(main)/(seo-landings)/seo-landing-footer-links.tsdiff --git a/src/app/(seo-landings)/seo-landing-route.tsx b/src/app/(main)/(seo-landings)/seo-landing-route.tsxsimilarity index 93%rename from src/app/(seo-landings)/seo-landing-route.tsxrename to src/app/(main)/(seo-landings)/seo-landing-route.tsxindex 0b87e95..c4988ec 100644--- a/src/app/(seo-landings)/seo-landing-route.tsx+++ b/src/app/(main)/(seo-landings)/seo-landing-route.tsx@@ -1,10 +1,10 @@import type { Metadata } from "next";-import { SeoLandingShell } from "@/app/(seo-landings)/components/seo-landing-shell";+import { SeoLandingShell } from "@/app/(main)/(seo-landings)/components/seo-landing-shell";import {SEO_LANDING_DEFINITIONS,type SeoLandingSlug,-} from "@/app/(seo-landings)/seo-landing-definitions";+} from "@/app/(main)/(seo-landings)/seo-landing-definitions";import { APP_URL, STATIC_ASSETS_URL, TWITTER_CREATOR } from "@/config";export function buildSeoLandingMetadata(slug: SeoLandingSlug): Metadata {diff --git a/src/app/(seo-landings)/stripe-invoice-alternative/page.tsx b/src/app/(main)/(seo-landings)/stripe-invoice-alternative/page.tsxsimilarity index 76%rename from src/app/(seo-landings)/stripe-invoice-alternative/page.tsxrename to src/app/(main)/(seo-landings)/stripe-invoice-alternative/page.tsxindex ddd62d0..14716e0 100644--- a/src/app/(seo-landings)/stripe-invoice-alternative/page.tsx+++ b/src/app/(main)/(seo-landings)/stripe-invoice-alternative/page.tsx@@ -1,9 +1,7 @@import {buildSeoLandingMetadata,SeoLandingRoutePage,-} from "@/app/(seo-landings)/seo-landing-route";--export const dynamic = "force-static";+} from "@/app/(main)/(seo-landings)/seo-landing-route";export const generateMetadata = () => {return buildSeoLandingMetadata("stripe-invoice-alternative");diff --git a/src/app/changelog/[slug]/page.tsx b/src/app/(main)/changelog/[slug]/page.tsxsimilarity index 99%rename from src/app/changelog/[slug]/page.tsxrename to src/app/(main)/changelog/[slug]/page.tsxindex 6db75e1..8958ec1 100644--- a/src/app/changelog/[slug]/page.tsx+++ b/src/app/(main)/changelog/[slug]/page.tsx@@ -10,7 +10,7 @@ import {getChangelogEntries,getNextChangelogEntry,getPreviousChangelogEntry,-} from "@/app/changelog/utils";+} from "@/app/(main)/changelog/utils";import {APP_URL,PERSONAL_WEBSITE_URL,diff --git a/src/app/changelog/build-changelog-json-ld.ts b/src/app/(main)/changelog/build-changelog-json-ld.tssimilarity index 100%rename from src/app/changelog/build-changelog-json-ld.tsrename to src/app/(main)/changelog/build-changelog-json-ld.tsdiff --git a/src/app/changelog/changelog-index-json-ld.tsx b/src/app/(main)/changelog/changelog-index-json-ld.tsxsimilarity index 100%rename from src/app/changelog/changelog-index-json-ld.tsxrename to src/app/(main)/changelog/changelog-index-json-ld.tsxdiff --git a/src/app/changelog/changelog-post-json-ld.tsx b/src/app/(main)/changelog/changelog-post-json-ld.tsxsimilarity index 100%rename from src/app/changelog/changelog-post-json-ld.tsxrename to src/app/(main)/changelog/changelog-post-json-ld.tsxdiff --git a/src/app/changelog/components/changelog-author-byline.tsx b/src/app/(main)/changelog/components/changelog-author-byline.tsxsimilarity index 100%rename from src/app/changelog/components/changelog-author-byline.tsxrename to src/app/(main)/changelog/components/changelog-author-byline.tsxdiff --git a/src/app/changelog/components/changelog-version-badge-link.tsx b/src/app/(main)/changelog/components/changelog-version-badge-link.tsxsimilarity index 90%rename from src/app/changelog/components/changelog-version-badge-link.tsxrename to src/app/(main)/changelog/components/changelog-version-badge-link.tsxindex 225e3b1..4c4d396 100644--- a/src/app/changelog/components/changelog-version-badge-link.tsx+++ b/src/app/(main)/changelog/components/changelog-version-badge-link.tsx@@ -1,4 +1,4 @@-import { getChangelogReleaseNotesUrl } from "@/app/changelog/utils";+import { getChangelogReleaseNotesUrl } from "@/app/(main)/changelog/utils";interface ChangelogVersionBadgeLinkProps {version: string;diff --git a/src/app/changelog/components/date-time.tsx b/src/app/(main)/changelog/components/date-time.tsxsimilarity index 100%rename from src/app/changelog/components/date-time.tsxrename to src/app/(main)/changelog/components/date-time.tsxdiff --git a/src/app/changelog/content/easy-invoice-pdf-launch.mdx b/src/app/(main)/changelog/content/easy-invoice-pdf-launch.mdxsimilarity index 100%rename from src/app/changelog/content/easy-invoice-pdf-launch.mdxrename to src/app/(main)/changelog/content/easy-invoice-pdf-launch.mdxdiff --git a/src/app/changelog/content/faster-pdf-preview-and-mobile-polish.mdx b/src/app/(main)/changelog/content/faster-pdf-preview-and-mobile-polish.mdxsimilarity index 100%rename from src/app/changelog/content/faster-pdf-preview-and-mobile-polish.mdxrename to src/app/(main)/changelog/content/faster-pdf-preview-and-mobile-polish.mdxdiff --git a/src/app/changelog/content/qr-codes-and-improvements.mdx b/src/app/(main)/changelog/content/qr-codes-and-improvements.mdxsimilarity index 100%rename from src/app/changelog/content/qr-codes-and-improvements.mdxrename to src/app/(main)/changelog/content/qr-codes-and-improvements.mdxdiff --git a/src/app/changelog/content/seller-buyer-improvements.mdx b/src/app/(main)/changelog/content/seller-buyer-improvements.mdxsimilarity index 100%rename from src/app/changelog/content/seller-buyer-improvements.mdxrename to src/app/(main)/changelog/content/seller-buyer-improvements.mdxdiff --git a/src/app/changelog/content/stripe-pdf-template.mdx b/src/app/(main)/changelog/content/stripe-pdf-template.mdxsimilarity index 100%rename from src/app/changelog/content/stripe-pdf-template.mdxrename to src/app/(main)/changelog/content/stripe-pdf-template.mdxdiff --git a/src/app/changelog/layout.tsx b/src/app/(main)/changelog/layout.tsxsimilarity index 96%rename from src/app/changelog/layout.tsxrename to src/app/(main)/changelog/layout.tsxindex 91a7240..1e9f712 100644--- a/src/app/changelog/layout.tsx+++ b/src/app/(main)/changelog/layout.tsx@@ -14,9 +14,6 @@ import {} from "./build-changelog-json-ld";import { ChangelogIndexJsonLd } from "./changelog-index-json-ld";-// Enable static generation for changelog layout-export const dynamic = "force-static";-export const metadata: Metadata = {title: CHANGELOG_INDEX_TITLE,description: CHANGELOG_INDEX_DESCRIPTION,diff --git a/src/app/changelog/loading.tsx b/src/app/(main)/changelog/loading.tsxsimilarity index 100%rename from src/app/changelog/loading.tsxrename to src/app/(main)/changelog/loading.tsxdiff --git a/src/app/changelog/page.tsx b/src/app/(main)/changelog/page.tsxsimilarity index 97%rename from src/app/changelog/page.tsxrename to src/app/(main)/changelog/page.tsxindex 98ca096..07f3e35 100644--- a/src/app/changelog/page.tsx+++ b/src/app/(main)/changelog/page.tsx@@ -6,15 +6,12 @@ import {formatChangelogDate,getChangelogEntries,type ChangelogEntry,-} from "@/app/changelog/utils";+} from "@/app/(main)/changelog/utils";import { ChangelogAuthorByline } from "./components/changelog-author-byline";import { ChangelogVersionBadgeLink } from "./components/changelog-version-badge-link";import { DateTime } from "./components/date-time";-// Enable static generation for this page-export const dynamic = "force-static";-// https://nextjs.org/docs/app/guides/mdx/**diff --git a/src/app/changelog/utils.ts b/src/app/(main)/changelog/utils.tssimilarity index 99%rename from src/app/changelog/utils.tsrename to src/app/(main)/changelog/utils.tsindex 1a8a871..10d08bc 100644--- a/src/app/changelog/utils.ts+++ b/src/app/(main)/changelog/utils.ts@@ -89,6 +89,7 @@ async function getChangelogFiles(): Promise<string[]> {process.cwd(),"src","app",+ "(main)","changelog","content",);diff --git a/src/app/founder/build-founder-json-ld.ts b/src/app/(main)/founder/build-founder-json-ld.tssimilarity index 100%rename from src/app/founder/build-founder-json-ld.tsrename to src/app/(main)/founder/build-founder-json-ld.tsdiff --git a/src/app/founder/components/animated-div.tsx b/src/app/(main)/founder/components/animated-div.tsxsimilarity index 100%rename from src/app/founder/components/animated-div.tsxrename to src/app/(main)/founder/components/animated-div.tsxdiff --git a/src/app/founder/components/animated-signature.tsx b/src/app/(main)/founder/components/animated-signature.tsxsimilarity index 100%rename from src/app/founder/components/animated-signature.tsxrename to src/app/(main)/founder/components/animated-signature.tsxdiff --git a/src/app/founder/founder-json-ld.tsx b/src/app/(main)/founder/founder-json-ld.tsxsimilarity index 100%rename from src/app/founder/founder-json-ld.tsxrename to src/app/(main)/founder/founder-json-ld.tsxdiff --git a/src/app/founder/layout.tsx b/src/app/(main)/founder/layout.tsxsimilarity index 98%rename from src/app/founder/layout.tsxrename to src/app/(main)/founder/layout.tsxindex cb09d96..93624c0 100644--- a/src/app/founder/layout.tsx+++ b/src/app/(main)/founder/layout.tsx@@ -15,8 +15,6 @@ import {import { FounderJsonLd } from "./founder-json-ld";-export const dynamic = "force-static";-const ogImageAlt = "Vlad Sazonau, founder of EasyInvoicePDF — product engineer";export const metadata: Metadata = {diff --git a/src/app/founder/page.tsx b/src/app/(main)/founder/page.tsxsimilarity index 96%rename from src/app/founder/page.tsxrename to src/app/(main)/founder/page.tsxindex 5365122..d08b230 100644--- a/src/app/founder/page.tsx+++ b/src/app/(main)/founder/page.tsx@@ -5,8 +5,8 @@ import Link from "next/link";import {AnimatedDiv,blockEnterSpring,-} from "@/app/founder/components/animated-div";-import { AnimatedSignature } from "@/app/founder/components/animated-signature";+} from "@/app/(main)/founder/components/animated-div";+import { AnimatedSignature } from "@/app/(main)/founder/components/animated-signature";import { LINKEDIN_URL, TWITTER_URL } from "@/config";export default function ContactPage() {diff --git a/src/app/how-it-works/build-how-it-works-json-ld.test.ts b/src/app/(main)/how-it-works/build-how-it-works-json-ld.test.tssimilarity index 100%rename from src/app/how-it-works/build-how-it-works-json-ld.test.tsrename to src/app/(main)/how-it-works/build-how-it-works-json-ld.test.tsdiff --git a/src/app/how-it-works/build-how-it-works-json-ld.ts b/src/app/(main)/how-it-works/build-how-it-works-json-ld.tssimilarity index 100%rename from src/app/how-it-works/build-how-it-works-json-ld.tsrename to src/app/(main)/how-it-works/build-how-it-works-json-ld.tsdiff --git a/src/app/how-it-works/how-it-works-json-ld.tsx b/src/app/(main)/how-it-works/how-it-works-json-ld.tsxsimilarity index 100%rename from src/app/how-it-works/how-it-works-json-ld.tsxrename to src/app/(main)/how-it-works/how-it-works-json-ld.tsxdiff --git a/src/app/how-it-works/layout.tsx b/src/app/(main)/how-it-works/layout.tsxsimilarity index 98%rename from src/app/how-it-works/layout.tsxrename to src/app/(main)/how-it-works/layout.tsxindex ed407ff..0a98648 100644--- a/src/app/how-it-works/layout.tsx+++ b/src/app/(main)/how-it-works/layout.tsx@@ -10,8 +10,6 @@ import {import { HowItWorksJsonLd } from "./how-it-works-json-ld";-export const dynamic = "force-static";-const HOW_IT_WORKS_PAGE_URL = "https://easyinvoicepdf.com/how-it-works";const PAGE_TITLE = "How EasyInvoicePDF Works | Video Tutorials";diff --git a/src/app/how-it-works/page.tsx b/src/app/(main)/how-it-works/page.tsxsimilarity index 97%rename from src/app/how-it-works/page.tsxrename to src/app/(main)/how-it-works/page.tsxindex 79935ca..fe7becd 100644--- a/src/app/how-it-works/page.tsx+++ b/src/app/(main)/how-it-works/page.tsx@@ -2,12 +2,10 @@ import { ArrowRightIcon } from "lucide-react";import Link from "next/link";import { Suspense } from "react";-import { HowItWorksVideos } from "@/app/(app)/components/how-it-works-videos";+import { HowItWorksVideos } from "@/app/(main)/(app)/components/how-it-works-videos";import { HOW_IT_WORKS_VIDEOS } from "@/config";import { cn } from "@/lib/utils";-export const dynamic = "force-static";-const linkClassName ="font-medium text-slate-950 underline decoration-slate-400 underline-offset-2 transition-colors hover:text-slate-950/90 hover:decoration-slate-500";diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsxnew file mode 100644index 0000000..05fc1dc--- /dev/null+++ b/src/app/(main)/layout.tsx@@ -0,0 +1,21 @@+import type { Metadata, Viewport } from "next";++import {+ RootDocument,+ rootMetadata,+ rootViewport,+} from "@/app/(components)/root-document";+import { routing } from "@/i18n/routing";++export const viewport: Viewport = rootViewport;++export const metadata: Metadata = rootMetadata;++/**+ * Root layout of the unprefixed routes (`/`, `/changelog`, `/tos`, ...), which are+ * only served in the default locale. The localized pages have their own root+ * layout in `src/app/[locale]/layout.tsx`.+ */+export default function MainRootLayout({ children }: LayoutProps<"/">) {+ return <RootDocument lang={routing.defaultLocale}>{children}</RootDocument>;+}diff --git a/src/app/(main)/not-found.tsx b/src/app/(main)/not-found.tsxnew file mode 100644index 0000000..3d04b8d--- /dev/null+++ b/src/app/(main)/not-found.tsx@@ -0,0 +1,3 @@+import { NotFoundPage } from "@/app/(components)/not-found-page";++export default NotFoundPage;diff --git a/src/app/tos/layout.tsx b/src/app/(main)/tos/layout.tsxsimilarity index 98%rename from src/app/tos/layout.tsxrename to src/app/(main)/tos/layout.tsxindex 6b34313..a4c2dce 100644--- a/src/app/tos/layout.tsx+++ b/src/app/(main)/tos/layout.tsx@@ -8,8 +8,6 @@ import {TWITTER_CREATOR,} from "@/config";-export const dynamic = "force-static";-export const metadata: Metadata = {title: "Terms of Service | EasyInvoicePDF",description:diff --git a/src/app/tos/loading.tsx b/src/app/(main)/tos/loading.tsxsimilarity index 100%rename from src/app/tos/loading.tsxrename to src/app/(main)/tos/loading.tsxdiff --git a/src/app/tos/page.tsx b/src/app/(main)/tos/page.tsxsimilarity index 100%rename from src/app/tos/page.tsxrename to src/app/(main)/tos/page.tsxdiff --git a/src/app/[locale]/[...rest]/page.tsx b/src/app/[locale]/[...rest]/page.tsxdeleted file mode 100644index 2dc2960..0000000--- a/src/app/[locale]/[...rest]/page.tsx+++ /dev/null@@ -1,5 +0,0 @@-import { notFound } from "next/navigation";--export default function CatchAllPage() {- notFound();-}diff --git a/src/app/[locale]/[[...rest]]/page.tsx b/src/app/[locale]/[[...rest]]/page.tsxnew file mode 100644index 0000000..00e3d80--- /dev/null+++ b/src/app/[locale]/[[...rest]]/page.tsx@@ -0,0 +1,13 @@+import { notFound } from "next/navigation";++/**+ * Optional catch-all under the `[locale]` root layout.+ *+ * Besides `/en/whatever`, this also catches every single-segment URL that no other+ * route claims (`/en`, `/non-existent-page`): with two root layouts there is no+ * top-level `not-found.tsx` any more, so without this Next.js would answer those+ * with its built-in 404 document instead of `src/app/[locale]/not-found.tsx`.+ */+export default function CatchAllPage() {+ notFound();+}diff --git a/src/app/[locale]/about/components/__tests__/legacy-video-fallback.test.tsx b/src/app/[locale]/about/components/__tests__/legacy-video-fallback.test.tsxnew file mode 100644index 0000000..dec963e--- /dev/null+++ b/src/app/[locale]/about/components/__tests__/legacy-video-fallback.test.tsx@@ -0,0 +1,186 @@+// @vitest-environment happy-dom++import { cleanup, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";++import { VIDEO_DEMO_FALLBACK_IMG, VIDEO_DEMO_YOUTUBE_URL } from "@/config";++import { FeaturesCarousel } from "../features-carousel";+import { HeroDemoVideo } from "../hero-demo-video";++/**+ * The two ends of the `useSupportsInlineVideo` swap on the about page. The thresholds+ * themselves live in `src/utils/__tests__/browser-support.test.ts`; this is about the+ * components actually rendering the other branch once the hook says so.+ *+ * The feature cards pick their player on two axes — viewport width and whether the+ * browser can play the MP4s inline — so both are stubbed here.+ */++const CHROME_141 =+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36";+// the reported case: an iPhone on the last iOS it can run+const IOS_SAFARI_15 =+ "Mozilla/5.0 (iPhone; CPU iPhone OS 15_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Mobile/15E148 Safari/604.1";++const ORIGINAL_USER_AGENT = window.navigator.userAgent;+const ORIGINAL_MATCH_MEDIA = window.matchMedia;++function setUserAgent(userAgent: string) {+ Object.defineProperty(window.navigator, "userAgent", {+ value: userAgent,+ configurable: true,+ });+}++/**+ * `useIsXlUp` is the only media query the feature cards ask about, so a stub that+ * answers every query the same way is enough to put them on either side of `xl`.+ */+function setIsXlUp(matches: boolean) {+ Object.defineProperty(window, "matchMedia", {+ configurable: true,+ value: (query: string) => {+ return {+ matches,+ media: query,+ onchange: null,+ addEventListener: () => {+ return undefined;+ },+ removeEventListener: () => {+ return undefined;+ },+ dispatchEvent: () => {+ return false;+ },+ };+ },+ });+}++const FEATURES = [+ {+ translationKey: "livePreview",+ title: "Live preview",+ description: "See the invoice update as you type.",+ videoSrc: "https://example.com/live-preview.mp4",+ videoFallbackImg: "https://example.com/live-preview.png",+ videoDescription: "Live preview demo",+ youtubeVideoId: "pWkb_JcKouU",+ },+ {+ translationKey: "openSource",+ title: "Open source",+ description: "Every line of it is on GitHub.",+ videoSrc: "https://example.com/open-source.mp4",+ videoFallbackImg: "https://example.com/open-source.png",+ videoDescription: "Open source demo",+ youtubeVideoId: "mBam1T7peJA",+ },+];++const CAROUSEL_TRANSLATIONS = {+ label: "Product features",+ previousFeature: "Previous feature",+ nextFeature: "Next feature",+};++// the embed waits for a play button press, so the still it stands behind is what says+// "this card went the YouTube way"+function getYouTubeStills() {+ return screen.queryAllByTestId(/-demo-video-youtube-poster$/);+}++afterEach(() => {+ // this project runs vitest without globals, so RTL does not auto-cleanup+ cleanup();+ setUserAgent(ORIGINAL_USER_AGENT);+ Object.defineProperty(window, "matchMedia", {+ configurable: true,+ value: ORIGINAL_MATCH_MEDIA,+ });+});++describe("HeroDemoVideo", () => {+ it("plays the self-hosted demo on a browser that can", () => {+ setUserAgent(CHROME_141);++ render(<HeroDemoVideo />);++ const video = screen.getByTestId("hero-about-page-video");++ // the <source> is only added once the video scrolls into view, so the poster+ // is what identifies it here+ expect(video.getAttribute("poster")).toBe(VIDEO_DEMO_FALLBACK_IMG);+ expect(screen.queryByTestId("hero-about-page-video-youtube")).toBeNull();+ });++ it("swaps in the YouTube embed on iOS 15", () => {+ setUserAgent(IOS_SAFARI_15);++ render(<HeroDemoVideo />);++ const embed = screen.getByTestId("hero-about-page-video-youtube");+ // oxlint-disable-next-line vitest/no-conditional-in-test+ const src = new URL(embed.getAttribute("src") ?? "");++ expect(src.origin + src.pathname).toBe(+ new URL(VIDEO_DEMO_YOUTUBE_URL).origin ++ new URL(VIDEO_DEMO_YOUTUBE_URL).pathname,+ );+ // the clip it stands in for starts on its own, so this one does too+ expect(src.searchParams.get("autoplay")).toBe("1");+ expect(src.searchParams.get("mute")).toBe("1");+ expect(src.searchParams.get("playsinline")).toBe("1");+ expect(screen.queryByTestId("hero-about-page-video")).toBeNull();+ });+});++describe("FeaturesCarousel", () => {+ function renderCarousel() {+ return render(+ <FeaturesCarousel+ features={FEATURES}+ translations={CAROUSEL_TRANSLATIONS}+ />,+ );+ }++ it("plays the self-hosted demos on a wide screen that can play them", () => {+ setUserAgent(CHROME_141);+ setIsXlUp(true);++ renderCarousel();++ expect(screen.getByTestId("livePreview-demo-video")).toBeDefined();+ expect(screen.getByTestId("openSource-demo-video")).toBeDefined();+ expect(getYouTubeStills()).toHaveLength(0);+ });++ it("hands every card to YouTube below xl", () => {+ setUserAgent(CHROME_141);+ setIsXlUp(false);++ renderCarousel();++ expect(getYouTubeStills()).toHaveLength(FEATURES.length);+ expect(screen.queryByTestId("livePreview-demo-video")).toBeNull();+ });++ it("keeps the cards, on YouTube, on a wide screen running iOS 15", () => {+ setUserAgent(IOS_SAFARI_15);+ setIsXlUp(true);++ renderCarousel();++ // the section used to be swapped wholesale for the "How it works" tutorials here,+ // because there was no YouTube copy of each demo; there is one per feature now+ expect(screen.getByTestId("features-carousel")).toBeDefined();+ expect(getYouTubeStills()).toHaveLength(FEATURES.length);+ expect(screen.queryByTestId("livePreview-demo-video")).toBeNull();++ expect(screen.getByText("Live preview")).toBeDefined();+ expect(screen.getByText("Every line of it is on GitHub.")).toBeDefined();+ });+});diff --git a/src/app/[locale]/about/components/feature-card.tsx b/src/app/[locale]/about/components/feature-card.tsxindex 4b64f81..81976af 100644--- a/src/app/[locale]/about/components/feature-card.tsx+++ b/src/app/[locale]/about/components/feature-card.tsx@@ -1,4 +1,7 @@-import { AutoPlayVideo, ManualPlayVideo } from "@/components/video";+import { AutoPlayVideo } from "@/components/video";+import { ManualPlayYouTubeEmbed } from "@/components/youtube-embed-manual-play";+import { useIsXlUp } from "@/hooks/use-media-query";+import { useSupportsInlineVideo } from "@/hooks/use-supports-inline-video";import { cn } from "@/lib/utils";export interface FeatureCardProps {@@ -7,6 +10,8 @@ export interface FeatureCardProps {videoSrc: string;videoFallbackImg: string;videoDescription: string;+ /** Bare YouTube id of the same demo, played on the narrow layout. */+ youtubeVideoId: string;/*** Used to build the video `data-testid`, e.g. `livePreview-demo-video`*/@@ -17,6 +22,18 @@ export interface FeatureCardProps {/*** A single marketing feature card: title, description and a demo video* inside a Mac OS like browser frame.+ *+ * The demo is the self-hosted MP4 on wide screens and the same clip on YouTube below+ * `xl`, where YouTube serves a rendition sized for the device instead of the+ * full-width MP4. Both narrow paths wait for a tap, as the MP4 one always has. The two+ * cannot be swapped with `hidden`/`xl:block` the way they were — an iframe in a+ * display-none container still loads the whole player — so this is a real branch.+ *+ * A wide screen on a browser that cannot play the MP4s inline (iOS 15 and desktop+ * Safari 15 and older) takes the YouTube path too. That used to be handled a level up,+ * by swapping the whole section for the "How it works" tutorials, because there was no+ * YouTube copy of each individual demo; there is one per feature now, so those visitors+ * get the same six cards as everyone else.*/export function FeatureCard({title,@@ -24,11 +41,19 @@ export function FeatureCard({videoSrc,videoFallbackImg,videoDescription,+ youtubeVideoId,translationKey,className,}: FeatureCardProps) {const testId = `${translationKey}-demo-video`;+ // `false` until the effect runs, so the first client render matches the server and+ // the narrow layout — the one that renders a still, not a player — is what hydrates+ const isXlUp = useIsXlUp();+ const canPlayInlineVideo = useSupportsInlineVideo();++ const showsYouTube = !isXlUp || !canPlayInlineVideo;+return (<divclassName={cn(@@ -62,22 +87,23 @@ export function FeatureCard({</div>{/* Video container */}<div className="relative aspect-[16.6/8.9] h-full w-full lg:aspect-[16.99/9.1]">- {/* Auto play video for desktop */}- <AutoPlayVideo- className="hidden xl:block"- src={videoSrc}- posterImg={videoFallbackImg}- description={videoDescription}- testId={testId}- />- {/* Manual play video for mobile for better UX */}- <ManualPlayVideo- className="xl:hidden"- src={videoSrc}- posterImg={videoFallbackImg}- description={videoDescription}- testId={testId}- />+ {showsYouTube ? (+ /* The same demo from YouTube on mobile, tablet and old browsers */+ <ManualPlayYouTubeEmbed+ videoId={youtubeVideoId}+ title={videoDescription}+ posterImg={videoFallbackImg}+ testId={`${testId}-youtube`}+ />+ ) : (+ /* Self-hosted demo on desktop */+ <AutoPlayVideo+ src={videoSrc}+ posterImg={videoFallbackImg}+ description={videoDescription}+ testId={testId}+ />+ )}</div></div></div>diff --git a/src/app/[locale]/about/components/hero-demo-video.tsx b/src/app/[locale]/about/components/hero-demo-video.tsxnew file mode 100644index 0000000..29689a9--- /dev/null+++ b/src/app/[locale]/about/components/hero-demo-video.tsx@@ -0,0 +1,47 @@+"use client";++import { AutoPlayVideo } from "@/components/video";+import { YouTubeEmbed } from "@/components/youtube-embed";+import {+ VIDEO_DEMO_FALLBACK_IMG,+ VIDEO_DEMO_URL,+ VIDEO_DEMO_YOUTUBE_URL,+} from "@/config";+import { useSupportsInlineVideo } from "@/hooks/use-supports-inline-video";++const VIDEO_DESCRIPTION =+ "How to create and download an invoice as a PDF in EasyInvoicePDF.com";++/**+ * The demo in the hero's browser frame: the self-hosted MP4 normally, and the same+ * demo on YouTube on browsers that cannot play it inline (iOS 15 and older, where+ * the `<video>` sat on its poster and never started).+ *+ * Fills its positioned parent, like `AutoPlayVideo` does on its own.+ */+export function HeroDemoVideo() {+ const canPlayInlineVideo = useSupportsInlineVideo();++ if (!canPlayInlineVideo) {+ return (+ <YouTubeEmbed+ src={VIDEO_DEMO_YOUTUBE_URL}+ title={VIDEO_DESCRIPTION}+ // the hero demo runs by itself on every other browser, and this is the same+ // clip standing in for it+ autoPlay+ className="absolute left-0 top-0"+ testId="hero-about-page-video-youtube"+ />+ );+ }++ return (+ <AutoPlayVideo+ src={VIDEO_DEMO_URL}+ posterImg={VIDEO_DEMO_FALLBACK_IMG}+ testId="hero-about-page-video"+ description={VIDEO_DESCRIPTION}+ />+ );+}diff --git a/src/app/[locale]/about/layout.tsx b/src/app/[locale]/about/layout.tsxindex d76e041..d6e98ea 100644--- a/src/app/[locale]/about/layout.tsx+++ b/src/app/[locale]/about/layout.tsx@@ -1,7 +1,7 @@import type { Metadata } from "next";import { hasLocale, type Locale } from "next-intl";-import { setRequestLocale } from "next-intl/server";import { notFound } from "next/navigation";+import { locale as rootLocale } from "next/root-params";import { APP_URL, STATIC_ASSETS_URL, TWITTER_CREATOR } from "@/config";import { routing } from "@/i18n/routing";@@ -11,15 +11,8 @@ import type EnMessages from "../../../../messages/en.json";import { AboutJsonLd } from "./about-json-ld";// Add metadata to make sure search engines can index the page-// Next.js types dynamic segments as `string`, so we narrow to `Locale` below-export async function generateMetadata({- params,-}: Pick<LayoutProps<"/[locale]/about">, "params">): Promise<Metadata> {- const { locale } = await params;-- if (!hasLocale(routing.locales, locale)) {- notFound();- }+export async function generateMetadata(): Promise<Metadata> {+ const locale = await getValidatedLocale();try {// Load the messages for the requested locale@@ -102,20 +95,10 @@ export async function generateMetadata({}}-// Next.js types dynamic segments as `string`, so we narrow to `Locale` belowexport default async function AboutLocaleLayout({children,- params,}: LayoutProps<"/[locale]/about">) {- // Ensure that the incoming `locale` is valid- const { locale } = await params;-- if (!hasLocale(routing.locales, locale)) {- notFound();- }-- // Enables static rendering to prevent an error: https://nextjs.org/docs/messages/dynamic-server-error- setRequestLocale(locale);+ const locale = await getValidatedLocale();return (<>@@ -125,3 +108,19 @@ export default async function AboutLocaleLayout({</>);}++/**+ * The `[locale]` root param matches any single path segment (`/xx/about`), and+ * `src/i18n/request.ts` maps unknown values to the default locale so the root+ * layout can still render. Here an unknown value is a 404 instead, rendered by+ * `src/app/[locale]/not-found.tsx` inside the locale root layout.+ */+async function getValidatedLocale(): Promise<Locale> {+ const requested = await rootLocale();++ if (!hasLocale(routing.locales, requested)) {+ notFound();+ }++ return requested;+}diff --git a/src/app/[locale]/about/page.tsx b/src/app/[locale]/about/page.tsxindex f47bbc9..1d15ce6 100644--- a/src/app/[locale]/about/page.tsx+++ b/src/app/[locale]/about/page.tsx@@ -1,8 +1,5 @@-import { hasLocale, useTranslations } from "next-intl";-import { setRequestLocale } from "next-intl/server";+import { useLocale, useTranslations } from "next-intl";import Link from "next/link";-import { notFound } from "next/navigation";-import { use } from "react";import { type HeaderProps, Header } from "@/app/(components)/header";import {@@ -13,37 +10,17 @@ import { ABOUT_FAQ_ITEM_KEYS } from "@/app/[locale]/about/about-faq-item-keys";import { AboutFooter } from "@/app/[locale]/about/components/about-footer";import { FeaturesCarousel } from "@/app/[locale]/about/components/features-carousel";import { 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 { Button } from "@/components/ui/button";import { FaqAccordion, FaqAccordionItem } from "@/components/ui/faq-accordion";import { TooltipProvider } from "@/components/ui/tooltip";-import { AutoPlayVideo } from "@/components/video";-import {- GITHUB_URL,- MARKETING_FEATURES_CARDS,- VIDEO_DEMO_FALLBACK_IMG,- VIDEO_DEMO_URL,-} from "@/config";-import { routing } from "@/i18n/routing";--// statically generate the pages for all locales-export function generateStaticParams() {- return routing.locales.map((locale) => {- return { locale };- });-}--// Next.js types dynamic segments as `string`, so we narrow to `Locale` below-export default function AboutPage({ params }: PageProps<"/[locale]/about">) {- const { locale } = use(params);-- if (!hasLocale(routing.locales, locale)) {- notFound();- }-- // Enables static rendering to prevent an error: https://nextjs.org/docs/messages/dynamic-server-error- setRequestLocale(locale);+import { GITHUB_URL, MARKETING_FEATURES_CARDS } from "@/config";+// The locale is validated by the `about` layout and resolved from the `[locale]`+// root param in `src/i18n/request.ts`; the static params live in `src/app/[locale]/layout.tsx`.+export default function AboutPage() {+ const locale = useLocale();const t = useTranslations("About");const navLinks = {@@ -209,12 +186,7 @@ function HeroSection() {</div>{/* Video container */}<div className="relative aspect-video w-full">- <AutoPlayVideo- src={VIDEO_DEMO_URL}- posterImg={VIDEO_DEMO_FALLBACK_IMG}- testId="hero-about-page-video"- description="How to create and download an invoice as a PDF in EasyInvoicePDF.com"- />+ <HeroDemoVideo /></div></div></div>@@ -234,6 +206,7 @@ function FeaturesSection() {videoSrc: feature.videoSrc,videoFallbackImg: feature.videoFallbackImg,videoDescription: feature.videoDescription,+ youtubeVideoId: feature.youtubeVideoId,title: t(`features.items.${feature.translationKey}.title`),description: t(`features.items.${feature.translationKey}.description`),};diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsxindex 4dfdc7e..5023ca4 100644--- a/src/app/[locale]/layout.tsx+++ b/src/app/[locale]/layout.tsx@@ -1,8 +1,37 @@-// TODO: figure out if we need this layout-export default async function RootLayout({+import type { Metadata, Viewport } from "next";+import { getLocale } from "next-intl/server";++import {+ RootDocument,+ rootMetadata,+ rootViewport,+} from "@/app/(components)/root-document";+import { routing } from "@/i18n/routing";++export const viewport: Viewport = rootViewport;++export const metadata: Metadata = rootMetadata;++// statically generate the pages for all locales+export function generateStaticParams() {+ return routing.locales.map((locale) => {+ return { locale };+ });+}++/**+ * Root layout of the localized routes.+ *+ * It must be a *root* layout (nothing above it) so that `locale` is a root param:+ * `src/i18n/request.ts` reads it through `next/root-params`, which is what lets+ * every Server Component below call `useLocale()`/`getTranslations()` without+ * `setRequestLocale()`. Unknown values (`/xx/about`) resolve to the default locale+ * here; the `about` layout is what turns them into a 404.+ */+export default async function LocaleRootLayout({children,-}: Readonly<{- children: React.ReactNode;-}>) {- return <>{children}</>;+}: LayoutProps<"/[locale]">) {+ const locale = await getLocale();++ return <RootDocument lang={locale}>{children}</RootDocument>;}diff --git a/src/app/[locale]/not-found.tsx b/src/app/[locale]/not-found.tsxnew file mode 100644index 0000000..3d04b8d--- /dev/null+++ b/src/app/[locale]/not-found.tsx@@ -0,0 +1,3 @@+import { NotFoundPage } from "@/app/(components)/not-found-page";++export default NotFoundPage;diff --git a/src/app/api/generate-invoice/__tests__/render-pdf-on-server.test.tsx b/src/app/api/generate-invoice/__tests__/render-pdf-on-server.test.tsxindex 2171a62..3bc955b 100644--- a/src/app/api/generate-invoice/__tests__/render-pdf-on-server.test.tsx+++ b/src/app/api/generate-invoice/__tests__/render-pdf-on-server.test.tsx@@ -2,7 +2,7 @@import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { nowInTimeZone } from "../invoice-time-zone";import {diff --git a/src/app/api/generate-invoice/render-pdf-on-server.tsx b/src/app/api/generate-invoice/render-pdf-on-server.tsxindex c124ec5..1517f82 100644--- a/src/app/api/generate-invoice/render-pdf-on-server.tsx+++ b/src/app/api/generate-invoice/render-pdf-on-server.tsx@@ -3,9 +3,9 @@import { Document, Font, Page, renderToBuffer } from "@react-pdf/renderer";import type dayjs from "dayjs";-import { PDF_DEFAULT_TEMPLATE_STYLES } from "@/app/(app)/components/invoice-templates/invoice-pdf-default-template";-import { InvoiceBody } from "@/app/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-body";-import { INVOICE_PDF_TRANSLATIONS } from "@/app/(app)/pdf-i18n-translations/pdf-translations";+import { PDF_DEFAULT_TEMPLATE_STYLES } from "@/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template";+import { InvoiceBody } from "@/app/(main)/(app)/components/invoice-templates/invoice-pdf-default-template/invoice-body";+import { INVOICE_PDF_TRANSLATIONS } from "@/app/(main)/(app)/pdf-i18n-translations/pdf-translations";import { getInvoiceDefaultNumberValue } from "@/app/constants";import { type InvoiceData, type SupportedLanguages } from "@/app/schema";import { INVOICE_PDF_FONTS } from "@/config";diff --git a/src/app/constants/index.ts b/src/app/constants/index.tsindex 20d820a..99b9a4c 100644--- a/src/app/constants/index.ts+++ b/src/app/constants/index.ts@@ -3,7 +3,7 @@ import dayjs from "dayjs";import {getDefaultInvoiceNumberLabel,INVOICE_PDF_TRANSLATIONS,-} from "../(app)/pdf-i18n-translations/pdf-translations";+} from "../(main)/(app)/pdf-i18n-translations/pdf-translations";import {SUPPORTED_CURRENCIES,SUPPORTED_LANGUAGES,diff --git a/src/app/globals.css b/src/app/globals.cssindex f1d02e9..d4201a1 100644--- a/src/app/globals.css+++ b/src/app/globals.css@@ -2,8 +2,14 @@@tailwind components;@tailwind utilities;-html {- scroll-behavior: smooth;+/* Anyone who asked their OS for less motion gets instant jumps instead. Playwright sets+ `reducedMotion: "reduce"` for the same reason: WebKit honours `scroll-behavior` in+ Playwright's scroll-into-view (Chromium's does not), so an animated scroll left buttons+ drifting out from under the cursor between mousedown and mouseup. */+@media (prefers-reduced-motion: no-preference) {+ html {+ scroll-behavior: smooth;+ }}body {diff --git a/src/app/layout.tsx b/src/app/layout.tsxdeleted file mode 100644index 0598c71..0000000--- a/src/app/layout.tsx+++ /dev/null@@ -1,124 +0,0 @@-import { SpeedInsights } from "@vercel/speed-insights/next";-import type { Metadata, Viewport } from "next";-import { NextIntlClientProvider } from "next-intl";-import Script from "next/script";-import { Toaster } from "sonner";--import { ResponsiveIndicator } from "@/components/dev/responsive-indicator";-import { SentryIndicator } from "@/components/dev/sentry-indicator";-import { PERSONAL_WEBSITE_URL, STATIC_ASSETS_URL } from "@/config";-import { DeviceContextProvider } from "@/contexts/device-context";-import { checkDeviceUserAgent } from "@/lib/check-device.server";-import { JsonLdScript } from "@/lib/seo/render-json-ld";-import { buildSiteWideJsonLdGraph } from "@/lib/seo/site-entities";--import "./globals.css";-import "react-pdf/dist/Page/AnnotationLayer.css";-import "react-pdf/dist/Page/TextLayer.css";--export const viewport: Viewport = {- initialScale: 1, // Sets the default zoom level to 1 (100%)- width: "device-width", // Ensures the viewport width matches the device's screen width- maximumScale: 1, // Prevents users from zooming in- viewportFit: "cover", // Enables edge-to-edge content display on devices with rounded corners (like iPhones with a notch)-};--export const metadata: Metadata = {- // metadataBase: new URL(APP_URL),- title: "Create Invoice — EasyInvoicePDF",- description:- "Create and download professional invoices instantly with EasyInvoicePDF.com. Free and open-source. No signup required.",- keywords: [- "invoice pdf generator",- "free invoice pdf",- "create invoice pdf",- "invoice generator open source",- "pdf invoice template",- "invoice generator",- "free invoice generator",- "online invoice generator",- "invoice maker pdf",- "professional invoice generator",- ],- authors: [{ name: "Vlad Sazonau", url: PERSONAL_WEBSITE_URL }],- creator: "Vlad Sazonau",- publisher: "Vlad Sazonau",- icons: {- icon: [- {- url: `${STATIC_ASSETS_URL}/favicon.ico`,- },- {- url: `${STATIC_ASSETS_URL}/icon.png`,- type: "image/png",- sizes: "96x96",- },- ],- apple: [- {- url: `${STATIC_ASSETS_URL}/apple-icon.png`,- type: "image/png",- sizes: "180x180",- },- ],- },-};--export default async function RootLayout({- children,-}: Readonly<{- children: React.ReactNode;-}>) {- const {- isDesktop: isDesktopServer,- isAndroid,- isMobile,- inAppInfo,- } = await checkDeviceUserAgent();-- const siteWideJsonLd = buildSiteWideJsonLdGraph();-- return (- <html lang="en">- <body>- <DeviceContextProvider- isDesktop={isDesktopServer}- isAndroid={isAndroid}- isMobile={isMobile}- inAppInfo={inAppInfo}- >- <NextIntlClientProvider>- {children}-- {/* https://sonner.emilkowal.ski/ */}- <Toaster visibleToasts={1} richColors closeButton />- {/* show responsive indicator(tailwind breakpoint) for debugging responsive designs */}- {process.env.NODE_ENV === "development" ? (- <>- <ResponsiveIndicator />- {/* only renders while the browser Sentry SDK is actually live */}- <SentryIndicator />- </>- ) : null}- {/* should only be enabled in production */}- {process.env.VERCEL_ENV === "production" ? (- <>- <SpeedInsights- sampleRate={0.3} // send only x% of the requests to Speed Insights (for cost-saving)- />- {/* https://eu.umami.is/dashboard */}- <Script- // we proxy umami check next.config.mjs rewrites- src="/stats/script.js"- data-website-id="1914352c-5ebb-4806-bfc3-f494712bb4a4"- defer- />- </>- ) : null}- <JsonLdScript id="site-wide-json-ld" data={siteWideJsonLd} />- </NextIntlClientProvider>- </DeviceContextProvider>- </body>- </html>- );-}diff --git a/src/app/schema/i18n-schema.ts b/src/app/schema/i18n-schema.tsindex 633b176..0ab2dd8 100644--- a/src/app/schema/i18n-schema.ts+++ b/src/app/schema/i18n-schema.ts@@ -148,11 +148,27 @@ const faqSchema = z}).strict();+const browserSupportNoticeSchema = z+ .object({+ title: z.string(),+ description: z.string(),+ })+ .strict();++/** Copy for the "your browser is old" toast, see `src/components/browser-support-notice.tsx`. */+const browserSupportSchema = z+ .object({+ outdated: browserSupportNoticeSchema,+ unsupported: browserSupportNoticeSchema,+ })+ .strict();+export const messagesSchema = z.object({About: aboutSchema,Metadata: metadataSchema,FAQ: faqSchema,+ BrowserSupport: browserSupportSchema,}).strict();diff --git a/src/app/sitemap.ts b/src/app/sitemap.tsindex b980209..77c3811 100644--- a/src/app/sitemap.ts+++ b/src/app/sitemap.ts@@ -1,9 +1,9 @@import { type MetadataRoute } from "next";-import { SEO_LANDING_SLUGS } from "@/app/(seo-landings)/seo-landing-definitions";+import { SEO_LANDING_SLUGS } from "@/app/(main)/(seo-landings)/seo-landing-definitions";import { APP_URL } from "@/config";-import { getChangelogEntries } from "./changelog/utils";+import { getChangelogEntries } from "./(main)/changelog/utils";import { SUPPORTED_LANGUAGES } from "./schema";export default async function sitemap(): Promise<MetadataRoute.Sitemap> {diff --git a/src/components/__tests__/browser-support-notice.test.tsx b/src/components/__tests__/browser-support-notice.test.tsxnew file mode 100644index 0000000..41c1dcb--- /dev/null+++ b/src/components/__tests__/browser-support-notice.test.tsx@@ -0,0 +1,123 @@+// @vitest-environment happy-dom++import { render } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++import { useIsDesktop } from "@/hooks/use-media-query";++import { BrowserSupportNotice } from "../browser-support-notice";++vi.mock("sonner", () => {+ return {+ toast: Object.assign(vi.fn(), { info: vi.fn(), warning: vi.fn() }),+ };+});++vi.mock("next-intl", () => {+ return {+ // `t("outdated.title")` -> `"outdated.title"`, so the assertions below stay+ // about which message is picked rather than about its English wording+ useTranslations: () => {+ return (key: string) => {+ return key;+ };+ },+ };+});++vi.mock("@/hooks/use-media-query", () => {+ return {+ useIsDesktop: vi.fn(() => {+ return true;+ }),+ };+});++import { toast } from "sonner";++const CHROME_141 =+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36";+const SAFARI_15 =+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15";+const CHROME_49 =+ "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36";++function renderWithUserAgent(userAgent: string) {+ Object.defineProperty(window.navigator, "userAgent", {+ value: userAgent,+ configurable: true,+ });++ return render(<BrowserSupportNotice />);+}++describe("BrowserSupportNotice", () => {+ beforeEach(() => {+ vi.clearAllMocks();+ vi.mocked(useIsDesktop).mockReturnValue(true);+ });++ afterEach(() => {+ vi.restoreAllMocks();+ });++ it("says nothing on an up-to-date browser", () => {+ renderWithUserAgent(CHROME_141);++ expect(toast.info).not.toHaveBeenCalled();+ expect(toast.warning).not.toHaveBeenCalled();+ });++ it("nudges a browser that is more than three years old", () => {+ renderWithUserAgent(SAFARI_15);++ expect(toast.info).toHaveBeenCalledWith(+ "outdated.title",+ expect.objectContaining({+ id: "browser-support-toast",+ position: "bottom-right",+ }),+ );+ expect(toast.warning).not.toHaveBeenCalled();+ });++ it("warns harder below the `.browserslistrc` floor", () => {+ renderWithUserAgent(CHROME_49);++ expect(toast.warning).toHaveBeenCalledWith(+ "unsupported.title",+ expect.objectContaining({ id: "browser-support-toast" }),+ );+ expect(toast.info).not.toHaveBeenCalled();+ });++ it("keeps the toast clear of the sticky bottom bar on mobile", () => {+ vi.mocked(useIsDesktop).mockReturnValue(false);++ renderWithUserAgent(SAFARI_15);++ expect(toast.info).toHaveBeenCalledWith(+ "outdated.title",+ expect.objectContaining({ position: "top-center" }),+ );+ });++ it("waits for the media query before opening the toast", () => {+ // `useIsDesktop` is `undefined` on the first commit; opening the toast then+ // would put it in the mobile position on a desktop+ vi.mocked(useIsDesktop).mockReturnValue(undefined);++ renderWithUserAgent(SAFARI_15);++ expect(toast.info).not.toHaveBeenCalled();+ });++ it("shows the toast only once even when the media query resolves late", () => {+ vi.mocked(useIsDesktop).mockReturnValue(true);++ const { rerender } = renderWithUserAgent(SAFARI_15);+ rerender(<BrowserSupportNotice />);++ expect(toast.info).toHaveBeenCalledTimes(1);+ });+});diff --git a/src/components/__tests__/video.test.tsx b/src/components/__tests__/video.test.tsxnew file mode 100644index 0000000..1dc2faa--- /dev/null+++ b/src/components/__tests__/video.test.tsx@@ -0,0 +1,154 @@+// @vitest-environment happy-dom++import { cleanup, render, screen } from "@testing-library/react";+import { act } from "react";+import {+ mockAllIsIntersecting,+ resetIntersectionMocking,+ setupIntersectionMocking,+} from "react-intersection-observer/test-utils";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++import { AutoPlayVideo } from "../video";++/**+ * What has to hold for the demo videos to start on a phone, where every browser is+ * WebKit and the rules are stricter than anywhere else — plus what happens when iOS+ * refuses anyway (Low Power Mode, Low Data Mode, "Auto-Play Video Previews" off),+ * which no amount of markup can talk it out of.+ */++const SRC = "https://example.com/demo.mp4";+const POSTER = "https://example.com/demo.png";++/** What iOS rejects with when it will not start a video without a tap. */+const NOT_ALLOWED = new DOMException(+ "The request is not allowed",+ "NotAllowedError",+);++let play: ReturnType<typeof vi.fn>;++beforeEach(() => {+ // the library only wires this up on its own when vitest runs with globals, and this+ // project does not+ setupIntersectionMocking(vi.fn);++ play = vi.fn(() => {+ return Promise.resolve();+ });++ vi.spyOn(HTMLMediaElement.prototype, "play").mockImplementation(() => {+ return play() as Promise<void>;+ });+ vi.spyOn(HTMLMediaElement.prototype, "pause").mockImplementation(() => {+ return undefined;+ });+});++afterEach(() => {+ // this project runs vitest without globals, so RTL does not auto-cleanup+ cleanup();+ resetIntersectionMocking();+ vi.restoreAllMocks();+});++function renderVideo() {+ const result = render(+ <AutoPlayVideo src={SRC} posterImg={POSTER} testId="demo" />,+ );++ // the source is only attached once the video scrolls into view+ act(() => {+ return mockAllIsIntersecting(true);+ });++ return result;+}++describe("AutoPlayVideo", () => {+ it("carries the muted attribute, not just the React property", async () => {+ renderVideo();++ const video = screen.getByTestId<HTMLVideoElement>("demo");++ // React only ever assigns the property, and WebKit reads the attribute when it+ // decides whether a video is allowed to start on its own+ expect(video.hasAttribute("muted")).toBe(true);+ expect(video.muted).toBe(true);+ expect(video.hasAttribute("playsinline")).toBe(true);+ });++ it("puts the lazy-loaded url on the element rather than in a <source>", () => {+ const { container } = renderVideo();++ const video = screen.getByTestId<HTMLVideoElement>("demo");++ // a media element that has already picked a resource ignores a <source> appended+ // afterwards; assigning `src` is what makes it look again+ expect(video.getAttribute("src")).toBe(`${SRC}#t=0.001`);+ expect(container.querySelectorAll("source")).toHaveLength(0);+ });++ it("plays without a play button when the browser allows it", () => {+ renderVideo();++ expect(play).toHaveBeenCalledWith();+ expect(screen.queryByTestId("demo-play-button")).toBeNull();+ });++ it("offers a play button once the browser refuses to start on its own", async () => {+ play.mockRejectedValue(NOT_ALLOWED);++ renderVideo();++ const button = await screen.findByTestId("demo-play-button");++ expect(button.getAttribute("aria-label")).toBe("Play video");+ });++ it("stays out of the way when the autoplay attribute got there first", async () => {+ play.mockRejectedValue(NOT_ALLOWED);+ // the element is playing; only our own call was turned down+ vi.spyOn(HTMLMediaElement.prototype, "paused", "get").mockReturnValue(+ false,+ );++ renderVideo();++ await act(async () => {+ return undefined;+ });++ expect(screen.queryByTestId("demo-play-button")).toBeNull();+ });++ it("keeps the poster untouched when the play was only interrupted", async () => {+ // the load the play itself kicks off cuts the play short; it is not a refusal+ play.mockRejectedValue(new DOMException("interrupted", "AbortError"));++ renderVideo();++ await act(async () => {+ return undefined;+ });++ expect(screen.queryByTestId("demo-play-button")).toBeNull();+ });++ it("starts the video and drops the button when it is pressed", async () => {+ play.mockRejectedValue(NOT_ALLOWED);++ renderVideo();++ const button = await screen.findByTestId("demo-play-button");++ play.mockResolvedValue(undefined);++ await act(async () => {+ return button.click();+ });++ expect(screen.queryByTestId("demo-play-button")).toBeNull();+ });+});diff --git a/src/components/__tests__/youtube-embed-manual-play.test.tsx b/src/components/__tests__/youtube-embed-manual-play.test.tsxnew file mode 100644index 0000000..07b8ee2--- /dev/null+++ b/src/components/__tests__/youtube-embed-manual-play.test.tsx@@ -0,0 +1,126 @@+// @vitest-environment happy-dom++import { cleanup, render, screen } from "@testing-library/react";+import { act } from "react";+import {+ mockAllIsIntersecting,+ resetIntersectionMocking,+ setupIntersectionMocking,+} from "react-intersection-observer/test-utils";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++import { ManualPlayYouTubeEmbed } from "../youtube-embed-manual-play";++const VIDEO_ID = "pWkb_JcKouU";+const POSTER = "https://example.com/live-preview.png";+const TITLE = "Live preview demo";++function renderEmbed() {+ return render(+ <ManualPlayYouTubeEmbed+ videoId={VIDEO_ID}+ title={TITLE}+ posterImg={POSTER}+ testId="live-preview-demo-video-youtube"+ />,+ );+}++function getEmbed() {+ return screen.queryByTestId("live-preview-demo-video-youtube");+}++function getPoster() {+ return screen.queryByTestId("live-preview-demo-video-youtube-poster");+}++function pressPlay() {+ act(() => {+ return screen.getByRole("button", { name: TITLE }).click();+ });+}++function setInView(inView: boolean) {+ act(() => {+ return mockAllIsIntersecting(inView);+ });+}++// this project runs vitest without globals, so the `beforeEach` that `test-utils`+// registers on import never runs and the mock has to be wired up by hand+beforeEach(() => {+ setupIntersectionMocking(vi.fn);+});++afterEach(() => {+ // ...and for the same reason RTL does not auto-cleanup either+ cleanup();+ resetIntersectionMocking();+});++describe("ManualPlayYouTubeEmbed", () => {+ it("shows a still and a play button, and loads no player, until asked", () => {+ renderEmbed();+ setInView(true);++ expect(getEmbed()).toBeNull();+ expect(getPoster()?.getAttribute("src")).toBe(POSTER);+ expect(screen.getByRole("button", { name: TITLE })).toBeDefined();+ });++ it("mounts a muted, looping player when the play button is pressed", () => {+ renderEmbed();+ setInView(true);+ pressPlay();++ // `getByTestId` rather than the nullable helper: the assertions below read+ // attributes off the element, and optional chaining in a test reads as a branch+ const embed = screen.getByTestId("live-preview-demo-video-youtube");+ // `String(...)` rather than `?? ""`: a fallback here reads as a branch to the+ // lint rule, and a missing src would fail the URL parse just as loudly+ const src = new URL(String(embed.getAttribute("src")));++ expect(src.origin + src.pathname).toBe(+ `https://www.youtube.com/embed/${VIDEO_ID}`,+ );+ // the press is the gesture; this is what saves it from needing a second one on+ // YouTube's own play button+ expect(src.searchParams.get("autoplay")).toBe("1");+ expect(src.searchParams.get("mute")).toBe("1");+ expect(src.searchParams.get("playsinline")).toBe("1");+ // `loop` needs the video to name itself as a single-entry playlist+ expect(src.searchParams.get("loop")).toBe("1");+ expect(src.searchParams.get("playlist")).toBe(VIDEO_ID);+ expect(src.searchParams.get("controls")).toBe("1");++ // ...and the Permissions Policy has to delegate autoplay to the iframe, or the+ // player is not allowed to start itself whatever the URL asks for+ expect(embed.getAttribute("allow")).toContain("autoplay");++ expect(getPoster()).toBeNull();+ });++ it("unmounts the player once it scrolls out of view", () => {+ renderEmbed();+ setInView(true);+ pressPlay();+ expect(getEmbed()).not.toBeNull();++ setInView(false);++ expect(getEmbed()).toBeNull();+ expect(getPoster()).not.toBeNull();+ });++ it("does not start again on its own when it scrolls back into view", () => {+ renderEmbed();+ setInView(true);+ pressPlay();+ setInView(false);++ setInView(true);++ expect(getEmbed()).toBeNull();+ expect(screen.getByRole("button", { name: TITLE })).toBeDefined();+ });+});diff --git a/src/components/__tests__/youtube-embed.test.tsx b/src/components/__tests__/youtube-embed.test.tsxnew file mode 100644index 0000000..9171483--- /dev/null+++ b/src/components/__tests__/youtube-embed.test.tsx@@ -0,0 +1,75 @@+// @vitest-environment happy-dom++import { cleanup, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";++import { YouTubeEmbed } from "../youtube-embed";++/**+ * The player parameters behind the hero fallback. `autoplay=1` on its own is not+ * enough anywhere that matters — no browser hands a gesture-free start to a player+ * that could make noise — so the interesting part is what travels with it.+ */++const SRC = "https://www.youtube.com/embed/iAROeCIcZ40?si=EyJKCsUr43Z8zY1f";++afterEach(() => {+ // this project runs vitest without globals, so RTL does not auto-cleanup+ cleanup();+});++function getSrc() {+ return new URL(screen.getByTestId("embed").getAttribute("src") ?? "");+}++describe("YouTubeEmbed", () => {+ it("leaves the url alone by default", () => {+ render(<YouTubeEmbed src={SRC} title="Demo" testId="embed" />);++ expect(screen.getByTestId("embed").getAttribute("src")).toBe(SRC);+ });++ it("delegates autoplay through the permissions policy", () => {+ render(<YouTubeEmbed src={SRC} title="Demo" testId="embed" />);++ // without this the player may not start itself, whatever the URL asks for+ expect(screen.getByTestId("embed").getAttribute("allow")).toContain(+ "autoplay",+ );+ });++ it("asks the player to start itself, muted and inline", () => {+ render(<YouTubeEmbed src={SRC} title="Demo" autoPlay testId="embed" />);++ const src = getSrc();++ expect(src.searchParams.get("autoplay")).toBe("1");+ expect(src.searchParams.get("mute")).toBe("1");+ // without this iOS takes the video fullscreen the moment it starts+ expect(src.searchParams.get("playsinline")).toBe("1");+ });++ it("loops the clip by naming it as its own playlist", () => {+ render(<YouTubeEmbed src={SRC} title="Demo" autoPlay testId="embed" />);++ const src = getSrc();++ expect(src.searchParams.get("loop")).toBe("1");+ expect(src.searchParams.get("playlist")).toBe("iAROeCIcZ40");+ });++ it("keeps the parameters the url arrived with", () => {+ render(<YouTubeEmbed src={SRC} title="Demo" autoPlay testId="embed" />);++ expect(getSrc().searchParams.get("si")).toBe("EyJKCsUr43Z8zY1f");+ });++ it("hands back a url it cannot parse", () => {+ // a broken iframe in the hero is worse than a player that waits for a tap+ render(+ <YouTubeEmbed src="not-a-url" title="Demo" autoPlay testId="embed" />,+ );++ expect(screen.getByTestId("embed").getAttribute("src")).toBe("not-a-url");+ });+});diff --git a/src/components/browser-support-notice.tsx b/src/components/browser-support-notice.tsxnew file mode 100644index 0000000..1e31ea8--- /dev/null+++ b/src/components/browser-support-notice.tsx@@ -0,0 +1,62 @@+"use client";++import { useTranslations } from "next-intl";+import { useEffect, useRef } from "react";+import { toast } from "sonner";++import { useIsDesktop } from "@/hooks/use-media-query";+import { getBrowserSupport } from "@/utils/browser-support";++/**+ * Nudges visitors on a stale browser to update, once per page load.+ *+ * Mounted from the shared root document, so it covers the invoice generator and the+ * marketing pages alike: everything here (client-side PDF rendering above all) leans+ * hard on the browser, and a three year old Safari is where the odd unreproducible+ * bug report tends to come from.+ *+ * Renders nothing — it only fires a toast, and lives as a component rather than a+ * hook so it can be dropped into the (server) root document directly.+ */+export function BrowserSupportNotice() {+ const t = useTranslations("BrowserSupport");+ const isDesktop = useIsDesktop();++ // Guards the toast so it only shows once per mount. A ref, not state: nothing in+ // the render output depends on it.+ const noticeShownRef = useRef(false);++ useEffect(() => {+ // `useIsDesktop` is `undefined` until its media query has been read in an+ // effect. Waiting for it keeps the toast from opening in the mobile position+ // on a desktop; it resolves on the very next commit.+ if (noticeShownRef.current || isDesktop === undefined) {+ return;+ }++ const support = getBrowserSupport(window.navigator.userAgent);++ // `null` is an unrecognised browser, and most visitors are simply up to date+ if (!support || support.status === "supported") {+ return;+ }++ noticeShownRef.current = true;++ const { status, name, majorVersion } = support;+ const showToast = status === "unsupported" ? toast.warning : toast.info;++ showToast(t(`${status}.title`), {+ description: t(`${status}.description`, {+ browser: name,+ version: String(majorVersion),+ }),+ id: "browser-support-toast", // To prevent duplicate toasts+ duration: Infinity,+ icon: "⚠️",+ position: isDesktop ? "bottom-right" : "top-center",+ });+ }, [isDesktop, t]);++ return null;+}diff --git a/src/components/video.tsx b/src/components/video.tsxindex a163a7c..9669844 100644--- a/src/components/video.tsx+++ b/src/components/video.tsx@@ -1,7 +1,7 @@"use client";import { Play } from "lucide-react";-import { useEffect, useId, useRef, useState } from "react";+import { useCallback, useEffect, useId, useRef, useState } from "react";import { useInView } from "react-intersection-observer";import { cn } from "@/lib/utils";@@ -18,6 +18,11 @@ interface SharedVideoProps extends React.ComponentPropsWithRef<"div"> {interface AutoPlayVideoProps extends SharedVideoProps {paused?: boolean;+ /**+ * Accessible name for the play button shown when the browser refuses to start the+ * video on its own. Falls back to `description`, then to a generic label.+ */+ playButtonLabel?: string;}/**@@ -42,11 +47,20 @@ export function AutoPlayVideo({loop = true,prefersReducedMotion = false,renderReducedMotionFallback,+ playButtonLabel,testId = "",...props}: AutoPlayVideoProps) {+ // `description` defaults to an empty string, which would be an unnamed button+ const playLabel = playButtonLabel || description || "Play video";+const videoRef = useRef<HTMLVideoElement | null>(null);const [srcAdded, setSrcAdded] = useState(false);+ // iOS refuses to start a video on its own in Low Power Mode, in Low Data Mode, and+ // with "Auto-Play Video Previews" switched off under Accessibility > Motion. None of+ // that is ours to override, so a refusal turns the poster into a play button rather+ // than leaving a still frame that looks broken.+ const [autoplayRefused, setAutoplayRefused] = useState(false);const descriptionID = useId();const { ref, inView } = useInView({@@ -54,23 +68,53 @@ export function AutoPlayVideo({rootMargin: "50px",});+ /**+ * React assigns `muted` as a DOM property and never writes the attribute — not on+ * the client and not into the prerendered HTML. WebKit reads the attribute when it+ * decides whether a video may start without a tap, so a `<video muted>` React+ * rendered is, for that decision, a video with sound. `defaultMuted` is the property+ * that reflects the attribute.+ */+ const attachVideo = useCallback((video: HTMLVideoElement | null) => {+ videoRef.current = video;++ if (!video) return;++ video.defaultMuted = true;+ video.muted = true;+ }, []);+function pauseVideo() {videoRef.current?.pause();}- // Attempts to play the video with retry logic for autoplay restrictions- // Some browsers block autoplay until user interaction, so we retry once after 100msfunction playVideo() {const video = videoRef.current;if (!video || paused) return;- video.play().catch(() => {- // Retry once if initial play fails (common with autoplay policies)- setTimeout(() => {- void video.play().catch(() => {- // if play fails again, do nothing- });- }, 100);- });++ // the gesture-free start is granted to a muted element and taken back the moment+ // it is not one, so this is asserted on every attempt rather than only on mount+ video.muted = true;++ void video.play().then(+ () => {+ return setAutoplayRefused(false);+ },+ (error: unknown) => {+ // `AbortError` is this attempt being cut short — by the load it just kicked+ // off, or by the pause that follows scrolling away — not the browser refusing.+ // The `canplay` handler below asks again once there is something to play.+ if (error instanceof DOMException && error.name === "AbortError")+ return;++ // the `autoplay` attribute is a second, independent way in, and it can have+ // succeeded while this call was being turned down; a play button over a+ // playing video is worse than no button at all+ if (!video.paused) return;++ setAutoplayRefused(true);+ },+ );}// Lazy-load video source when component enters viewport@@ -84,7 +128,7 @@ export function AutoPlayVideo({// - If in viewport and not paused, play the video// - If out of viewport, pause to save resourcesuseEffect(() => {- // oxlint-disable-next-line react-you-might-not-need-an-effect/no-event-handler -- there is no event to hang this on: `inView` comes from an IntersectionObserver and `srcAdded` tells us the <source> is in the DOM, both of which have to be synchronised with the <video> element+ // oxlint-disable-next-line react-you-might-not-need-an-effect/no-event-handler -- there is no event to hang this on: `inView` comes from an IntersectionObserver and `srcAdded` tells us the source is on the element, both of which have to be synchronised with the <video> elementif (!srcAdded) return;if (paused) pauseVideo();@@ -93,6 +137,24 @@ export function AutoPlayVideo({// eslint-disable-next-line react-hooks/exhaustive-deps}, [inView, srcAdded, paused, prefersReducedMotion]);+ // `preload="none"` means the first `play()` above usually lands on an element with+ // nothing decoded yet. Asking again on `canplay` is what turns that into playback+ // without guessing at a delay, and it covers a stall mid-scroll for free.+ useEffect(() => {+ const video = videoRef.current;+ if (!video) return;++ function handleCanPlay() {+ if (inView && !paused) playVideo();+ }++ video.addEventListener("canplay", handleCanPlay);+ return () => {+ return video.removeEventListener("canplay", handleCanPlay);+ };+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [inView, paused]);+// Add click handler to toggle play/pause on user interaction// This provides manual control over autoplay videosuseEffect(() => {@@ -128,7 +190,7 @@ export function AutoPlayVideo({</p>) : null}<video- ref={videoRef}+ ref={attachVideo}aria-describedby={description ? descriptionID : undefined}className="h-full w-full cursor-pointer"autoPlay@@ -137,145 +199,24 @@ export function AutoPlayVideo({playsInlinepreload="none"poster={posterImg}+ // The URL goes on the element rather than into a `<source>` child, because+ // this one arrives after the element is already in the DOM: a media element+ // that has finished picking a resource does not go back and look at a+ // `<source>` appended afterwards, while assigning `src` restarts that pick+ // by itself. `#t=0.001` keeps iOS on the first frame instead of a blank+ // element while the poster loads.+ src={srcAdded ? `${src}#t=0.001` : undefined}data-testid={testId}- >- {srcAdded ? (- <source src={`${src}#t=0.001`} type="video/mp4" />- ) : null}- </video>- </>- )}- </div>- );-}--type ManualPlayVideoProps = SharedVideoProps;--/**- * ManualPlayVideo component displays a video that requires user interaction to play.- *- * This component is designed for **mobile and touch devices** where autoplay may not be desired- * or supported. It ensures only one video plays at a time by listening to custom- * "video-play" events and pausing other videos when a new one starts.- *- * @example- * ```tsx- * <ManualPlayVideo- * src="/videos/demo.mp4"- * posterImg="/images/poster.jpg"- * testId="demo-video"- * />- * ```- */-export function ManualPlayVideo({- className,- src,- posterImg,- description = "",- loop = true,- prefersReducedMotion = false,- renderReducedMotionFallback,- testId = "",- ...props-}: ManualPlayVideoProps) {- const descriptionID = useId();- const videoId = useId();-- const videoRef = useRef<HTMLVideoElement | null>(null);-- const [isPlaying, setIsPlaying] = useState(false);-- const { ref: inViewRef, inView } = useInView({ threshold: 0.3 });-- // Effect: Pauses video when it scrolls out of view- // This prevents videos from playing audio/consuming resources when not visible- // Pausing an already paused video is a no-op, so this does not check `isPlaying`- useEffect(() => {- if (inView) {- return;- }-- videoRef.current?.pause();-- // oxlint-disable-next-line react/set-state-in-effect -- the <video> element is an external system and `inView` comes from an IntersectionObserver; there is no event here to update this from- setIsPlaying(false);- }, [inView]);-- // Effect: Ensures only one video plays at a time across the page- // When any video starts playing, it dispatches a "video-play" event with its unique ID.- // This effect listens for those events and pauses this video if a different video started playing.- useEffect(() => {- function handler(e: Event) {- // Check if the event came from this video instance- // If so, ignore it (don't pause ourselves)- if ((e as CustomEvent<{ id: string }>).detail.id === videoId) return;-- // Another video started playing, so pause this one- videoRef.current?.pause();- setIsPlaying(false);- }-- // Listen for video-play events from any video on the page- window.addEventListener("video-play", handler);-- // Cleanup: remove listener when component unmounts- return () => {- return window.removeEventListener("video-play", handler);- };- }, [videoId]);-- // Handler: Called when user clicks the play button- function handlePlay() {- // Broadcast that this video is starting to play- // This will trigger the useEffect in other ManualPlayVideo instances to pause themselves- window.dispatchEvent(- new CustomEvent("video-play", { detail: { id: videoId } }),- );-- // Start playing this video- void videoRef.current?.play();- setIsPlaying(true);- }-- return (- <div- ref={inViewRef}- className={cn("absolute left-0 top-0 h-full w-full", className)}- {...props}- >- {prefersReducedMotion &&- typeof renderReducedMotionFallback === "function" ? (- renderReducedMotionFallback()- ) : (- <>- {description ? (- <p id={descriptionID} className="sr-only">- {description}- </p>- ) : null}- <video- ref={videoRef}- aria-describedby={description ? descriptionID : undefined}- className="h-full w-full"- playsInline- preload="none"- loop={loop}- muted- controls={isPlaying}- poster={posterImg}- data-testid={testId}- >- <source src={src} type="video/mp4" />- </video>- {/*- Play button overlay - only shown when video is not playing- */}- {!isPlaying ? (+ />+ {autoplayRefused ? (<buttontype="button"- aria-label={description ? description : "Play video"}+ aria-label={playLabel}+ onClick={() => {+ return playVideo();+ }}className="absolute inset-0 flex items-center justify-center backdrop-blur-[1px]"- onClick={handlePlay}+ data-testid={testId ? `${testId}-play-button` : undefined}><span className="flex size-14 items-center justify-center rounded-full bg-slate-800/90 shadow-lg transition-transform duration-150 hover:scale-110 active:scale-95"><Play className="ml-1 h-6 w-6 fill-white text-white" />diff --git a/src/components/youtube-embed-manual-play.tsx b/src/components/youtube-embed-manual-play.tsxnew file mode 100644index 0000000..4fa5155--- /dev/null+++ b/src/components/youtube-embed-manual-play.tsx@@ -0,0 +1,140 @@+"use client";++import { Play } from "lucide-react";+import { useState } from "react";+import { useInView } from "react-intersection-observer";++import { cn } from "@/lib/utils";++interface ManualPlayYouTubeEmbedProps {+ /**+ * Bare YouTube id, e.g. `pWkb_JcKouU`. Not a URL: looping a single video needs the+ * id twice, once in the path and once as `playlist`.+ */+ videoId: string;+ /** Accessible name for the play button and for the iframe it swaps in. */+ title: string;+ /** Still frame standing in for the player until someone asks for it. */+ posterImg: string;+ className?: string;+ testId?: string;+}++/**+ * A muted, looping YouTube player that a viewer starts by tapping, and that stops when+ * it scrolls out of view — the marketing demos on mobile, where the self-hosted MP4s+ * are the expensive way to show the same clip.+ *+ * Nothing but a still image exists until that tap. A YouTube iframe is roughly a+ * megabyte of player, so a carousel that mounted all six would cost more than the+ * videos it replaces, and mounting one per slide the viewer happens to swipe past+ * would spend that on clips nobody asked to see.+ *+ * Scrolling away unmounts the player rather than pausing it, which is what keeps this+ * free of `enablejsapi` postMessage plumbing. Coming back shows the still again and+ * needs another tap, so a video never starts on its own.+ *+ * Fills its positioned parent, like the videos in `src/components/video.tsx` do.+ */+export function ManualPlayYouTubeEmbed({+ videoId,+ title,+ posterImg,+ className,+ testId,+}: ManualPlayYouTubeEmbedProps) {+ const { ref, inView } = useInView({ threshold: 0.3 });++ const [isPlaying, setIsPlaying] = useState(false);++ // Stop a player the viewer has swiped or scrolled away from. Adjusted during render+ // off the previous value rather than from an effect, because that is all this is: a+ // piece of state that resets when something else changes.+ // https://react.dev/learn/you-might-not-need-an-effect+ const [wasInView, setWasInView] = useState(inView);+ if (wasInView !== inView) {+ setWasInView(inView);++ if (!inView) {+ setIsPlaying(false);+ }+ }++ return (+ <div+ ref={ref}+ className={cn("absolute left-0 top-0 h-full w-full", className)}+ >+ {isPlaying ? (+ <iframe+ src={buildEmbedUrl(videoId)}+ title={title}+ // `autoplay` here is the Permissions Policy delegation: without it the+ // player is not allowed to start itself, whatever the URL asks for+ allow="autoplay; encrypted-media; picture-in-picture; web-share"+ referrerPolicy="strict-origin-when-cross-origin"+ allowFullScreen+ className="h-full w-full border-0"+ data-testid={testId}+ />+ ) : (+ <>+ <img+ src={posterImg}+ // the button over it carries the name; this is the same frame twice+ alt=""+ loading="lazy"+ className="h-full w-full object-cover"+ data-testid={testId ? `${testId}-poster` : undefined}+ />+ <button+ type="button"+ aria-label={title}+ onClick={() => {+ return setIsPlaying(true);+ }}+ className="absolute inset-0 flex items-center justify-center backdrop-blur-[1px]"+ >+ <span className="flex size-14 items-center justify-center rounded-full bg-slate-800/90 shadow-lg transition-transform duration-150 hover:scale-110 active:scale-95">+ <Play className="ml-1 h-6 w-6 fill-white text-white" />+ </span>+ </button>+ </>+ )}+ </div>+ );+}++/**+ * The player parameters behind the demo loop: muted, looping, and stripped of+ * everything that would send a viewer off to YouTube.+ *+ * `autoplay` is not the page deciding to play something — the iframe only exists once+ * the play button has been pressed, and this is what saves that press from needing a+ * second one on YouTube's own button.+ *+ * Controls stay on. They cost a scrubber over the bottom of the clip, but they are the+ * only way to pause, scrub, unmute or go fullscreen.+ *+ * @see https://developers.google.com/youtube/player_parameters+ */+function buildEmbedUrl(videoId: string) {+ const params = new URLSearchParams({+ autoplay: "1",+ // the demos are silent, and a tap on a marketing page should not make noise+ mute: "1",+ // without this iOS takes the video fullscreen the moment it starts+ playsinline: "1",+ loop: "1",+ // `loop` is a playlist feature; a single video has to name itself as the playlist+ playlist: videoId,+ // show controls+ controls: "1",+ rel: "0",+ modestbranding: "1",+ // no annotations over the demo+ iv_load_policy: "3",+ });++ return `https://www.youtube.com/embed/${videoId}?${params.toString()}`;+}diff --git a/src/components/youtube-embed.tsx b/src/components/youtube-embed.tsxnew file mode 100644index 0000000..ab324ad--- /dev/null+++ b/src/components/youtube-embed.tsx@@ -0,0 +1,92 @@+import { cn } from "@/lib/utils";++interface YouTubeEmbedProps {+ /** A `https://www.youtube.com/embed/...` URL, e.g. from `HOW_IT_WORKS_VIDEOS`. */+ src: string;+ /** Accessible name for the iframe — screen readers read this, not the video title. */+ title: string;+ /**+ * Start the clip on its own, muted and looping, the way the self-hosted demo it+ * stands in for does.+ *+ * Off by default: a player someone opened on purpose, like the "How it works" tabs,+ * should wait to be asked.+ */+ autoPlay?: boolean;+ className?: string;+ testId?: string;+}++/**+ * A YouTube player in an iframe, sized to fill its container.+ *+ * Used both by the "How it works" tabs and as the fallback for browsers that cannot+ * play the self-hosted demo MP4s (`src/hooks/use-supports-inline-video.ts`): YouTube+ * ships its own player and serves a rendition the device can decode, which is the+ * point of falling back to it at all.+ */+export function YouTubeEmbed({+ src,+ title,+ autoPlay = false,+ className,+ testId,+}: YouTubeEmbedProps) {+ return (+ <iframe+ src={autoPlay ? buildAutoPlayUrl(src) : src}+ title={title}+ // `autoplay` here is the Permissions Policy delegation: without it the player is+ // not allowed to start itself, whatever the URL asks for+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"+ referrerPolicy="strict-origin-when-cross-origin"+ allowFullScreen+ className={cn("h-full w-full border-0", className)}+ data-testid={testId}+ />+ );+}++/**+ * The same URL with the parameters that make the player behave like the muted, looping+ * demo it replaces.+ *+ * Existing parameters on `src` are kept. A URL that cannot be parsed is handed back+ * untouched — this is the fallback path for browsers old enough that the MP4 does not+ * play, and a player that waits for a tap is a far better outcome there than a hero+ * with a broken iframe in it.+ *+ * @see https://developers.google.com/youtube/player_parameters+ */+function buildAutoPlayUrl(src: string) {+ let url: URL;++ try {+ url = new URL(src);+ } catch {+ return src;+ }++ url.searchParams.set("autoplay", "1");+ // no browser grants a gesture-free start to a player that can make noise, and a+ // marketing page should not make noise either way+ url.searchParams.set("mute", "1");+ // without this iOS takes the video fullscreen the moment it starts+ url.searchParams.set("playsinline", "1");+ // the only way to pause, scrub, unmute or go fullscreen once it is running+ url.searchParams.set("controls", "1");+ url.searchParams.set("rel", "0");+ url.searchParams.set("modestbranding", "1");+ // no annotations over the demo+ url.searchParams.set("iv_load_policy", "3");++ // `loop` is a playlist feature: a single video has to name itself as the playlist+ const videoId = url.pathname.split("/").pop();++ if (videoId) {+ url.searchParams.set("loop", "1");+ url.searchParams.set("playlist", videoId);+ }++ return url.toString();+}diff --git a/src/config.ts b/src/config.tsindex 994777a..b4556a3 100644--- a/src/config.ts+++ b/src/config.ts@@ -133,42 +133,54 @@ export const MARKETING_FEATURES_CARDS = [videoSrc: `${STATIC_ASSETS_URL}/demo-videos/live-preview-v1.mp4`,videoFallbackImg: `${STATIC_ASSETS_URL}/demo-videos/live-preview-fallback-v1.png`,videoDescription: "Live preview of the invoice as you make changes",+ youtubeVideoId: "pWkb_JcKouU",},{translationKey: "instantDownload",videoSrc: `${STATIC_ASSETS_URL}/demo-videos/instand-download-v1.mp4`,videoFallbackImg: `${STATIC_ASSETS_URL}/demo-videos/instant-download-fallback-04-03-2026.png`,videoDescription: "Instant download of the invoice as a PDF file",+ youtubeVideoId: "I4ygKyyyJ4I",},{translationKey: "shareableLinks",videoSrc: `${STATIC_ASSETS_URL}/demo-videos/share-invoice-v1.mp4`,videoFallbackImg: `${STATIC_ASSETS_URL}/demo-videos/share-invoice-fallback-v1.png`,videoDescription: "Shareable links to your invoice",+ youtubeVideoId: "GBNQtBciCJI",},{translationKey: "taxSupport",videoSrc: `${STATIC_ASSETS_URL}/demo-videos/tax-custom-v1.mp4`,videoFallbackImg: `${STATIC_ASSETS_URL}/demo-videos/tax-custom-fallback-v1.png`,videoDescription: "Customizable tax system support",+ youtubeVideoId: "F_iJxZ3PHbk",},{translationKey: "multiLanguage",videoSrc: `${STATIC_ASSETS_URL}/demo-videos/multi-lang-v1.mp4`,videoFallbackImg: `${STATIC_ASSETS_URL}/demo-videos/multi-lang-fallback-v1.png`,videoDescription: "Multiple languages and currencies support",+ youtubeVideoId: "ITMeKohyz3I",},{translationKey: "openSource",videoSrc: `${STATIC_ASSETS_URL}/demo-videos/open-source-v1.mp4`,videoFallbackImg: `${STATIC_ASSETS_URL}/demo-videos/open-source-fallback-v1.png`,videoDescription: "Open source invoice generator",+ youtubeVideoId: "mBam1T7peJA",},] as const satisfies {translationKey: string;videoSrc: string;videoFallbackImg: string;videoDescription: string;+ /**+ * Bare YouTube video id of the same demo, played on mobile instead of the MP4.+ * Stored as an id rather than a URL because looping a single video needs it+ * twice — once in the path and once as `playlist` (see `AutoPlayYouTubeEmbed`).+ */+ youtubeVideoId: string;}[];/**diff --git a/src/hooks/use-media-query.tsx b/src/hooks/use-media-query.tsxindex 6e5f815..a6cec98 100644--- a/src/hooks/use-media-query.tsx+++ b/src/hooks/use-media-query.tsx@@ -74,3 +74,8 @@ function useMediaQuery(export const useIsDesktop = () => {return useMediaQuery("(min-width: 1024px)");};++/** Tailwind's `xl` breakpoint, where the marketing demos switch from YouTube to MP4. */+export const useIsXlUp = () => {+ return useMediaQuery("(min-width: 1280px)");+};diff --git a/src/hooks/use-supports-inline-video.ts b/src/hooks/use-supports-inline-video.tsnew file mode 100644index 0000000..a32a348--- /dev/null+++ b/src/hooks/use-supports-inline-video.ts@@ -0,0 +1,54 @@+import { useSyncExternalStore } from "react";++import { supportsInlineVideo } from "@/utils/browser-support";++/** The user agent never changes, so there is nothing to subscribe to. */+const noop = () => {+ return undefined;+};++function subscribe() {+ return noop;+}++/**+ * `useSyncExternalStore` re-reads the snapshot on every render and treats a new value+ * as a change, so the answer is parsed once per user agent and handed back from here+ * afterwards. Keying the cache on the string rather than caching the first call keeps+ * it correct for anything that swaps the user agent underneath us (device emulation,+ * tests) instead of pinning whichever one happened to be first.+ */+let cachedUserAgent: string | null = null;+let cachedSnapshot = true;++function getSnapshot() {+ const userAgent = window.navigator.userAgent;++ if (userAgent !== cachedUserAgent) {+ cachedUserAgent = userAgent;+ cachedSnapshot = supportsInlineVideo(userAgent);+ }++ return cachedSnapshot;+}++/**+ * Prerendering has no user agent to read — the marketing pages are static — so the+ * server assumes the `<video>` path and the client corrects it on hydration if it+ * has to. That is the whole reason this is a store rather than an effect: React+ * expects the two snapshots to differ here and swaps them without a mismatch warning.+ */+function getServerSnapshot() {+ return true;+}++/**+ * Whether this browser can be trusted to play the self-hosted MP4 demos inline.+ *+ * `false` on iOS 15 and older and on desktop Safari 15 and older, where the demos+ * silently never start; those visitors get a YouTube embed instead. See+ * {@link supportsInlineVideo} for the thresholds and why it fails open.+ */+export function useSupportsInlineVideo() {+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);+}diff --git a/src/i18n/request.ts b/src/i18n/request.tsindex c9824df..455117b 100644--- a/src/i18n/request.ts+++ b/src/i18n/request.ts@@ -1,13 +1,18 @@import { hasLocale } from "next-intl";import { getRequestConfig } from "next-intl/server";+import { locale as rootLocale } from "next/root-params";import type EnMessages from "../../messages/en.json";import { routing } from "./routing";-export default getRequestConfig(async ({ requestLocale }) => {+export default getRequestConfig(async ({ locale: explicitLocale }) => {try {- // Typically corresponds to the `[locale]` segment- const requested = await requestLocale;+ // An explicit override (`getTranslations({ locale })`) wins. Otherwise the locale+ // is the `[locale]` root param. It is `undefined` under the `(main)` root layout+ // (`/`, `/changelog`, ...) and can be anything at all for a URL like `/xx/about`,+ // so both fall back to the default locale; the localized layouts decide whether+ // an unknown value is a 404.+ const requested = explicitLocale ?? (await rootLocale());const locale = hasLocale(routing.locales, requested)? requested@@ -24,7 +29,10 @@ export default getRequestConfig(async ({ requestLocale }) => {messages,};} catch (error) {- console.error("Error generating metadata:", error);+ console.error(+ "[i18n] [request.ts] Error resolving the request locale:",+ error,+ );throw error;}diff --git a/src/lib/debug-log.ts b/src/lib/debug-log.tsnew file mode 100644index 0000000..e86c1cf--- /dev/null+++ b/src/lib/debug-log.ts@@ -0,0 +1,31 @@+/**+ * Whether the development traces below are printed.+ *+ * Off by default, and deliberately a plain constant rather than an env var: flipping it is a+ * one-character edit while you are already in the editor chasing something, and it costs the+ * app no configuration surface. `next.config.mjs` strips `console` calls from production+ * builds anyway -- this switch is about the *development* console, which the invoice page's+ * data-flow traces otherwise fill on every keystroke, burying anything else you were watching.+ */+// The annotation is the point: without it `false` narrows to a literal type, and every call+// below becomes statically dead code -- which is exactly what breaks the moment you flip this.+// oxlint-disable-next-line typescript/no-inferrable-types+const DEBUG_LOGS_ENABLED: boolean = false;++/**+ * Traces the invoice page's data flow: which source the invoice was initialized from, when the+ * URL is rewritten, when a change is detected against a shared link.+ *+ * These read as a narrative when you are debugging that flow and as noise the rest of the time,+ * which is why they are gated rather than deleted. `console.warn` (not `log`) because the repo+ * bans `console.log`.+ *+ * @param args - Anything `console.warn` accepts.+ */+export function debugLog(...args: unknown[]) {+ if (!DEBUG_LOGS_ENABLED) {+ return;+ }++ console.warn(...args);+}diff --git a/src/lib/google-drive.ts b/src/lib/google-drive.tsindex 6166f13..81db9a8 100644--- a/src/lib/google-drive.ts+++ b/src/lib/google-drive.ts@@ -7,7 +7,7 @@ import { env } from "@/env";type GoogleDriveFile = drive_v3.Schema$File;-export interface DriveFolderRef {+interface DriveFolderRef {id: string;webViewLink: string;}diff --git a/src/lib/seo/__tests__/changelog-json-ld.test.ts b/src/lib/seo/__tests__/changelog-json-ld.test.tsindex fc0cbc5..b2f3471 100644--- a/src/lib/seo/__tests__/changelog-json-ld.test.ts+++ b/src/lib/seo/__tests__/changelog-json-ld.test.ts@@ -3,7 +3,8 @@ import { describe, expect, it } from "vitest";import {buildChangelogIndexJsonLdGraph,buildChangelogPostJsonLdGraph,-} from "../../../app/changelog/build-changelog-json-ld";+} from "@/app/(main)/changelog/build-changelog-json-ld";+import { JSON_LD_IDS } from "../json-ld-ids";describe("buildChangelogIndexJsonLdGraph", () => {diff --git a/src/lib/seo/__tests__/founder-json-ld.test.ts b/src/lib/seo/__tests__/founder-json-ld.test.tsindex af8cd63..97be0b5 100644--- a/src/lib/seo/__tests__/founder-json-ld.test.ts+++ b/src/lib/seo/__tests__/founder-json-ld.test.ts@@ -1,6 +1,7 @@import { describe, expect, it } from "vitest";-import { buildFounderJsonLdGraph } from "../../../app/founder/build-founder-json-ld";+import { buildFounderJsonLdGraph } from "@/app/(main)/founder/build-founder-json-ld";+import { JSON_LD_IDS } from "../json-ld-ids";describe("buildFounderJsonLdGraph", () => {diff --git a/src/lib/seo/__tests__/home-json-ld.test.ts b/src/lib/seo/__tests__/home-json-ld.test.tsindex 9385c51..f77f534 100644--- a/src/lib/seo/__tests__/home-json-ld.test.ts+++ b/src/lib/seo/__tests__/home-json-ld.test.ts@@ -1,6 +1,7 @@import { describe, expect, it } from "vitest";-import { buildHomeJsonLdGraph } from "../../../app/(app)/home-json-ld";+import { buildHomeJsonLdGraph } from "@/app/(main)/(app)/home-json-ld";+import { JSON_LD_IDS } from "../json-ld-ids";describe("buildHomeJsonLdGraph", () => {diff --git a/src/lib/tailwind-hit-area-plugin.ts b/src/lib/tailwind-hit-area-plugin.tsnew file mode 100644index 0000000..d9ac9a7--- /dev/null+++ b/src/lib/tailwind-hit-area-plugin.ts@@ -0,0 +1,100 @@+import plugin from "tailwindcss/plugin";+import type { CSSRuleObject } from "tailwindcss/types/config";++/**+ * `hit-area-*` utilities: grow an element's touch target without touching the layout.+ *+ * A small control surrounded by padding leaves a dead zone — the tap looks like it landed+ * on the button but hits the container instead. Growing the control itself (more padding,+ * a taller box) moves everything around it, so the hit area is grown with an absolutely+ * positioned, invisible `::before` that spills outside the element's own box.+ *+ * ```tsx+ * <button className="hit-area-2" /> // 8px on every side+ * <button className="hit-area-y-1.5" /> // 6px top and bottom+ * <button className="hit-area-l-4" /> // 16px on the left only+ * <button className="hit-area-[21px]" /> // arbitrary values work too+ * <button className="hit-area-2 hit-area-debug" /> // paint the zone while developing+ * ```+ *+ * The utilities compose: each one only writes the custom properties for the sides it+ * names, and the shared `::before` reads all four with a `0px` fallback.+ *+ * Ported to Tailwind v3 from Kian Bazarjani's v4 `@utility` version,+ * https://bazza.dev/craft/2026/hit-area+ */++type HitAreaSide = "t" | "r" | "b" | "l";++const ALL_SIDES = [+ "t",+ "r",+ "b",+ "l",+] as const satisfies readonly HitAreaSide[];++const HIT_AREA_PSEUDO_ELEMENT = {+ position: "relative",+ "&::before": {+ content: '""',+ position: "absolute",+ top: "var(--hit-area-t, 0px)",+ right: "var(--hit-area-r, 0px)",+ bottom: "var(--hit-area-b, 0px)",+ left: "var(--hit-area-l, 0px)",+ // `inherit` rather than `auto`: a disabled control sets `pointer-events: none`, and+ // its hit area has to go dead with it+ pointerEvents: "inherit",+ },+} satisfies CSSRuleObject;++/**+ * Builds the callback Tailwind hands a matched value, e.g. `4` (from the spacing scale)+ * or `21px` (arbitrary). Offsets are negative so the pseudo-element grows outwards.+ */+function hitAreaUtility(sides: readonly HitAreaSide[]) {+ return (value: string): CSSRuleObject => {+ const offsets: CSSRuleObject = {};++ for (const side of sides) {+ offsets[`--hit-area-${side}`] = `calc(${value} * -1)`;+ }++ return { ...offsets, ...HIT_AREA_PSEUDO_ELEMENT };+ };+}++export const hitAreaPlugin = plugin(+ ({ matchUtilities, addUtilities, theme }) => {+ matchUtilities(+ {+ "hit-area": hitAreaUtility(ALL_SIDES),+ "hit-area-x": hitAreaUtility(["l", "r"]),+ "hit-area-y": hitAreaUtility(["t", "b"]),+ "hit-area-t": hitAreaUtility(["t"]),+ "hit-area-r": hitAreaUtility(["r"]),+ "hit-area-b": hitAreaUtility(["b"]),+ "hit-area-l": hitAreaUtility(["l"]),+ },+ { values: theme("spacing") },+ );++ // Development aid: makes the invisible zone visible. Registered after the utilities+ // above so it wins the `::before` cascade and can paint over them.+ addUtilities({+ ".hit-area-debug": {+ ...HIT_AREA_PSEUDO_ELEMENT,+ "&::before": {+ ...HIT_AREA_PSEUDO_ELEMENT["&::before"],+ outline: "1px dashed rgb(59 130 246)", // blue-500+ backgroundColor: "rgb(59 130 246 / 0.1)",+ },+ // turns green under the pointer, so adjacent zones can be told apart+ "&:hover::before": {+ outline: "1px dashed rgb(34 197 94)", // green-500+ backgroundColor: "rgb(34 197 94 / 0.1)",+ },+ },+ });+ },+);diff --git a/src/middleware.ts b/src/proxy.tssimilarity index 51%rename from src/middleware.tsrename to src/proxy.tsindex 6c6ee5c..eb2c6ae 100644--- a/src/middleware.ts+++ b/src/proxy.ts@@ -3,13 +3,14 @@ import createMiddleware from "next-intl/middleware";import { routing } from "@/i18n/routing";/**- * Resolves the locale before any layout renders.+ * Resolves the locale before any layout renders. Next.js 16 renamed the+ * `middleware` file convention to `proxy` (Node.js runtime only); next-intl+ * still exports the handler from `next-intl/middleware`.*- * Without this, next-intl falls back to `setRequestLocale()`, whose value does- * not reach `getRequestConfig()` on Next.js 15 — every `[locale]` route then- * renders in the default locale. Static rendering hides it (the `/[locale]/about`- * pages are prerendered per locale), so it only shows up on dynamic renders,- * i.e. `next dev`.+ * The locale itself is resolved from the `[locale]` root param in+ * `src/i18n/request.ts` (`next/root-params`); the proxy only keeps next-intl's+ * routing behaviour for the prefixed routes (the `NEXT_LOCALE` cookie and the+ * locale header it sets for the request).*/export default createMiddleware(routing);diff --git a/src/trigger/monthly-recurring-invoice.ts b/src/trigger/monthly-recurring-invoice.tsindex d81e1b7..de7fa24 100644--- a/src/trigger/monthly-recurring-invoice.ts+++ b/src/trigger/monthly-recurring-invoice.ts@@ -19,8 +19,6 @@ const INVOICE_GENERATION_HOUR = 13;* the /api/generate-invoice endpoint.** Replaces the old .github/workflows/monthly-recurring-invoice.yml workflow.- *- * @lintignore consumed by the Trigger.dev CLI, not by app code*/export const monthlyRecurringInvoice = schedules.task({id: "monthly-recurring-invoice",diff --git a/src/types/next-root-params.d.ts b/src/types/next-root-params.d.tsnew file mode 100644index 0000000..3c41322--- /dev/null+++ b/src/types/next-root-params.d.ts@@ -0,0 +1,16 @@+// Not a module on purpose (no top-level import/export): a module augmentation+// cannot add new declarations, only an ambient declaration merges with the+// shorthand `declare module 'next/root-params'` that ships with Next.js.++/**+ * `next typegen` (16.3.4) leaves `next/root-params` untyped for this app: it works+ * on normalized routes, where the `(main)` root layout becomes `/` and is then+ * treated as an ancestor of the `[locale]` root layout, so "no root params" are+ * emitted (`.next/types/root-params.d.ts`) and every import is `any`. The runtime+ * detects root layouts from the file system and does resolve `locale`; this only+ * restores the type. `string | undefined` because the `(main)` root layout has no+ * such param. Drop this file once the generated one declares `locale` itself.+ */+declare module "next/root-params" {+ export function locale(): Promise<string | undefined>;+}diff --git a/src/utils/__tests__/browser-support.test.ts b/src/utils/__tests__/browser-support.test.tsnew file mode 100644index 0000000..28917b0--- /dev/null+++ b/src/utils/__tests__/browser-support.test.ts@@ -0,0 +1,343 @@+import { describe, expect, it } from "vitest";++import {+ BROWSER_SUPPORT_TABLES,+ detectBrowser,+ detectIosVersion,+ getBrowserSupport,+ supportsInlineVideo,+} from "../browser-support";++/**+ * Real user agent strings. The "recent" ones only have to sit above the+ * `MINIMUM_RECENT_VERSION` table, the "old" ones below it.+ */+const USER_AGENTS = {+ chromeRecent:+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",+ chromeOld:+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",+ chromeAncient:+ "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36",+ chromeIos:+ "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/126.0.6478.54 Mobile/15E148 Safari/604.1",+ edgeRecent:+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0",+ edgeLegacy:+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763",+ firefoxRecent:+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0",+ firefoxOld:+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0",+ firefoxIos:+ "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/127.0 Mobile/15E148 Safari/605.1.15",+ safariRecent:+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1 Safari/605.1.15",+ safariOld:+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15",+ safariAncient:+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7",+ iosSafariRecent:+ "Mozilla/5.0 (iPhone; CPU iPhone OS 18_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1 Mobile/15E148 Safari/604.1",+ iosSafariOld:+ "Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Mobile/15E148 Safari/604.1",+ operaRecent:+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 OPR/125.0.0.0",+ operaPresto: "Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14",+ samsungRecent:+ "Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/27.0 Chrome/125.0.0.0 Mobile Safari/537.36",+ samsungOld:+ "Mozilla/5.0 (Linux; Android 9) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/10.1 Chrome/71.0.3578.99 Mobile Safari/537.36",+ androidWebView:+ "Mozilla/5.0 (Linux; Android 10; SM-A505F Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/96.0.4664.104 Mobile Safari/537.36",+ iosWebView:+ "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",+ // an iPhone 6s on the last iOS it can run: WebKit 15 no matter which browser+ chromeIosOld:+ "Mozilla/5.0 (iPhone; CPU iPhone OS 15_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/126.0.6478.54 Mobile/15E148 Safari/604.1",+ iosWebViewOld:+ "Mozilla/5.0 (iPhone; CPU iPhone OS 15_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",+ // iPad drops the `iPhone` from the OS token+ ipadSafariOld:+ "Mozilla/5.0 (iPad; CPU OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Mobile/15E148 Safari/604.1",+ googlebot:+ "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",+ // Playwright's `iPhone 13 Pro` descriptor, verbatim: a modern WebKit behind an OS+ // token frozen at `15_0`. No real device emits this pair - iOS 15 ships Safari 15.+ emulatedIphone:+ "Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.4 Mobile/15E148 Safari/604.1",+} as const;++describe("detectBrowser", () => {+ it("picks the browser over the Chromium/WebKit tokens it also carries", () => {+ // Edge, Opera and Samsung Internet all say `Chrome/`, Chrome on iOS says+ // `Safari/`: the most specific match has to win.+ expect(detectBrowser(USER_AGENTS.edgeRecent)).toEqual({+ id: "edge",+ name: "Microsoft Edge",+ majorVersion: 141,+ });+ expect(detectBrowser(USER_AGENTS.operaRecent)).toEqual({+ id: "opera",+ name: "Opera",+ majorVersion: 125,+ });+ expect(detectBrowser(USER_AGENTS.samsungRecent)).toEqual({+ id: "samsung",+ name: "Samsung Internet",+ majorVersion: 27,+ });+ expect(detectBrowser(USER_AGENTS.chromeIos)).toEqual({+ id: "chrome",+ name: "Chrome",+ majorVersion: 126,+ });+ expect(detectBrowser(USER_AGENTS.firefoxIos)).toEqual({+ id: "firefox",+ name: "Firefox",+ majorVersion: 127,+ });+ });++ it("reads Safari's marketing version, not WebKit's build number", () => {+ expect(detectBrowser(USER_AGENTS.safariRecent)).toEqual({+ id: "safari",+ name: "Safari",+ majorVersion: 18,+ });+ expect(detectBrowser(USER_AGENTS.iosSafariOld)).toEqual({+ id: "safari",+ name: "Safari",+ majorVersion: 15,+ });+ });++ it("returns null for anything it cannot place", () => {+ // An iOS WebView has no `Version/` token, so it is not Safari as far as we+ // are concerned — better silent than nagging the wrong browser.+ expect(detectBrowser(USER_AGENTS.iosWebView)).toBeNull();+ expect(detectBrowser(USER_AGENTS.googlebot)).toBeNull();+ expect(detectBrowser("")).toBeNull();+ });+});++describe("getBrowserSupport", () => {+ it("stays quiet on browsers released within the last three years", () => {+ const recent = [+ USER_AGENTS.chromeRecent,+ USER_AGENTS.chromeIos,+ USER_AGENTS.edgeRecent,+ USER_AGENTS.firefoxRecent,+ USER_AGENTS.firefoxIos,+ USER_AGENTS.safariRecent,+ USER_AGENTS.iosSafariRecent,+ USER_AGENTS.operaRecent,+ USER_AGENTS.samsungRecent,+ ];++ for (const userAgent of recent) {+ expect(getBrowserSupport(userAgent)?.status).toBe("supported");+ }+ });++ it("flags browsers older than three years as outdated", () => {+ const outdated = [+ USER_AGENTS.chromeOld,+ USER_AGENTS.firefoxOld,+ USER_AGENTS.safariOld,+ USER_AGENTS.iosSafariOld,+ // an Android system WebView reports the Chrome version it is built on,+ // and `Version/4.0` is not a Safari version+ USER_AGENTS.androidWebView,+ // Samsung Internet has no `.browserslistrc` floor, so even a very old one+ // can only ever come out as "outdated"+ USER_AGENTS.samsungOld,+ ];++ for (const userAgent of outdated) {+ expect(getBrowserSupport(userAgent)?.status).toBe("outdated");+ }+ });++ it("flags browsers below the `.browserslistrc` floor as unsupported", () => {+ const unsupported = [+ USER_AGENTS.chromeAncient,+ USER_AGENTS.edgeLegacy,+ USER_AGENTS.safariAncient,+ USER_AGENTS.operaPresto,+ ];++ for (const userAgent of unsupported) {+ expect(getBrowserSupport(userAgent)?.status).toBe("unsupported");+ }+ });++ it("returns null for an unidentified browser", () => {+ expect(getBrowserSupport(USER_AGENTS.googlebot)).toBeNull();+ });+});++describe("detectIosVersion", () => {+ it("reads the OS version from any browser on iOS", () => {+ expect(detectIosVersion(USER_AGENTS.iosSafariOld)).toBe(15);+ expect(detectIosVersion(USER_AGENTS.iosSafariRecent)).toBe(18);+ expect(detectIosVersion(USER_AGENTS.chromeIos)).toBe(17);+ expect(detectIosVersion(USER_AGENTS.firefoxIos)).toBe(17);+ // a WebView says nothing about the browser, but still says which iOS it is+ expect(detectIosVersion(USER_AGENTS.iosWebView)).toBe(17);+ // iPad writes `CPU OS 15_6`, without the `iPhone`+ expect(detectIosVersion(USER_AGENTS.ipadSafariOld)).toBe(15);+ });++ it("returns null off iOS", () => {+ expect(detectIosVersion(USER_AGENTS.safariRecent)).toBeNull();+ expect(detectIosVersion(USER_AGENTS.chromeRecent)).toBeNull();+ expect(detectIosVersion(USER_AGENTS.androidWebView)).toBeNull();+ expect(detectIosVersion("")).toBeNull();+ });+});++describe("supportsInlineVideo", () => {+ it("sends every browser on an old iOS to the YouTube fallback", () => {+ // On iOS the OS decides, not the badge on the browser: `CriOS/126` and a+ // WebView with no browser token at all are the same WebKit 15 underneath.+ const oldIos = [+ USER_AGENTS.iosSafariOld,+ USER_AGENTS.chromeIosOld,+ USER_AGENTS.iosWebViewOld,+ USER_AGENTS.ipadSafariOld,+ ];++ for (const userAgent of oldIos) {+ expect(supportsInlineVideo(userAgent)).toBe(false);+ }+ });++ it("sends old desktop Safari to the YouTube fallback too", () => {+ expect(supportsInlineVideo(USER_AGENTS.safariOld)).toBe(false);+ expect(supportsInlineVideo(USER_AGENTS.safariAncient)).toBe(false);+ });++ it("keeps the inline video on everything that plays it", () => {+ const supported = [+ USER_AGENTS.chromeRecent,+ // three years old, but Chromium has never had a problem with these files+ USER_AGENTS.chromeOld,+ USER_AGENTS.chromeIos,+ USER_AGENTS.edgeRecent,+ USER_AGENTS.firefoxRecent,+ USER_AGENTS.firefoxOld,+ USER_AGENTS.firefoxIos,+ USER_AGENTS.safariRecent,+ USER_AGENTS.iosSafariRecent,+ USER_AGENTS.iosWebView,+ USER_AGENTS.operaRecent,+ USER_AGENTS.samsungRecent,+ // Samsung Internet has no video floor of its own+ USER_AGENTS.samsungOld,+ USER_AGENTS.androidWebView,+ ];++ for (const userAgent of supported) {+ expect(supportsInlineVideo(userAgent)).toBe(true);+ }+ });++ it("goes by Safari's own version on iOS, not the OS token", () => {+ // Emulated iPhones (Playwright, devtools device mode) pair a current WebKit with+ // a stale OS token. Safari reports the engine itself in `Version/`, so that is+ // what decides - otherwise every WebKit e2e run gets the YouTube fallback.+ expect(supportsInlineVideo(USER_AGENTS.emulatedIphone)).toBe(true);++ // and a real iOS 15, where the two agree, is still sent to the fallback+ expect(supportsInlineVideo(USER_AGENTS.iosSafariOld)).toBe(false);+ });++ it("falls back to the inline video when it cannot place the browser", () => {+ // Swapping a working <video> for a third party iframe is its own regression,+ // so an unknown user agent keeps the default path.+ expect(supportsInlineVideo(USER_AGENTS.googlebot)).toBe(true);+ expect(supportsInlineVideo("")).toBe(true);+ });++ it("drops browsers below the `.browserslistrc` floor as well", () => {+ expect(supportsInlineVideo(USER_AGENTS.chromeAncient)).toBe(false);+ expect(supportsInlineVideo(USER_AGENTS.edgeLegacy)).toBe(false);+ expect(supportsInlineVideo(USER_AGENTS.operaPresto)).toBe(false);+ });+});++describe("version tables", () => {+ it("keeps the unsupported floor in sync with .browserslistrc", async () => {+ const { readFile } = await import("node:fs/promises");++ const browserslistrc = await readFile(+ new URL("../../../.browserslistrc", import.meta.url),+ "utf8",+ );++ // `chrome 64` -> `["chrome", 64]`, ignoring comments and blank lines+ const configured = new Map(+ browserslistrc+ .split("\n")+ .map((line) => {+ return /^\s*([a-z_]+)\s+(\d+)\s*$/.exec(line);+ })+ .filter((match) => {+ return match !== null;+ })+ .map((match) => {+ return [match[1], Number(match[2])] as const;+ }),+ );++ expect(Object.fromEntries(configured)).toEqual({+ chrome: 64,+ edge: 79,+ firefox: 67,+ opera: 51,+ safari: 12,+ // `ios_saf` shares Safari's major version, so it has no entry of its own+ // in the table under test+ ios_saf: 12,+ });++ expect(BROWSER_SUPPORT_TABLES.minimumSupported).toEqual({+ chrome: configured.get("chrome"),+ edge: configured.get("edge"),+ firefox: configured.get("firefox"),+ opera: configured.get("opera"),+ safari: configured.get("safari"),+ });+ });++ it("only gives Safari a video floor of its own", () => {+ // Every other entry tracks the browserslist floor on purpose: below it the+ // bundle is not compiled for the browser anyway, and above it there is no+ // known video problem outside WebKit.+ const { minimumInlineVideo, minimumSupported } = BROWSER_SUPPORT_TABLES;++ expect(minimumInlineVideo).toEqual({+ ...minimumSupported,+ safari: 16,+ });+ expect(BROWSER_SUPPORT_TABLES.minimumInlineVideoIos).toBe(16);+ });++ it("fails once the three-year table has drifted by a full year", () => {+ // Deliberately a time bomb, with a year of slack: the table says "released+ // more than three years ago", and nothing else notices when that quietly+ // becomes "more than four years ago".+ const fourYearsAgo = new Date();+ fourYearsAgo.setFullYear(fourYearsAgo.getFullYear() - 4);++ for (const [browser, { majorVersion, releasedOn }] of Object.entries(+ BROWSER_SUPPORT_TABLES.minimumRecent,+ )) {+ expect(+ new Date(releasedOn).getTime(),+ `${browser} ${majorVersion} (${releasedOn}) is over four years old. Refresh MINIMUM_RECENT_VERSION in src/utils/browser-support.ts with: npx update-browserslist-db@latest && npx browserslist "last 3 years"`,+ ).toBeGreaterThan(fourYearsAgo.getTime());+ }+ });+});diff --git a/src/utils/__tests__/invoice-utils.test.ts b/src/utils/__tests__/invoice-utils.test.tsnew file mode 100644index 0000000..761318e--- /dev/null+++ b/src/utils/__tests__/invoice-utils.test.ts@@ -0,0 +1,112 @@+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 { MAX_SPELLABLE } from "@/utils/number-to-words";++import { getAmountInWords } from "../invoice.utils";++vi.mock("sonner", () => {+ return { toast: { error: vi.fn() } };+});++vi.mock("@sentry/nextjs", () => {+ return { captureException: vi.fn() };+});++/**+ * One known conversion per supported language.+ *+ * `getAmountInWords` no longer goes through `n2words`' runtime dispatcher — it indexes a+ * table of per-locale converters built at module scope, so a language wired to the wrong+ * import would still return a perfectly valid string. These expectations are the output of+ * the dispatcher it replaced, which is what makes a mis-wired locale fail here.+ */+const AMOUNT_IN_WORDS_BY_LANGUAGE = {+ en: "one thousand two hundred and thirty-four",+ pl: "tysiąc dwieście trzydzieści cztery",+ de: "eintausendzweihundertvierunddreißig",+ es: "mil doscientos treinta y cuatro",+ pt: "mil duzentos e trinta e quatro",+ ru: "одна тысяча двести тридцать четыре",+ uk: "одна тисяча двiстi тридцять чотири",+ fr: "mille deux cent trente-quatre",+ it: "milleduecentotrentaquattro",+ nl: "twaalfhonderd vierendertig",+} as const satisfies Record<(typeof SUPPORTED_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("covers every supported language", () => {+ expect(Object.keys(AMOUNT_IN_WORDS_BY_LANGUAGE).sort()).toEqual(+ [...SUPPORTED_LANGUAGES].sort(),+ );+ });++ it("floors the amount before converting", () => {+ expect(getAmountInWords({ amount: 42.99, language: "en" })).toBe(+ "forty-two",+ );+ });++ it("converts zero", () => {+ expect(getAmountInWords({ amount: 0, language: "en" })).toBe("zero");+ });++ it("returns a placeholder for a negative amount", () => {+ expect(getAmountInWords({ amount: -1, language: "en" })).toBe("-/-");+ });++ /**+ * A sum past the largest scale word these languages carry is an ordinary invoice in a+ * currency like VND or IDR, so it falls back to the digits without the error toast and+ * the Sentry report that a genuine conversion bug earns.+ */+ describe("an amount above the spellable range", () => {+ beforeEach(() => {+ vi.mocked(toast.error).mockClear();+ vi.mocked(Sentry.captureException).mockClear();+ });++ it("prints digits, never exponential notation", () => {+ // `<input type="number">` accepts "1e21" as typed input, and `toString()` would turn+ // that back into "1e+21" on the invoice.+ expect(getAmountInWords({ amount: 1e21, language: "en" })).toBe(+ "1000000000000000000000",+ );+ expect(getAmountInWords({ amount: 1.234e22, language: "en" })).toBe(+ "12340000000000000000000",+ );+ });++ it("falls back to the digits", () => {+ expect(+ getAmountInWords({ amount: MAX_SPELLABLE + 1, language: "en" }),+ ).toBe(String(MAX_SPELLABLE + 1));+ });++ it("does not tell the visitor something went wrong", () => {+ getAmountInWords({ amount: MAX_SPELLABLE + 1, language: "en" });++ expect(toast.error).not.toHaveBeenCalled();+ });++ it("does not report itself to Sentry", () => {+ getAmountInWords({ amount: MAX_SPELLABLE + 1, language: "en" });++ expect(Sentry.captureException).not.toHaveBeenCalled();+ });++ it("still spells out the largest amount it can", () => {+ expect(+ getAmountInWords({ amount: MAX_SPELLABLE, language: "en" }),+ ).toContain("nine hundred and ninety-nine billion");+ });+ });+});diff --git a/src/utils/browser-support.ts b/src/utils/browser-support.tsnew file mode 100644index 0000000..63e0f68--- /dev/null+++ b/src/utils/browser-support.ts@@ -0,0 +1,299 @@+/**+ * Client-side "is this browser too old?" check, used to nudge visitors on a stale+ * browser towards updating (`src/components/browser-support-notice.tsx`).+ *+ * Deliberately hand-rolled instead of reusing `ua-parser-js` (already a dependency,+ * but server-only today): all we need is the major version of the six engines that+ * make up practically all of the traffic, and that is a handful of regexes rather+ * than ~7 kB gzip of parser in the client bundle.+ *+ * Everything here is a pure function of the user agent string so it can be unit+ * tested without a DOM — see `__tests__/browser-support.test.ts`.+ */++const BROWSER_IDS = [+ "chrome",+ "edge",+ "firefox",+ "opera",+ "safari",+ "samsung",+] as const;++type BrowserId = (typeof BROWSER_IDS)[number];++export interface DetectedBrowser {+ id: BrowserId;+ /** Display name for the notice, e.g. `"Safari"`. */+ name: string;+ /**+ * Major version as the vendor markets it: Chrome 117, Safari 17 (Safari jumped+ * from 18 to 26 in 2025, so this is not a linear counter).+ */+ majorVersion: number;+}++interface BrowserPattern {+ id: BrowserId;+ name: string;+ /** Must capture the major version in group 1. */+ pattern: RegExp;+}++/**+ * Ordered most specific first: every Chromium browser also says `Chrome/` and every+ * WebKit browser also says `Safari/`, so Edge/Opera/Samsung have to be tried before+ * Chrome, and Chrome before Safari.+ */+const BROWSER_PATTERNS = [+ // `Edg/` desktop, `EdgA/` Android, `EdgiOS/` iOS, `Edge/` the old EdgeHTML one+ { id: "edge", name: "Microsoft Edge", pattern: /\bEdg(?:e|A|iOS)?\/(\d+)/ },+ // `OPR/` desktop and Android, `OPiOS/` iOS, `Opera/` the old Presto ones+ { id: "opera", name: "Opera", pattern: /\b(?:OPR|OPiOS|Opera)\/(\d+)/ },+ {+ id: "samsung",+ name: "Samsung Internet",+ pattern: /\bSamsungBrowser\/(\d+)/,+ },+ // `FxiOS/` is Firefox on iOS, which is WebKit but versioned like Firefox+ { id: "firefox", name: "Firefox", pattern: /\b(?:Firefox|FxiOS)\/(\d+)/ },+ // `CriOS/` is Chrome on iOS, versioned in lockstep with desktop Chrome+ {+ id: "chrome",+ name: "Chrome",+ pattern: /\b(?:Chrome|CriOS|Chromium)\/(\d+)/,+ },+ // Safari puts its marketing version in `Version/`; `Safari/605.1.15` is WebKit's.+ // A WebView with no `Version/` token stays unidentified on purpose (see below).+ {+ id: "safari",+ name: "Safari",+ pattern: /\bVersion\/(\d+)[\d.]*\s+(?:Mobile\/\S+\s+)?Safari\//,+ },+] as const satisfies readonly BrowserPattern[];++interface MinimumRecentVersion {+ majorVersion: number;+ /** Release date of `majorVersion`, kept so the staleness test can date the table. */+ releasedOn: `${number}-${number}-${number}`;+}++/**+ * Oldest major version of each browser that is *not yet* three years old — i.e. the+ * output of browserslist's `last 3 years` query. Anything below this is what we call+ * "outdated".+ *+ * Regenerate roughly once a year (a unit test fails when the table drifts past four+ * years, which is the point at which "three years old" has become a lie):+ *+ * ```sh+ * npx update-browserslist-db@latest && npx browserslist "last 3 years"+ * ```+ */+const MINIMUM_RECENT_VERSION = {+ chrome: { majorVersion: 117, releasedOn: "2023-09-12" },+ edge: { majorVersion: 117, releasedOn: "2023-09-14" },+ firefox: { majorVersion: 118, releasedOn: "2023-09-26" },+ opera: { majorVersion: 103, releasedOn: "2023-10-02" },+ // `safari 17` in browserslist, `ios_saf 17` shipped a week earlier (2023-09-18)+ safari: { majorVersion: 17, releasedOn: "2023-09-26" },+ samsung: { majorVersion: 23, releasedOn: "2023-10-18" },+} as const satisfies Record<BrowserId, MinimumRecentVersion>;++/**+ * The floor from `.browserslistrc`: below this the client bundle is not even+ * *syntactically* targeted at the browser any more, so the app is likely to break+ * outright rather than merely miss a feature.+ *+ * Kept in sync with that file by a unit test. Samsung Internet has no entry there+ * (browserslist only expands the browsers the config names), so it has no floor and+ * can only ever come out as "outdated".+ */+const MINIMUM_SUPPORTED_VERSION = {+ chrome: 64,+ edge: 79,+ firefox: 67,+ opera: 51,+ // `safari 12` and `ios_saf 12` are the same major+ safari: 12,+} as const satisfies Partial<Record<BrowserId, number>>;++/**+ * Oldest major version of each browser that plays the self-hosted `<video>` demos on+ * the marketing pages reliably. Below it we swap them for a YouTube embed, which+ * brings its own player and picks a rendition the device can actually decode — see+ * {@link supportsInlineVideo} and `src/hooks/use-supports-inline-video.ts`.+ *+ * Only Safari has a floor of its own: iOS 15 and older is where the "the demo videos+ * never start" reports come from. Every other entry mirrors+ * {@link MINIMUM_SUPPORTED_VERSION}, the point at which the bundle stops being+ * compiled for the browser at all — there is no evidence of a video-specific problem+ * anywhere above it, and swapping a working `<video>` for a third party iframe is not+ * free. Samsung Internet is Chromium and has no entry, i.e. no video floor.+ */+const MINIMUM_INLINE_VIDEO_VERSION = {+ chrome: MINIMUM_SUPPORTED_VERSION.chrome,+ edge: MINIMUM_SUPPORTED_VERSION.edge,+ firefox: MINIMUM_SUPPORTED_VERSION.firefox,+ opera: MINIMUM_SUPPORTED_VERSION.opera,+ safari: 16,+} as const satisfies Partial<Record<BrowserId, number>>;++/**+ * Oldest iOS major version that plays the demos reliably, checked ahead of+ * {@link MINIMUM_INLINE_VIDEO_VERSION} for every browser on iOS *except* Safari.+ *+ * On iOS every browser is WebKit underneath, but only Safari says so: Chrome reports+ * `CriOS/141`, Firefox `FxiOS/145` and a WebView reports no browser at all, so the+ * version in {@link detectBrowser} says nothing about the engine that has to decode+ * the video. The OS version in the user agent does.+ *+ * Safari is the exception: its `Version/` token *is* the WebKit version, so it is the+ * more precise of the two signals and the one {@link supportsInlineVideo} goes by.+ * Kept equal to `MINIMUM_INLINE_VIDEO_VERSION.safari` — on a real device the two move+ * together (iOS 15 ships Safari 15) and only ever disagree on a synthesised user+ * agent, where the OS token is the half that is stale.+ */+const MINIMUM_INLINE_VIDEO_IOS_VERSION = 16;++/**+ * Matches the OS version iOS puts in every user agent on the platform, Safari or not:+ * `CPU iPhone OS 15_6 like Mac OS X` on iPhone, `CPU OS 15_6 like Mac OS X` on iPad.+ */+const IOS_VERSION_PATTERN = /\bCPU (?:iPhone )?OS (\d+)(?:_\d+)* like Mac OS X/;++/**+ * Major iOS version behind a user agent, or `null` when it is not iOS.+ *+ * iPadOS 13 and later lie about themselves in desktop mode (`Macintosh; Intel Mac OS+ * X`), which lands here as `null` — those are iPads new enough to be well above the+ * floor anyway.+ */+export function detectIosVersion(userAgent: string): number | null {+ const match = IOS_VERSION_PATTERN.exec(userAgent);++ if (!match?.[1]) {+ return null;+ }++ // the pattern only ever captures digits, so `Number` is safe here+ const majorVersion = Number(match[1]);++ return Number.isFinite(majorVersion) ? majorVersion : null;+}++/**+ * Whether the browser behind `userAgent` can be trusted to play the self-hosted MP4+ * demos inline.+ *+ * Fails open — an unrecognised browser gets the `<video>` element — for the same+ * reason {@link detectBrowser} does: the fallback is a third party iframe, and+ * serving that to a browser that never had a problem is its own regression.+ */+export function supportsInlineVideo(userAgent: string): boolean {+ const browser = detectBrowser(userAgent);+ const iosVersion = detectIosVersion(userAgent);++ // iOS settles the engine for every browser on the platform, including the ones+ // `detectBrowser` reads as recent Chrome/Firefox or cannot place at all - but not+ // for Safari, which reports the engine itself in `Version/`. Browser emulation+ // (Playwright's iPhone descriptors, devtools device mode) pairs a modern WebKit+ // with a years-old OS token, and it is the OS token that is the fiction there.+ if (iosVersion !== null && browser?.id !== "safari") {+ return iosVersion >= MINIMUM_INLINE_VIDEO_IOS_VERSION;+ }++ if (!browser) {+ return true;+ }++ const minimumVersion =+ browser.id in MINIMUM_INLINE_VIDEO_VERSION+ ? MINIMUM_INLINE_VIDEO_VERSION[+ browser.id as keyof typeof MINIMUM_INLINE_VIDEO_VERSION+ ]+ : null;++ return minimumVersion === null || browser.majorVersion >= minimumVersion;+}++const BROWSER_SUPPORT_STATUSES = [+ /** Recent enough that we say nothing. */+ "supported",+ /** Released more than three years ago. */+ "outdated",+ /** Below the `.browserslistrc` floor: the bundle is not compiled for it. */+ "unsupported",+] as const;++type BrowserSupportStatus = (typeof BROWSER_SUPPORT_STATUSES)[number];++export interface BrowserSupport extends DetectedBrowser {+ status: BrowserSupportStatus;+}++/**+ * Identify the browser behind a user agent string.+ *+ * Returns `null` when it is none of the six we know about — a niche browser, a bot,+ * or an iOS WebView that omits the `Version/` token. Failing open is deliberate:+ * an unprompted "update your browser" toast aimed at the wrong browser is worse+ * than staying quiet.+ */+export function detectBrowser(userAgent: string): DetectedBrowser | null {+ for (const { id, name, pattern } of BROWSER_PATTERNS) {+ const match = pattern.exec(userAgent);++ if (!match?.[1]) {+ continue;+ }++ // the pattern only ever captures digits, so `Number` is safe here+ const majorVersion = Number(match[1]);++ if (!Number.isFinite(majorVersion)) {+ continue;+ }++ return { id, name, majorVersion };+ }++ return null;+}++/**+ * How far behind the browser behind `userAgent` is, or `null` when it could not be+ * identified (see {@link detectBrowser}).+ */+export function getBrowserSupport(userAgent: string): BrowserSupport | null {+ const browser = detectBrowser(userAgent);++ if (!browser) {+ return null;+ }++ const minimumSupported =+ browser.id in MINIMUM_SUPPORTED_VERSION+ ? MINIMUM_SUPPORTED_VERSION[+ browser.id as keyof typeof MINIMUM_SUPPORTED_VERSION+ ]+ : null;++ if (minimumSupported !== null && browser.majorVersion < minimumSupported) {+ return { ...browser, status: "unsupported" };+ }++ if (browser.majorVersion < MINIMUM_RECENT_VERSION[browser.id].majorVersion) {+ return { ...browser, status: "outdated" };+ }++ return { ...browser, status: "supported" };+}++/** Exported for the table-drift unit test only. */+export const BROWSER_SUPPORT_TABLES = {+ minimumRecent: MINIMUM_RECENT_VERSION,+ minimumSupported: MINIMUM_SUPPORTED_VERSION,+ minimumInlineVideo: MINIMUM_INLINE_VIDEO_VERSION,+ minimumInlineVideoIos: MINIMUM_INLINE_VIDEO_IOS_VERSION,+} as const;diff --git a/src/utils/invoice.utils.ts b/src/utils/invoice.utils.tsindex 4830213..ac73df3 100644--- a/src/utils/invoice.utils.ts+++ b/src/utils/invoice.utils.ts@@ -1,10 +1,26 @@import * as Sentry from "@sentry/nextjs";-import n2words from "n2words";import { toast } from "sonner";import { z } from "zod";import { SUPPORTED_LANGUAGES, type SupportedLanguages } from "@/app/schema";import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";+import { numberToWords } from "@/utils/number-to-words";++/**+ * The digits of a whole amount, for the two paths where it cannot be spelled out.+ *+ * Not `toString()`: from 10^21 up that switches to exponential notation and would print+ * "1e+21" on the invoice. `<input type="number">` accepts "1e21" as typed input, so a value+ * that large really can arrive from the form.+ *+ * @param amount - A whole, non-negative amount.+ */+function amountAsDigits(amount: number) {+ return amount.toLocaleString("en-US", {+ useGrouping: false,+ maximumFractionDigits: 0,+ });+}/*** Get the amount in words (e.g. 123.45 -> "one hundred twenty-three and 45/100 dollars")@@ -46,9 +62,15 @@ export function getAmountInWords({let amountInWords = "";try {- amountInWords = n2words(result.data.amount, {- lang: result.data.language,+ const words = numberToWords({+ value: result.data.amount,+ language: result.data.language,});++ // `null` means the amount is past the largest scale word these languages carry. That is+ // an unusual invoice, not a broken one -- in VND or IDR it is an ordinary sum -- so it+ // falls back to the digits quietly, without the toast and the Sentry report below.+ amountInWords = words ?? amountAsDigits(result.data.amount);} catch (error) {console.error("Failed to convert number to words:", error);toast.error("Failed to convert number to words", {@@ -65,7 +87,7 @@ export function getAmountInWords({Sentry.captureException(error);}- amountInWords = Math.floor(amount ?? 0).toString();+ amountInWords = amountAsDigits(Math.floor(amount));}return amountInWords;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.tsnew file mode 100644index 0000000..bf6c0b3--- /dev/null+++ b/src/utils/number-to-words/__tests__/number-to-words.test.ts@@ -0,0 +1,431 @@+import { describe, expect, it } from "vitest";++import { SUPPORTED_LANGUAGES, type SupportedLanguages } from "@/app/schema";++import { MAX_SPELLABLE, numberToWords } from "..";++/**+ * The output `n2words` produced for these values, captured before it was removed.+ *+ * This module replaced that package because it stored its number tables as BigInt+ * literals -- Safari 14+ syntax that no transpiler can lower, so the chunk it landed in+ * failed to parse outright on older iOS and took the invoice page down with it. Nothing+ * about the wording was meant to change, and these fixtures are what holds that line: they+ * are the old library's exact output, not a fresh reading of the grammar.+ *+ * The replacement was checked against `n2words` over every integer to 12,000, every scale+ * boundary, and 40,000 pseudo-random values across the whole supported range; it matched on+ * all ten languages. It was then checked against the fixtures `n2words` ships today, which+ * agreed everywhere except two points, both deliberate: Polish 90, where the old version+ * misspelled "dziewięćdziesiąt" and we follow the correction rather than the package (see+ * `../pl.ts`), and Dutch 1, which upstream now accents as "één" behind a new option whose+ * default it flipped -- a wording change, not a fix, so we keep "een".+ *+ * The rows below are the interesting corners of that sweep -- the irregular tens and+ * hundreds, the point where each scale word appears, and the plural forms the Slavic+ * languages switch between.+ */+const EXPECTED = {+ en: [+ [0, "zero"],+ [1, "one"],+ [11, "eleven"],+ [19, "nineteen"],+ [21, "twenty-one"],+ [42, "forty-two"],+ [80, "eighty"],+ [81, "eighty-one"],+ [99, "ninety-nine"],+ [100, "one hundred"],+ [101, "one hundred and one"],+ [111, "one hundred and eleven"],+ [200, "two hundred"],+ [700, "seven hundred"],+ [999, "nine hundred and ninety-nine"],+ [1000, "one thousand"],+ [1100, "one thousand one hundred"],+ [1234, "one thousand two hundred and thirty-four"],+ [2021, "two thousand and twenty-one"],+ [9999, "nine thousand nine hundred and ninety-nine"],+ [+ 123_456,+ "one hundred and twenty-three thousand four hundred and fifty-six",+ ],+ [1_000_000, "one million"],+ [2_000_000, "two million"],+ [+ 1_234_567,+ "one million two hundred and thirty-four thousand five hundred and sixty-seven",+ ],+ [1_000_000_000, "one billion"],+ [+ 999_999_999_999,+ "nine hundred and ninety-nine billion nine hundred and ninety-nine million nine hundred and ninety-nine thousand nine hundred and ninety-nine",+ ],+ ],+ pl: [+ [0, "zero"],+ [1, "jeden"],+ [11, "jedenaście"],+ [19, "dziewiętnaście"],+ [21, "dwadzieścia jeden"],+ [42, "czterdzieści dwa"],+ [80, "osiemdziesiąt"],+ [81, "osiemdziesiąt jeden"],+ [99, "dziewięćdziesiąt dziewięć"],+ [100, "sto"],+ [101, "sto jeden"],+ [111, "sto jedenaście"],+ [200, "dwieście"],+ [700, "siedemset"],+ [999, "dziewięćset dziewięćdziesiąt dziewięć"],+ [1000, "tysiąc"],+ [1100, "tysiąc sto"],+ [1234, "tysiąc dwieście trzydzieści cztery"],+ [2021, "dwa tysiące dwadzieścia jeden"],+ [9999, "dziewięć tysięcy dziewięćset dziewięćdziesiąt dziewięć"],+ [123_456, "sto dwadzieścia trzy tysiące czterysta pięćdziesiąt sześć"],+ [1_000_000, "milion"],+ [2_000_000, "dwa miliony"],+ [+ 1_234_567,+ "milion dwieście trzydzieści cztery tysiące pięćset sześćdziesiąt siedem",+ ],+ [1_000_000_000, "miliard"],+ [+ 999_999_999_999,+ "dziewięćset dziewięćdziesiąt dziewięć miliardów dziewięćset dziewięćdziesiąt dziewięć milionów dziewięćset dziewięćdziesiąt dziewięć tysięcy dziewięćset dziewięćdziesiąt dziewięć",+ ],+ ],+ de: [+ [0, "null"],+ [1, "eins"],+ [11, "elf"],+ [19, "neunzehn"],+ [21, "einundzwanzig"],+ [42, "zweiundvierzig"],+ [80, "achtzig"],+ [81, "einundachtzig"],+ [99, "neunundneunzig"],+ [100, "einhundert"],+ [101, "einhunderteins"],+ [111, "einhundertelf"],+ [200, "zweihundert"],+ [700, "siebenhundert"],+ [999, "neunhundertneunundneunzig"],+ [1000, "eintausend"],+ [1100, "eintausendeinhundert"],+ [1234, "eintausendzweihundertvierunddreißig"],+ [2021, "zweitausendeinundzwanzig"],+ [9999, "neuntausendneunhundertneunundneunzig"],+ [123_456, "einhundertdreiundzwanzigtausendvierhundertsechsundfünfzig"],+ [1_000_000, "eine Million"],+ [2_000_000, "zwei Millionen"],+ [+ 1_234_567,+ "eine Million zweihundertvierunddreißigtausendfünfhundertsiebenundsechzig",+ ],+ [1_000_000_000, "eine Milliarde"],+ [+ 999_999_999_999,+ "neunhundertneunundneunzig Milliarden neunhundertneunundneunzig Millionen neunhundertneunundneunzigtausendneunhundertneunundneunzig",+ ],+ ],+ es: [+ [0, "cero"],+ [1, "uno"],+ [11, "once"],+ [19, "diecinueve"],+ [21, "veintiuno"],+ [42, "cuarenta y dos"],+ [80, "ochenta"],+ [81, "ochenta y uno"],+ [99, "noventa y nueve"],+ [100, "cien"],+ [101, "ciento uno"],+ [111, "ciento once"],+ [200, "doscientos"],+ [700, "setecientos"],+ [999, "novecientos noventa y nueve"],+ [1000, "mil"],+ [1100, "mil cien"],+ [1234, "mil doscientos treinta y cuatro"],+ [2021, "dos mil veintiuno"],+ [9999, "nueve mil novecientos noventa y nueve"],+ [123_456, "ciento veintitrés mil cuatrocientos cincuenta y seis"],+ [1_000_000, "un millón"],+ [2_000_000, "dos millones"],+ [+ 1_234_567,+ "un millón doscientos treinta y cuatro mil quinientos sesenta y siete",+ ],+ [1_000_000_000, "mil millones"],+ [+ 999_999_999_999,+ "novecientos noventa y nueve mil novecientos noventa y nueve millones novecientos noventa y nueve mil novecientos noventa y nueve",+ ],+ ],+ pt: [+ [0, "zero"],+ [1, "um"],+ [11, "onze"],+ [19, "dezanove"],+ [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, "mil milhões"],+ [+ 999_999_999_999,+ "novecentos e noventa e nove mil novecentos e noventa e nove milhões novecentos e noventa e nove mil novecentos e noventa e nove",+ ],+ ],+ ru: [+ [0, "ноль"],+ [1, "один"],+ [11, "одиннадцать"],+ [19, "девятнадцать"],+ [21, "двадцать один"],+ [42, "сорок два"],+ [80, "восемьдесят"],+ [81, "восемьдесят один"],+ [99, "девяносто девять"],+ [100, "сто"],+ [101, "сто один"],+ [111, "сто одиннадцать"],+ [200, "двести"],+ [700, "семьсот"],+ [999, "девятьсот девяносто девять"],+ [1000, "одна тысяча"],+ [1100, "одна тысяча сто"],+ [1234, "одна тысяча двести тридцать четыре"],+ [2021, "две тысячи двадцать один"],+ [9999, "девять тысяч девятьсот девяносто девять"],+ [123_456, "сто двадцать три тысячи четыреста пятьдесят шесть"],+ [1_000_000, "один миллион"],+ [2_000_000, "два миллиона"],+ [+ 1_234_567,+ "один миллион двести тридцать четыре тысячи пятьсот шестьдесят семь",+ ],+ [1_000_000_000, "один миллиард"],+ [+ 999_999_999_999,+ "девятьсот девяносто девять миллиардов девятьсот девяносто девять миллионов девятьсот девяносто девять тысяч девятьсот девяносто девять",+ ],+ ],+ uk: [+ [0, "нуль"],+ [1, "один"],+ [11, "одинадцять"],+ [19, "дев'ятнадцять"],+ [21, "двадцять один"],+ [42, "сорок два"],+ [80, "вiсiмдесят"],+ [81, "вiсiмдесят один"],+ [99, "дев'яносто дев'ять"],+ [100, "сто"],+ [101, "сто один"],+ [111, "сто одинадцять"],+ [200, "двiстi"],+ [700, "сiмсот"],+ [999, "дев'ятсот дев'яносто дев'ять"],+ [1000, "одна тисяча"],+ [1100, "одна тисяча сто"],+ [1234, "одна тисяча двiстi тридцять чотири"],+ [2021, "двi тисячi двадцять один"],+ [9999, "дев'ять тисяч дев'ятсот дев'яносто дев'ять"],+ [123_456, "сто двадцять три тисячi чотириста п'ятдесят шiсть"],+ [1_000_000, "один мiльйон"],+ [2_000_000, "два мiльйони"],+ [+ 1_234_567,+ "один мiльйон двiстi тридцять чотири тисячi п'ятсот шiстдесят сiм",+ ],+ [1_000_000_000, "один мiльярд"],+ [+ 999_999_999_999,+ "дев'ятсот дев'яносто дев'ять мiльярдiв дев'ятсот дев'яносто дев'ять мiльйонiв дев'ятсот дев'яносто дев'ять тисяч дев'ятсот дев'яносто дев'ять",+ ],+ ],+ fr: [+ [0, "zéro"],+ [1, "un"],+ [11, "onze"],+ [19, "dix-neuf"],+ [21, "vingt et un"],+ [42, "quarante-deux"],+ [80, "quatre-vingts"],+ [81, "quatre-vingt-un"],+ [99, "quatre-vingt-dix-neuf"],+ [100, "cent"],+ [101, "cent un"],+ [111, "cent onze"],+ [200, "deux cents"],+ [700, "sept cents"],+ [999, "neuf cent quatre-vingt-dix-neuf"],+ [1000, "mille"],+ [1100, "mille cent"],+ [1234, "mille deux cent trente-quatre"],+ [2021, "deux mille vingt et un"],+ [9999, "neuf mille neuf cent quatre-vingt-dix-neuf"],+ [123_456, "cent vingt-trois mille quatre cent cinquante-six"],+ [1_000_000, "un million"],+ [2_000_000, "deux millions"],+ [+ 1_234_567,+ "un million deux cent trente-quatre mille cinq cent soixante-sept",+ ],+ [1_000_000_000, "un milliard"],+ [+ 999_999_999_999,+ "neuf cent quatre-vingt-dix-neuf milliards neuf cent quatre-vingt-dix-neuf millions neuf cent quatre-vingt-dix-neuf mille neuf cent quatre-vingt-dix-neuf",+ ],+ ],+ it: [+ [0, "zero"],+ [1, "uno"],+ [11, "undici"],+ [19, "diciannove"],+ [21, "ventuno"],+ [42, "quarantadue"],+ [80, "ottanta"],+ [81, "ottantuno"],+ [99, "novantanove"],+ [100, "cento"],+ [101, "centouno"],+ [111, "centoundici"],+ [200, "duecento"],+ [700, "settecento"],+ [999, "novecentonovantanove"],+ [1000, "mille"],+ [1100, "millecento"],+ [1234, "milleduecentotrentaquattro"],+ [2021, "duemilaventuno"],+ [9999, "novemilanovecentonovantanove"],+ [123_456, "centoventitremilaquattrocentocinquantasei"],+ [1_000_000, "un milione"],+ [2_000_000, "due milioni"],+ [+ 1_234_567,+ "un milione e duecentotrentaquattromilacinquecentosessantasette",+ ],+ [1_000_000_000, "un miliardo"],+ [+ 999_999_999_999,+ "novecentonovantanove miliardi, novecentonovantanove milioni e novecentonovantanovemilanovecentonovantanove",+ ],+ ],+ nl: [+ [0, "nul"],+ [1, "een"],+ [11, "elf"],+ [19, "negentien"],+ [21, "eenentwintig"],+ [42, "tweeënveertig"],+ [80, "tachtig"],+ [81, "eenentachtig"],+ [99, "negenennegentig"],+ [100, "honderd"],+ [101, "honderdeen"],+ [111, "honderdelf"],+ [200, "tweehonderd"],+ [700, "zevenhonderd"],+ [999, "negenhonderdnegenennegentig"],+ [1000, "duizend"],+ [1100, "elfhonderd"],+ [1234, "twaalfhonderd vierendertig"],+ [2021, "tweeduizend eenentwintig"],+ [9999, "negenennegentighonderd negenennegentig"],+ [123_456, "honderddrieëntwintigduizend vierhonderdzesenvijftig"],+ [1_000_000, "een miljoen"],+ [2_000_000, "twee miljoen"],+ [+ 1_234_567,+ "een miljoen tweehonderdvierendertigduizend vijfhonderdzevenenzestig",+ ],+ [1_000_000_000, "een miljard"],+ [+ 999_999_999_999,+ "negenhonderdnegenennegentig miljard negenhonderdnegenennegentig miljoen negenhonderdnegenennegentigduizend negenhonderdnegenennegentig",+ ],+ ],+} 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);+ });++ 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();+ }+ });+});++describe("numberToWords", () => {+ it("covers every supported language", () => {+ expect(Object.keys(EXPECTED).sort()).toEqual(+ [...SUPPORTED_LANGUAGES].sort(),+ );+ });++ it.each([-1, 1.5, Number.NaN, Number.POSITIVE_INFINITY])(+ "throws on %p, which can only be a caller that skipped its validation",+ (value) => {+ expect(() => {+ return numberToWords({ value, language: "en" });+ }).toThrow("expected a whole, non-negative number");+ },+ );++ it.each([MAX_SPELLABLE + 1, Number.MAX_SAFE_INTEGER])(+ "returns null for %p rather than spelling out something wrong",+ (value) => {+ expect(numberToWords({ value, language: "en" })).toBeNull();+ },+ );++ it("spells Polish 90 the way Polish spells it", () => {+ // The package this replaced misspelled it as "dziewięćdzisiąt"; upstream has since+ // corrected it, and so do we. See `../pl.ts`.+ expect(numberToWords({ value: 90, language: "pl" })).toBe(+ "dziewięćdziesiąt",+ );+ expect(numberToWords({ value: 1_000_090, language: "pl" })).toContain(+ "dziewięćdziesiąt",+ );+ });++ it("still spells out the largest supported value", () => {+ expect(numberToWords({ value: MAX_SPELLABLE, language: "en" })).toBe(+ "nine hundred and ninety-nine billion nine hundred and ninety-nine million nine hundred and ninety-nine thousand nine hundred and ninety-nine",+ );+ });+});diff --git a/src/utils/number-to-words/cards.ts b/src/utils/number-to-words/cards.tsnew file mode 100644index 0000000..6aa840a--- /dev/null+++ b/src/utils/number-to-words/cards.ts@@ -0,0 +1,198 @@+/**+ * The "highest matching card" engine that most European languages here are built on.+ *+ * A language supplies a table of cards -- a number and the word for it, highest first --+ * and a `merge` that says how two adjacent pieces join up. The engine repeatedly takes the+ * largest card that fits, recurses on how many of it there are, and then folds the whole+ * (nested) list back into a single phrase with `merge`.+ *+ * Ported from `n2words`' `BaseLanguage`, which we had to drop: it stores its cards as BigInt+ * literals, and BigInt is Safari 14+ syntax that no transpiler can lower, so the whole chunk+ * failed to parse on older iOS. See `./index.ts` for the range this works over.+ */++/** Words paired with the number they currently spell out. */+interface WordValue {+ /** The words accumulated so far, e.g. `"one hundred"`. */+ text: string;+ /** The number those words spell out, e.g. `100`. */+ value: number;+}++/** A number and the word for it, e.g. `[100, "hundred"]`. */+type NumberCard = readonly [number, string];++/** Everything a card-based language has to provide. */+export interface CardLanguage {+ /**+ * Cards from highest to lowest. Must include a card for `1` and end with one for `0`,+ * so that every non-negative value matches something.+ */+ cards: readonly NumberCard[];+ /** Joins two neighbouring pieces into one, applying the language's grammar. */+ merge: (parts: { left: WordValue; right: WordValue }) => WordValue;+ /** Last pass over the finished string. Defaults to trimming trailing space. */+ postClean?: (words: string) => string;+}++/** Either a finished piece or a nested group of them, mirroring how the engine recurses. */+type CardMatch = WordValue | CardMatch[];++function isGroup(match: CardMatch): match is CardMatch[] {+ return Array.isArray(match);+}++function findCard({+ cards,+ remaining,+}: {+ cards: readonly NumberCard[];+ remaining: number;+}): NumberCard {+ const card = cards.find(([number]) => {+ return remaining >= number;+ });++ if (!card) {+ // Only reachable if a language's table is missing its `0` card.+ throw new Error(`No card matches ${remaining}.`);+ }++ return card;+}++function wordForOne(cards: readonly NumberCard[]): string {+ const card = cards.find(([number]) => {+ return number === 1;+ });++ if (!card) {+ throw new Error("Language is missing a card for 1.");+ }++ return card[1];+}++/**+ * Break a value into the nested list of card matches that spell it out.+ *+ * `1234` becomes, roughly, `[[one], [thousand], [two, hundred], [thirty], [four]]` -- the+ * quantity of each card is itself run through the engine, which is where the nesting and+ * the recursion come from.+ */+function toCardMatches({+ value,+ cards,+}: {+ value: number;+ cards: readonly NumberCard[];+}): CardMatch[] {+ const out: CardMatch[] = [];+ let remaining = value;++ do {+ const card = findCard({ cards, remaining });+ const [cardNumber, cardWord] = card;++ let quantity: number;++ if (remaining === 0) {+ // Zero would make the division below meaningless, so short-circuit it.+ quantity = 1;+ remaining = 0;+ } else {+ quantity = Math.floor(remaining / cardNumber);+ remaining = remaining % cardNumber;+ }++ if (quantity === 1) {+ out.push({ text: wordForOne(cards), value: 1 });+ } else {+ out.push(toCardMatches({ value: quantity, cards }));+ }++ out.push({ text: cardWord, value: cardNumber });+ } while (remaining > 0);++ return out;+}++/**+ * Fold the nested match list down to a single piece.+ *+ * Each pass either merges the leading pair (when both are finished pieces) or flattens one+ * level of nesting, until a single piece is left.+ */+function collapse({+ matches,+ merge,+}: {+ matches: CardMatch[];+ merge: CardLanguage["merge"];+}): CardMatch {+ let words = matches;+ let out: CardMatch[] = matches;++ while (words.length !== 1) {+ out = [];++ const left = words[0];+ const right = words[1];++ if (left && right && !isGroup(left) && !isGroup(right)) {+ out.push(merge({ left, right }));++ const rest = words.slice(2);++ if (rest.length > 0) {+ out.push(rest);+ }+ } else {+ for (const element of words) {+ if (!isGroup(element)) {+ out.push(element);+ } else if (element.length === 1 && element[0]) {+ out.push(element[0]);+ } else {+ out.push(collapse({ matches: element, merge }));+ }+ }+ }++ words = out;+ }++ const result = out[0];++ if (result === undefined) {+ throw new Error("Collapsed to nothing.");+ }++ return result;+}++/**+ * Spell out a non-negative integer using a card-based language.+ */+export function cardsToWords({+ value,+ language,+}: {+ value: number;+ language: CardLanguage;+}): string {+ const matches = toCardMatches({ value, cards: language.cards });+ const collapsed = collapse({ matches, merge: language.merge });++ if (isGroup(collapsed)) {+ throw new Error("Collapsed to a group rather than a phrase.");+ }++ const postClean =+ language.postClean ??+ ((words: string) => {+ return words.replace(/\s+$/, "");+ });++ return postClean(collapsed.text);+}diff --git a/src/utils/number-to-words/de.ts b/src/utils/number-to-words/de.tsnew file mode 100644index 0000000..82936ac--- /dev/null+++ b/src/utils/number-to-words/de.ts@@ -0,0 +1,91 @@+import { cardsToWords, type CardLanguage } from "./cards";++/** `String.prototype.at` is Safari 15.4, which is newer than the browsers we target. */+function lastCharacter(text: string): string {+ // oxlint-disable-next-line unicorn/prefer-at -- `.at()` is Safari 15.4; `.browserslistrc` targets Safari 12, and SWC lowers syntax but never polyfills a built-in+ return text.charAt(text.length - 1);+}++const GERMAN: CardLanguage = {+ cards: [+ [1_000_000_000, "Milliarde"],+ [1_000_000, "Million"],+ [1000, "tausend"],+ [100, "hundert"],+ [90, "neunzig"],+ [80, "achtzig"],+ [70, "siebzig"],+ [60, "sechzig"],+ [50, "fünfzig"],+ [40, "vierzig"],+ [30, "dreißig"],+ [20, "zwanzig"],+ [19, "neunzehn"],+ [18, "achtzehn"],+ [17, "siebzehn"],+ [16, "sechzehn"],+ [15, "fünfzehn"],+ [14, "vierzehn"],+ [13, "dreizehn"],+ [12, "zwölf"],+ [11, "elf"],+ [10, "zehn"],+ [9, "neun"],+ [8, "acht"],+ [7, "sieben"],+ [6, "sechs"],+ [5, "fünf"],+ [4, "vier"],+ [3, "drei"],+ [2, "zwei"],+ [1, "eins"],+ [0, "null"],+ ],+ merge({ left, right }) {+ let leftText = left.text;+ let rightText = right.text;++ if (left.value === 1) {+ if (right.value === 100 || right.value === 1000) {+ return { text: `ein${rightText}`, value: right.value };+ }++ if (right.value < 1_000_000) {+ return right;+ }++ leftText = "eine";+ }++ if (right.value > left.value) {+ if (right.value >= 1_000_000) {+ if (left.value > 1) {+ rightText += lastCharacter(rightText) === "e" ? "n" : "en";+ }++ leftText += " ";+ }++ return {+ text: `${leftText}${rightText}`,+ value: left.value * right.value,+ };+ }++ if (right.value < 10 && left.value > 10 && left.value < 100) {+ // German says the units before the tens: "vierundzwanzig", literally "four and twenty".+ const units = right.value === 1 ? "ein" : rightText;++ rightText = leftText;+ leftText = `${units}und`;+ } else if (left.value >= 1_000_000) {+ leftText += " ";+ }++ return { text: `${leftText}${rightText}`, value: left.value + right.value };+ },+};++export function toWords(value: number): string {+ return cardsToWords({ value, language: GERMAN });+}diff --git a/src/utils/number-to-words/en.ts b/src/utils/number-to-words/en.tsnew file mode 100644index 0000000..3256446--- /dev/null+++ b/src/utils/number-to-words/en.ts@@ -0,0 +1,73 @@+import { cardsToWords, type CardLanguage } from "./cards";++const ENGLISH: CardLanguage = {+ cards: [+ [1_000_000_000, "billion"],+ [1_000_000, "million"],+ [1000, "thousand"],+ [100, "hundred"],+ [90, "ninety"],+ [80, "eighty"],+ [70, "seventy"],+ [60, "sixty"],+ [50, "fifty"],+ [40, "forty"],+ [30, "thirty"],+ [20, "twenty"],+ [19, "nineteen"],+ [18, "eighteen"],+ [17, "seventeen"],+ [16, "sixteen"],+ [15, "fifteen"],+ [14, "fourteen"],+ [13, "thirteen"],+ [12, "twelve"],+ [11, "eleven"],+ [10, "ten"],+ [9, "nine"],+ [8, "eight"],+ [7, "seven"],+ [6, "six"],+ [5, "five"],+ [4, "four"],+ [3, "three"],+ [2, "two"],+ [1, "one"],+ [0, "zero"],+ ],+ merge({ left, right }) {+ if (left.value === 1 && right.value < 100) {+ return right;+ }++ if (left.value < 100 && left.value > right.value) {+ return {+ text: `${left.text}-${right.text}`,+ value: left.value + right.value,+ };+ }++ if (left.value >= 100 && right.value < 100) {+ return {+ text: `${left.text} and ${right.text}`,+ value: left.value + right.value,+ };+ }++ if (right.value > left.value) {+ return {+ text: `${left.text} ${right.text}`,+ value: left.value * right.value,+ };+ }++ return {+ text: `${left.text} ${right.text}`,+ value: left.value + right.value,+ };+ },+};++export function toWords(value: number): string {+ return cardsToWords({ value, language: ENGLISH });+}diff --git a/src/utils/number-to-words/es.ts b/src/utils/number-to-words/es.tsnew file mode 100644index 0000000..a56bb9b--- /dev/null+++ b/src/utils/number-to-words/es.ts@@ -0,0 +1,108 @@+import { cardsToWords, type CardLanguage } from "./cards";++/**+ * Spanish counts in the long scale, so it has no card for 10^9 or 10^15: a billion is+ * 10^12 ("billón") and the gaps are spelled out as "mil millones" and so on.+ */+const SPANISH: CardLanguage = {+ cards: [+ [1_000_000, "millón"],+ [1000, "mil"],+ [100, "cien"],+ [90, "noventa"],+ [80, "ochenta"],+ [70, "setenta"],+ [60, "sesenta"],+ [50, "cincuenta"],+ [40, "cuarenta"],+ [30, "treinta"],+ [29, "veintinueve"],+ [28, "veintiocho"],+ [27, "veintisiete"],+ [26, "veintiséis"],+ [25, "veinticinco"],+ [24, "veinticuatro"],+ [23, "veintitrés"],+ [22, "veintidós"],+ [21, "veintiuno"],+ [20, "veinte"],+ [19, "diecinueve"],+ [18, "dieciocho"],+ [17, "diecisiete"],+ [16, "dieciseis"],+ [15, "quince"],+ [14, "catorce"],+ [13, "trece"],+ [12, "doce"],+ [11, "once"],+ [10, "diez"],+ [9, "nueve"],+ [8, "ocho"],+ [7, "siete"],+ [6, "seis"],+ [5, "cinco"],+ [4, "cuatro"],+ [3, "tres"],+ [2, "dos"],+ [1, "uno"],+ [0, "cero"],+ ],+ merge({ left, right }) {+ let leftText = left.text;+ let rightText = right.text;++ if (left.value === 1) {+ if (right.value < 1_000_000) {+ return right;+ }++ leftText = "un";+ } else if (left.value === 100 && right.value % 1000 !== 0) {+ // "cien" becomes "ciento" as soon as something follows it.+ leftText += "to";+ }++ if (right.value < left.value) {+ if (left.value < 100) {+ return {+ text: `${leftText} y ${rightText}`,+ value: left.value + right.value,+ };+ }++ return {+ text: `${leftText} ${rightText}`,+ value: left.value + right.value,+ };+ }++ if (right.value % 1_000_000 === 0 && left.value > 1) {+ rightText = `${rightText.slice(0, -3)}lones`;+ }++ if (right.value === 100) {+ // The hundreds are irregular: quinientos, setecientos, novecientos.+ if (left.value === 5) {+ leftText = "quinien";+ rightText = "";+ } else if (left.value === 7) {+ leftText = "sete";+ } else if (left.value === 9) {+ leftText = "nove";+ }++ rightText += "tos";+ } else {+ rightText = ` ${rightText}`;+ }++ return {+ text: `${leftText}${rightText}`,+ value: left.value * right.value,+ };+ },+};++export function toWords(value: number): string {+ return cardsToWords({ value, language: SPANISH });+}diff --git a/src/utils/number-to-words/fr.ts b/src/utils/number-to-words/fr.tsnew file mode 100644index 0000000..292575f--- /dev/null+++ b/src/utils/number-to-words/fr.ts@@ -0,0 +1,102 @@+import { cardsToWords, type CardLanguage } from "./cards";++/** `String.prototype.at` is Safari 15.4, which is newer than the browsers we target. */+function lastCharacter(text: string): string {+ // oxlint-disable-next-line unicorn/prefer-at -- `.at()` is Safari 15.4; `.browserslistrc` targets Safari 12, and SWC lowers syntax but never polyfills a built-in+ return text.charAt(text.length - 1);+}++const FRENCH: CardLanguage = {+ cards: [+ [1_000_000_000, "milliard"],+ [1_000_000, "million"],+ [1000, "mille"],+ [100, "cent"],+ [80, "quatre-vingts"],+ [60, "soixante"],+ [50, "cinquante"],+ [40, "quarante"],+ [30, "trente"],+ [20, "vingt"],+ [19, "dix-neuf"],+ [18, "dix-huit"],+ [17, "dix-sept"],+ [16, "seize"],+ [15, "quinze"],+ [14, "quatorze"],+ [13, "treize"],+ [12, "douze"],+ [11, "onze"],+ [10, "dix"],+ [9, "neuf"],+ [8, "huit"],+ [7, "sept"],+ [6, "six"],+ [5, "cinq"],+ [4, "quatre"],+ [3, "trois"],+ [2, "deux"],+ [1, "un"],+ [0, "zéro"],+ ],+ merge({ left, right }) {+ let leftText = left.text;+ let rightText = right.text;++ if (left.value === 1) {+ if (right.value < 1_000_000) {+ return right;+ }+ } else {+ // "quatre-vingts" drops its s before another number: "quatre-vingt-un".+ if (+ ((left.value - 80) % 100 === 0 ||+ (left.value % 100 === 0 && left.value < 1000)) &&+ right.value < 1_000_000 &&+ lastCharacter(leftText) === "s"+ ) {+ leftText = leftText.slice(0, -1);+ }++ // ...and "cent" gains one when it is itself multiplied: "deux cents".+ if (+ left.value < 1000 &&+ right.value !== 1000 &&+ lastCharacter(rightText) !== "s" &&+ right.value % 100 === 0+ ) {+ rightText += "s";+ }+ }++ if (right.value < left.value && left.value < 100) {+ if (right.value % 10 === 1 && left.value !== 80) {+ return {+ text: `${leftText} et ${rightText}`,+ value: left.value + right.value,+ };+ }++ return {+ text: `${leftText}-${rightText}`,+ value: left.value + right.value,+ };+ }++ if (right.value > left.value) {+ return {+ text: `${leftText} ${rightText}`,+ value: left.value * right.value,+ };+ }++ return {+ text: `${leftText} ${rightText}`,+ value: left.value + right.value,+ };+ },+};++export function toWords(value: number): string {+ return cardsToWords({ value, language: FRENCH });+}diff --git a/src/utils/number-to-words/index.ts b/src/utils/number-to-words/index.tsnew file mode 100644index 0000000..d01a8de--- /dev/null+++ b/src/utils/number-to-words/index.ts@@ -0,0 +1,85 @@+import { SUPPORTED_LANGUAGES, type SupportedLanguages } from "@/app/schema";++import { toWords as toWordsDE } from "./de";+import { toWords as toWordsEN } from "./en";+import { toWords as toWordsES } from "./es";+import { toWords as toWordsFR } from "./fr";+import { toWords as toWordsIT } from "./it";+import { toWords as toWordsNL } from "./nl";+import { toWords as toWordsPL } from "./pl";+import { toWords as toWordsPT } from "./pt";+import { toWords as toWordsRU } from "./ru";+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`+ * without a converter here is a type error rather than a runtime hole.+ */+const CONVERTERS = {+ en: toWordsEN,+ pl: toWordsPL,+ de: toWordsDE,+ es: toWordsES,+ pt: toWordsPT,+ ru: toWordsRU,+ uk: toWordsUK,+ fr: toWordsFR,+ it: toWordsIT,+ nl: toWordsNL,+} satisfies Record<SupportedLanguages, (value: number) => string>;++/**+ * One less than a trillion, the largest amount these languages carry a scale word for.+ *+ * The words above it are a liability rather than a feature: every language names the big+ * scales differently (a German "Trillion" is 10^18, an English one 10^12), so they are easy+ * to get subtly wrong and impossible to review. We decline past this point instead of+ * spelling out something we cannot vouch for.+ */+export const MAX_SPELLABLE = 999_999_999_999;++/**+ * Spell out a whole, non-negative number in one of the supported languages.+ *+ * This replaces the `n2words` package, which stored its number tables as BigInt literals.+ * BigInt is Safari 14+ *syntax*, so no transpiler could lower it and the chunk it landed in+ * failed to parse outright on older iOS -- taking the whole invoice page with it.+ *+ * @returns The number in words, or `null` when it is above {@link MAX_SPELLABLE}. An amount+ * that large is a legitimate invoice in a currency like VND or IDR, not a bug, so the caller+ * is handed a value to present rather than an exception to report -- see `getAmountInWords`.+ *+ * @throws {Error} If the value is not a whole, non-negative number. Unlike an amount over+ * the cap, that can only be a caller that skipped its own validation.+ */+export function numberToWords({+ value,+ language,+}: {+ /** A whole, non-negative number. */+ value: number;+ /** Which language to spell it out in. */+ language: SupportedLanguages;+}): string | null {+ if (!Number.isInteger(value) || value < 0) {+ throw new Error(+ `Cannot spell out ${value}: expected a whole, non-negative number.`,+ );+ }++ if (value > MAX_SPELLABLE) {+ return null;+ }++ const convert = CONVERTERS[language];++ if (!convert) {+ throw new Error(+ `No converter for language "${language}". Supported: ${SUPPORTED_LANGUAGES.join(", ")}.`,+ );+ }++ return convert(value);+}diff --git a/src/utils/number-to-words/it.ts b/src/utils/number-to-words/it.tsnew file mode 100644index 0000000..7d57aa6--- /dev/null+++ b/src/utils/number-to-words/it.ts@@ -0,0 +1,158 @@+// oxlint-disable 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++/**+ * Italian does not fit the card model the other European languages here share: it writes+ * numbers as one unbroken word and elides vowels where they collide, so it gets its own+ * digit-by-digit construction.+ */++const ZERO = "zero";++const CARDINAL_WORDS = [+ ZERO,+ "uno",+ "due",+ "tre",+ "quattro",+ "cinque",+ "sei",+ "sette",+ "otto",+ "nove",+ "dieci",+ "undici",+ "dodici",+ "tredici",+ "quattordici",+ "quindici",+ "sedici",+ "diciassette",+ "diciotto",+ "diciannove",+];++/** The tens that are not formed by the regular "-anta" suffix. */+const IRREGULAR_TENS: Record<number, string | undefined> = {+ 2: "venti",+ 3: "trenta",+ 4: "quaranta",+ 6: "sessanta",+};++/**+ * Italian builds its scale words from a prefix plus "-ilione"/"-iliardo": "m" gives+ * milione and miliardo. Only "m" is reachable, because `numberToWords` refuses anything+ * from 10^12 up -- the next prefix would start spelling out biliardi and beyond.+ */+const EXPONENT_PREFIXES = [ZERO, "m"];++/** Only "tre" at the end of a longer word takes the accent: "ventitré", but "tre". */+function accentuate(words: string): string {+ return words+ .split(" ")+ .map((word) => {+ const plain = word.replace(/tré/g, "tre");++ return word.endsWith("tre") && word.length > 3+ ? `${plain.slice(0, -3)}tré`+ : plain;+ })+ .join(" ");+}++function omitIfZero(words: string): string {+ return words === ZERO ? "" : words;+}++/** Italian drops the first of two colliding vowels: "venti" + "otto" becomes "ventotto". */+function phoneticContraction(words: string): string {+ return words+ .replace(/oo/g, "o")+ .replace(/ao/g, "o")+ .replace(/io/g, "o")+ .replace(/au/g, "u")+ .replace(/iu/g, "u");+}++function tensToWords(value: number): string {+ const tens = Math.floor(value / 10);+ const units = value % 10;++ // "cinque" -> "cinquanta", "otto" -> "ottanta", and so on for the regular tens.+ const prefix =+ IRREGULAR_TENS[tens] ?? `${CARDINAL_WORDS[tens].slice(0, -1)}anta`;++ return phoneticContraction(`${prefix}${omitIfZero(CARDINAL_WORDS[units])}`);+}++function hundredsToWords(value: number): string {+ const hundreds = Math.floor(value / 100);+ const prefix = hundreds === 1 ? "cento" : `${CARDINAL_WORDS[hundreds]}cento`;++ return phoneticContraction(`${prefix}${omitIfZero(toCardinal(value % 100))}`);+}++function thousandsToWords(value: number): string {+ const thousands = Math.floor(value / 1000);+ const prefix = thousands === 1 ? "mille" : `${toCardinal(thousands)}mila`;++ return `${prefix}${omitIfZero(toCardinal(value % 1000))}`;+}++function exponentLengthToWords(exponentLength: number): string {+ const prefix = EXPONENT_PREFIXES[Math.floor(exponentLength / 6)];++ return exponentLength % 6 === 0 ? `${prefix}ilione` : `${prefix}iliardo`;+}++function bigNumberToWords(value: number): string {+ const digits = String(value).split("");++ const leadingCount = digits.length % 3 === 0 ? 3 : digits.length % 3;+ const multiplier = digits.slice(0, leadingCount).join("");+ const exponent = digits.slice(leadingCount).join("");++ let prefix: string;+ let infix = exponentLengthToWords(exponent.length);++ if (multiplier === "1") {+ prefix = "un ";+ } else {+ prefix = toCardinal(Math.trunc(Number(multiplier)));+ infix = ` ${infix.slice(0, -1)}i`;+ }++ const hasRemainder = /[1-9]/.test(exponent);++ if (!hasRemainder) {+ return `${prefix}${infix}`;+ }++ const postfix = toCardinal(Math.trunc(Number(exponent)));++ return `${prefix}${infix}${postfix.includes(" e ") ? ", " : " e "}${postfix}`;+}++function toCardinal(value: number): string {+ if (value < 20) {+ return accentuate(CARDINAL_WORDS[value]);+ }++ if (value < 100) {+ return accentuate(tensToWords(value));+ }++ if (value < 1000) {+ return accentuate(hundredsToWords(value));+ }++ if (value < 1_000_000) {+ return accentuate(thousandsToWords(value));+ }++ return accentuate(bigNumberToWords(value));+}++export function toWords(value: number): string {+ return toCardinal(value);+}diff --git a/src/utils/number-to-words/nl.ts b/src/utils/number-to-words/nl.tsnew file mode 100644index 0000000..193b32f--- /dev/null+++ b/src/utils/number-to-words/nl.ts@@ -0,0 +1,98 @@+import { cardsToWords, type CardLanguage } from "./cards";++const DUTCH: CardLanguage = {+ cards: [+ [1_000_000_000, "miljard"],+ [1_000_000, "miljoen"],+ [1000, "duizend"],+ [100, "honderd"],+ [90, "negentig"],+ [80, "tachtig"],+ [70, "zeventig"],+ [60, "zestig"],+ [50, "vijftig"],+ [40, "veertig"],+ [30, "dertig"],+ [20, "twintig"],+ [19, "negentien"],+ [18, "achttien"],+ [17, "zeventien"],+ [16, "zestien"],+ [15, "vijftien"],+ [14, "veertien"],+ [13, "dertien"],+ [12, "twaalf"],+ [11, "elf"],+ [10, "tien"],+ [9, "negen"],+ [8, "acht"],+ [7, "zeven"],+ [6, "zes"],+ [5, "vijf"],+ [4, "vier"],+ [3, "drie"],+ [2, "twee"],+ [1, "een"],+ [0, "nul"],+ ],+ merge({ left, right }) {+ let leftText = left.text;+ let rightText = right.text;++ if (left.value === 1) {+ if (right.value < 1_000_000) {+ return right;+ }++ leftText = "een";+ }++ if (right.value > left.value) {+ if (right.value >= 1_000_000) {+ leftText += " ";+ } else if (right.value > 100) {+ rightText += " ";+ }++ return {+ text: `${leftText}${rightText}`,+ value: left.value * right.value,+ };+ }++ if (right.value < 10 && left.value > 10 && left.value < 100) {+ // Dutch says the units before the tens: "vierendertig", literally "four and thirty".+ const units = rightText;++ rightText = leftText;+ leftText = `${units}${units.endsWith("e") ? "ën" : "en"}`;+ } else if (left.value >= 1_000_000 || left.value === 1000) {+ leftText += " ";+ }++ return { text: `${leftText}${rightText}`, value: left.value + right.value };+ },+};++/**+ * Spell out a non-negative integer in Dutch.+ *+ * Between 1100 and 9999 Dutch prefers counting in hundreds -- 1234 is "twaalfhonderd+ * vierendertig", twelve hundred thirty-four -- so long as the hundreds part is not a round+ * multiple of ten ("tweeduizend", not "twintighonderd").+ */+export function toWords(value: number): string {+ if (value >= 1100 && value < 10_000) {+ const hundreds = Math.floor(value / 100);+ const rest = value % 100;++ if (hundreds % 10 !== 0) {+ const spelledRest =+ rest === 0 ? "" : ` ${cardsToWords({ value: rest, language: DUTCH })}`;++ return `${cardsToWords({ value: hundreds, language: DUTCH })}honderd${spelledRest}`;+ }+ }++ return cardsToWords({ value, language: DUTCH });+}diff --git a/src/utils/number-to-words/pl.ts b/src/utils/number-to-words/pl.tsnew file mode 100644index 0000000..b3eb83a--- /dev/null+++ b/src/utils/number-to-words/pl.ts@@ -0,0 +1,90 @@+/**+ * Polish vocabulary for the shared Slavic engine.+ *+ * Tables lifted from `n2words`' `pl.js`, which this replaces, with one correction: that+ * version misspells 90 as "dziewięćdzisiąt". No such Polish word exists -- every other ten+ * in the same table ends in "-dziesiąt" -- and upstream has since fixed it, so this is the+ * one place the wording deliberately departs from the package we replaced. It is not a+ * rare corner: 19% of the amounts below 100,000 contain a nine in the tens place.+ *+ * `n2words`' Polish class inherited the Russian one, so it also inherited a table of+ * Russian feminine units it never read; Polish thousands take the plain units+ * ("dwa tysiące"), so there is no `onesFeminine` here at all.+ */+import { slavicToWords, type SlavicLanguage } from "./slavic";++const POLISH: SlavicLanguage = {+ zero: "zero",+ ones: {+ 1: "jeden",+ 2: "dwa",+ 3: "trzy",+ 4: "cztery",+ 5: "pięć",+ 6: "sześć",+ 7: "siedem",+ 8: "osiem",+ 9: "dziewięć",+ },+ teens: {+ 0: "dziesięć",+ 1: "jedenaście",+ 2: "dwanaście",+ 3: "trzynaście",+ 4: "czternaście",+ 5: "piętnaście",+ 6: "szesnaście",+ 7: "siedemnaście",+ 8: "osiemnaście",+ 9: "dziewiętnaście",+ },+ twenties: {+ 2: "dwadzieścia",+ 3: "trzydzieści",+ 4: "czterdzieści",+ 5: "pięćdziesiąt",+ 6: "sześćdziesiąt",+ 7: "siedemdziesiąt",+ 8: "osiemdziesiąt",+ 9: "dziewięćdziesiąt",+ },+ hundreds: {+ 1: "sto",+ 2: "dwieście",+ 3: "trzysta",+ 4: "czterysta",+ 5: "pięćset",+ 6: "sześćset",+ 7: "siedemset",+ 8: "osiemset",+ 9: "dziewięćset",+ },+ scales: {+ 1: ["tysiąc", "tysiące", "tysięcy"],+ 2: ["milion", "miliony", "milionów"],+ 3: ["miliard", "miliardy", "miliardów"],+ },+ omitOneBeforeScale: true,+ /**+ * Polish differs from its neighbours: only a bare 1 takes the singular, so 21 takes the+ * "many" form ("dwadzieścia jeden tysięcy") where Russian would take the singular.+ */+ pluralize({ count, forms }) {+ if (count === 1) {+ return forms[0];+ }++ const last = count % 10;+ const lastTwo = count % 100;++ if (last > 1 && last < 5 && (lastTwo < 10 || lastTwo > 20)) {+ return forms[1];+ }++ return forms[2];+ },+};++export function toWords(value: number): string {+ return slavicToWords({ value, language: POLISH });+}diff --git a/src/utils/number-to-words/pt.ts b/src/utils/number-to-words/pt.tsnew file mode 100644index 0000000..db8f635--- /dev/null+++ b/src/utils/number-to-words/pt.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",+ "mil milhões",+ "bilião",+ "biliões",+ "mil biliões",+];++const PORTUGUESE: CardLanguage = {+ cards: [+ [1_000_000, "milião"],+ [1000, "mil"],+ [100, "cem"],+ [90, "noventa"],+ [80, "oitenta"],+ [70, "setenta"],+ [60, "sessenta"],+ [50, "cinquenta"],+ [40, "quarenta"],+ [30, "trinta"],+ [20, "vinte"],+ [19, "dezanove"],+ [18, "dezoito"],+ [17, "dezassete"],+ [16, "dezasseis"],+ [15, "quinze"],+ [14, "catorze"],+ [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,+ };+ }++ if (right.value % 1_000_000_000 === 0 && left.value > 1) {+ rightText = `${rightText.slice(0, -4)}liões`;+ } else if (right.value % 1_000_000 === 0 && left.value > 1) {+ rightText = `${rightText.slice(0, -4)}lhões`;+ }++ if (rightText === "milião") {+ rightText = "milhão";+ }++ 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: PORTUGUESE });+}diff --git a/src/utils/number-to-words/ru.ts b/src/utils/number-to-words/ru.tsnew file mode 100644index 0000000..05abe52--- /dev/null+++ b/src/utils/number-to-words/ru.ts@@ -0,0 +1,80 @@+/**+ * Russian vocabulary for the shared Slavic engine.+ *+ * Tables lifted verbatim from `n2words`' `ru.js`, which this replaces.+ */+import {+ slavicToWords,+ eastSlavicPluralize,+ type SlavicLanguage,+} from "./slavic";++const RUSSIAN: SlavicLanguage = {+ zero: "ноль",+ ones: {+ 1: "один",+ 2: "два",+ 3: "три",+ 4: "четыре",+ 5: "пять",+ 6: "шесть",+ 7: "семь",+ 8: "восемь",+ 9: "девять",+ },+ onesFeminine: {+ 1: "одна",+ 2: "две",+ 3: "три",+ 4: "четыре",+ 5: "пять",+ 6: "шесть",+ 7: "семь",+ 8: "восемь",+ 9: "девять",+ },+ teens: {+ 0: "десять",+ 1: "одиннадцать",+ 2: "двенадцать",+ 3: "тринадцать",+ 4: "четырнадцать",+ 5: "пятнадцать",+ 6: "шестнадцать",+ 7: "семнадцать",+ 8: "восемнадцать",+ 9: "девятнадцать",+ },+ twenties: {+ 2: "двадцать",+ 3: "тридцать",+ 4: "сорок",+ 5: "пятьдесят",+ 6: "шестьдесят",+ 7: "семьдесят",+ 8: "восемьдесят",+ 9: "девяносто",+ },+ hundreds: {+ 1: "сто",+ 2: "двести",+ 3: "триста",+ 4: "четыреста",+ 5: "пятьсот",+ 6: "шестьсот",+ 7: "семьсот",+ 8: "восемьсот",+ 9: "девятьсот",+ },+ scales: {+ 1: ["тысяча", "тысячи", "тысяч"],+ 2: ["миллион", "миллиона", "миллионов"],+ 3: ["миллиард", "миллиарда", "миллиардов"],+ },+ omitOneBeforeScale: false,+ pluralize: eastSlavicPluralize,+};++export function toWords(value: number): string {+ return slavicToWords({ value, language: RUSSIAN });+}diff --git a/src/utils/number-to-words/slavic.ts b/src/utils/number-to-words/slavic.tsnew file mode 100644index 0000000..0586b07--- /dev/null+++ b/src/utils/number-to-words/slavic.ts@@ -0,0 +1,145 @@+/**+ * The shared engine for Polish, Russian and Ukrainian.+ *+ * These languages read a number in groups of three digits, and each group picks its own+ * form of the scale word after it ("две тысячи" but "пять тысяч"), so they do not fit the+ * card model the other languages here use.+ *+ * Ported from `n2words`' `N2WordsRU`, which we had to drop -- see `./cards.ts` for why.+ */++/** A scale word in its three grammatical forms: one, a few, many. */+export type PluralForms = readonly [string, string, string];++export interface SlavicLanguage {+ /** The word for 0, used on its own. */+ zero: string;+ /** Units 1-9. */+ ones: Record<number, string>;+ /**+ * Units 1-9 in the feminine form the thousands take ("одна тысяча", "двi тисячi").+ *+ * Left out by languages whose thousands take the plain units instead ("dwa tysiące").+ * Absence is the signal, rather than a separate flag: a flag can be flipped on for a+ * language that never filled this table in, and the mistake shows up as words from the+ * wrong language rather than as a type error.+ */+ onesFeminine?: Record<number, string>;+ /** 10-19, keyed by the units digit. */+ teens: Record<number, string>;+ /** 20-90, keyed by the tens digit. */+ twenties: Record<number, string>;+ /** 100-900, keyed by the hundreds digit. */+ hundreds: Record<number, string>;+ /** Scale word per group, keyed by how many groups follow it (1 = thousands). */+ scales: Record<number, PluralForms>;+ /** Whether a group of exactly 1 drops its "one" before a scale word ("tysiąc"). */+ omitOneBeforeScale: boolean;+ /** Chooses the scale word's form for a group. */+ pluralize: (params: { count: number; forms: PluralForms }) => string;+}++/** Split a whole number into its three-digit groups, most significant first. */+function splitIntoGroups(value: number): number[] {+ const digits = String(value);+ const groups: number[] = [];++ const leading = digits.length % 3;++ if (leading > 0) {+ groups.push(Number(digits.slice(0, leading)));+ }++ for (let index = leading; index < digits.length; index += 3) {+ groups.push(Number(digits.slice(index, index + 3)));+ }++ return groups;+}++/** Spell out a non-negative integer in one of the Slavic languages. */+export function slavicToWords({+ value,+ language,+}: {+ value: number;+ language: SlavicLanguage;+}): string {+ if (value === 0) {+ return language.zero;+ }++ const words: string[] = [];+ const groups = splitIntoGroups(value);++ // How many groups follow this one -- 1 means thousands, 2 millions, and so on.+ let index = groups.length;++ for (const group of groups) {+ index -= 1;++ if (group === 0) {+ continue;+ }++ const units = group % 10;+ const tens = Math.floor(group / 10) % 10;+ const hundreds = Math.floor(group / 100) % 10;++ if (hundreds > 0) {+ words.push(language.hundreds[hundreds]);+ }++ if (tens > 1) {+ words.push(language.twenties[tens]);+ }++ if (tens === 1) {+ words.push(language.teens[units]);+ } else if (+ units > 0 &&+ !(language.omitOneBeforeScale && index > 0 && group === 1)+ ) {+ // Thousands are the only group that can call for a different set of units.+ const unitWords =+ index === 1 ? (language.onesFeminine ?? language.ones) : language.ones;++ words.push(unitWords[units]);+ }++ if (index > 0) {+ words.push(+ language.pluralize({ count: group, forms: language.scales[index] }),+ );+ }+ }++ return words.join(" ");+}++/**+ * The Russian and Ukrainian rule: singular after 1, the "few" form after 2-4, and the+ * "many" form otherwise -- except in the teens, which always take "many".+ */+export function eastSlavicPluralize({+ count,+ forms,+}: {+ count: number;+ forms: PluralForms;+}): string {+ const lastTwo = count % 100;+ const last = count % 10;++ if (lastTwo < 10 || lastTwo > 20) {+ if (last === 1) {+ return forms[0];+ }++ if (last > 1 && last < 5) {+ return forms[1];+ }+ }++ return forms[2];+}diff --git a/src/utils/number-to-words/uk.ts b/src/utils/number-to-words/uk.tsnew file mode 100644index 0000000..aa9abd0--- /dev/null+++ b/src/utils/number-to-words/uk.ts@@ -0,0 +1,82 @@+/**+ * Ukrainian vocabulary for the shared Slavic engine.+ *+ * Tables lifted verbatim from `n2words`' `uk.js`, which this replaces -- including its+ * habit of spelling the Cyrillic "і" with a Latin "i". Kept as-is so the wording of an+ * already-issued invoice does not change underneath anyone.+ */+import {+ slavicToWords,+ eastSlavicPluralize,+ type SlavicLanguage,+} from "./slavic";++const UKRAINIAN: SlavicLanguage = {+ zero: "нуль",+ ones: {+ 1: "один",+ 2: "два",+ 3: "три",+ 4: "чотири",+ 5: "п'ять",+ 6: "шiсть",+ 7: "сiм",+ 8: "вiсiм",+ 9: "дев'ять",+ },+ onesFeminine: {+ 1: "одна",+ 2: "двi",+ 3: "три",+ 4: "чотири",+ 5: "п'ять",+ 6: "шiсть",+ 7: "сiм",+ 8: "вiсiм",+ 9: "дев'ять",+ },+ teens: {+ 0: "десять",+ 1: "одинадцять",+ 2: "дванадцять",+ 3: "тринадцять",+ 4: "чотирнадцять",+ 5: "п'ятнадцять",+ 6: "шiстнадцять",+ 7: "сiмнадцять",+ 8: "вiсiмнадцять",+ 9: "дев'ятнадцять",+ },+ twenties: {+ 2: "двадцять",+ 3: "тридцять",+ 4: "сорок",+ 5: "п'ятдесят",+ 6: "шiстдесят",+ 7: "сiмдесят",+ 8: "вiсiмдесят",+ 9: "дев'яносто",+ },+ hundreds: {+ 1: "сто",+ 2: "двiстi",+ 3: "триста",+ 4: "чотириста",+ 5: "п'ятсот",+ 6: "шiстсот",+ 7: "сiмсот",+ 8: "вiсiмсот",+ 9: "дев'ятсот",+ },+ scales: {+ 1: ["тисяча", "тисячi", "тисяч"],+ 2: ["мiльйон", "мiльйони", "мiльйонiв"],+ 3: ["мiльярд", "мiльярди", "мiльярдiв"],+ },+ omitOneBeforeScale: false,+ pluralize: eastSlavicPluralize,+};++export function toWords(value: number): string {+ return slavicToWords({ value, language: UKRAINIAN });+}diff --git a/tailwind.config.ts b/tailwind.config.tsindex d345c4d..aeda8f6 100644--- a/tailwind.config.ts+++ b/tailwind.config.ts@@ -1,5 +1,9 @@import type { Config } from "tailwindcss";+// relative, not `@/`: Tailwind loads this config through jiti, which does not resolve+// the tsconfig path aliases+import { hitAreaPlugin } from "./src/lib/tailwind-hit-area-plugin";+const config: Config = {darkMode: ["class"],content: [@@ -107,8 +111,13 @@ const config: Config = {},},},- // tailwind v3 resolves plugins through CJS `require`- // oxlint-disable-next-line typescript/no-require-imports- plugins: [require("tailwindcss-animate"), require("@tailwindcss/typography")],+ plugins: [+ // tailwind v3 resolves published plugins through CJS `require`+ // oxlint-disable-next-line typescript/no-require-imports+ require("tailwindcss-animate"),+ // oxlint-disable-next-line typescript/no-require-imports+ require("@tailwindcss/typography"),+ hitAreaPlugin,+ ],};export default config;diff --git a/trigger.config.ts b/trigger.config.tsindex fac8cdc..078c167 100644--- a/trigger.config.ts+++ b/trigger.config.ts@@ -1,11 +1,12 @@-import { defineConfig } from "@trigger.dev/sdk/v3";+import { defineConfig } from "@trigger.dev/sdk";/*** @lintignore consumed by the Trigger.dev CLI, not by app code*/export default defineConfig({project: "proj_fuwfkbtfwembbzndcipt",- runtime: "node",+ // "node" is Node 21.7.3, deprecated: new deploys using it fail from 2026-10-05.+ runtime: "node-24",logLevel: "log",// The max compute seconds a task is allowed to run. If the task run exceeds this duration, it will be stopped.// You can override this on an individual task.diff --git a/tsconfig.json b/tsconfig.jsonindex d620610..af12560 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -10,7 +10,7 @@"moduleResolution": "bundler","resolveJsonModule": true,"isolatedModules": true,- "jsx": "preserve",+ "jsx": "react-jsx","incremental": true,"allowArbitraryExtensions": true,"noImplicitReturns": true,@@ -31,10 +31,15 @@},"include": ["next-env.d.ts",+ // must come before any file importing `next/root-params`: TypeScript takes the+ // first declaration it sees, and the one shipped in node_modules is a shorthand+ // (`any`) - see src/types/next-root-params.d.ts+ "src/types/next-root-params.d.ts","**/*.ts","**/*.tsx",".next/types/**/*.ts",- "trigger.config.ts"+ "trigger.config.ts",+ ".next/dev/types/**/*.ts"],"exclude": ["node_modules"]}