AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import {
PlatformBillingInformation,
SeatsBillableFeature,
} from '@activepieces/shared';
import { t } from 'i18next';
import { Users } from 'lucide-react';
import { useState } from 'react';
import { Link } from 'react-router-dom';
import { Button } from '@/components/ui/button';
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog';
import { AdminControl, adminControl } from '@/lib/admin-control';
import { billingMutations } from '../../hooks/billing-hooks';
import { billingUtils } from '../../utils/billing-utils';
import { ManageSeatsDialog } from './manage-seats-dialog';
export const OutOfSeatsDialog = ({
open,
onOpenChange,
info,
feature,
}: OutOfSeatsDialogProps) => {
const [isManageSeatsOpen, setIsManageSeatsOpen] = useState(false);
const { mutate: reactivate, isPending: isReactivating } =
billingMutations.useReactivateSubscription(() => onOpenChange(false));
const total = info.plan.usersLimit ?? info.usage.users;
const { capBinds, scheduledCap, scheduledPlanName, switchDate } =
billingUtils.resolveSeatCap(info);
return (
<>
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-[420px]">
<DialogHeader>
<div className="flex size-10 items-center justify-center rounded-full bg-accent-3">
<Users className="size-5 text-accent-11" />
</div>
<DialogTitle>{t("You're out of seats")}</DialogTitle>
<DialogDescription>
{capBinds
? t(
'Seats are capped at {cap, plural, =1 {1 seat} other {# seats}} until your plan switches to {plan} on {date}. Keep your current plan to lift the cap.',
{
cap: scheduledCap,
plan: scheduledPlanName,
date: switchDate,
},
)
: t(
'All {total} seats on your plan are in use ({active} active, {invited} invited). {invitedCount, plural, =0 {Add seats to invite more.} other {Add seats or revoke a pending invitation to invite more.}}',
{
total: total.toLocaleString(),
active: info.usage.activeUsers.toLocaleString(),
invited: info.usage.invitedSeats.toLocaleString(),
invitedCount: info.usage.invitedSeats,
},
)}
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button
type="button"
variant="outline"
onClick={() => onOpenChange(false)}
>
{t('Cancel')}
</Button>
{info.usage.invitedSeats > 0 && (
<Button type="button" variant="outline" asChild>
<Link to="/platform/users" onClick={() => onOpenChange(false)}>
{t('Manage invitations')}
</Link>
</Button>
)}
{capBinds ? (
<Button
{...adminControl(AdminControl.BILLING_SEATS_KEEP_PLAN_RUN)}
type="button"
loading={isReactivating}
onClick={() => reactivate()}
>
{t('Keep current plan')}
</Button>
) : (
<Button
{...adminControl(AdminControl.BILLING_SEATS_ADD_OPEN)}
type="button"
onClick={() => {
onOpenChange(false);
setIsManageSeatsOpen(true);
}}
>
{t('Add seats')}
</Button>
)}
</DialogFooter>
</DialogContent>
</Dialog>
<ManageSeatsDialog
open={isManageSeatsOpen}
onOpenChange={setIsManageSeatsOpen}
feature={feature}
currentUsers={info.usage.users}
includedSeats={info.includedSeats}
additionalSeats={info.additionalSeats}
/>
</>
);
};
type OutOfSeatsDialogProps = {
open: boolean;
onOpenChange: (open: boolean) => void;
info: PlatformBillingInformation;
feature: SeatsBillableFeature;
};