2025-12-07 19:32:53 +02:00
|
|
|
import { createWebAPIs } from './api';
|
2026-01-22 01:19:24 +02:00
|
|
|
import { registerSW } from 'virtual:pwa-register';
|
|
|
|
|
|
2025-12-07 19:32:53 +02:00
|
|
|
import type { RuntimeAPIs } from '@openchamber/ui/lib/api/types';
|
|
|
|
|
import '@openchamber/ui/index.css';
|
|
|
|
|
import '@openchamber/ui/styles/fonts';
|
|
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
|
interface Window {
|
|
|
|
|
__OPENCHAMBER_RUNTIME_APIS__?: RuntimeAPIs;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.__OPENCHAMBER_RUNTIME_APIS__ = createWebAPIs();
|
2026-01-22 01:19:24 +02:00
|
|
|
|
2026-02-27 20:45:03 +02:00
|
|
|
if (import.meta.env.PROD) {
|
|
|
|
|
registerSW({
|
|
|
|
|
onRegisterError(error: unknown) {
|
|
|
|
|
console.warn('[PWA] service worker registration failed:', error);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else if ('serviceWorker' in navigator) {
|
|
|
|
|
void navigator.serviceWorker.getRegistrations()
|
|
|
|
|
.then((registrations) => Promise.all(registrations.map((registration) => registration.unregister())))
|
|
|
|
|
.catch(() => {});
|
|
|
|
|
}
|
2026-01-22 01:19:24 +02:00
|
|
|
|
2025-12-07 19:32:53 +02:00
|
|
|
import('@openchamber/ui/main');
|