"use client"; import { useSearchParams, useRouter, usePathname } from "next/navigation"; import { useEffect, useState } from "react"; import { useIdentityData } from "./IdentityProvider"; import { Modal } from "./Modal"; import { ButtonPrimary } from "./Buttons"; import { theme } from "tailwind.config"; import { replaceWithoutParams } from "src/utils/replaceWithoutParams"; export function SubscriptionSuccessModal() { let searchParams = useSearchParams(); let router = useRouter(); let pathname = usePathname(); let { identity, mutate } = useIdentityData(); let [open, setOpen] = useState(false); let [loading, setLoading] = useState(true); let isUpgradeSuccess = searchParams.get("upgrade") === "success"; useEffect(() => { if (!isUpgradeSuccess) return; setOpen(true); setLoading(true); mutate().then(() => setLoading(false)); }, [isUpgradeSuccess]); function handleOpenChange(next: boolean) { setOpen(next); if (!next) { replaceWithoutParams(router, pathname, searchParams, ["upgrade"], { scroll: false, }); } } if (!isUpgradeSuccess && !open) return null; return ( } className="sm:max-w-sm sm:w-[1000px] w-full" > {loading ? (

Activating your subscription...

) : (

Welcome to Pro!

Thank you for supporting Leaflet.
We're looking forward to bringing you even cooler stuff in the near future!

handleOpenChange(false)} > Got it, Thanks!
)} ); } const ProIllo = () => { return ( ); };