Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 2 additions & 0 deletions admin/billing/biller.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ const (
TeamPlanType
ManagedPlanType
EnterprisePlanType
FreePlanType
GrowthPlanType
)

type Plan struct {
Expand Down
8 changes: 8 additions & 0 deletions admin/billing/orb.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,10 @@ func getPlanType(externalID string) PlanType {
return TeamPlanType
case "managed":
return ManagedPlanType
case "free", "free_plan", "free-plan":
Comment thread
royendo marked this conversation as resolved.
Outdated
return FreePlanType
case "growth", "growth_plan", "growth-plan":
Comment thread
royendo marked this conversation as resolved.
Outdated
return GrowthPlanType
default:
return EnterprisePlanType
}
Expand All @@ -664,6 +668,10 @@ func getPlanDisplayName(externalID string) string {
return "Team"
case "managed":
return "Managed"
case "free", "free_plan", "free-plan":
return "Free Plan"
case "growth", "growth_plan", "growth-plan":
Comment thread
royendo marked this conversation as resolved.
Outdated
return "Growth Plan"
default:
return "Enterprise"
}
Expand Down
4 changes: 4 additions & 0 deletions admin/server/billing.go
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,10 @@ func planTypeToDTO(t billing.PlanType) adminv1.BillingPlanType {
return adminv1.BillingPlanType_BILLING_PLAN_TYPE_MANAGED
case billing.EnterprisePlanType:
return adminv1.BillingPlanType_BILLING_PLAN_TYPE_ENTERPRISE
case billing.FreePlanType:
return adminv1.BillingPlanType_BILLING_PLAN_TYPE_FREE
case billing.GrowthPlanType:
return adminv1.BillingPlanType_BILLING_PLAN_TYPE_GROWTH
default:
return adminv1.BillingPlanType_BILLING_PLAN_TYPE_UNSPECIFIED
}
Expand Down
2 changes: 2 additions & 0 deletions proto/gen/rill/admin/v1/admin.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4706,6 +4706,8 @@ definitions:
- BILLING_PLAN_TYPE_TEAM
- BILLING_PLAN_TYPE_MANAGED
- BILLING_PLAN_TYPE_ENTERPRISE
- BILLING_PLAN_TYPE_FREE
- BILLING_PLAN_TYPE_GROWTH
default: BILLING_PLAN_TYPE_UNSPECIFIED
v1Bookmark:
type: object
Expand Down
3,208 changes: 1,609 additions & 1,599 deletions proto/gen/rill/admin/v1/api.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions proto/gen/rill/admin/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ components:
- BILLING_PLAN_TYPE_TEAM
- BILLING_PLAN_TYPE_MANAGED
- BILLING_PLAN_TYPE_ENTERPRISE
- BILLING_PLAN_TYPE_FREE
- BILLING_PLAN_TYPE_GROWTH
type: string
v1Bookmark:
properties:
Expand Down
2 changes: 2 additions & 0 deletions proto/gen/rill/admin/v1/public.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ components:
- BILLING_PLAN_TYPE_TEAM
- BILLING_PLAN_TYPE_MANAGED
- BILLING_PLAN_TYPE_ENTERPRISE
- BILLING_PLAN_TYPE_FREE
- BILLING_PLAN_TYPE_GROWTH
type: string
v1Bookmark:
properties:
Expand Down
2 changes: 2 additions & 0 deletions proto/rill/admin/v1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3502,6 +3502,8 @@ enum BillingPlanType {
BILLING_PLAN_TYPE_TEAM = 2;
BILLING_PLAN_TYPE_MANAGED = 3;
BILLING_PLAN_TYPE_ENTERPRISE = 4;
BILLING_PLAN_TYPE_FREE = 5;
BILLING_PLAN_TYPE_GROWTH = 6;
}

message BillingPlan {
Expand Down
42 changes: 42 additions & 0 deletions web-admin/src/features/billing/plans/FreePlan.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<script lang="ts">
import type { V1BillingPlan } from "@rilldata/web-admin/client";
import ContactUs from "@rilldata/web-admin/features/billing/ContactUs.svelte";
import PlanQuotas from "@rilldata/web-admin/features/billing/plans/PlanQuotas.svelte";
import StartTeamPlanDialog from "@rilldata/web-admin/features/billing/plans/StartTeamPlanDialog.svelte";
import SettingsContainer from "@rilldata/web-admin/features/organizations/settings/SettingsContainer.svelte";
import { Button } from "@rilldata/web-common/components/button";

let {
organization,
plan,
}: {
organization: string;
plan: V1BillingPlan;
} = $props();

let open = $state(false);
</script>

<SettingsContainer title={plan?.displayName ?? "Free Plan"}>
<div slot="body">
<div>
You're on the Free plan. Ready to get started with Rill?
<a
href="https://www.rilldata.com/pricing"
target="_blank"
rel="noreferrer noopener">See pricing details -></a
>
</div>
<PlanQuotas {organization} />
</div>
<svelte:fragment slot="contact">
<span>For any questions,</span>
<ContactUs />
</svelte:fragment>

<Button type="primary" slot="action" onClick={() => (open = true)}>
Upgrade to Team plan
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be Pro Plan? Or is that something only we can switch a user into?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

planning to upgrade this link when everything is set up! dont want to change default behavior just yet

</Button>
</SettingsContainer>

<StartTeamPlanDialog bind:open {organization} type="base" />
37 changes: 37 additions & 0 deletions web-admin/src/features/billing/plans/GrowthPlan.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script lang="ts">
import type {
V1BillingPlan,
V1Subscription,
} from "@rilldata/web-admin/client";
import ContactUs from "@rilldata/web-admin/features/billing/ContactUs.svelte";
import PlanQuotas from "@rilldata/web-admin/features/billing/plans/PlanQuotas.svelte";
import { getNextBillingCycleDate } from "@rilldata/web-admin/features/billing/plans/selectors";
import SettingsContainer from "@rilldata/web-admin/features/organizations/settings/SettingsContainer.svelte";

let {
organization,
subscription,
plan,
}: {
organization: string;
subscription: V1Subscription;
plan: V1BillingPlan;
} = $props();
</script>

<SettingsContainer title={plan?.displayName ?? "Growth Plan"}>
<div slot="body">
Next billing cycle will start on
<b>{getNextBillingCycleDate(subscription.currentBillingCycleEndDate)}</b>.
<a
href="https://www.rilldata.com/pricing"
target="_blank"
rel="noreferrer noopener">See pricing details -></a
>
<PlanQuotas {organization} />
</div>
<svelte:fragment slot="contact">
<span>For any questions,</span>
<ContactUs />
</svelte:fragment>
</SettingsContainer>
17 changes: 16 additions & 1 deletion web-admin/src/features/billing/plans/Plan.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
import { createAdminServiceGetBillingSubscription } from "@rilldata/web-admin/client";
import CancelledTeamPlan from "@rilldata/web-admin/features/billing/plans/CancelledTeamPlan.svelte";
import EnterprisePlan from "@rilldata/web-admin/features/billing/plans/EnterprisePlan.svelte";
import FreePlan from "@rilldata/web-admin/features/billing/plans/FreePlan.svelte";
import GrowthPlan from "@rilldata/web-admin/features/billing/plans/GrowthPlan.svelte";
import POCPlan from "@rilldata/web-admin/features/billing/plans/POCPlan.svelte";
import TeamPlan from "@rilldata/web-admin/features/billing/plans/TeamPlan.svelte";
import TrialPlan from "@rilldata/web-admin/features/billing/plans/TrialPlan.svelte";
import {
isFreePlan,
isGrowthPlan,
isManagedPlan,
isTeamPlan,
} from "@rilldata/web-admin/features/billing/plans/utils";
Expand All @@ -27,10 +31,17 @@
$: isTrial = !!$categorisedIssues.data?.trial;
// ended subscription will have a cancelled issue associated with it
$: subHasEnded = !!$categorisedIssues.data?.cancelled;
$: subIsFreePlan = plan && isFreePlan(plan.name);
$: subIsGrowthPlan = plan && isGrowthPlan(plan.name);
$: subIsTeamPlan = plan && isTeamPlan(plan.name);
$: subIsManagedPlan = plan && isManagedPlan(plan.name);
$: subIsEnterprisePlan =
plan && !isTrial && !subIsTeamPlan && !subIsManagedPlan;
plan &&
!isTrial &&
!subIsFreePlan &&
!subIsGrowthPlan &&
!subIsTeamPlan &&
!subIsManagedPlan;
</script>

{#if neverSubbed}
Expand All @@ -39,6 +50,10 @@
<TrialPlan {organization} {subscription} {showUpgradeDialog} {plan} />
{:else if subHasEnded}
<CancelledTeamPlan {organization} {showUpgradeDialog} {plan} />
{:else if subIsFreePlan}
<FreePlan {organization} {plan} />
{:else if subIsGrowthPlan}
<GrowthPlan {organization} {subscription} {plan} />
{:else if subIsTeamPlan}
<TeamPlan {organization} {subscription} {plan} />
{:else if subIsManagedPlan}
Expand Down
20 changes: 19 additions & 1 deletion web-admin/src/features/billing/plans/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,27 @@ export function isManagedPlan(planName: string) {
return planName === "managed";
}

export function isFreePlan(planName: string) {
return (
planName === "free" || planName === "free_plan" || planName === "free-plan"
);
}

export function isGrowthPlan(planName: string) {
return (
planName === "growth" ||
planName === "growth_plan" ||
planName === "growth-plan"
);
}

export function isEnterprisePlan(planName: string) {
return (
!isTrialPlan(planName) && !isTeamPlan(planName) && !isManagedPlan(planName)
!isTrialPlan(planName) &&
!isTeamPlan(planName) &&
!isManagedPlan(planName) &&
!isFreePlan(planName) &&
!isGrowthPlan(planName)
);
}

Expand Down
12 changes: 12 additions & 0 deletions web-common/src/proto/gen/rill/admin/v1/api_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ export enum BillingPlanType {
* @generated from enum value: BILLING_PLAN_TYPE_ENTERPRISE = 4;
*/
ENTERPRISE = 4,

/**
* @generated from enum value: BILLING_PLAN_TYPE_FREE = 5;
*/
FREE = 5,

/**
* @generated from enum value: BILLING_PLAN_TYPE_GROWTH = 6;
*/
GROWTH = 6,
}
// Retrieve enum metadata with: proto3.getEnumType(BillingPlanType)
proto3.util.setEnumType(BillingPlanType, "rill.admin.v1.BillingPlanType", [
Expand All @@ -132,6 +142,8 @@ proto3.util.setEnumType(BillingPlanType, "rill.admin.v1.BillingPlanType", [
{ no: 2, name: "BILLING_PLAN_TYPE_TEAM" },
{ no: 3, name: "BILLING_PLAN_TYPE_MANAGED" },
{ no: 4, name: "BILLING_PLAN_TYPE_ENTERPRISE" },
{ no: 5, name: "BILLING_PLAN_TYPE_FREE" },
{ no: 6, name: "BILLING_PLAN_TYPE_GROWTH" },
]);

/**
Expand Down
Loading