-
Notifications
You must be signed in to change notification settings - Fork 61
fix(billing): explain the merged usage limit as $20 included + org spend limit #3509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { UsageMeter } from "@posthog/ui/features/billing/UsageMeter"; | ||
| import type { Meta, StoryObj } from "@storybook/react-vite"; | ||
|
|
||
| const meta: Meta<typeof UsageMeter> = { | ||
| title: "Billing/UsageMeter", | ||
| component: UsageMeter, | ||
| decorators: [ | ||
| (Story) => ( | ||
| <div style={{ maxWidth: 560 }}> | ||
| <Story /> | ||
| </div> | ||
| ), | ||
| ], | ||
| }; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof UsageMeter>; | ||
|
|
||
| // A subscribed org on default settings: the $70 limit renders as two | ||
| // segments — the $20 included allowance (green) and the $50 default spend | ||
| // limit (accent) — with a dot legend naming each amount. Usage still inside | ||
| // the included allowance only fills the green segment. | ||
| export const SubscribedWithBreakdown: Story = { | ||
| args: { | ||
| label: "Usage this period", | ||
| percent: 18, | ||
| valueLabel: "$12.40 of $70", | ||
| detail: "Resets Jul 31 at 2:00 PM PDT", | ||
| breakdown: { includedUsd: 20, spendLimitUsd: 50, usedUsd: 12.4 }, | ||
| }, | ||
| }; | ||
|
|
||
| // Past the allowance: the green segment is full and billable usage fills the | ||
| // accent segment. | ||
| export const SubscribedPastIncluded: Story = { | ||
| args: { | ||
| label: "Usage this period", | ||
| percent: 66, | ||
| valueLabel: "$46.20 of $70", | ||
| detail: "Resets Jul 31 at 2:00 PM PDT", | ||
| breakdown: { includedUsd: 20, spendLimitUsd: 50, usedUsd: 46.2 }, | ||
| }, | ||
| }; | ||
|
|
||
| // A subscribed org that set its spend limit to $0: only the included segment | ||
| // (and its legend entry) renders. | ||
| export const ZeroSpendLimit: Story = { | ||
| args: { | ||
| label: "Usage this period", | ||
| percent: 65, | ||
| valueLabel: "$13 of $20", | ||
| detail: "Resets Jul 31 at 2:00 PM PDT", | ||
| breakdown: { includedUsd: 20, spendLimitUsd: 0, usedUsd: 13 }, | ||
| }, | ||
| }; | ||
|
|
||
| // Free tier has no breakdown — its limit IS the allowance, so the plain | ||
| // single-track bar renders. | ||
| export const FreeTier: Story = { | ||
| args: { | ||
| label: "Monthly free usage", | ||
| percent: 62, | ||
| valueLabel: "$12.40 of $20 included", | ||
| detail: "Resets Jul 31 at 2:00 PM PDT", | ||
| }, | ||
| }; | ||
|
|
||
| export const Exceeded: Story = { | ||
| args: { | ||
| label: "Usage this period", | ||
| percent: 100, | ||
| valueLabel: "$70 of $70", | ||
| detail: "Limit exceeded. Resets Jul 31 at 2:00 PM PDT", | ||
| breakdown: { includedUsd: 20, spendLimitUsd: 50, usedUsd: 70 }, | ||
| color: "red", | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.