1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Commercial (SaaS) wire shapes: the plans a paid deployment offers and the
//! checkout handoff that carries a bearer-token client into the server's web
//! checkout.
//!
//! A plain self-host server serves none of these routes, so a client treats
//! their absence (a 404 or a network error) as "this deployment has no
//! commerce" and shows nothing — the same optional-by-default stance
//! [`super::MeResponse::label`] takes. The shapes live here, in the permissive
//! shared crate, so the open PWA and the closed SaaS server stay statically
//! typed across the boundary without either's license reaching across it; only
//! a commercial deployment ever implements them.
use ;
/// One purchasable plan, as returned by `GET /api/v1/commerce/plans`.
/// `GET /api/v1/commerce/plans` response: the deployment's purchasable plans,
/// cheapest first. An empty list is a valid answer (a deployment with nothing
/// to sell) and reads the same as no commerce.
/// `POST /api/v1/commerce/checkout` request: which plan to start checkout for.
/// `POST /api/v1/commerce/checkout` response: a one-time URL that logs the
/// bearer-authenticated caller into the server's web checkout for the chosen
/// plan. The client opens it as a top-level navigation — a first-party page
/// load on the server's own origin — which is why the server returns a URL
/// carrying a single-use ticket rather than a body the client would post
/// itself: a cross-origin fetch could never establish the server's web
/// session cookie.