flagon-io/g1t

public

Git for AI scale: a forge for thousands of agents working on the same code at once.

g1t/apps/sudo/app/lib/review.ts

46 lines2,101 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Billing on Stripe's pages, month-end charges, warnings; sudo by workspace1/**
2 * What a billing form posts back: an error for one section, a change to
Stripe webhooks, enterprise invoices, and sudo for both3 * confirm, or a result to show once (a Stripe billing link, an invoice).
4 * Shared by the workspace and enterprise pages.
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace5 */
Stripe webhooks, enterprise invoices, and sudo for both6import type { BillingLink, EnterpriseInvoice, Terms } from "@g1t/contracts";
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace7
8export type Review =
9 | { intent: "terms"; before: Terms; after: Terms; fields: Record<string, string> }
10 | { intent: "attach"; workspace: string; targetName: string; fields: Record<string, string> }
11 | { intent: "detach"; workspace: string; from: string; fields: Record<string, string> }
Stripe webhooks, enterprise invoices, and sudo for both12 | { intent: "billing-link"; workspace: string; fields: Record<string, string> }
13 | { intent: "billing-email"; name: string; before: string | null; after: string; fields: Record<string, string> }
14 | { intent: "invoice"; name: string; email: string | null; workspaces: number; fields: Record<string, string> };
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace15
16export type ActionData =
17 | { error: string; section: string; values?: Record<string, string> }
18 | { review: Review }
Stripe webhooks, enterprise invoices, and sudo for both19 | { link: BillingLink; workspace: string }
20 | { invoice: EnterpriseInvoice };
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace21
22export type SectionError = { error: string; values?: Record<string, string> } | null;
23
24/** The flash messages a change redirects back with (`?done=`). */
25export const DONE: Record<string, string> = {
26 terms: "Terms saved. They apply to charges from now on.",
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put27 allowances: "Plan and pools saved. They apply to charges from now on.",
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace28 attach: "Workspace moved onto the enterprise.",
29 detach: "Workspace moved off the enterprise. It pays for itself again.",
30 credit: "Credit issued.",
31 created: "Enterprise created.",
Stripe webhooks, enterprise invoices, and sudo for both32 "billing-email": "Saved where the enterprise's invoices go.",
A menu shaped by how g1t works, Soon pages for every promise, and sudo for sales33 sales: "Sales record saved.",
34 note: "Note added.",
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace35};
36
A menu shaped by how g1t works, Soon pages for every promise, and sudo for sales37/** The `?done=` key, if it is one sudo knows. */
38export function doneKey(url: string): string | null {
39 const done = new URL(url).searchParams.get("done");
40 return done && DONE[done] ? done : null;
41}
42
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace43export function doneMessage(url: string): string | null {
44 const done = new URL(url).searchParams.get("done");
45 return done && DONE[done] ? DONE[done] : null;
46}