3288fde693
Access & navigation
- Gate partner-mode strictly to partner staff so admins/end-users never inherit
leftover partner-view state; purge stale session entry on hydrate.
- Role-driven admin entry: useMe.isTenantAdmin, Admin/Personal tiles in the app
launcher, and an /admin route guard in the global middleware (fail closed).
- Drop the duplicate user identity block from the sidebar footer.
Admin pages on real data
- New tenant-scoped, membership-gated endpoints: GET /tenants/:slug/{audit,users,
invoices}; useTenant composable resolves the active workspace + subscription.
- Dashboard: real seats, spend (cycle-normalized + minor-units), plan, renewal,
and recent audit; unbacked sections removed.
- Users & groups: real members; Groups/Invitations/Service accounts shown as
honest "coming soon".
- Subscription & invoices: real plan hero, invoice history, and billing details.
Stripe payment method (Elements + SetupIntent)
- StripeClient: publishable key + getDefaultCard/createSetupIntent/setDefaultCard.
- CustomerBillingController + BillingService methods (ensure-customer on demand).
- Portal: PaymentMethodModal, useStripeJs (CDN load), proxies; hidePostalCode.
Editable billing details & whitelabel branding
- PATCH /tenants/:slug/billing-info (narrow: company/VAT/country/email).
- TenantBranding schema/service + GET/PUT /tenants/:slug/branding: real product
name, accent colour, and per-tenant email-template overrides.
- Branding preview + sidebar workspace mark wired to real name/plan/seats/colour
with YIQ auto-contrast (readableOn util).
Session resilience
- Request offline_access so Authentik issues a refresh token (automaticRefresh).
- Silent refresh + single retry on 401 for writes (useApiFetch, incl. partner
pages) and reads (useMe.fetchMe) — no redirect, no lost input.
- Modal backdrop closes only on press+release on the backdrop (no more
drag-select-to-close).
42 lines
1.7 KiB
TypeScript
42 lines
1.7 KiB
TypeScript
import { Module } from '@nestjs/common'
|
|
import { MongooseModule } from '@nestjs/mongoose'
|
|
import { AuditModule } from '../audit/audit.module.js'
|
|
import { AuthModule } from '../auth/auth.module.js'
|
|
import { IntegrationsModule } from '../integrations/integrations.module.js'
|
|
import { Invoice, InvoiceSchema } from '../schemas/invoice.schema.js'
|
|
import { Partner, PartnerSchema } from '../schemas/partner.schema.js'
|
|
import { Payout, PayoutSchema } from '../schemas/payout.schema.js'
|
|
import { Subscription, SubscriptionSchema } from '../schemas/subscription.schema.js'
|
|
import { Tenant, TenantSchema } from '../schemas/tenant.schema.js'
|
|
import { UsersModule } from '../users/users.module.js'
|
|
import { BillingService } from './billing.service.js'
|
|
import { CustomerBillingController } from './customer-billing.controller.js'
|
|
import { OperatorBillingController } from './operator-billing.controller.js'
|
|
import { PartnerBillingController } from './partner-billing.controller.js'
|
|
import { PayoutWorker } from './payout.worker.js'
|
|
import { StripeWebhookController } from './stripe-webhook.controller.js'
|
|
|
|
@Module({
|
|
imports: [
|
|
MongooseModule.forFeature([
|
|
{ name: Invoice.name, schema: InvoiceSchema },
|
|
{ name: Payout.name, schema: PayoutSchema },
|
|
{ name: Subscription.name, schema: SubscriptionSchema },
|
|
{ name: Partner.name, schema: PartnerSchema },
|
|
{ name: Tenant.name, schema: TenantSchema },
|
|
]),
|
|
AuthModule,
|
|
AuditModule,
|
|
IntegrationsModule,
|
|
UsersModule,
|
|
],
|
|
controllers: [
|
|
PartnerBillingController,
|
|
OperatorBillingController,
|
|
CustomerBillingController,
|
|
StripeWebhookController,
|
|
],
|
|
providers: [BillingService, PayoutWorker],
|
|
})
|
|
export class BillingModule {}
|