Skip to content

Commit 88ed570

Browse files
committed
chore: enable self-hosted payment option
1 parent dd46cff commit 88ed570

File tree

4 files changed

+57
-22
lines changed

4 files changed

+57
-22
lines changed

src/pages/user/account/_components/SubscriptionDetails.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ export default function SubscriptionDetails({ user }: Props) {
4747
subtitle={[
4848
user.package.name,
4949
user.package.id.startsWith("self-hosted")
50-
? `${capitalize(user.package.edition)} - ${license?.seats} Seats`
50+
? `${capitalize(user.package.edition)} - ${
51+
license?.seats || "unlimited"
52+
} seats`
5153
: "",
5254
]
5355
.filter(i => i)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import type { RenderResult } from "@testing-library/react";
2+
import { render, fireEvent } from "@testing-library/react";
3+
import SubscriptionDetailsCheckout from "./SubscriptionDetailsCheckout";
4+
import mockUser from "~/testing/data/mock_user";
5+
6+
interface Props {
7+
user: User;
8+
}
9+
10+
describe("~/pages/user/account/_components/SubscriptionDetailsCheckout", () => {
11+
let wrapper: RenderResult;
12+
13+
const createWrapper = ({ user }: Props) => {
14+
wrapper = render(<SubscriptionDetailsCheckout user={user} />);
15+
};
16+
17+
beforeEach(() => {
18+
createWrapper({ user: mockUser() });
19+
});
20+
21+
test("should display two options", () => {
22+
expect(wrapper.getByText("Self-Hosted Edition")).toBeTruthy();
23+
expect(wrapper.getByText("Cloud Edition")).toBeTruthy();
24+
});
25+
26+
test("should have 'Limited Edition' pre-selected", () => {
27+
expect(wrapper.getByText("Limited Edition")).toBeTruthy();
28+
});
29+
30+
test("should 'Up to 100 deployments per month' pre-selected", () => {
31+
expect(wrapper.getByText("Up to 100 deployments per month")).toBeTruthy();
32+
});
33+
34+
test("should have two self hosted editions", () => {
35+
fireEvent.mouseDown(wrapper.getAllByRole("combobox").at(0)!);
36+
expect(wrapper.getByText("Premium Edition")).toBeTruthy();
37+
});
38+
39+
test("should have three cloud editions", () => {
40+
fireEvent.mouseDown(wrapper.getAllByRole("combobox").at(1)!);
41+
expect(wrapper.getByText("Up to 500 deployments per month")).toBeTruthy();
42+
expect(wrapper.getByText("Up to 1000 deployments per month")).toBeTruthy();
43+
});
44+
});

src/pages/user/account/_components/SubscriptionDetailsCheckout.tsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useState } from "react";
22
import Box from "@mui/material/Box";
3-
import Chip from "@mui/material/Chip";
43
import Typography from "@mui/material/Typography";
54
import Button from "@mui/material/Button";
65
import { grey } from "@mui/material/colors";
@@ -70,16 +69,8 @@ export default function Checkout({ user }: Props) {
7069
<CardHeader
7170
title="Self-Hosted Edition"
7271
subtitle={`Host Stormkit on your own servers, ensuring complete control and security of your data. Perfect for teams requiring flexibility, scalability, and compliance with internal policies.`}
73-
sx={{
74-
opacity: 0.25,
75-
}}
7672
/>
77-
<Chip
78-
label="Soon 🎉"
79-
color="success"
80-
sx={{ position: "absolute", top: -10, right: -10, zIndex: 5 }}
81-
/>
82-
<Box sx={{ opacity: 0.25 }}>
73+
<Box>
8374
<Box sx={{ mb: 4, flex: 1 }}>
8475
<Box sx={{ display: "flex", mb: 2 }}>
8576
{edition === "limited" ? (
@@ -104,7 +95,6 @@ export default function Checkout({ user }: Props) {
10495
variant="outlined"
10596
selected={[edition]}
10697
sx={{ color: "white" }}
107-
disabled={true}
10898
items={[
10999
{ text: "Limited Edition", value: "limited" },
110100
{ text: "Premium Edition", value: "premium" },
@@ -126,14 +116,13 @@ export default function Checkout({ user }: Props) {
126116
</Box>
127117
</Box>
128118
</Box>
129-
<CardFooter sx={{ textAlign: "center", opacity: 0.25 }}>
119+
<CardFooter sx={{ textAlign: "center" }}>
130120
{edition === "limited" ? (
131121
<Button
132122
variant="contained"
133123
color="secondary"
134124
sx={{ px: 6 }}
135125
href={`${paymentLinks["self-hosted"]}?prefilled_email=${user?.email}`}
136-
disabled
137126
>
138127
Go to portal
139128
</Button>

src/pages/user/account/_components/WhatsIncluded.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ export const includedFeatures = (tier: SubscriptionName, edition?: Edition) => {
5656
included: true,
5757
text: tier === "self-hosted" ? "Up to 5 seats" : "Unlimited seats",
5858
},
59-
{
60-
included: edition === "premium",
61-
text: "Analytics",
62-
},
59+
// {
60+
// included: edition === "premium",
61+
// text: "Analytics",
62+
// },
6363
{
6464
included: edition === "premium",
6565
text: "Audit Logs",
@@ -68,10 +68,10 @@ export const includedFeatures = (tier: SubscriptionName, edition?: Edition) => {
6868
// included: tier === "self-hosted-premium",
6969
// text: "Prerendering",
7070
// },
71-
{
72-
included: edition === "premium",
73-
text: "IP Limiting",
74-
},
71+
// {
72+
// included: edition === "premium",
73+
// text: "IP Limiting",
74+
// },
7575
{
7676
included: edition === "premium",
7777
text: "Premium support",

0 commit comments

Comments
 (0)