Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ bun.lock
test-results/
playwright-report/
blob-report/
playwright/.cache/
playwright/.cache/

# TS build info
tsconfig.tsbuildinfo
867 changes: 867 additions & 0 deletions app/(member)/billing/page.tsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/[communitySlug]/admin/members/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ export default function MembersPage() {
<div className="flex flex-wrap items-center gap-2 text-xs text-muted-foreground">
<span>Tier: {m.tier}</span>
<div className="flex flex-wrap gap-1">
{m.roles.map((r) => (
{m.roles.map((r: string) => (
<button
key={r}
type="button"
Expand Down
5 changes: 5 additions & 0 deletions app/[communitySlug]/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ export default function DashboardPage() {
<MembershipExpiryBadge expiresAt={membership.expiresAt} />
) : null}
</div>
<div className="pt-3">
<Link href="/billing" className={buttonVariants({ variant: "outline", size: "sm" })}>
Manage Billing
</Link>
</div>
</div>
)}
</Section>
Expand Down
2 changes: 1 addition & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RootProviders } from '@/lib/wallet/providers'
import { Nav } from '@/components/nav'
import { SwRegistrar } from '@/components/sw-registrar'
import { BackendHealthCheck } from '@/components/backend-health-check'
import SyncStatusBanner from '@/components/ui/sync-status-banner'
import { SyncStatusBanner } from '@/components/ui/sync-status-banner'

export const metadata: Metadata = {
title: {
Expand Down
1 change: 1 addition & 0 deletions components/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export function Nav() {
enabled: features.resources,
},
{ href: `${prefix}/events/demo` as Route, label: "Event", enabled: features.events },
{ href: `/billing` as Route, label: "Billing", enabled: true },
{
href: `${prefix}/developer` as Route,
label: "Dev",
Expand Down
19 changes: 19 additions & 0 deletions lib/billing/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { config } from '../config'
import { MockBillingApi } from './mock'
import { BillingApi } from './types'

/**
* Returns the appropriate Billing API client based on the environment.
*
* @param address Connected wallet address (used for billing state queries)
* @param token SIWE session token — pass this to authenticate mutations if needed.
* @param communityId Scoped community ID or slug
*/
export function getBillingApi(address?: string, token?: string, communityId?: string): BillingApi {
// Currently, we only target the mock provider as live integrations are out of scope.
// When adding support for a live billing client (e.g. Stripe, Paddle), branch here based on environment:
// if (config.apiMode === 'live') return new LiveBillingApi(address, token, communityId)
return new MockBillingApi(address, communityId)
}

export * from './types'
Loading