61 Commits
Author SHA1 Message Date
joshuaandClaude Opus 5.5 74c56b67e9 Release 2.0.2: refund a payment; void invoices that aren't paid
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v2.0.2
2026-11-17 13:36:09 +02:00
joshua 8698f60b96 Merge branch 'fix/void-refunded' 2026-11-17 13:36:03 +02:00
joshuaandClaude Opus 5.5 3706b73879 Billing: refund a payment; void invoices that aren't paid (none, or all refunded)
Void was refused while any payment was recorded, so a paid-then-refunded
invoice could only be voided by deleting the payment and losing the
record. A payment can now be marked refunded: kept with its receipt, no
longer counted as paid, shown on the statement as money going back out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 13:34:08 +02:00
joshuaandClaude Opus 5.5 9aa06ae894 Docs: token AI status is shown from Cross Events 2.2.0 (was planned for 2.3.0)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:38:33 +02:00
joshuaandClaude Opus 5.5 44e65bb563 Release 2.0.1: AI use in tokens for churches, default markup 15%
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v2.0.1
2026-11-17 11:27:45 +02:00
joshua a0ceecbb25 Merge branch 'feat/ai-tokens' 2026-11-17 11:27:32 +02:00
joshuaandClaude Opus 5.5 fd76961391 AI: default markup 15% (was 40%)
Saved settings and per-customer markups are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:25:59 +02:00
joshuaandClaude Opus 5.5 7cd59ed651 AI status: tokens used and an estimated allowance in tokens, for churches (2.0.1)
Churches see their AI use as input/output tokens; rand stays on the Hub.
The status also carries usedInputTokens/usedOutputTokens and
capInputTokens/capOutputTokens (half the cap priced as input, half as
output). Cents unchanged for older installs. Protocol §3b updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:58:49 +02:00
joshua bee19b494e Merge branch 'docs/roadmap-moved' 2026-11-05 09:48:40 +02:00
joshuaandClaude Opus 5.5 5f416c828b Docs: point to the roadmap and protocol in crosscode-platform
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 09:48:37 +02:00
joshuaandClaude Opus 5.5 dbcfc92d65 Merge branch 'release/2.0' (2.0.0: release commit)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v2.0.0
2026-11-05 09:07:47 +02:00
joshuaandClaude Opus 5.5 595cdf71a5 Merge branch 'release/2.0' (2.0.0)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 09:07:29 +02:00
joshuaandClaude Opus 5.5 3579d7abe6 Release 2.0.0: Cross Code Hub
Docs: protocol v2 (hub-protocol.md §6), README, deployment.md
(Upgrading to 2.0), plan marked done, CHANGELOG 2.0.0; versions 2.0.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 09:07:16 +02:00
joshuaandClaude Opus 5.5 8a0ed7f155 Merge branch 'feat/hub2-dashboard' into release/2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 09:03:40 +02:00
joshuaandClaude Opus 5.5 e697564ff5 Hub 2.0 step 7: dashboard per product, revenue, linked products
Dashboard: monthly recurring revenue after discounts, overdue invoices,
per-product installs, latest version, behind, critical and licences.
Install page: the church's other products and whether they're listed to
this site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 09:03:39 +02:00
joshuaandClaude Opus 5.5 255ac6ae6e Merge branch 'feat/hub2-ai' into release/2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 08:55:45 +02:00
joshuaandClaude Opus 5.5 59e6b9f03c Hub 2.0 step 6: AI cap and markup per church
The cap and markup move from the licence to the customer (migrated), use
is counted over all the church's installs under one lock per church, and
the licence token carries the church's cap. Settings → AI shows product.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 08:55:43 +02:00
joshuaandClaude Opus 5.5 6e51780103 Merge branch 'feat/hub2-address' into release/2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:24:11 +02:00
joshuaandClaude Opus 5.5 fbbf72dcd8 Hub 2.0 step 5: the church's address
Own domain R0, Cross Code address R10, domain included R25 (custom price
for other endings), once per invoice and never discounted; renewal date
with a reminder 30 days before, once per renewal, and Renewed to move it on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:24:10 +02:00
joshuaandClaude Opus 5.5 fff1c6f4ef Merge branch 'feat/hub2-billing' into release/2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:18:25 +02:00
joshuaandClaude Opus 5.5 7478e84e9d Hub 2.0 step 4: billing per customer
- One invoice per customer per period for all its products; the schedule
  moves from Licence to Customer (migration copies it, so billing carries
  on unchanged); licences get billedFrom / billedUntil
- Website (R99, 5 GB) and App (on active members) prices next to the
  Events tiers; founding prices per product, then bundles (15% two, 25%
  three); extra website storage R20 per 5 GB, never discounted
- A product added to a billed customer starts after its free month; days
  before its first full period are prorated, never charged twice
- Annual review per product (Events income, App members), one notice of
  licence change per product; invoices, PDFs and emails name products
