Files
orca/src/preload/api/orca-profile-api.ts
T
Neil c4550cc781 feat(billing): Team pricing, opt-in overage, Stripe test-mode e2e, dev deploy (#18)
* feat(billing): Team-only pricing, opt-in overage with spend cap, live Stripe test-mode e2e

- Catalog: Team $50/seat/mo or $480/seat/yr, 60 Standard h/seat/month pooled
  (monthly windows on annual plans), Large 2x, 3 running/seat, 15-min idle sleep;
  Enterprise is contact-only. All numbers/labels in BILLING_PLANS defaults.
- Overage is opt-in (adds the metered item), $0.75/h, monthly spend cap (default
  $25, admin-raisable) enforced in the meter outbox; 80%/100% usage warnings.
- Checkout: plan/interval/seats with adjustable quantity; portal configuration var.
- Workers reject fetch redirect 'error': use 'manual'. Log route errors.
- scripts/stripe-test-setup.ts creates the test catalog + portal configuration;
  scripts/e2e-test-mode.ts drives Checkout (headless, test card), overage, meter,
  cap, annual, test-clock renewal, payment failure and cancel.
- Desktop: Team/Enterprise cards with interval + seats, usage warnings, overage
  toggle + cap; split into copy/offers/usage modules.

* feat(billing): dev deployment config, dev operator keys, return page

- wrangler.dev.jsonc for orca-billing-dev (workers.dev, dev D1, test-mode prices).
- BILLING_DEV_JWKS (issuer orca-billing-dev-test) accepted only when BILLING_ENV
  is not prod, for e2e runs until auth mints billing tokens.
- GET /return: static 'return to Orca' page for Checkout/Portal redirects.
- Design doc: final pricing, dev URL and resources for the control plane.
2026-11-08 23:06:48 -08:00

83 lines
3.4 KiB
TypeScript

import type {
OrcaCloudSignInProgress,
ConnectCurrentOrcaProfileResult,
CreateCloudLinkedOrcaProfileArgs,
CreateCloudLinkedOrcaProfileResult,
CreateLocalOrcaProfileArgs,
CreateLocalOrcaProfileResult,
FindOrcaProfileProjectsByPathArgs,
FindOrcaProfileProjectsByPathResult,
OrcaProfileAuthStatus,
OrcaProfileListResult,
OrcaProfileOrgInviteRevokeArgs,
OrcaProfileOrgMemberChangeRoleArgs,
OrcaProfileOrgMemberInviteArgs,
OrcaProfileOrgMemberMutationResult,
OrcaProfileOrgMemberRemoveArgs,
OrcaProfileOrgMembersListArgs,
OrcaProfileOrgMembersListResult,
RefreshCurrentOrcaProfileAuthResult,
SelectOrcaProfileOrgArgs,
SelectOrcaProfileOrgResult,
SignOutCurrentOrcaProfileResult,
SwitchOrcaProfileArgs,
SwitchOrcaProfileResult,
TransferOrcaProfileProjectArgs,
TransferOrcaProfileProjectResult
} from '../../shared/orca-profiles'
import type {
OrcaBillingCheckoutArgs,
OrcaBillingOpenResult,
OrcaBillingOverageArgs,
OrcaBillingOverageResult,
OrcaBillingStatusResult
} from '../../shared/orca-billing'
export type OrcaProfileApi = {
list: () => Promise<OrcaProfileListResult>
authStatus: () => Promise<OrcaProfileAuthStatus>
/** Fires when main changed the stored auth status on its own (e.g. a revoked session). */
onAuthStatusChanged: (callback: () => void) => () => void
createLocal: (args?: CreateLocalOrcaProfileArgs) => Promise<CreateLocalOrcaProfileResult>
createCloudLinked: (
args?: CreateCloudLinkedOrcaProfileArgs
) => Promise<CreateCloudLinkedOrcaProfileResult>
switchProfile: (args: SwitchOrcaProfileArgs) => Promise<SwitchOrcaProfileResult>
transferProject: (
args: TransferOrcaProfileProjectArgs
) => Promise<TransferOrcaProfileProjectResult>
findProjectProfiles: (
args: FindOrcaProfileProjectsByPathArgs
) => Promise<FindOrcaProfileProjectsByPathResult>
connectCurrent: () => Promise<ConnectCurrentOrcaProfileResult>
signInProgress: () => Promise<OrcaCloudSignInProgress | null>
onSignInProgressChanged: (
callback: (progress: OrcaCloudSignInProgress | null) => void
) => () => void
cancelSignIn: () => Promise<void>
refreshAuth: () => Promise<RefreshCurrentOrcaProfileAuthResult>
signOutCurrent: () => Promise<SignOutCurrentOrcaProfileResult>
selectOrg: (args: SelectOrcaProfileOrgArgs) => Promise<SelectOrcaProfileOrgResult>
orgMembersList: (args: OrcaProfileOrgMembersListArgs) => Promise<OrcaProfileOrgMembersListResult>
orgMemberInvite: (
args: OrcaProfileOrgMemberInviteArgs
) => Promise<OrcaProfileOrgMemberMutationResult>
orgInviteRevoke: (
args: OrcaProfileOrgInviteRevokeArgs
) => Promise<OrcaProfileOrgMemberMutationResult>
orgMemberChangeRole: (
args: OrcaProfileOrgMemberChangeRoleArgs
) => Promise<OrcaProfileOrgMemberMutationResult>
orgMemberRemove: (
args: OrcaProfileOrgMemberRemoveArgs
) => Promise<OrcaProfileOrgMemberMutationResult>
/** Plan & billing for the signed-in account (Orca Cloud billing service). */
billingStatus: () => Promise<OrcaBillingStatusResult>
/** Opens hosted Stripe Checkout in the browser. */
billingOpenCheckout: (args: OrcaBillingCheckoutArgs) => Promise<OrcaBillingOpenResult>
/** Opens the Stripe Customer Portal in the browser. */
billingOpenPortal: () => Promise<OrcaBillingOpenResult>
/** Opt in/out of sandbox overage and set the monthly spend cap (org admins). */
billingSetOverage: (args: OrcaBillingOverageArgs) => Promise<OrcaBillingOverageResult>
}