Skip to content
Open
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
6 changes: 0 additions & 6 deletions packages/web/src/app/capture/Start.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { FileImport } from "../../icons";

import { useAppDispatch, useAppSelector } from "./store";
import { selectFiles } from "./slice";
import Subscription from "./Subscription";
import GeneralError from "../../features/general-error/GeneralError";

export default function Start() {
Expand Down Expand Up @@ -61,11 +60,6 @@ export default function Start() {
and security.
</p>

{token !== undefined && (
<SubscriptionDetails>
<Subscription token={token} useDevEndpoints={useDevEndpoints} />
</SubscriptionDetails>
)}
<GeneralError />
</Contents>
);
Expand Down
164 changes: 0 additions & 164 deletions packages/web/src/app/capture/Subscription.tsx

This file was deleted.

60 changes: 14 additions & 46 deletions packages/web/src/app/config/Subscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ export default function Subscription({
);
}

const currentAllowance = data.monthlyOp + data.bonusOp;
const currentUsage =
data.currentAuditUsage +
data.currentScanUsage +
data.currentGraphqlAuditUsage +
data.currentGraphqlScanUsage +
data.currentCaptureUsage;
const currentAllowanceLeftPercentage =
currentAllowance > 0 ? 1 - currentUsage / currentAllowance : 0;

return (
<Container>
<Section>
Expand Down Expand Up @@ -91,54 +101,12 @@ export default function Subscription({
</Section>

<Section>
<Title>Audit</Title>
<Subtitle>Monthly operation audits left</Subtitle>
<Counters>
{data.monthlyAudit - data.currentAuditUsage} / {data.monthlyAudit}
</Counters>
<ProgressBar label="" progress={1 - data.currentAuditUsage / data.monthlyAudit} />
</Section>

<Section>
<Title>Scan</Title>
<Subtitle>Monthly operation scans left</Subtitle>
<Counters>
{data.monthlyScan - data.currentScanUsage} / {data.monthlyScan}
</Counters>
<ProgressBar label="" progress={1 - data.currentScanUsage / data.monthlyScan} />
</Section>

<Section>
<Title>GraphQL Audit</Title>
<Subtitle>Monthly operation audits left</Subtitle>
<Counters>
{data.monthlyGraphqlAudit - data.currentGraphqlAuditUsage} / {data.monthlyGraphqlAudit}
</Counters>
<ProgressBar
label=""
progress={1 - data.currentGraphqlAuditUsage / data.monthlyGraphqlAudit}
/>
</Section>

<Section>
<Title>GraphQL Scan</Title>
<Subtitle>Monthly operation scans left</Subtitle>
<Counters>
{data.monthlyGraphqlScan - data.currentGraphqlScanUsage} / {data.monthlyGraphqlScan}
</Counters>
<ProgressBar
label=""
progress={1 - data.currentGraphqlScanUsage / data.monthlyGraphqlScan}
/>
</Section>

<Section>
<Title>API Contract Generator</Title>
<Subtitle>Monthly operations left</Subtitle>
<Title>Usage</Title>
<Subtitle>Monthly allowance left</Subtitle>
<Counters>
{data.monthlyCapture - data.currentCaptureUsage} / {data.monthlyCapture}
{currentAllowance - currentUsage} / {currentAllowance}
</Counters>
<ProgressBar label="" progress={1 - data.currentCaptureUsage / data.monthlyCapture} />
<ProgressBar label="" progress={currentAllowanceLeftPercentage} />
</Section>
</Container>
);
Expand Down
14 changes: 3 additions & 11 deletions packages/web/src/features/http-client/freemiumd-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,13 @@ export type Subscription = {
userEmail: string;
subscriptionKind: string;
periodStart: string;
monthlyAudit: number;
bonusAuditOp: number;
monthlyOp: number;
bonusOp: number;
currentAuditUsage: number;
monthlyScan: number;
bonusScanOp: number;
currentScanUsage: number;
monthlyCapture: number;
bonusCaptureOp: number;
currentCaptureUsage: number;
monthlyGraphqlAudit: number;
bonusGraphqlAuditOp: number;
currentGraphqlAuditUsage: number;
monthlyGraphqlScan: number;
bonusGraphqlScanOp: number;
currentGraphqlScanUsage: number;
currentCaptureUsage: number;
};

export const freemiumdApi = createApi({
Expand Down