2023-06-09 18:21:18 +10:00
|
|
|
import { redirect } from 'next/navigation';
|
|
|
|
|
|
|
|
|
|
import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-session';
|
|
|
|
|
|
|
|
|
|
import { PasswordForm } from '~/components/forms/password';
|
2023-08-18 20:05:14 +10:00
|
|
|
import { getServerComponentFlag } from '~/helpers/get-server-component-feature-flag';
|
2023-06-09 18:21:18 +10:00
|
|
|
|
|
|
|
|
export default async function BillingSettingsPage() {
|
|
|
|
|
const user = await getRequiredServerComponentSession();
|
|
|
|
|
|
2023-08-18 20:05:14 +10:00
|
|
|
const isBillingEnabled = await getServerComponentFlag('billing');
|
|
|
|
|
|
2023-06-09 18:21:18 +10:00
|
|
|
// Redirect if subscriptions are not enabled.
|
2023-08-18 20:05:14 +10:00
|
|
|
if (!isBillingEnabled) {
|
2023-06-09 18:21:18 +10:00
|
|
|
redirect('/settings/profile');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<h3 className="text-lg font-medium">Billing</h3>
|
|
|
|
|
|
|
|
|
|
<p className="mt-2 text-sm text-slate-500">
|
|
|
|
|
Here you can update and manage your subscription.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<hr className="my-4" />
|
|
|
|
|
|
|
|
|
|
<PasswordForm user={user} className="max-w-xl" />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|