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 workspace | 1 | /** |
| 2 | * What a billing form posts back: an error for one section, a change to | |
| Stripe webhooks, enterprise invoices, and sudo for both | 3 | * 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 workspace | 5 | */ |
| Stripe webhooks, enterprise invoices, and sudo for both | 6 | import type { BillingLink, EnterpriseInvoice, Terms } from "@g1t/contracts"; |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 7 | |
| 8 | export 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 both | 12 | | { 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 workspace | 15 | |
| 16 | export type ActionData = | |
| 17 | | { error: string; section: string; values?: Record<string, string> } | |
| 18 | | { review: Review } | |
| Stripe webhooks, enterprise invoices, and sudo for both | 19 | | { link: BillingLink; workspace: string } |
| 20 | | { invoice: EnterpriseInvoice }; | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 21 | |
| 22 | export type SectionError = { error: string; values?: Record<string, string> } | null; | |
| 23 | ||
| 24 | /** The flash messages a change redirects back with (`?done=`). */ | |
| 25 | export const DONE: Record<string, string> = { | |
| 26 | terms: "Terms saved. They apply to charges from now on.", | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 27 | allowances: "Plan, pools and caps saved. They apply from now on.", |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 28 | attach: "Workspace moved onto the enterprise.", |
| 29 | detach: "Workspace moved off the enterprise. It pays for itself again.", | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 30 | credit: "Credit given. It is on the balance and the statement, and the owners were emailed.", |
| 31 | revoked: "What was left of the credit was taken back. It is on the statement and in the audit log.", | |
| sudo: a billing reset runs the costs analysis again so every figure is fresh; every submit button shows it is working (CSS only); no margin percentage on less than a cent sold | 32 | reset: "Billing reset. The workspace starts again as a new customer, and the costs analysis ran again, so every figure is fresh.", |
| 33 | "reset-stale": "Billing reset. The workspace starts again as a new customer; the costs analysis did not finish, so press Run the analysis now on Costs & margin.", | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 34 | created: "Enterprise created.", |
| Stripe webhooks, enterprise invoices, and sudo for both | 35 | "billing-email": "Saved where the enterprise's invoices go.", |
| A menu shaped by how g1t works, Soon pages for every promise, and sudo for sales | 36 | sales: "Sales record saved.", |
| 37 | note: "Note added.", | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 38 | payment: "Payment recorded. It is on the workspace's statement and counts toward its limit.", |
| 39 | approved: "Approved. The owner is told in the app and by email.", | |
| 40 | declined: "Declined. The owner is told why, in the app and by email.", | |
| 41 | goodwill: "Goodwill credit given. It is on the statement and in the audit log.", | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 42 | }; |
| 43 | ||
| A menu shaped by how g1t works, Soon pages for every promise, and sudo for sales | 44 | /** The `?done=` key, if it is one sudo knows. */ |
| 45 | export function doneKey(url: string): string | null { | |
| 46 | const done = new URL(url).searchParams.get("done"); | |
| 47 | return done && DONE[done] ? done : null; | |
| 48 | } | |
| 49 | ||
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 50 | export function doneMessage(url: string): string | null { |
| 51 | const done = new URL(url).searchParams.get("done"); | |
| 52 | return done && DONE[done] ? DONE[done] : null; | |
| 53 | } |