Skip to content

Commit b02e199

Browse files
fix: fixed checkout, separated tier for edge and upgraded to Next 14
1 parent ff2f9d4 commit b02e199

File tree

7 files changed

+680
-325
lines changed

7 files changed

+680
-325
lines changed

next.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const nextConfig = {
77
domains: ["avatars.githubusercontent.com"],
88
},
99
experimental: {
10-
serverActions: true,
1110
serverComponentsExternalPackages: ["@prisma/client"],
1211
},
1312
typescript: {

package-lock.json

Lines changed: 662 additions & 312 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
"@headlessui/react": "^1.7.15",
1919
"@heroicons/react": "^2.0.18",
2020
"@next-auth/prisma-adapter": "^1.0.7",
21-
"@prisma/client": "^5.4.1",
21+
"@prisma/client": "^5.5.2",
2222
"@radix-ui/react-toast": "^1.1.4",
2323
"@t3-oss/env-nextjs": "^0.6.0",
2424
"ai": "^2.1.26",
2525
"clsx": "^1.2.1",
2626
"cva": "npm:class-variance-authority@^0.6.1",
2727
"lucide-react": "^0.256.0",
28-
"next": "^13.4.7",
29-
"next-auth": "^4.22.1",
28+
"next": "^14.0.0",
29+
"next-auth": "^4.24.4",
3030
"nodemailer": "^6.9.3",
3131
"openai-edge": "^1.2.2",
3232
"react": "^18.2.0",
@@ -44,14 +44,14 @@
4444
"@tailwindcss/line-clamp": "^0.4.4",
4545
"@tailwindcss/typography": "^0.5.9",
4646
"@types/node": "^20.3.2",
47-
"@types/react": "^18.2.14",
48-
"@types/react-dom": "^18.2.6",
47+
"@types/react": "^18.2.33",
48+
"@types/react-dom": "^18.2.14",
4949
"@typescript-eslint/parser": "^5.60.1",
5050
"autoprefixer": "^10.4.14",
5151
"commitizen": "^4.3.0",
5252
"cz-conventional-changelog": "^3.3.0",
5353
"eslint": "^8.43.0",
54-
"eslint-config-next": "^13.4.7",
54+
"eslint-config-next": "^14.0.0",
5555
"eslint-config-prettier": "^8.8.0",
5656
"eslint-plugin-react": "^7.32.2",
5757
"eslint-plugin-tailwindcss": "^3.13.0",
@@ -62,7 +62,7 @@
6262
"prettier": "^2.8.8",
6363
"prettier-plugin-tailwindcss": "^0.3.0",
6464
"pretty-quick": "^3.1.3",
65-
"prisma": "^5.4.1",
65+
"prisma": "^5.5.2",
6666
"stripe": "^12.17.0",
6767
"tailwindcss": "^3.3.2",
6868
"tailwindcss-animate": "^1.0.6",

src/app/api/change-plan/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export async function GET(req: Request) {
2929
const checkout = await tier.checkout(`org:${user?.id}`, successUrl, {
3030
cancelUrl,
3131
});
32-
3332
return new Response(JSON.stringify({ url: checkout.url }));
3433
} else {
3534
console.log("subscribe");

src/app/api/generate/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { z } from "zod";
55
import { env } from "@/env.mjs";
66
import { TIER_AICOPY_FEATURE_ID, TIER_EXTRACOPY_FEATURE_ID } from "@/config/tierConstants";
77
import { openAI } from "@/lib/ai";
8-
import { tier } from "@/lib/tier";
8+
import { tier } from "@/lib/tier-edge";
99

1010
if (!env.OPENAI_API_KEY) {
1111
throw new Error("Missing env var from OpenAI");

src/lib/tier-edge.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Tier } from "tier/client";
2+
3+
import { env } from "@/env.mjs";
4+
5+
export const tier = new Tier({
6+
baseURL: env.TIER_BASE_URL as string,
7+
apiKey: env.TIER_API_KEY,
8+
debug: true,
9+
});

src/lib/tier.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// import { Tier } from "tier"; // If you do not want to make Tier work on edge
2-
3-
import { Tier } from "tier/client"; // If you want to make Tier work on edge
1+
import { Tier } from "tier";
42

53
import { env } from "@/env.mjs";
64

0 commit comments

Comments
 (0)