npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@endora-commerce/mod-invoices

v0.103.1

Published

Invoice generation, numbering, PDF templates, corrections, and email delivery.

Readme

Invoices module (feature 047)

Generates, numbers, renders, corrects, and emails invoices for orders.

What works today

  • Issuance — manual (POST /api/v1/admin/orders/:orderId/invoices) and automatic when an order reaches the configured trigger status (invoices.auto_issue.trigger_status, per channel). Idempotent per (order, kind); blocked with 422 when seller settings are missing.
  • Numbering — gap-free, row-locked counter per (sales_channel, kind, year) with a configurable pattern (invoices.numbering.<kind>.pattern) supporting {seq}, {seq:N}, {YYYY}, {YY}, {MM}. Resets yearly.
  • PDF — pdfmake renderer with a built-in generic layout modelled on the reference invoice (seller w/ NIP + bank, buyer, line table, per-rate VAT summary, totals, amount-in-words, KSeF area). Rendered on demand. KSeF is layout-ready only — no live integration.
  • Corrections — the returns CorrectiveInvoicePort draws correction-sequence numbers (when an original invoice exists), references the original, snapshots corrected lines, and caps the credited total at the original gross.
  • Email — invoice_issued transactional-email definition (admin-editable via the transactional_emails module); sent on issue (per channel) or on demand, with the PDF attached (attachment mode) or a storefront download link (link mode). Idempotent, best-effort.
  • Customer access — GET /api/v1/orders/:id/invoices and .../:invoiceId/pdf (ownership-guarded); surfaced on the storefront order page.
  • WYSIWYG templates (US6) — a seeded global generic template + optional per-channel templates, authored in a dedicated Puck editor in the admin (/invoices/templates). The PDF renderer maps the template's Puck tree to pdfmake sections (InvoiceHeader, InvoiceParties, InvoiceLineItems, InvoiceVatSummary, InvoiceTotals, InvoiceNotes, InvoiceKsef), falling back to the built-in layout when no valid template applies (FR-016). Endpoints under /api/v1/admin/invoice-templates (list/get/create, PUT content/:lang, GET .../preview, page-builder config).
  • Settings — seller VAT/NIP + company data (JSON), numbering patterns, auto-issue trigger, email toggle + delivery mode, storefront base URL — all global + per-channel.

Settings

invoices.seller.tax_id, invoices.seller.company_data, invoices.auto_issue.trigger_status, invoices.email.send_on_issue, invoices.email.delivery_mode, invoices.numbering.{invoice,proforma,correction}.pattern, invoices.storefront_base_url.

Permissions

invoices:read, invoices:write.

Deferred / follow-ups

  • The invoice Puck config lives in the admin module (not packages/cms-components) — invoice authoring is admin-only and the real layout is server-side pdfmake; this avoids coupling invoice components into the shared CMS/email component package.
  • Audit-log entries are written on issue (invoice.issued) and correction (invoice.corrected).
  • PDF is rendered on demand; caching into assets_library (pdf_asset_id) is a future optimization.
  • A dedicated admin invoice detail page (management actions live on the list).