- Customer page: schedule, per-product billing, next-invoice preview
- Invoices from before 2.0 kept as they were (still recalculable)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:18:23 +02:00
joshuaandClaude Opus 5.5 937c1fa38e Merge branch 'feat/hub2-releases' into release/2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:57:47 +02:00
joshuaandClaude Opus 5.5 816452e1c2 Hub 2.0 step 3: releases per product, with requirements
- Release.product and requires; unique (product, version); latest version
  per product (latest_version stays Cross Events' latest)
- Release sources per product (Releases page): repository, tag prefix,
  notes file. Defaults: every product from crosscode-platform plus Cross
  Events' v1.2.3 tags from hope-events. A product's releases are only
  removed when all its sources were read and found tags
- "— requires accounts 1.2.0" in a notes heading: Request update answers
  409 REQUIREMENT_NOT_MET until the church's install of that product is new
  enough; install page and Releases page show it; v2 replies carry requires
- @crosscode/contracts 1.1.0 vendored (optional requires on releases)
- Alerts, dashboard and install lists compare against each product's latest

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:57:46 +02:00
joshuaandClaude Opus 5.5 0318b4f6f4 Merge branch 'feat/hub2-protocol' into release/2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:37:03 +02:00
joshuaandClaude Opus 5.5 ab6a0c6914 Hub 2.0 step 2: protocol v2 next to v1
- Accepts protocol 1 and 2 (utils/protocol.js); v2 bodies checked with the
  contracts' zod schemas (400 INVALID_REQUEST), v1 unchanged
- v2 register/heartbeat carry product (409 WRONG_PRODUCT on a mismatch),
  register stores the install's public key, stats stored per product
- v2 replies add linkedProducts (the church's other installs in use with a
  public key); v1 replies unchanged
- Licence tokens carry customerId and product
- Until releases per product, only Events installs get releases / "behind"
- Tests: every contract sample through the real routes, replies checked
  against the contract response schemas

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:37:02 +02:00
joshuaandClaude Opus 5.5 56370419bb Merge branch 'feat/hub2-products' into release/2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:28:07 +02:00
joshuaandClaude Opus 5.5 ad602b2846 Hub 2.0 step 1: products foundation
- Product enum (events, accounts, website, app) on Licence and Install,
  Install.publicKey; existing rows are events
- One open licence per product per customer: partial unique index, with a
  migration guard that names customers with duplicates (npm run check:hub2
  lists them beforehand)
- Licence keys per product (CEH-, CCA-, CCW-, CCP-); free Accounts licence
  created with the first other product licence
- Protocol v1 registers Events licences only (409 WRONG_PRODUCT); only Events
  licences can be invoiced until billing per customer
- Cross Code Hub in the UI, emails and PDFs
- @crosscode/contracts 1.0.0 vendored (backend/vendor)
- Steps merge into release/2.0, not main (plan updated)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:28:06 +02:00
joshuaandClaude Opus 5.5 fe0f2638c6 Merge branch 'docs/hub-2-plan'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:18:18 +02:00
joshuaandClaude Opus 5.5 788ab39dd1 Docs: Hub 2.0.0 plan
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:18:17 +02:00
joshua 016438a808 Merge branch 'feat/invoicing' v1.7.0 2026-11-03 13:42:45 +02:00
joshuaandClaude Opus 5.5 6fce0fe90e Billing: invoices, approval, receipts, statements, licence changes (1.7.0)
- Invoices drafted 14 days before each licence's invoice date and emailed
  to the alert email for approval; approved ones go out on their date from
  08:00 SA time. Drafts can be edited, recalculated, sent early, put back
  to draft or voided; one-off invoices too.
- Annual tier review from the 12-month event-income band; approving a tier
  change emails a notice of licence change, applied when the invoice goes out.
  Notices can also be sent by hand.
- Founding churches (35% off as its own line), payments with receipts,
  statements for any dates.
- Every billing email is styled HTML with a PDF (invoice / tax invoice,
  receipt, statement, licence change) and logged per customer.
- Settings -> Billing: business and bank details, VAT (off: plain invoices;
  on: VAT-inclusive tax invoices), timing and numbering.
- Migration 20261103111645_invoicing; pdfkit 0.17.2; tests/billing.test.js;
  scripts/sample-billing-pdfs.js.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:42:45 +02:00
joshua cc7d62690b Merge branch 'feat/billing-tiers' v1.6.2 2026-11-03 12:18:02 +02:00
joshuaandClaude Opus 5.5 219b08538f Billing tiers on the install page, plan picker on licences (1.6.2)
- Install page shows the 12-month event-income band (Cross Events 2.0.2+),
  the tier it falls in with its price and founding price, and flags a
  licence whose plan is a different tier.
- Licence card: Plan picker (Trial or Seed to Network).
- Protocol doc: 14 income bands and eventIncome12m.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 12:18:02 +02:00
joshua 922a17fbed Merge branch 'feat/ai-model-picker' v1.6.1 2026-10-30 17:21:30 +02:00
joshuaandClaude Opus 5.5 ae7e10844d Sonnet 5.5 as the default AI model, and a model list with prices (1.6.1)
Settings -> AI picks the model from a list (utils/aiModels.js: Sonnet,
Haiku, Opus 5.5 with list prices) or takes another model ID; choosing
one fills in its prices. Blank prices use the built-in ones, and cache
reads are metered at each model's own price.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 17:21:30 +02:00
joshua 160ff3b927 Merge branch 'feat/ai-proxy' v1.6.0 2026-10-30 09:16:16 +02:00
joshuaandClaude Opus 5.5 49f62aeb75 WIP Hub 1.6.0: AI proxy for Cross Events 2.0
Signed /installs/ai/status and /installs/ai/complete (protocol 3b):
the Hub holds the Claude key, holds each call's worst case against the
licence's monthly cap in a locked transaction, calls Claude Haiku 5.5
and meters real cost and charged amount (markup) in rand. Settings ->
AI, licence markup override, AI use on the install page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 09:16:04 +02:00
joshua 0f4d1c360a Merge branch 'feat/change-update-request' v1.5.0 2026-10-28 12:16:59 +02:00
joshuaandClaude Opus 5.5 a3e9c5b4f6 Change an open update request to a newer version (1.5.0)
When a site asks again after a newer version came out, the open
update_requested alert moves on to the latest version ("changed from
...") and the alert address is emailed once; the response says
changed: true with previousVersion (protocol §3a). Needs Cross Events
1.47.4 for the button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 12:16:59 +02:00
joshua 322635978a Merge branch 'chore/notes-from-main' v1.4.1 2026-10-28 09:25:10 +02:00
joshuaandClaude Opus 5.5 633813c50d Read release notes from the default branch; changelog (1.4.1)
Notes still only attach to tagged versions, so they can be written ahead of a
release or corrected afterwards without tagging a new version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 09:25:10 +02:00
joshua 48d76d1b71 Merge branch 'chore/releases-notices' v1.4.0 2026-10-28 09:13:30 +02:00
joshuaandClaude Opus 5.5 0adb304024 Releases from git tags and WHATS-NEW.md; docs, changelog (1.4.0)
The Hub reads the Cross Events repo's v* tags (each a release, the newest the
latest version) and the client notes from WHATS-NEW.md as of the newest tag,
every 15 minutes and on Sync now. Urgent/security in a version heading marks it
urgent. Repo address, notes path and an optional encrypted token on the
Releases page; manual releases only when no repo is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 09:13:30 +02:00
joshuaandClaude Opus 5.5 1449e5046e Releases with what's new, notices to churches, withdrawn update requests
- Releases page: each Cross Events version with notes and an urgent flag; the
  newest is the latest version (moved off Settings; the old setting becomes the
  first release). Installs get the notes for every newer version.
- Notices page: a banner for site admins and supervisors (with a time window),
  an email to the customer and admin contact, or both; for every install or
  chosen ones.
- POST /api/installs/update-request/cancel resolves the request and emails Joshua.
- Protocol doc: releases and notices in the heartbeat/register replies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 08:54:35 +02:00
joshua 26e12a199a Merge branch 'feat/search-pagination-settings-tabs' v1.3.0 2026-10-28 07:51:32 +02:00
joshuaandClaude Opus 5.5 d235ae6c95 Search and paging on lists, Settings in tabs, pinned sidebar (1.3.0)
- Installs, Customers, Alerts and the audit log get a search box and
  25-per-page paging (Installs also a health filter); install History pages too.
- Settings is split into Releases and alerts / Email / Login and security /
  Audit log tabs, remembered in the URL hash.
- The side navigation is sticky at window height, so Sign out no longer
  scrolls off long pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 07:51:32 +02:00
joshua e22fa5369b Merge branch 'feat/smtp-settings' v1.2.0 2026-10-28 01:26:41 +02:00
joshuaandClaude Opus 5.5 613a4450cb SMTP settings on the Settings page, with a test (1.2.0)
SMTP server, port, user, password and from address are now Hub settings in
the database instead of SMTP_* in .env. The password is encrypted with
HUB_ENCRYPTION_KEY and never sent to the browser; a blank field keeps it.
POST /api/admin/settings/smtp-test logs in with the form's values (saved or
not) and sends a test email, returning the server's reason on failure; it is
rate limited and audited. On first start an existing SMTP_* setup is copied
into Settings once. The audit log no longer records the SMTP password.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls1vMaqhrehXcHJe32jLL9
2026-10-28 01:26:41 +02:00
joshua ad01328ce3 Merge branch 'chore/deploy-script' 2026-10-27 23:55:46 +02:00
joshuaandClaude Opus 5.5 5a90c713d8 Deploy script with rollback (1.1.2)
scripts/deploy.sh backs up the database (pg_dump), checks out the release,
runs npm ci, prisma migrate deploy and generate, builds the frontend,
restarts the PM2 apps and health-checks them. Any failure puts back the
previous code and build, and restores the dump if new migrations had run.
deployment.md §12 now uses it. tsconfig.tsbuildinfo leaves git so builds
don't leave the tree dirty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 23:55:46 +02:00