diff --git a/example/convex/_generated/api.d.ts b/example/convex/_generated/api.d.ts index f54ef46..e6e261a 100644 --- a/example/convex/_generated/api.d.ts +++ b/example/convex/_generated/api.d.ts @@ -113,7 +113,7 @@ export declare const components: { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; productId: string; recurringInterval: "month" | "year" | null; startedAt: string | null; @@ -141,7 +141,7 @@ export declare const components: { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; product: { createdAt: string; description: string | null; @@ -264,7 +264,7 @@ export declare const components: { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; productId: string; recurringInterval: "month" | "year" | null; startedAt: string | null; @@ -296,7 +296,7 @@ export declare const components: { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; productId: string; recurringInterval: "month" | "year" | null; startedAt: string | null; @@ -371,7 +371,7 @@ export declare const components: { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; product: { createdAt: string; description: string | null; @@ -490,7 +490,7 @@ export declare const components: { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; productId: string; recurringInterval: "month" | "year" | null; startedAt: string | null; diff --git a/example/convex/example.ts b/example/convex/example.ts index 3967a81..48b5fe6 100644 --- a/example/convex/example.ts +++ b/example/convex/example.ts @@ -88,7 +88,7 @@ const currentUser = async (ctx: QueryCtx) => { isPremiumPlus, subscription, maxTodos: isPremiumPlus - ? MAX_PREMIUM_TODOS + ? undefined : isPremium ? MAX_PREMIUM_TODOS : MAX_FREE_TODOS, @@ -137,8 +137,7 @@ export const insertTodo = mutation({ throw new Error("Reached maximum number of todos for free plan"); } if ( - (productKey === "premiumMonthly" || - productKey === "premiumPlusMonthly") && + (productKey === "premiumMonthly" || productKey === "premiumYearly") && todoCount >= MAX_PREMIUM_TODOS ) { throw new Error("Reached maximum number of todos for premium plan"); diff --git a/example/src/App.tsx b/example/src/App.tsx index 7617eda..af5787f 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -29,6 +29,7 @@ export default function TodoList() { const [newTodo, setNewTodo] = useState(""); const todosLength = todos?.length ?? 0; + console.log("user", user); const isAtMaxTodos = user?.maxTodos && todosLength >= user.maxTodos; const { diff --git a/src/component/_generated/api.d.ts b/src/component/_generated/api.d.ts index fecdd31..90e3365 100644 --- a/src/component/_generated/api.d.ts +++ b/src/component/_generated/api.d.ts @@ -99,7 +99,7 @@ export type Mounts = { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; productId: string; recurringInterval: "month" | "year" | null; startedAt: string | null; @@ -127,7 +127,7 @@ export type Mounts = { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; product: { createdAt: string; description: string | null; @@ -250,7 +250,7 @@ export type Mounts = { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; productId: string; recurringInterval: "month" | "year" | null; startedAt: string | null; @@ -282,7 +282,7 @@ export type Mounts = { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; productId: string; recurringInterval: "month" | "year" | null; startedAt: string | null; @@ -357,7 +357,7 @@ export type Mounts = { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; product: { createdAt: string; description: string | null; @@ -476,7 +476,7 @@ export type Mounts = { id: string; metadata: Record; modifiedAt: string | null; - priceId: string; + priceId?: string; productId: string; recurringInterval: "month" | "year" | null; startedAt: string | null;