Skip to content

Commit 7c18712

Browse files
Add stripe billing logic (#190)
* add side bar nav in settings page * improve styling of members page * wip adding stripe checkout button * wip onboarding flow * add stripe subscription id to org * save stripe session id and add manage subscription button in settings * properly block access to pages if user isn't in an org * wip add paywall * Domain support * add back paywall and also add support for incrememnting seat count on invite redemption * prevent self invite * action button styling in settings and toast on copy * add ability to remove member from org * move stripe product id to env var * add await for blocking loop in backend * add subscription info to billing page * handle trial case in billing info page * add trial duration indicator to nav bar * check if domain starts or ends with dash * remove unused no org component * remove package lock file and fix prisma dep version * revert dep version updates * fix yarn.lock * add auth and membership check to fetchSubscription * properly handle invite redeem with no valid subscription case * change back fetch subscription to not require org membership * add back subscription check in invite redeem page --------- Co-authored-by: bkellam <bshizzle1234@gmail.com>
1 parent e6ee45c commit 7c18712

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2560
-267
lines changed

packages/backend/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ export const main = async (db: PrismaClient, context: AppContext) => {
2626
connectionManager.registerPollingCallback();
2727

2828
const repoManager = new RepoManager(db, DEFAULT_SETTINGS, redis, context);
29-
repoManager.blockingPollLoop();
29+
await repoManager.blockingPollLoop();
3030
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "Org" ADD COLUMN "stripeCustomerId" TEXT;

packages/db/prisma/schema.prisma

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,20 @@ model Invite {
105105
}
106106

107107
model Org {
108-
id Int @id @default(autoincrement())
109-
name String
110-
domain String @unique
111-
createdAt DateTime @default(now())
112-
updatedAt DateTime @updatedAt
113-
members UserToOrg[]
114-
connections Connection[]
115-
repos Repo[]
116-
secrets Secret[]
108+
id Int @id @default(autoincrement())
109+
name String
110+
domain String @unique
111+
createdAt DateTime @default(now())
112+
updatedAt DateTime @updatedAt
113+
members UserToOrg[]
114+
connections Connection[]
115+
repos Repo[]
116+
secrets Secret[]
117+
118+
stripeCustomerId String?
117119
118120
/// List of pending invites to this organization
119-
invites Invite[]
121+
invites Invite[]
120122
}
121123

122124
enum OrgRole {

packages/web/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
"@sourcebot/db": "^0.1.0",
6565
"@sourcebot/schemas": "^0.1.0",
6666
"@ssddanbrown/codemirror-lang-twig": "^1.0.0",
67+
"@stripe/react-stripe-js": "^3.1.1",
68+
"@stripe/stripe-js": "^5.6.0",
6769
"@tanstack/react-query": "^5.53.3",
6870
"@tanstack/react-table": "^8.20.5",
6971
"@tanstack/react-virtual": "^3.10.8",
@@ -113,6 +115,7 @@
113115
"react-resizable-panels": "^2.1.1",
114116
"server-only": "^0.0.1",
115117
"sharp": "^0.33.5",
118+
"stripe": "^17.6.0",
116119
"tailwind-merge": "^2.5.2",
117120
"tailwind-scrollbar-hide": "^1.1.7",
118121
"tailwindcss-animate": "^1.0.7",

0 commit comments

Comments
 (0)