Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .server-changes/billing-limits.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
area: webapp
type: feature
---

Add billing limits. Customers set a spend cap; when usage crosses it, billable
environments pause for a grace period, new triggers are rejected once it ends,
and a recovery flow resumes or cancels the queued backlog. Reconciliation keeps
the webapp converged to billing's state.

## Manual pause during billing enforcement

While `pauseSource=BILLING_LIMIT`, manual resume is rejected and manual pause is
a silent no-op (`PauseEnvironmentService` returns success with state `paused`).
We do not stack a manual pause on top of billing enforcement because resolve
converge unpauses all `BILLING_LIMIT`-paused environments for the org.

API callers that pause during enforcement should expect the environment to
resume when the billing limit is resolved. The queues UI hides pause/resume in
this state; see `manualPauseEnvironmentGuard.server.ts`.
57 changes: 57 additions & 0 deletions apps/webapp/app/components/billing/AnimatedOrgBannerBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { ExclamationCircleIcon } from "@heroicons/react/20/solid";
import { AnimatePresence, motion } from "framer-motion";
import tileBgPath from "~/assets/images/error-banner-tile@2x.png";
import { Icon } from "~/components/primitives/Icon";
import { Paragraph } from "~/components/primitives/Paragraph";
import { cn } from "~/utils/cn";

type AnimatedOrgBannerBarProps = {
show: boolean;
variant: "warning" | "error";
children: React.ReactNode;
action?: React.ReactNode;
};

export function AnimatedOrgBannerBar({
show,
variant,
children,
action,
}: AnimatedOrgBannerBarProps) {
return (
<AnimatePresence initial={false}>
{show ? (
<motion.div
className={cn(
"flex h-10 items-center justify-between overflow-hidden py-0 pl-3 pr-2",
variant === "warning"
? "border-y border-amber-400/20 bg-warning/20"
: "border border-error bg-repeat"
)}
style={
variant === "error"
? { backgroundImage: `url(${tileBgPath})`, backgroundSize: "8px 8px" }
: undefined
}
initial={{ opacity: 0, height: 0 }}
animate={{ opacity: 1, height: "2.5rem" }}
exit={{ opacity: 0, height: 0 }}
>
<div className="flex items-center gap-2">
<Icon
icon={ExclamationCircleIcon}
className={cn("h-5 w-5", variant === "warning" ? "text-amber-400" : "text-error")}
/>
<Paragraph
variant="small"
className={variant === "warning" ? "text-amber-200" : "text-error"}
>
{children}
</Paragraph>
</div>
{action}
</motion.div>
) : null}
</AnimatePresence>
);
}
Loading
Loading