diff --git a/app/(app)/me/page.tsx b/app/(app)/me/page.tsx index 0ef548c..2a36d2e 100644 --- a/app/(app)/me/page.tsx +++ b/app/(app)/me/page.tsx @@ -8,10 +8,11 @@ import { type CertStatus, } from '@/lib/certifications-logic' import { PERMISSIONS, PERMISSION_CODES } from '@/lib/permissions-catalog' -import { getMyClassSignups, getMyReservations, getMyCards, getMyVisits } from '@/lib/actions' +import { getMyClassSignups, getMyReservations, getMyCards, getMyVisits, getMyBilling } from '@/lib/actions' import { SIGNUP_STATUS_LABEL, SESSION_STATUS_LABEL } from '@/lib/classes-logic' import { RESERVATION_STATUS_LABEL } from '@/lib/equipment-logic' import { presenceStatus } from '@/lib/presence-logic' +import { DuesCard } from '@/components/billing/dues-card' export const dynamic = 'force-dynamic' @@ -111,6 +112,10 @@ export default async function MePage() { const visitsRes = await getMyVisits() type MyVisit = { id: string; checked_in_at: string; checked_out_at: string | null; is_host: boolean; check_in_note: string | null; check_out_note: string | null } const myVisits: MyVisit[] = 'data' in visitsRes ? (visitsRes.data as MyVisit[]) : [] + const billingRes = await getMyBilling() + const billing = ('data' in billingRes ? billingRes.data : null) as + | { status: string | null; currentPeriodEnd: string | null; hasCustomer: boolean } + | null const titleOf = (cs: ClassSignup) => { const sess = sessionOf(cs) const c = sess ? (Array.isArray(sess.classes) ? sess.classes[0] : sess.classes) : null @@ -124,6 +129,13 @@ export default async function MePage() {
Membership dues
+ {billing?.status ? ( ++ {billing.status} + {billing.currentPeriodEnd + ? ` · renews ${new Date(billing.currentPeriodEnd).toLocaleDateString()}` + : ''} +
+ ) : ( +No active dues subscription.
+ )} ++ Uses your space’s own Stripe account. Keys are stored encrypted and never shown + again. After saving, add this webhook endpoint in your Stripe Dashboard and paste back + its signing secret, and activate the Customer Portal there. +
+ +Tier → Stripe Price
+Webhook endpoint (add in Stripe → Developers → Webhooks):
+{webhookUrl}
+ + Subscribe to: checkout.session.completed, customer.subscription.*, invoice.paid, invoice.payment_failed. +
+