Skip to content

Commit 4979974

Browse files
committed
build fix
1 parent 29c8767 commit 4979974

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

packages/dashboard/src/app/(layout)/subscription/components/PlansComparison.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type Props = {
1818
export default function PlansComparison({subscription, customerData}: Props) {
1919

2020
const [billingCycle, setBillingCycle] = useState("monthly");
21-
const {paddle, error, handleUpgrade} = usePaddle();
21+
const {handleUpgrade} = usePaddle();
2222

2323

2424
// Toggle billing cycle

packages/dashboard/src/app/(layout)/subscription/components/SubscriptionCard.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
"use client";
22

3-
import { useState } from "react";
4-
import { Badge } from "@/components/ui/badge";
5-
import { Progress } from "@/components/ui/progress";
6-
import { Button } from "@/components/ui/button";
7-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
3+
import {Badge} from "@/components/ui/badge";
4+
import {Progress} from "@/components/ui/progress";
5+
import {Button} from "@/components/ui/button";
6+
import {Card, CardContent, CardDescription, CardHeader, CardTitle} from "@/components/ui/card";
87
import {Tables} from "@/utils/supabase/database.types";
98
import {PLANS} from "@/utils/constants";
109
import {format} from "date-fns";
11-
import {pro_monthly_id, pro_yearly_id, usePaddle} from "@/hooks/usePaddle";
10+
import {pro_monthly_id, usePaddle} from "@/hooks/usePaddle";
1211

1312
type Props = {
1413
subscription: (Tables<'subscriptions'> & Tables<'customers'>) | null;
@@ -18,8 +17,8 @@ type Props = {
1817
}
1918
}
2019

21-
export default function SubscriptionCard({ subscription, usages, customerData }: Props) {
22-
const {paddle, error, handleUpgrade} = usePaddle();
20+
export default function SubscriptionCard({subscription, usages, customerData}: Props) {
21+
const {paddle, handleUpgrade} = usePaddle();
2322

2423
const isPro = subscription?.subscription_status === "active";
2524
const maxRequestsPerMonth = isPro ? PLANS.PRO.REQUESTS_PER_MONTH : PLANS.BASIC.REQUESTS_PER_MONTH
@@ -30,7 +29,7 @@ export default function SubscriptionCard({ subscription, usages, customerData }:
3029
const handleCancel = async () => {
3130
try {
3231
paddle?.Retain.initCancellationFlow({
33-
subscriptionId: subscription?.subscription_id!,
32+
subscriptionId: subscription?.subscription_id as string,
3433
})
3534
} catch (error) {
3635
console.error("Error canceling subscription:", error);
@@ -74,7 +73,7 @@ export default function SubscriptionCard({ subscription, usages, customerData }:
7473
{usages} / {maxRequestsPerMonth}
7574
</div>
7675
</div>
77-
<Progress value={usagePercentage} className="h-2" />
76+
<Progress value={usagePercentage} className="h-2"/>
7877
</CardContent>
7978
</Card>
8079
);

packages/dashboard/src/app/(layout)/subscription/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { getSubscription } from "@/utils/paddle/getSubscription";
77
export default async function SubscriptionPage() {
88
const supabase = await createClient()
99
const {data: {user}} = await supabase.auth.getUser()
10-
const { data } = await supabase.from('usages').select().eq('user_id',user?.id!).maybeSingle()
10+
const { data } = await supabase.from('usages').select().eq('user_id',user?.id as string).maybeSingle()
1111
const usages = data?.calls_count
1212
const subscription = await getSubscription()
1313

@@ -24,14 +24,14 @@ export default async function SubscriptionPage() {
2424
<div>
2525
<h2 className="text-xl font-semibold mb-4">Current Subscription</h2>
2626
<SubscriptionCard usages={usages} subscription={subscription} customerData={{
27-
email: user?.email!,
27+
email: user?.email as string,
2828
}} />
2929
</div>
3030

3131
<div>
3232
<h2 className="text-xl font-semibold mb-4">Plans Comparison</h2>
3333
<PlansComparison subscription={subscription} customerData={{
34-
email: user?.email!,
34+
email: user?.email as string,
3535
}} />
3636
</div>
3737
</div>

packages/dashboard/src/hooks/usePaddle.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { env } from "next-runtime-env";
22
import {useCallback, useEffect, useState } from "react";
33
import {initializePaddle, Paddle} from "@paddle/paddle-js";
4+
import { captureException } from "@sentry/nextjs"
45

56

67
const environment = env('NEXT_PUBLIC_PADDLE_ENV') as "sandbox";
@@ -24,6 +25,7 @@ export function usePaddle() {
2425
}
2526
})
2627
.catch((err) => {
28+
captureException(err);
2729
if (isMounted) {
2830
setError(err as Error);
2931
console.error('Failed to initialize Paddle:', err);
@@ -61,6 +63,7 @@ export function usePaddle() {
6163
}
6264
})
6365
} catch (error) {
66+
captureException(error);
6467
console.error("Error upgrading subscription:", error);
6568
}
6669
};

0 commit comments

Comments
 (0)