Skip to content

Commit

Permalink
feat: record a complete roundtrip stripe purchase (#156)
Browse files Browse the repository at this point in the history
* chipping away at the errors for the pricing widget

* massive changeset 🤡

migrated the pricing widget and styles - build is still broken, but getting close just needed to git this stuff committed

adds local mysql support via docker compose

* revert to serverless driver

* style(proaws): markdown

* style(proaws): opengraph image

* style(proaws): bring back opengraph images

* Update .env.example

* stripe checkout builds without error

added adapter pieces to load the required data

* stripe checkout redirects to stripe

* use a stripe adapter to wrap the client

* fix some build related stuff

also casually update to latest next canary

* fix some build related stuff

* rename from Stripe to Payments provider

* clean logs

* small bit of code tidying

* small bit of code tidying

* stripe webhook handler handles

* stripe webhooks sends inngest event

* chore: use standard mysql driver

* feat: complete purchase gets recorded

* fix: revert back to planetscale driver

it was causing some type issues and should be a different commit/pr

* feat: migrating a bunch of post purchase functionality

* thanks page renders as server component

* migrate all the trpc to server actions

trpc was 404ing so i was forced to migrate them which needed to be done anyway, but it's very annoying

* migrates welcome and redeemm app router

* migrates invoices to app router

* view a purchase and an invoice

* add the required env

* fix: pro-aws needed update for trpc

* chore: update some libraries

* chore: lock file conflicts

* misc 🤡

* gotta have the stub

* add changeset

---------

Co-authored-by: Vojta Holik <vojta@egghead.io>
  • Loading branch information
joelhooks and vojtaholik committed Apr 24, 2024
1 parent 0fc1f6b commit 18169be
Show file tree
Hide file tree
Showing 106 changed files with 6,080 additions and 613 deletions.
9 changes: 9 additions & 0 deletions .changeset/sour-donkeys-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@coursebuilder/adapter-drizzle": patch
"@coursebuilder/core": patch
"@coursebuilder/next": patch
"@coursebuilder/ui": patch
"create-course-app": patch
---

migrates commerce flows from Skill Stack into Course Builder
2 changes: 2 additions & 0 deletions apps/course-builder-web/.env.development.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# https://next-auth.js.org/configuration/options#secret
NEXTAUTH_SECRET="set-secret-here"

NEXT_PUBLIC_SUPPORT_EMAIL=team@coursebuilder.dev

# for webhooks use ngrok or similar for stable DNS accessible URL
NEXTAUTH_URL="https://some-subdomain.ngrok-free.app/api/auth"
COURSEBUILDER_URL="https://some-subdomain.ngrok-free.app"
Expand Down
2 changes: 2 additions & 0 deletions apps/course-builder-web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# should be updated accordingly.

NEXT_PUBLIC_APP_NAME=app-name
NEXT_PUBLIC_SUPPORT_EMAIL=team@coursebuilder.dev

COURSEBUILDER_URL="http://example.com"

Expand All @@ -20,6 +21,7 @@ COURSEBUILDER_URL="http://example.com"
DATABASE_URL='mysql://{USERNAME}:{PASSWORD}@aws.connect.psdb.cloud/{DATABASE_NAME}?ssl={"rejectUnauthorized":true}'

STRIPE_SECRET_TOKEN="sk_test_"
STRIPE_WEBHOOK_SECRET="whs_"

# Next Auth
# You can generate a new secret on the command line with:
Expand Down
28 changes: 19 additions & 9 deletions apps/course-builder-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@mdx-js/react": "^3.0.0",
"@msgpack/msgpack": "3.0.0-beta2",
"@mux/mux-player-react": "^2.2.0",
"@next/mdx": "14.3.0-canary.5",
"@next/mdx": "14.3.0-canary.18",
"@pinecone-database/pinecone": "^2.1.0",
"@planetscale/database": "1.14.0",
"@radix-ui/colors": "^3.0.0",
Expand All @@ -81,11 +81,12 @@
"@sanity/icons": "^2.6.0",
"@sindresorhus/slugify": "^2.2.1",
"@t3-oss/env-nextjs": "^0.7.1",
"@tanstack/react-query": "^4.36.1",
"@trpc/client": "10.45.0",
"@trpc/next": "10.45.0",
"@trpc/react-query": "10.45.0",
"@trpc/server": "10.45.0",
"@tanstack/react-query": "^5.25.0",
"@tanstack/react-query-devtools": "^5.31.0",
"@trpc/client": "next",
"@trpc/next": "next",
"@trpc/react-query": "next",
"@trpc/server": "next",
"@types/lodash": "^4.14.200",
"@types/mdx": "^2.0.10",
"@types/shortid": "^0.0.31",
Expand All @@ -106,7 +107,8 @@
"date-fns": "^2.30.0",
"date-fns-tz": "^2.0.0",
"drizzle-orm": "0.30.2",
"framer-motion": "^10.16.5",
"formik": "2.2.9",
"framer-motion": "^11",
"groq": "^3.18.1",
"i": "^0.3.7",
"inngest": "^3.16.1",
Expand All @@ -116,12 +118,15 @@
"lodash": "^4.17.21",
"lucide-react": "^0.288.0",
"memoize-one": "^6.0.0",
"mjml": "^4.15.3",
"nanoid": "^5.0.2",
"next": "14.3.0-canary.5",
"next": "14.3.0-canary.18",
"next-auth": "5.0.0-beta.16",
"next-axiom": "^1.1.1",
"next-mdx-remote": "^4.4.1",
"next-themes": "^0.2.1",
"next-themes": "^0.3",
"nodemailer": "^6.7.2",
"nodemailer-postmark-transport": "^5.2.1",
"npm": "^10.2.1",
"openai": "^4.28.4",
"openai-edge": "^1.2.2",
Expand All @@ -131,13 +136,16 @@
"query-string": "^9.0.0",
"react": "18.3.0-canary-feed8f3f9-20240118",
"react-aria": "^3.32.1",
"react-countdown": "^2.3.5",
"react-dom": "18.3.0-canary-feed8f3f9-20240118",
"react-gravatar": "^2.6.3",
"react-hook-form": "^7.48.0",
"react-hot-toast": "^2.4.1",
"react-icons": "^4.11.0",
"react-markdown": "^9.0.0",
"react-resizable-panels": "^2.0.12",
"react-stately": "^3.30.1",
"react-use": "^17.5.0",
"react-wrap-balancer": "^0.2.4",
"resend": "^3.2.0",
"satori": "^0.10.9",
Expand All @@ -158,6 +166,7 @@
"y-prosemirror": "^1.2.2",
"y-protocols": "^1.0.6",
"yjs": "^13.6.10",
"yup": "^0.32.11",
"zod": "^3.22.4",
"zod-to-json-schema": "^3.22.4",
"zustand": "^4.4.7"
Expand All @@ -168,6 +177,7 @@
"@types/base-64": "^1.0.1",
"@types/eslint": "^8.44.2",
"@types/json-schema": "^7.0.14",
"@types/mjml": "^4.7.4",
"@types/node": "^20.12.5",
"@types/pluralize": "^0.0.33",
"@types/react": "^18.2.73",
Expand Down
4 changes: 2 additions & 2 deletions apps/course-builder-web/src/ability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const UserSchema = z.object({

export type User = z.infer<typeof UserSchema>

type Actions = 'create' | 'read' | 'update' | 'delete' | 'manage'
type Subjects = 'Content' | 'User' | ContentResource | User | 'all'
type Actions = 'create' | 'read' | 'update' | 'delete' | 'manage' | 'view'
type Subjects = 'Content' | 'User' | ContentResource | User | 'all' | 'Invoice'

export type AppAbility = MongoAbility<[Actions, Subjects]>

Expand Down
Loading

0 comments on commit 18169be

Please sign in to comment.