"use client"; import React, { useCallback, useEffect, useState } from "react"; import { KeyRound, RefreshCw, ShieldCheck, ShieldAlert, ArrowUpCircle, Undo2, BellOff, BellRing, Megaphone } from "lucide-react"; import { useAuth } from "@/hooks/useAuth"; import { errorMessage } from "@/lib/utils"; import { apiV2Data, apiV2Raw } from "@/lib/apiV2"; export type HubStatus = { state: "active" | "grace" | "suspended" | "revoked" | "unlicensed"; readOnly: boolean; daysLeft: number | null; endsAt: string | null; graceEndsAt: string | null; licence: { customer: string; plan: string; status: string; licenceExpiresAt: string | null; graceDays: number; issuedAt: string; validUntil: string } | null; connected: boolean; keyConfigured: boolean; hubUrl: string; lastHeartbeatAt: string | null; lastError: string | null; version: string; latestVersion: string | null; updateAvailable: boolean; urgentUpdate: boolean; updateSnoozed: boolean; releases: HubRelease[]; // `outdated`: a newer version than the one asked for is out (the request can be changed to it). updateRequest: { requestedAt: string; version: string; outdated?: boolean } | null; notices: HubNotice[]; }; export type HubRelease = { version: string; releasedAt: string | null; urgent: boolean; notes: string }; export type HubNotice = { id: string; level: "info" | "maintenance" | "warning"; title: string; message: string; startsAt: string | null; endsAt: string | null; updatedAt: string | null }; /** Release notes from the provider: lines starting with "- " are a list, the rest paragraphs. */ export function ReleaseNotes({ notes }: { notes: string }) { const blocks: ({ list: false; text: string } | { list: true; items: string[] })[] = []; for (const raw of notes.split(/\r?\n/)) { const line = raw.trim(); if (!line) continue; const item = /^[-*•]\s+(.*)$/.exec(line); const last = blocks[blocks.length - 1]; if (item) { if (last?.list) last.items.push(item[1]); else blocks.push({ list: true, items: [item[1]] }); } else blocks.push({ list: false, text: line }); } if (!blocks.length) return
No details given.
; return ({b.text}
))}{msg.text}
:Loading…
; const st = STATE[status.state]; return (This site checks in with the Cross Events Hub 30 seconds after starting and every 15 minutes after that: version, health and totals only — never anyone's personal information.
{st.text}
This version has no Hub key built in yet, so it can't check licences. Update Cross Events, or set HUB_PUBLIC_KEY on the server for testing.
)} {status.licence && (Last problem: {status.lastError}
} {status.connected && ( )}{status.connected ? "New licence key, or moved to a new address? Connect again:" : "Enter the licence key you received:"}
This site runs Cross Events {status.version}.{status.latestVersion && !status.updateAvailable && " It's up to date."}
{status.updateAvailable && (
You asked for version {status.updateRequest.version} on {fmt(status.updateRequest.requestedAt)} — your provider will install it.
{status.connected && ( )}Version {status.latestVersion} has come out since. Ask for it instead, and your provider installs that one.
{status.connected && ( )}Version {status.latestVersion} is available.{status.updateSnoozed && You chose "Not now", so there are no reminders until the next version.}
{status.connected && ( )} {!status.urgentUpdate && (status.updateSnoozed ? ( ) : ( ))}{n.title}
{n.message}
{n.endsAt &&Until {fmt(n.endsAt)}
}