mirror of
https://github.com/hanzoai/billing.git
synced 2026-10-30 18:46:54 +00:00
- Add BillingAccount/BillingAccountMember types with owner/admin/viewer roles - Add account switcher dropdown + member management components - Add 7 billing account API methods to Commerce client - Add Team tab (12th) to billing workspace - Fix IAM client ID: app-hanzo (was placeholder hanzo-app-client-id) - Fix app name in auth config to match Casdoor registration - Relabel payment sections (no processor-specific references)
25 lines
774 B
TypeScript
25 lines
774 B
TypeScript
import type { IamAuthConfig } from './iam-auth'
|
|
import type { BillingOrgConfig } from './config'
|
|
|
|
function getBasePath(): string {
|
|
if (typeof window === 'undefined') return ''
|
|
// Detect basePath from current URL (handles GitHub Pages /billing/ prefix)
|
|
const path = window.location.pathname
|
|
// If path starts with /billing, we're on GitHub Pages
|
|
if (path.startsWith('/billing')) return '/billing'
|
|
return ''
|
|
}
|
|
|
|
export function makeAuthConf(org: BillingOrgConfig): IamAuthConfig {
|
|
const basePath = getBasePath()
|
|
return {
|
|
iamServerUrl: org.iamServerUrl,
|
|
clientId: org.iamClientId,
|
|
redirectUri: typeof window !== 'undefined'
|
|
? `${window.location.origin}${basePath}/auth/callback`
|
|
: '',
|
|
orgName: org.id,
|
|
appName: 'app-hanzo',
|
|
}
|
|
}
|