@rebasepro/client-firebase 0.0.1-canary.4d4fb3e → 0.0.1-canary.ca2cb6e
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.
- package/dist/components/RebaseFirebaseAppProps.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useAppCheck.d.ts +1 -1
- package/dist/hooks/useBuildUserManagement.d.ts +46 -0
- package/dist/index.es.js +451 -148
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +452 -152
- package/dist/index.umd.js.map +1 -1
- package/package.json +61 -59
- package/src/components/FirebaseLoginView.tsx +37 -47
- package/src/components/RebaseFirebaseApp.tsx +42 -26
- package/src/components/RebaseFirebaseAppProps.tsx +1 -1
- package/src/components/social_icons.tsx +8 -8
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAppCheck.ts +1 -1
- package/src/hooks/useBuildUserManagement.tsx +374 -0
- package/src/hooks/useFirebaseAuthController.ts +1 -1
- package/src/hooks/useFirebaseRealTimeDBDelegate.ts +8 -8
- package/src/hooks/useFirebaseStorageSource.ts +15 -16
- package/src/hooks/useFirestoreDriver.ts +19 -13
- package/src/utils/algolia.ts +1 -1
- package/src/utils/collections_firestore.ts +4 -5
- package/src/utils/local_text_search_controller.ts +4 -4
- package/src/utils/pinecone.ts +1 -1
- package/src/utils/rebase_search_controller.ts +6 -5
package/package.json
CHANGED
|
@@ -1,61 +1,63 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@rebasepro/client-firebase",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1-canary.ca2cb6e",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/index.umd.js",
|
|
9
|
+
"module": "./dist/index.es.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"source": "src/index.ts",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@firebase/auth": "*",
|
|
14
|
+
"react-fast-compare": "3.2.2",
|
|
15
|
+
"react-router-dom": "^7.13.1",
|
|
16
|
+
"@rebasepro/common": "0.0.1-canary.ca2cb6e",
|
|
17
|
+
"@rebasepro/core": "0.0.1-canary.ca2cb6e",
|
|
18
|
+
"@rebasepro/admin": "0.0.1-canary.ca2cb6e",
|
|
19
|
+
"@rebasepro/types": "0.0.1-canary.ca2cb6e",
|
|
20
|
+
"@rebasepro/ui": "0.0.1-canary.ca2cb6e",
|
|
21
|
+
"@rebasepro/utils": "0.0.1-canary.ca2cb6e"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"firebase": "^10.12.2 || ^11.0.0 || ^12.0.0",
|
|
25
|
+
"react": ">=19.0.0",
|
|
26
|
+
"react-dom": ">=19.0.0",
|
|
27
|
+
"typesense": "^1.8.0"
|
|
28
|
+
},
|
|
29
|
+
"peerDependenciesMeta": {
|
|
30
|
+
"typesense": {
|
|
31
|
+
"optional": true
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"development": "./src/index.ts",
|
|
38
|
+
"import": "./dist/index.es.js",
|
|
39
|
+
"require": "./dist/index.umd.js"
|
|
7
40
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
"exports": {
|
|
33
|
-
".": {
|
|
34
|
-
"types": "./dist/index.d.ts",
|
|
35
|
-
"development": "./src/index.ts",
|
|
36
|
-
"import": "./dist/index.es.js",
|
|
37
|
-
"require": "./dist/index.umd.js"
|
|
38
|
-
},
|
|
39
|
-
"./package.json": "./package.json"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@types/node": "^20.19.17",
|
|
43
|
-
"@types/react": "^19.0.8",
|
|
44
|
-
"@types/react-dom": "^19.0.3",
|
|
45
|
-
"babel-plugin-react-compiler": "^19.0.0-beta-af1b7da-20250417",
|
|
46
|
-
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
|
47
|
-
"typescript": "^5.9.3",
|
|
48
|
-
"typesense": "^2.1.0",
|
|
49
|
-
"vite": "^7.2.4"
|
|
50
|
-
},
|
|
51
|
-
"scripts": {
|
|
52
|
-
"dev": "vite",
|
|
53
|
-
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
|
54
|
-
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
|
|
55
|
-
},
|
|
56
|
-
"files": [
|
|
57
|
-
"dist",
|
|
58
|
-
"src"
|
|
59
|
-
],
|
|
60
|
-
"gitHead": "71bcef3c51a458cd054f7924cc18efbbe515dcc8"
|
|
61
|
-
}
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^20.19.17",
|
|
45
|
+
"@types/react": "^19.0.8",
|
|
46
|
+
"@types/react-dom": "^19.0.3",
|
|
47
|
+
"babel-plugin-react-compiler": "^19.0.0-beta-af1b7da-20250417",
|
|
48
|
+
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
|
49
|
+
"typescript": "^5.9.3",
|
|
50
|
+
"typesense": "^2.1.0",
|
|
51
|
+
"vite": "^7.2.4"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist",
|
|
55
|
+
"src"
|
|
56
|
+
],
|
|
57
|
+
"gitHead": "d935eefa5aa8d1009a2398cfac2c1e4ee9aeb6b6",
|
|
58
|
+
"scripts": {
|
|
59
|
+
"dev": "vite",
|
|
60
|
+
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
|
61
|
+
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
+
|
|
1
2
|
import React, { ReactNode, useCallback, useEffect, useRef, useState } from "react";
|
|
2
3
|
|
|
3
4
|
import { FirebaseApp, FirebaseError } from "@firebase/app";
|
|
4
|
-
import { ErrorView, RebaseLogo, useModeController, useSnackbarController
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
Button,
|
|
8
|
-
CallIcon,
|
|
9
|
-
CircularProgress,
|
|
10
|
-
cls,
|
|
11
|
-
IconButton,
|
|
12
|
-
LoadingButton,
|
|
13
|
-
MailIcon,
|
|
14
|
-
PersonIcon,
|
|
15
|
-
TextField,
|
|
16
|
-
Typography,
|
|
17
|
-
} from "@rebasepro/ui";
|
|
5
|
+
import { ErrorView, RebaseLogo, useModeController, useSnackbarController } from "@rebasepro/core";
|
|
6
|
+
import { Button, CircularProgress, cls, IconButton, LoadingButton, TextField, Typography , iconSize } from "@rebasepro/ui";
|
|
7
|
+
import { ArrowLeftIcon, MailIcon, PhoneIcon, UserIcon } from "lucide-react";
|
|
18
8
|
import { appleIcon, facebookIcon, githubIcon, googleIcon, microsoftIcon, twitterIcon } from "./social_icons";
|
|
19
9
|
import {
|
|
20
10
|
getAuth,
|
|
@@ -194,7 +184,7 @@ export function FirebaseLoginView({
|
|
|
194
184
|
<div className="p-4">
|
|
195
185
|
<ErrorView
|
|
196
186
|
title={"Firebase Auth not enabled"}
|
|
197
|
-
error={"You need to enable Firebase Auth and the corresponding login provider in your Firebase project"}
|
|
187
|
+
error={"You need to enable Firebase Auth and the corresponding login provider in your Firebase project"}/>
|
|
198
188
|
</div>
|
|
199
189
|
{firebaseApp &&
|
|
200
190
|
<div className="p-4">
|
|
@@ -212,19 +202,19 @@ export function FirebaseLoginView({
|
|
|
212
202
|
errorView = <div className="p-4">
|
|
213
203
|
<ErrorView
|
|
214
204
|
title={"Invalid API key"}
|
|
215
|
-
error={"auth/invalid-api-key: Check that your Firebase config is set correctly in your `firebase_config.ts` file"}
|
|
205
|
+
error={"auth/invalid-api-key: Check that your Firebase config is set correctly in your `firebase_config.ts` file"}/>
|
|
216
206
|
</div>;
|
|
217
207
|
} else if (authError.code === "auth/email-already-in-use") {
|
|
218
208
|
errorView = <div className="p-4">
|
|
219
209
|
<ErrorView
|
|
220
210
|
title={"Email already in use"}
|
|
221
|
-
error={"The selected email is already in use by another account"}
|
|
211
|
+
error={"The selected email is already in use by another account"}/>
|
|
222
212
|
</div>;
|
|
223
213
|
} else if (authError.code === "auth/invalid-credential") {
|
|
224
214
|
errorView = <div className="p-4">
|
|
225
215
|
<ErrorView
|
|
226
216
|
title={"Invalid credential"}
|
|
227
|
-
error={"The provided credential is not correct"}
|
|
217
|
+
error={"The provided credential is not correct"}/>
|
|
228
218
|
</div>;
|
|
229
219
|
} else if (!ignoredCodes.includes(authError.code)) {
|
|
230
220
|
if (authError.code === "auth/multi-factor-auth-required") {
|
|
@@ -232,7 +222,7 @@ export function FirebaseLoginView({
|
|
|
232
222
|
}
|
|
233
223
|
errorView =
|
|
234
224
|
<div className="p-4">
|
|
235
|
-
<ErrorView error={authController.authProviderError as Error}
|
|
225
|
+
<ErrorView error={authController.authProviderError as Error}/>
|
|
236
226
|
</div>;
|
|
237
227
|
}
|
|
238
228
|
}
|
|
@@ -247,9 +237,9 @@ export function FirebaseLoginView({
|
|
|
247
237
|
width: "100%",
|
|
248
238
|
objectFit: "contain"
|
|
249
239
|
}}
|
|
250
|
-
alt={"Logo"}
|
|
240
|
+
alt={"Logo"}/>;
|
|
251
241
|
} else {
|
|
252
|
-
logoComponent = <RebaseLogo
|
|
242
|
+
logoComponent = <RebaseLogo/>;
|
|
253
243
|
}
|
|
254
244
|
|
|
255
245
|
let notAllowedMessage: string | undefined;
|
|
@@ -285,7 +275,7 @@ export function FirebaseLoginView({
|
|
|
285
275
|
|
|
286
276
|
{notAllowedMessage &&
|
|
287
277
|
<div className="p-8">
|
|
288
|
-
<ErrorView error={notAllowedMessage}
|
|
278
|
+
<ErrorView error={notAllowedMessage}/>
|
|
289
279
|
</div>}
|
|
290
280
|
|
|
291
281
|
{buildErrorView()}
|
|
@@ -298,23 +288,23 @@ export function FirebaseLoginView({
|
|
|
298
288
|
<LoginButton
|
|
299
289
|
disabled={disabled}
|
|
300
290
|
text={"Email/password"}
|
|
301
|
-
icon={<MailIcon size={
|
|
302
|
-
onClick={() => setPasswordLoginSelected(true)}
|
|
291
|
+
icon={<MailIcon size={iconSize.medium}/>}
|
|
292
|
+
onClick={() => setPasswordLoginSelected(true)}/>}
|
|
303
293
|
|
|
304
294
|
{resolvedSignInOptions.includes("phone") &&
|
|
305
295
|
<LoginButton
|
|
306
296
|
disabled={disabled}
|
|
307
|
-
text={"
|
|
308
|
-
icon={<
|
|
309
|
-
onClick={() => setPhoneLoginSelected(true)}
|
|
297
|
+
text={"PhoneIcon number"}
|
|
298
|
+
icon={<PhoneIcon size={iconSize.medium}/>}
|
|
299
|
+
onClick={() => setPhoneLoginSelected(true)}/>}
|
|
310
300
|
|
|
311
301
|
{resolvedSignInOptions.includes("anonymous") &&
|
|
312
302
|
<LoginButton
|
|
313
303
|
disabled={disabled}
|
|
314
304
|
text={"Log in anonymously"}
|
|
315
|
-
icon={<
|
|
316
|
-
size={
|
|
317
|
-
onClick={authController.anonymousLogin}
|
|
305
|
+
icon={<UserIcon
|
|
306
|
+
size={"medium"}/>}
|
|
307
|
+
onClick={authController.anonymousLogin}/>}
|
|
318
308
|
|
|
319
309
|
{allowSkipLogin &&
|
|
320
310
|
<Button
|
|
@@ -363,7 +353,7 @@ export function LoginButton({
|
|
|
363
353
|
return (
|
|
364
354
|
<div className="my-1 w-full">
|
|
365
355
|
<Button
|
|
366
|
-
className={cls("w-full bg-white dark:bg-surface-
|
|
356
|
+
className={cls("w-full bg-white dark:bg-surface-950 text-surface-900 dark:text-surface-100", disabled ? "" : "hover:text-surface-950 hover:dark:text-white")}
|
|
367
357
|
style={{
|
|
368
358
|
height: "40px",
|
|
369
359
|
borderRadius: "4px",
|
|
@@ -420,15 +410,15 @@ function PhoneLoginForm({
|
|
|
420
410
|
<form onSubmit={handleSubmit}>
|
|
421
411
|
{isInvalidCode &&
|
|
422
412
|
<div className="p-8">
|
|
423
|
-
<ErrorView error={"Invalid confirmation code"}
|
|
413
|
+
<ErrorView error={"Invalid confirmation code"}/>
|
|
424
414
|
</div>}
|
|
425
415
|
|
|
426
|
-
<div id={RECAPTCHA_CONTAINER_ID}
|
|
416
|
+
<div id={RECAPTCHA_CONTAINER_ID}/>
|
|
427
417
|
|
|
428
418
|
<div className={"flex flex-col gap-1"}>
|
|
429
419
|
<IconButton
|
|
430
420
|
onClick={onClose}>
|
|
431
|
-
<
|
|
421
|
+
<ArrowLeftIcon className="w-5 h-5"/>
|
|
432
422
|
</IconButton>
|
|
433
423
|
<div className="p-1 flex">
|
|
434
424
|
<Typography align={"center"}
|
|
@@ -438,7 +428,7 @@ function PhoneLoginForm({
|
|
|
438
428
|
value={phone ?? ""}
|
|
439
429
|
disabled={Boolean(phone && (authController.authLoading || authController.confirmationResult))}
|
|
440
430
|
type="phone"
|
|
441
|
-
onChange={(event) => setPhone(event.target.value)}
|
|
431
|
+
onChange={(event: any) => setPhone(event.target.value)}/>
|
|
442
432
|
{Boolean(phone && authController.confirmationResult) &&
|
|
443
433
|
<>
|
|
444
434
|
<div className="mt-2 p-1 flex">
|
|
@@ -448,14 +438,14 @@ function PhoneLoginForm({
|
|
|
448
438
|
<TextField placeholder=""
|
|
449
439
|
value={code ?? ""}
|
|
450
440
|
type="text"
|
|
451
|
-
onChange={(event) => setCode(event.target.value)}
|
|
441
|
+
onChange={(event: any) => setCode(event.target.value)}/>
|
|
452
442
|
</>
|
|
453
443
|
}
|
|
454
444
|
|
|
455
445
|
<div className="flex justify-end items-center w-full">
|
|
456
446
|
|
|
457
447
|
{authController.authLoading &&
|
|
458
|
-
<CircularProgress className="p-1" size={"small"}
|
|
448
|
+
<CircularProgress className="p-1" size={"small"}/>
|
|
459
449
|
}
|
|
460
450
|
|
|
461
451
|
<Button type="submit">
|
|
@@ -569,7 +559,7 @@ function LoginForm({
|
|
|
569
559
|
<div className={"max-w-[480px] w-full flex flex-col gap-4"}>
|
|
570
560
|
<IconButton
|
|
571
561
|
onClick={onBackPressed}>
|
|
572
|
-
<
|
|
562
|
+
<ArrowLeftIcon className="w-5 h-5"/>
|
|
573
563
|
</IconButton>
|
|
574
564
|
|
|
575
565
|
<div>
|
|
@@ -584,7 +574,7 @@ function LoginForm({
|
|
|
584
574
|
value={email ?? ""}
|
|
585
575
|
disabled={authController.authLoading}
|
|
586
576
|
type="email"
|
|
587
|
-
onChange={(event) => setEmail(event.target.value)}
|
|
577
|
+
onChange={(event: any) => setEmail(event.target.value)}/>}
|
|
588
578
|
|
|
589
579
|
<div
|
|
590
580
|
className={`${loginState === "password" || (loginState === "registration" && !disableSignupScreen) ? "block" : "hidden"}`}>
|
|
@@ -593,14 +583,14 @@ function LoginForm({
|
|
|
593
583
|
disabled={authController.authLoading}
|
|
594
584
|
inputRef={passwordRef}
|
|
595
585
|
type="password"
|
|
596
|
-
onChange={(event) => setPassword(event.target.value)}
|
|
586
|
+
onChange={(event: any) => setPassword(event.target.value)}/>
|
|
597
587
|
</div>
|
|
598
588
|
|
|
599
589
|
<div
|
|
600
590
|
className={`${loginState === "registration" && disableSignupScreen ? "hidden" : "flex"} justify-end items-center w-full flex gap-2`}>
|
|
601
591
|
|
|
602
592
|
{authController.authLoading &&
|
|
603
|
-
<CircularProgress className="p-1" size={"small"}
|
|
593
|
+
<CircularProgress className="p-1" size={"small"}/>
|
|
604
594
|
}
|
|
605
595
|
|
|
606
596
|
{!disableResetPassword && <LoadingButton variant="text"
|
|
@@ -668,36 +658,36 @@ function buildOauthLoginButtons(authController: FirebaseAuthController, provider
|
|
|
668
658
|
disabled={disabled}
|
|
669
659
|
text={"Sign in with Google"}
|
|
670
660
|
icon={googleIcon(mode)}
|
|
671
|
-
onClick={authController.googleLogin}
|
|
661
|
+
onClick={authController.googleLogin}/>}
|
|
672
662
|
|
|
673
663
|
{providers.includes("microsoft.com") && <LoginButton
|
|
674
664
|
disabled={disabled}
|
|
675
665
|
text={"Sign in with Microsoft"}
|
|
676
666
|
icon={microsoftIcon(mode)}
|
|
677
|
-
onClick={authController.microsoftLogin}
|
|
667
|
+
onClick={authController.microsoftLogin}/>}
|
|
678
668
|
|
|
679
669
|
{providers.includes("apple.com") && <LoginButton
|
|
680
670
|
disabled={disabled}
|
|
681
671
|
text={"Sign in with Apple"}
|
|
682
672
|
icon={appleIcon(mode)}
|
|
683
|
-
onClick={authController.appleLogin}
|
|
673
|
+
onClick={authController.appleLogin}/>}
|
|
684
674
|
|
|
685
675
|
{providers.includes("github.com") && <LoginButton
|
|
686
676
|
disabled={disabled}
|
|
687
677
|
text={"Sign in with Github"}
|
|
688
678
|
icon={githubIcon(mode)}
|
|
689
|
-
onClick={authController.githubLogin}
|
|
679
|
+
onClick={authController.githubLogin}/>}
|
|
690
680
|
|
|
691
681
|
{providers.includes("facebook.com") && <LoginButton
|
|
692
682
|
disabled={disabled}
|
|
693
683
|
text={"Sign in with Facebook"}
|
|
694
684
|
icon={facebookIcon(mode)}
|
|
695
|
-
onClick={authController.facebookLogin}
|
|
685
|
+
onClick={authController.facebookLogin}/>}
|
|
696
686
|
|
|
697
687
|
{providers.includes("twitter.com") && <LoginButton
|
|
698
688
|
disabled={disabled}
|
|
699
689
|
text={"Sign in with Twitter"}
|
|
700
690
|
icon={twitterIcon(mode)}
|
|
701
|
-
onClick={authController.twitterLogin}
|
|
691
|
+
onClick={authController.twitterLogin}/>}
|
|
702
692
|
</>
|
|
703
693
|
}
|
|
@@ -23,12 +23,14 @@ import {
|
|
|
23
23
|
useBuildNavigationStateController,
|
|
24
24
|
CollectionRegistryContext,
|
|
25
25
|
UrlContext,
|
|
26
|
-
NavigationStateContext
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
NavigationStateContext,
|
|
27
|
+
SideEntityProvider,
|
|
28
|
+
RebaseRoute
|
|
29
|
+
} from "@rebasepro/admin";
|
|
30
|
+
import { Entity, PropertyConfig } from "@rebasepro/types";
|
|
29
31
|
import { CenteredView, CircularProgressCenter } from "@rebasepro/ui";
|
|
30
32
|
import { buildRebaseData } from "@rebasepro/common";
|
|
31
|
-
import { Route,
|
|
33
|
+
import { Route, Outlet, Navigate } from "react-router-dom";
|
|
32
34
|
|
|
33
35
|
import { RebaseFirebaseAppProps } from "./RebaseFirebaseAppProps";
|
|
34
36
|
import { FirebaseLoginView } from "./FirebaseLoginView";
|
|
@@ -38,6 +40,7 @@ import {
|
|
|
38
40
|
useFirebaseStorageSource,
|
|
39
41
|
useFirestoreDriver,
|
|
40
42
|
useInitialiseFirebase,
|
|
43
|
+
useBuildUserManagement
|
|
41
44
|
} from "../hooks";
|
|
42
45
|
|
|
43
46
|
import { FirebaseAuthController } from "../types";
|
|
@@ -100,7 +103,8 @@ export function RebaseFirebaseApp({
|
|
|
100
103
|
.map(pc => ({
|
|
101
104
|
[pc.key]: pc
|
|
102
105
|
}))
|
|
103
|
-
.reduce((a, b) => ({ ...a,
|
|
106
|
+
.reduce((a, b) => ({ ...a,
|
|
107
|
+
...b }), {});
|
|
104
108
|
|
|
105
109
|
const {
|
|
106
110
|
firebaseApp,
|
|
@@ -177,6 +181,13 @@ export function RebaseFirebaseApp({
|
|
|
177
181
|
collectionRegistryController
|
|
178
182
|
});
|
|
179
183
|
|
|
184
|
+
const defaultUserManagement = useBuildUserManagement({
|
|
185
|
+
authController,
|
|
186
|
+
dataSourceDelegate: firestoreDelegate
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const activeUserManagement = userManagement ?? defaultUserManagement;
|
|
190
|
+
|
|
180
191
|
const navigationStateController = useBuildNavigationStateController({
|
|
181
192
|
collections,
|
|
182
193
|
views,
|
|
@@ -187,12 +198,12 @@ export function RebaseFirebaseApp({
|
|
|
187
198
|
collectionRegistryController,
|
|
188
199
|
urlController,
|
|
189
200
|
adminMode: adminModeController.mode,
|
|
190
|
-
userManagement
|
|
201
|
+
userManagement: activeUserManagement as any
|
|
191
202
|
});
|
|
192
203
|
|
|
193
204
|
if (firebaseConfigLoading || !firebaseApp || loading) {
|
|
194
205
|
return <>
|
|
195
|
-
<CircularProgressCenter
|
|
206
|
+
<CircularProgressCenter/>
|
|
196
207
|
</>;
|
|
197
208
|
}
|
|
198
209
|
|
|
@@ -214,8 +225,8 @@ export function RebaseFirebaseApp({
|
|
|
214
225
|
dateTimeFormat={dateTimeFormat}
|
|
215
226
|
driver={firestoreDelegate}
|
|
216
227
|
storageSource={storageSource}
|
|
217
|
-
userManagement={
|
|
218
|
-
entityLinkBuilder={({ entity }) => `https://console.firebase.google.com/project/${firebaseApp.options.projectId}/firestore/data/${entity.path}/${entity.id}`}
|
|
228
|
+
userManagement={activeUserManagement}
|
|
229
|
+
entityLinkBuilder={({ entity }: { entity: Entity<any> }) => `https://console.firebase.google.com/project/${firebaseApp.options.projectId}/firestore/data/${entity.path}/${entity.id}`}
|
|
219
230
|
locale={locale}
|
|
220
231
|
onAnalyticsEvent={onAnalyticsEvent}
|
|
221
232
|
plugins={plugins}
|
|
@@ -227,7 +238,7 @@ export function RebaseFirebaseApp({
|
|
|
227
238
|
|
|
228
239
|
let component;
|
|
229
240
|
if (loading || authLoading) {
|
|
230
|
-
component = <CircularProgressCenter size={"large"}
|
|
241
|
+
component = <CircularProgressCenter size={"large"}/>;
|
|
231
242
|
} else {
|
|
232
243
|
const usedLogo = modeController.mode === "dark" && logoDark ? logoDark : logo;
|
|
233
244
|
if (!canAccessMainView) {
|
|
@@ -239,25 +250,30 @@ export function RebaseFirebaseApp({
|
|
|
239
250
|
signInOptions={signInOptions ?? DEFAULT_SIGN_IN_OPTIONS}
|
|
240
251
|
firebaseApp={firebaseApp}
|
|
241
252
|
authController={authController}
|
|
242
|
-
notAllowedError={notAllowedError}
|
|
253
|
+
notAllowedError={notAllowedError}/>
|
|
243
254
|
);
|
|
244
255
|
} else {
|
|
256
|
+
const firstCollectionEntry = navigationStateController.topLevelNavigation?.navigationEntries.find(e => e.type === "collection");
|
|
257
|
+
const fallbackRoute = firstCollectionEntry ? <Navigate to={urlController.buildUrlCollectionPath(firstCollectionEntry.id)} replace /> : <CenteredView>No home page or collections provided.</CenteredView>;
|
|
258
|
+
|
|
245
259
|
component = (
|
|
246
|
-
<
|
|
247
|
-
<
|
|
248
|
-
<
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
<SideEntityProvider>
|
|
261
|
+
<RebaseRoutes>
|
|
262
|
+
<Route element={
|
|
263
|
+
<Scaffold
|
|
264
|
+
logo={usedLogo}
|
|
265
|
+
autoOpenDrawer={autoOpenDrawer}>
|
|
266
|
+
<AppBar title={name} logo={usedLogo}/>
|
|
267
|
+
<Drawer/>
|
|
268
|
+
<Outlet/>
|
|
269
|
+
<SideDialogs/>
|
|
270
|
+
</Scaffold>
|
|
271
|
+
}>
|
|
272
|
+
<Route path="/" element={components?.HomePage ? <components.HomePage/> : fallbackRoute}/>
|
|
273
|
+
<Route path="/c/*" element={<RebaseRoute/>}/>
|
|
274
|
+
</Route>
|
|
275
|
+
</RebaseRoutes>
|
|
276
|
+
</SideEntityProvider>
|
|
261
277
|
);
|
|
262
278
|
}
|
|
263
279
|
}
|
|
@@ -163,7 +163,7 @@ export type RebaseFirebaseAppProps = {
|
|
|
163
163
|
/**
|
|
164
164
|
* Delegate for user and role management. Provides the admin views if specified.
|
|
165
165
|
*/
|
|
166
|
-
userManagement?: UserManagementDelegate
|
|
166
|
+
userManagement?: UserManagementDelegate<FirebaseUserWrapper>;
|
|
167
167
|
|
|
168
168
|
};
|
|
169
169
|
|
|
@@ -2,8 +2,8 @@ export const googleIcon = (mode: "light" | "dark") => <>
|
|
|
2
2
|
<svg
|
|
3
3
|
xmlns="http://www.w3.org/2000/svg"
|
|
4
4
|
viewBox="0 0 64 64"
|
|
5
|
-
width={
|
|
6
|
-
height={
|
|
5
|
+
width={24}
|
|
6
|
+
height={24}
|
|
7
7
|
>
|
|
8
8
|
<linearGradient
|
|
9
9
|
id="95yY7w43Oj6n2vH63j6HJb"
|
|
@@ -80,7 +80,7 @@ export const googleIcon = (mode: "light" | "dark") => <>
|
|
|
80
80
|
</svg>
|
|
81
81
|
</>;
|
|
82
82
|
|
|
83
|
-
export const appleIcon = (mode: "light" | "dark") => <svg width={
|
|
83
|
+
export const appleIcon = (mode: "light" | "dark") => <svg width={24} height={24}
|
|
84
84
|
viewBox="0 0 56 56"
|
|
85
85
|
style={{ transform: "scale(2.8)" }}
|
|
86
86
|
version="1.1"
|
|
@@ -97,8 +97,8 @@ export const githubIcon = (mode: "light" | "dark") => <svg
|
|
|
97
97
|
fill={mode === "light" ? "#1c1e21" : "white"}
|
|
98
98
|
role="img"
|
|
99
99
|
viewBox="0 0 24 24"
|
|
100
|
-
width={
|
|
101
|
-
height={
|
|
100
|
+
width={24}
|
|
101
|
+
height={24}
|
|
102
102
|
xmlns="http://www.w3.org/2000/svg">
|
|
103
103
|
<path
|
|
104
104
|
d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/>
|
|
@@ -107,7 +107,7 @@ export const githubIcon = (mode: "light" | "dark") => <svg
|
|
|
107
107
|
|
|
108
108
|
export const facebookIcon = (mode: "light" | "dark") => <svg
|
|
109
109
|
xmlns="http://www.w3.org/2000/svg"
|
|
110
|
-
width={
|
|
110
|
+
width={24} height={24}
|
|
111
111
|
viewBox="0 0 90 90">
|
|
112
112
|
<g>
|
|
113
113
|
<path
|
|
@@ -117,7 +117,7 @@ export const facebookIcon = (mode: "light" | "dark") => <svg
|
|
|
117
117
|
</svg>;
|
|
118
118
|
|
|
119
119
|
export const microsoftIcon = (mode: "light" | "dark") => <svg
|
|
120
|
-
xmlns="http://www.w3.org/2000/svg" width={
|
|
120
|
+
xmlns="http://www.w3.org/2000/svg" width={24} height={24}
|
|
121
121
|
viewBox="0 0 480 480">
|
|
122
122
|
<g>
|
|
123
123
|
<path
|
|
@@ -127,7 +127,7 @@ export const microsoftIcon = (mode: "light" | "dark") => <svg
|
|
|
127
127
|
</svg>;
|
|
128
128
|
|
|
129
129
|
export const twitterIcon = (mode: "light" | "dark") => <svg
|
|
130
|
-
xmlns="http://www.w3.org/2000/svg" width={
|
|
130
|
+
xmlns="http://www.w3.org/2000/svg" width={24} height={24}
|
|
131
131
|
viewBox="0 0 24 24">
|
|
132
132
|
<path fill={mode === "light" ? "#00acee" : "white"}
|
|
133
133
|
d="M24 4.557c-.883.392-1.832.656-2.828.775 1.017-.609 1.798-1.574 2.165-2.724-.951.564-2.005.974-3.127 1.195-.897-.957-2.178-1.555-3.594-1.555-3.179 0-5.515 2.966-4.797 6.045-4.091-.205-7.719-2.165-10.148-5.144-1.29 2.213-.669 5.108 1.523 6.574-.806-.026-1.566-.247-2.229-.616-.054 2.281 1.581 4.415 3.949 4.89-.693.188-1.452.232-2.224.084.626 1.956 2.444 3.379 4.6 3.419-2.07 1.623-4.678 2.348-7.29 2.04 2.179 1.397 4.768 2.212 7.548 2.212 9.142 0 14.307-7.721 13.995-14.646.962-.695 1.797-1.562 2.457-2.549z"/>
|
package/src/hooks/index.ts
CHANGED
package/src/hooks/useAppCheck.ts
CHANGED