Skip to content

Commit eb513fd

Browse files
authored
Conditionally use control-plane metadata endpoint (#3654)
* initial commit * update vendored apis
1 parent 45b408c commit eb513fd

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

frontend/app/src/lib/api/generated/control-plane/data-contracts.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,44 @@ export interface APIControlPlaneMetadata {
3838
* @example 3600000
3939
*/
4040
inactivityLogoutMs?: number;
41+
auth?: APIMetaAuth;
42+
/**
43+
* the Pylon app ID for usepylon.com chat support
44+
* @example "12345678-1234-1234-1234-123456789012"
45+
*/
46+
pylonAppId?: string;
47+
posthog?: APIMetaPosthog;
48+
/**
49+
* whether or not users can sign up for this instance
50+
* @example true
51+
*/
52+
allowSignup?: boolean;
53+
/**
54+
* whether or not users can invite other users to this instance
55+
* @example true
56+
*/
57+
allowInvites?: boolean;
58+
/**
59+
* whether or not users can create new tenants
60+
* @example true
61+
*/
62+
allowCreateTenant?: boolean;
63+
/**
64+
* whether or not users can change their password
65+
* @example true
66+
*/
67+
allowChangePassword?: boolean;
68+
/**
69+
* whether or not observability (trace collection) is enabled on this instance
70+
* @example false
71+
*/
72+
observabilityEnabled?: boolean;
4173
}
4274

75+
export type { APIMetaAuth } from '@/lib/api/generated/cloud/data-contracts';
76+
77+
export type { APIMetaPosthog } from '@/lib/api/generated/cloud/data-contracts';
78+
4379
export type { APIErrors } from '@/lib/api/generated/cloud/data-contracts';
4480

4581
export type { APIError } from '@/lib/api/generated/cloud/data-contracts';

frontend/app/src/pages/auth/hooks/use-api-meta.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1+
import useControlPlane from '@/hooks/use-control-plane.ts';
12
import api from '@/lib/api';
3+
import { controlPlaneApi } from '@/lib/api/api.ts';
24
import { useQuery } from '@tanstack/react-query';
35
import { useMemo } from 'react';
46

57
export default function useApiMeta() {
8+
const { isControlPlaneEnabled } = useControlPlane();
69
const metaQuery = useQuery({
710
queryKey: ['metadata:get'],
811
queryFn: async () => {
912
try {
10-
return await api.metadataGet();
13+
return await (isControlPlaneEnabled
14+
? controlPlaneApi.metadataGet()
15+
: api.metadataGet());
1116
} catch (e) {
1217
console.error('Failed to get API metadata', e);
1318
return null;

0 commit comments

Comments
 (0)