@mdguggenbichler/slugbase-core 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -74,16 +74,22 @@ class LoginRouteErrorBoundary extends Component<{ children: ReactNode }, { error
74
74
  function AppRoutes() {
75
75
  const { user, loading } = useAuth();
76
76
  const { t } = useTranslation();
77
- const { appRootPath } = useAppConfig();
78
- const [setupStatus, setSetupStatus] = React.useState<{ initialized: boolean } | null>(null);
79
- const [setupLoading, setSetupLoading] = React.useState(true);
77
+ const { appRootPath, skipSetupFlow } = useAppConfig();
78
+ const [setupStatus, setSetupStatus] = React.useState<{ initialized: boolean } | null>(() =>
79
+ skipSetupFlow ? { initialized: true } : null
80
+ );
81
+ const [setupLoading, setSetupLoading] = React.useState(() => !skipSetupFlow);
80
82
 
81
83
  React.useEffect(() => {
84
+ if (skipSetupFlow) {
85
+ setSetupLoading(false);
86
+ return;
87
+ }
82
88
  api.get('/auth/setup/status')
83
89
  .then((res) => res.data)
84
90
  .then((data) => { setSetupStatus(data); setSetupLoading(false); })
85
91
  .catch(() => { setSetupStatus({ initialized: true }); setSetupLoading(false); });
86
- }, []);
92
+ }, [skipSetupFlow]);
87
93
 
88
94
  if (setupLoading || (loading && setupStatus?.initialized)) {
89
95
  return <div className="min-h-screen flex items-center justify-center"><div className="text-lg">{t('common.loading')}</div></div>;
@@ -217,9 +223,11 @@ export interface AppProps {
217
223
  apiBaseUrl?: string;
218
224
  /** When set (e.g. "" or null), core does not render BrowserRouter; host (e.g. cloud) provides it. */
219
225
  routerBasename?: string | null;
226
+ /** When true, skip the first-time setup flow (e.g. in cloud; first user registers via Signup). */
227
+ skipSetupFlow?: boolean;
220
228
  }
221
229
 
222
- function App({ basePath, apiBaseUrl, routerBasename }: AppProps = {}) {
230
+ function App({ basePath, apiBaseUrl, routerBasename, skipSetupFlow }: AppProps = {}) {
223
231
  const appRootPath = basePath === '/' || !basePath ? '/' : basePath;
224
232
  const content = (
225
233
  <AuthProvider>
@@ -232,7 +240,7 @@ function App({ basePath, apiBaseUrl, routerBasename }: AppProps = {}) {
232
240
  );
233
241
  return (
234
242
  <AppErrorBoundary>
235
- <AppConfigProvider appBasePath={basePath} apiBaseUrl={apiBaseUrl} appRootPath={appRootPath}>
243
+ <AppConfigProvider appBasePath={basePath} apiBaseUrl={apiBaseUrl} appRootPath={appRootPath} skipSetupFlow={skipSetupFlow}>
236
244
  {routerBasename !== undefined ? (
237
245
  content
238
246
  ) : (
@@ -5,6 +5,8 @@ export interface AppConfig {
5
5
  appBasePath: string;
6
6
  apiBaseUrl: string;
7
7
  appRootPath: string;
8
+ /** When true, skip the first-time setup flow (e.g. in cloud; first user registers via Signup). */
9
+ skipSetupFlow?: boolean;
8
10
  }
9
11
 
10
12
  const defaultConfig: AppConfig = {
@@ -20,16 +22,19 @@ export function AppConfigProvider({
20
22
  appBasePath,
21
23
  apiBaseUrl,
22
24
  appRootPath,
25
+ skipSetupFlow,
23
26
  }: {
24
27
  children: React.ReactNode;
25
28
  appBasePath?: string;
26
29
  apiBaseUrl?: string;
27
30
  appRootPath?: string;
31
+ skipSetupFlow?: boolean;
28
32
  }) {
29
33
  const value: AppConfig = {
30
34
  appBasePath: appBasePath ?? defaultConfig.appBasePath,
31
35
  apiBaseUrl: apiBaseUrl ?? defaultConfig.apiBaseUrl,
32
36
  appRootPath: appRootPath ?? defaultConfig.appRootPath,
37
+ skipSetupFlow,
33
38
  };
34
39
  return <AppConfigContext.Provider value={value}>{children}</AppConfigContext.Provider>;
35
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdguggenbichler/slugbase-core",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "SlugBase core: backend and frontend entrypoints for self-hosted and cloud apps",
5
5
  "type": "module",
6
6
  "exports": {