25 lines
490 B
TypeScript
25 lines
490 B
TypeScript
type PushConfig = {
|
|
enabled: boolean;
|
|
vapidPublicKey: string | null;
|
|
};
|
|
|
|
type RuntimeConfig = {
|
|
push: PushConfig;
|
|
};
|
|
|
|
export function getRuntimeConfig(): RuntimeConfig {
|
|
const raw = typeof window !== 'undefined' ? window.__GUEST_RUNTIME_CONFIG__ : undefined;
|
|
|
|
return {
|
|
push: {
|
|
enabled: Boolean(raw?.push?.enabled),
|
|
vapidPublicKey: raw?.push?.vapidPublicKey ?? null,
|
|
},
|
|
};
|
|
}
|
|
|
|
export function getPushConfig(): PushConfig {
|
|
return getRuntimeConfig().push;
|
|
}
|
|
|