diff --git a/actions/stripe-redirect/index.ts b/actions/stripe-redirect/index.ts index 5c5d25e..716f7ef 100644 --- a/actions/stripe-redirect/index.ts +++ b/actions/stripe-redirect/index.ts @@ -38,7 +38,7 @@ const handler = async (data: InputType): Promise => { const stripeSession = await stripe.checkout.sessions.create({ success_url: settingsUrl, cancel_url: settingsUrl, - // payment_method_types: ['card', 'paypal'], + payment_method_types: ['card', 'paypal'], mode: 'subscription', billing_address_collection: 'auto', customer_email: user.emailAddresses[0].emailAddress, diff --git a/app/(platform)/(dashboard)/organization/[organizationId]/billing/_components/subscription-button.tsx b/app/(platform)/(dashboard)/organization/[organizationId]/billing/_components/subscription-button.tsx index 73326cd..0b787dc 100644 --- a/app/(platform)/(dashboard)/organization/[organizationId]/billing/_components/subscription-button.tsx +++ b/app/(platform)/(dashboard)/organization/[organizationId]/billing/_components/subscription-button.tsx @@ -1,6 +1,7 @@ 'use client'; import { toast } from 'sonner'; +import { useRouter } from 'next/navigation'; import { stripeRedirect } from '@/actions/stripe-redirect'; import { Button } from '@/components/ui/button'; @@ -13,10 +14,11 @@ interface SubscriptionButtonProps { export const SubscriptionButton = ({ isPro }: SubscriptionButtonProps) => { const proModal = useProModal(); + const router = useRouter(); const { execute, isLoading } = useAction(stripeRedirect, { onSuccess: (data) => { - window.location.href = data; + router.push(data); }, onError: (error) => { toast.error(error); diff --git a/components/modals/pro-modal.tsx b/components/modals/pro-modal.tsx index 16cd3e1..6f117b5 100644 --- a/components/modals/pro-modal.tsx +++ b/components/modals/pro-modal.tsx @@ -2,6 +2,7 @@ import Image from 'next/image'; import { toast } from 'sonner'; +import { useRouter } from 'next/navigation'; import { Dialog, DialogContent } from '@/components/ui/dialog'; import { useProModal } from '@/hooks/use-pro-modal'; @@ -11,10 +12,11 @@ import { stripeRedirect } from '@/actions/stripe-redirect'; export const ProModal = () => { const proModal = useProModal(); + const router = useRouter(); const { execute, isLoading } = useAction(stripeRedirect, { onSuccess: (data) => { - window.location.href = data; + router.push(data); }, onError: (error) => { toast.error(error); diff --git a/liveblocks.config.ts b/liveblocks.config.ts index e8684f1..d74be8a 100644 --- a/liveblocks.config.ts +++ b/liveblocks.config.ts @@ -4,7 +4,8 @@ declare global { interface Liveblocks { // Each user's Presence, for useMyPresence, useOthers, etc. Presence: { - cursor: { x: number; y: number } | null; + // Example, real-time cursor coordinates + cursor: { x: number; y: number }; }; // The Storage tree for the room, for useMutation, useStorage, etc. @@ -25,9 +26,9 @@ declare global { // Custom events, for useBroadcastEvent, useEventListener RoomEvent: {}; - // Example has two events, using a union - // | { type: "PLAY" } - // | { type: "REACTION"; emoji: "🔥" }; + // Example has two events, using a union + // | { type: "PLAY" } + // | { type: "REACTION"; emoji: "🔥" }; // Custom metadata set on threads, for useThreads, useCreateThread, etc. ThreadMetadata: {