feat(adminsite): licence delivery, paste instructions and relink

The blob is shown inline as well as offered as a file, because a licence is
signed public data bound to one instance -- useless anywhere else -- and a
blocked download must never leave a paying customer stuck. Admin now returns
it to its owner for the same reason.

Relink shows the remaining allowance from the backend's max_relinks rather
than a hardcoded 3, and at zero it disables and says to contact support
instead of failing at the API.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
mrhid6
2026-07-25 21:06:21 +01:00
co-authored by Claude Opus 5
parent 242a587340
commit 92ac1eeb62
6 changed files with 282 additions and 1 deletions
@@ -0,0 +1,20 @@
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { LicenceDelivery } from "./LicenceDelivery";
describe("LicenceDelivery", () => {
it("offers the file and always shows the blob as a fallback", () => {
render(
<LicenceDelivery
instanceId="6a0fe3f0-49d2-4aa1-967c-a3094b200b5d"
blob="VANTAGE-LIC abc123"
downloadUrl="https://admin.example.com/api/instances/x/license/download"
/>,
);
const link = screen.getByRole("link", { name: /download licence/i });
expect(link).toHaveAttribute("href", expect.stringContaining("/license/download"));
// A blocked download must never leave a paying customer stuck.
expect(screen.getByText(/VANTAGE-LIC abc123/)).toBeInTheDocument();
expect(screen.getByText(/Settings → Licence/)).toBeInTheDocument();
});
});