Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
Lägger docs/production-readiness.md och siax/production-gaps.json enligt SIAX Master Definition of Done. Underlag: git-, kod- och live-evidens 2026-11-11. Nivån är evidensbaserad, inte ett leveransgodkännande.
* fix(invoices): say what is missing when an invoice preview cannot be rendered
The PDF route already refuses with a structured envelope that names exactly
what the invoice lacks (no bankgiro, plusgiro, Swish or bank account for a
SEK invoice; no IBAN account for a foreign currency) and where to add it.
Two clients threw that away:
- The settings preview dialog (Inställningar -> Fakturering -> Förhandsvisa
faktura) wrapped the envelope's inner object in new Error(), which
stringified it to "[object Object]" and left only the generic "Kunde inte
hantera fakturan. Försök igen." fallback. The parsed body now goes to the
error mapper whole, with the invoice context and status.
- The invoice page's Förhandsgranska navigated a new tab straight to the
re-render URL, so a 400 showed the raw JSON in that tab. The tab is now
opened blank inside the click's activation window, the PDF is fetched
first, and the tab gets the PDF as a blob URL or is closed again with the
refusal in a toast. The archived delivery copy keeps the direct open.
Ladda ner on the same page had a fixed "Kunde inte generera PDF" for
re-render refusals and now maps the body the same way.
Regression test on the mapper covers the exact call shape the two surfaces
use and pins the old mangled shape as the fallback it produced.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GUdZPW46a16GWUdgt2qSZA
* fix(invoices): probe the PDF route before opening the preview tab
Resolves the review findings on the first push in one pass.
Skeptic (correctness): the archived-copy branch still called window.open
with 'noopener', which returns null by spec even on success, so every
successful archived preview also fired the "popup blocked" toast (#1613
had the same defect). Both branches now go through openDeferredTab, which
opens with a real handle and severs the opener itself.
Skeptic (regression): serving the re-render as a blob URL lost the
Content-Disposition filename and gave the tab an address that dies on
reload. The route gains ?probe=1, which runs every refusal check and
answers 204 without rendering; the page probes first, shows a refusal as a
toast, and otherwise points the tab at the real inline URL. Filename,
reload and the single render are all kept. The blob URL is gone, which
also settles the compliance swarm's noopener and unrevoked-blob notes and
CodeRabbit's revoke request.
CodeRabbit: the probe fetch is bounded by AbortSignal.timeout so a stalled
route cannot leave a blank tab open, and the network-error mapper now
receives the active locale and invoice context.
Tests: route probe (204 without render, same 400 envelope as the render,
unknown value ignored) and the URL helper's probe flag.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GUdZPW46a16GWUdgt2qSZA
---------
Co-authored-by: Claude Fable 5.1 <[email protected]>
* feat(invoices): Betald-stämpel i faktura-PDF + betalningsbekräftelse till kund
Closes#1693. A paid faktura re-renders with a BETALD banner (paid date
and amount) and "Betalt: X" followed by "Att betala: 0"; partially_paid
gets the Betalt / Att betala (remaining) rows without a banner. Credit
notes and proformas are unchanged. Labels in sv and en.
The paid copy is its own document, a betalningsbekräftelse, never the
archived original: GET /api/invoices/[id]/pdf?variant=paid refuses
anything but status paid (409 INVOICE_PAYMENT_CONFIRMATION_NOT_PAID),
names the file Betalningsbekraftelse-<nr>.pdf and never reads or
replaces the delivery archive. invoice-pdf-source gains the
'payment_confirmation' re-render reason so the UI caveats it like any
re-render. POST /api/invoices/[id]/send-payment-confirmation emails the
paid PDF with a dedicated subject/body through the existing email
service and recipient routing, without touching status, sent_at,
journal entries or invoice_deliveries (no kind column there; logged via
the route logger instead).
Detail page: the two actions sit inside the Betald card (download paid
copy, send confirmation with an up-front confirm dialog), not in the
header row. No migrations.
Co-Authored-By: Claude Fable 5 <[email protected]>
* fix(invoices): one-line hint for the betalningsbekräftelse actions
Co-Authored-By: Claude Fable 5 <[email protected]>
---------
Co-authored-by: Jakob Wennberg <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Reviewing an invoice or a verifikat bilaga meant saving a file and opening it
from the Downloads folder (user request, [email protected] 2026-07-25).
- GET /api/invoices/[id]/pdf accepts ?disposition=inline and serves the PDF for
in-browser review; anything else keeps the download behaviour every existing
caller relies on. The filename still travels in the header, so the browser
viewer's own save action produces the same name as the download button, and
nosniff pins the content type.
- The invoice detail page gets a "Förhandsgranska" action next to "Ladda ner
PDF". It resolves the document through the same resolveInvoicePdfSource path
as the download, so preview cannot become the shortcut that presents a
re-render as the invoice the customer received: the archived delivery wins,
a re-render is shown with its caveat, and an unreadable delivery history
still asks instead of guessing. The archive dialog now remembers whether the
user asked to view or to save, and its fallback does that.
- DocumentViewButton (supplier-invoice underlag, staged agent previews) points
at the existing /api/documents/:id/inline proxy, so bilagor render in the
browser. Navigation now happens straight from the click, so the signed-URL
fetch and its popup-blocker workaround are gone.
- The three re-render caveat strings and the two archive-dialog descriptions
lose their "you downloaded" wording so they stay true for both actions;
five new keys in sv + en.
Tests: route cases for the default, inline and unknown disposition values;
invoiceRerenderUrl cases for both modes and id encoding. npm test 11364
passed, lint 0 errors. Button row screenshotted against the design system
(pill outline, Eye icon) via a temporary sandbox route.
Closes#1190
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>