Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
ProPlanType
)

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_plan":
return FreePlanType
case "pro_plan":
return ProPlanType
default:
return EnterprisePlanType
}
Expand All @@ -664,6 +668,10 @@ func getPlanDisplayName(externalID string) string {
return "Team"
case "managed":
return "Managed"
case "free_plan":
return "Free Plan"
case "pro_plan":
return "Pro 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.ProPlanType:
return adminv1.BillingPlanType_BILLING_PLAN_TYPE_PRO
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_PRO
default: BILLING_PLAN_TYPE_UNSPECIFIED
v1Bookmark:
type: object
Expand Down
3,191 changes: 1,600 additions & 1,591 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_PRO
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_PRO
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_PRO = 6;
}

message BillingPlan {
Expand Down
2 changes: 2 additions & 0 deletions web-admin/src/client/gen/index.schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ export const V1BillingPlanType = {
BILLING_PLAN_TYPE_TEAM: "BILLING_PLAN_TYPE_TEAM",
BILLING_PLAN_TYPE_MANAGED: "BILLING_PLAN_TYPE_MANAGED",
BILLING_PLAN_TYPE_ENTERPRISE: "BILLING_PLAN_TYPE_ENTERPRISE",
BILLING_PLAN_TYPE_FREE: "BILLING_PLAN_TYPE_FREE",
BILLING_PLAN_TYPE_PRO: "BILLING_PLAN_TYPE_PRO",
} as const;

export interface V1Bookmark {
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 Trial"}>
<div slot="body">
<div>
You're on the Free Trial 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" />
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 ProPlan from "@rilldata/web-admin/features/billing/plans/ProPlan.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,
isProPlan,
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);
$: subIsProPlan = plan && isProPlan(plan.name);
$: subIsTeamPlan = plan && isTeamPlan(plan.name);
$: subIsManagedPlan = plan && isManagedPlan(plan.name);
$: subIsEnterprisePlan =
plan && !isTrial && !subIsTeamPlan && !subIsManagedPlan;
plan &&
!isTrial &&
!subIsFreePlan &&
!subIsProPlan &&
!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 subIsProPlan}
<ProPlan {organization} {subscription} {plan} />
{:else if subIsTeamPlan}
<TeamPlan {organization} {subscription} {plan} />
{:else if subIsManagedPlan}
Expand Down
37 changes: 37 additions & 0 deletions web-admin/src/features/billing/plans/ProPlan.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 ?? "Pro Plan"}>
<div slot="body">
Next billing cycle will start on
<b>{getNextBillingCycleDate(subscription.currentBillingCycleEndDate)}</b>.
<a
href="https://www.rilldata.com/pricing"
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.

This link doesnt seem to have any info about a "Pro Plan". Is it planned to update separately?

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.

yep

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>
14 changes: 13 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,21 @@ export function isManagedPlan(planName: string) {
return planName === "managed";
}

export function isFreePlan(planName: string) {
return planName === "free_plan";
}

export function isProPlan(planName: string) {
return planName === "pro_plan";
}

export function isEnterprisePlan(planName: string) {
return (
!isTrialPlan(planName) && !isTeamPlan(planName) && !isManagedPlan(planName)
!isTrialPlan(planName) &&
!isTeamPlan(planName) &&
!isManagedPlan(planName) &&
!isFreePlan(planName) &&
!isProPlan(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_PRO = 6;
*/
PRO = 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_PRO" },
]);

/**
Expand Down
Loading