@rebasepro/client-firebase 0.5.0 → 0.6.1
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/FirebaseLoginView.d.ts +2 -2
- package/dist/components/RebaseFirebaseApp.d.ts +2 -1
- package/dist/components/RebaseFirebaseAppProps.d.ts +0 -5
- package/dist/components/social_icons.d.ts +6 -6
- package/dist/hooks/useBuildUserManagement.d.ts +33 -2
- package/dist/index.es.js +2578 -3124
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2689 -3165
- package/dist/index.umd.js.map +1 -1
- package/package.json +22 -22
- package/src/components/RebaseFirebaseApp.tsx +4 -8
- package/src/components/RebaseFirebaseAppProps.tsx +1 -6
- package/src/hooks/useBuildUserManagement.tsx +5 -10
- package/src/hooks/useFirestoreDriver.ts +3 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/client-firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"source": "src/index.ts",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@firebase/auth": "^1.13.
|
|
13
|
+
"@firebase/auth": "^1.13.2",
|
|
14
14
|
"fast-equals": "6.0.0",
|
|
15
|
-
"fuse.js": "^7.
|
|
16
|
-
"react-router-dom": "^7.
|
|
17
|
-
"@rebasepro/
|
|
18
|
-
"@rebasepro/
|
|
19
|
-
"@rebasepro/
|
|
20
|
-
"@rebasepro/utils": "0.
|
|
21
|
-
"@rebasepro/
|
|
22
|
-
"@rebasepro/
|
|
15
|
+
"fuse.js": "^7.4.2",
|
|
16
|
+
"react-router-dom": "^7.17.0",
|
|
17
|
+
"@rebasepro/admin": "0.6.1",
|
|
18
|
+
"@rebasepro/common": "0.6.1",
|
|
19
|
+
"@rebasepro/core": "0.6.1",
|
|
20
|
+
"@rebasepro/utils": "0.6.1",
|
|
21
|
+
"@rebasepro/types": "0.6.1",
|
|
22
|
+
"@rebasepro/ui": "0.6.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"firebase": "^10.12.2 || ^11.0.0 || ^12.0.0",
|
|
@@ -42,22 +42,22 @@
|
|
|
42
42
|
"./package.json": "./package.json"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@firebase/app": "^0.14.
|
|
46
|
-
"@firebase/app-check": "^0.11.
|
|
45
|
+
"@firebase/app": "^0.14.13",
|
|
46
|
+
"@firebase/app-check": "^0.11.4",
|
|
47
47
|
"@firebase/database": "^1.1.3",
|
|
48
|
-
"@firebase/firestore": "^4.
|
|
49
|
-
"@firebase/functions": "^0.13.
|
|
48
|
+
"@firebase/firestore": "^4.15.0",
|
|
49
|
+
"@firebase/functions": "^0.13.5",
|
|
50
50
|
"@firebase/storage": "^0.14.3",
|
|
51
|
-
"@types/jest": "^
|
|
52
|
-
"@types/node": "^
|
|
53
|
-
"@types/react": "^19.2.
|
|
51
|
+
"@types/jest": "^30.0.0",
|
|
52
|
+
"@types/node": "^25.9.3",
|
|
53
|
+
"@types/react": "^19.2.17",
|
|
54
54
|
"@types/react-dom": "^19.2.3",
|
|
55
|
-
"@vitejs/plugin-react": "^
|
|
55
|
+
"@vitejs/plugin-react": "^6.0.2",
|
|
56
56
|
"babel-plugin-react-compiler": "19.0.0-beta-ebf51a3-20250411",
|
|
57
|
-
"firebase": "^12.
|
|
58
|
-
"typescript": "^
|
|
59
|
-
"typesense": "^
|
|
60
|
-
"vite": "^
|
|
57
|
+
"firebase": "^12.14.0",
|
|
58
|
+
"typescript": "^6.0.3",
|
|
59
|
+
"typesense": "^3.0.6",
|
|
60
|
+
"vite": "^8.0.16"
|
|
61
61
|
},
|
|
62
62
|
"files": [
|
|
63
63
|
"dist",
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
SideEntityProvider,
|
|
27
27
|
RebaseRoute
|
|
28
28
|
} from "@rebasepro/admin";
|
|
29
|
-
import { Entity, PropertyConfig, RebaseContext
|
|
29
|
+
import { Entity, PropertyConfig, RebaseContext } from "@rebasepro/types";
|
|
30
30
|
import { CenteredView, CircularProgressCenter } from "@rebasepro/ui";
|
|
31
31
|
import { buildRebaseData } from "@rebasepro/common";
|
|
32
32
|
import { Route, Outlet, Navigate } from "react-router-dom";
|
|
@@ -90,8 +90,7 @@ export function RebaseFirebaseApp({
|
|
|
90
90
|
autoOpenDrawer,
|
|
91
91
|
firestoreIndexesBuilder,
|
|
92
92
|
components,
|
|
93
|
-
localTextSearchEnabled = false
|
|
94
|
-
userManagement
|
|
93
|
+
localTextSearchEnabled = false
|
|
95
94
|
}: RebaseFirebaseAppProps) {
|
|
96
95
|
|
|
97
96
|
/**
|
|
@@ -185,8 +184,7 @@ export function RebaseFirebaseApp({
|
|
|
185
184
|
authController,
|
|
186
185
|
dataSourceDelegate: firestoreDelegate
|
|
187
186
|
});
|
|
188
|
-
|
|
189
|
-
const activeUserManagement = userManagement ?? defaultUserManagement;
|
|
187
|
+
|
|
190
188
|
|
|
191
189
|
const navigationStateController = useBuildNavigationStateController({
|
|
192
190
|
collections,
|
|
@@ -197,8 +195,7 @@ export function RebaseFirebaseApp({
|
|
|
197
195
|
plugins,
|
|
198
196
|
collectionRegistryController,
|
|
199
197
|
urlController,
|
|
200
|
-
adminMode: adminModeController.mode
|
|
201
|
-
userManagement: activeUserManagement as unknown as UserManagementDelegate
|
|
198
|
+
adminMode: adminModeController.mode
|
|
202
199
|
});
|
|
203
200
|
|
|
204
201
|
if (firebaseConfigLoading || !firebaseApp || loading) {
|
|
@@ -225,7 +222,6 @@ export function RebaseFirebaseApp({
|
|
|
225
222
|
dateTimeFormat={dateTimeFormat}
|
|
226
223
|
driver={firestoreDelegate}
|
|
227
224
|
storageSource={storageSource}
|
|
228
|
-
userManagement={activeUserManagement}
|
|
229
225
|
entityLinkBuilder={({ entity }: { entity: Entity<any> }) => `https://console.firebase.google.com/project/${firebaseApp.options.projectId}/firestore/data/${entity.path}/${entity.id}`}
|
|
230
226
|
locale={locale}
|
|
231
227
|
onAnalyticsEvent={onAnalyticsEvent}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { AnalyticsEvent, AppView, AppViewsBuilder, EntityCollection, EntityCollectionsBuilder, RebasePlugin, Locale, PropertyConfig } from "@rebasepro/types";
|
|
4
4
|
import { FirebaseAccessGate } from "../hooks/useFirebaseAccessGate";
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
import { FirebaseApp } from "@firebase/app";
|
|
7
7
|
import { FirebaseLoginViewProps } from "./FirebaseLoginView";
|
|
8
8
|
import {
|
|
@@ -161,11 +161,6 @@ export type RebaseFirebaseAppProps = {
|
|
|
161
161
|
|
|
162
162
|
components?: ComponentsRegistry;
|
|
163
163
|
|
|
164
|
-
/**
|
|
165
|
-
* Delegate for user and role management. Provides the admin views if specified.
|
|
166
|
-
*/
|
|
167
|
-
userManagement?: UserManagementDelegate<FirebaseUserWrapper>;
|
|
168
|
-
|
|
169
164
|
};
|
|
170
165
|
|
|
171
166
|
export type ComponentsRegistry = {
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
AuthController,
|
|
7
7
|
DataDriver,
|
|
8
8
|
Entity,
|
|
9
|
-
User
|
|
10
|
-
UserManagementDelegate
|
|
9
|
+
User
|
|
11
10
|
} from "@rebasepro/types";
|
|
12
11
|
import { FirebaseAccessGate } from "./useFirebaseAccessGate";
|
|
13
12
|
|
|
@@ -75,7 +74,7 @@ export function useBuildUserManagement<CONTROLLER extends AuthController<User> =
|
|
|
75
74
|
usersPath = "__FIRECMS/config/users",
|
|
76
75
|
rolesPath = "__FIRECMS/config/roles",
|
|
77
76
|
allowDefaultRolesCreation
|
|
78
|
-
}: UserManagementDelegateParams<CONTROLLER>)
|
|
77
|
+
}: UserManagementDelegateParams<CONTROLLER>) {
|
|
79
78
|
|
|
80
79
|
if (!authController) {
|
|
81
80
|
throw Error("useBuildUserManagement: You need to provide an authController since version 3.0.0-beta.11. Check https://firecms.co/docs/pro/migrating_from_v3_beta");
|
|
@@ -88,7 +87,7 @@ export function useBuildUserManagement<CONTROLLER extends AuthController<User> =
|
|
|
88
87
|
const [usersWithRoleIds, setUsersWithRoleIds] = React.useState<UserWithRoleIds<USER>[]>([]);
|
|
89
88
|
|
|
90
89
|
const users = usersWithRoleIds.map(u => ({
|
|
91
|
-
...u
|
|
90
|
+
...u
|
|
92
91
|
}) as USER);
|
|
93
92
|
|
|
94
93
|
const [rolesError, setRolesError] = React.useState<Error | undefined>();
|
|
@@ -182,12 +181,9 @@ export function useBuildUserManagement<CONTROLLER extends AuthController<User> =
|
|
|
182
181
|
const userExists = users.find(u => u.email?.toLowerCase() === email);
|
|
183
182
|
const data = {
|
|
184
183
|
...user,
|
|
185
|
-
roles: roleIds ?? []
|
|
184
|
+
roles: roleIds ?? [],
|
|
185
|
+
...(userExists ? {} : { created_on: new Date() })
|
|
186
186
|
};
|
|
187
|
-
if (!userExists) {
|
|
188
|
-
// @ts-ignore
|
|
189
|
-
data.created_on = new Date();
|
|
190
|
-
}
|
|
191
187
|
// delete the previous user entry if it exists and the uid has changed
|
|
192
188
|
if (userExists && userExists.uid !== user.uid) {
|
|
193
189
|
const entity: Entity<any> = {
|
|
@@ -258,7 +254,6 @@ export function useBuildUserManagement<CONTROLLER extends AuthController<User> =
|
|
|
258
254
|
}, [rolesPath, dataSourceDelegate?.initialised]);
|
|
259
255
|
|
|
260
256
|
|
|
261
|
-
|
|
262
257
|
const defineRolesFor: ((user: User) => string[] | undefined) = useCallback((user) => {
|
|
263
258
|
if (!usersWithRoleIds) throw Error("Users not loaded");
|
|
264
259
|
const mgmtUser = usersWithRoleIds.find(u => u.email?.toLowerCase() === user?.email?.toLowerCase());
|
|
@@ -666,11 +666,10 @@ value: (data as { toArray: () => number[] }).toArray() };
|
|
|
666
666
|
return new GeoPoint(data.latitude, data.longitude);
|
|
667
667
|
}
|
|
668
668
|
if (data instanceof DocumentReference) {
|
|
669
|
-
|
|
670
|
-
const databaseId = data?.firestore?._databaseId?.database;
|
|
669
|
+
const databaseId = (data?.firestore as unknown as { _databaseId?: { database?: string } })?._databaseId?.database;
|
|
671
670
|
return new EntityReference({ id: data.id,
|
|
672
|
-
path: getCMSPathFromFirestorePath(data.path),
|
|
673
|
-
databaseId });
|
|
671
|
+
path: getCMSPathFromFirestorePath(data.path),
|
|
672
|
+
databaseId });
|
|
674
673
|
}
|
|
675
674
|
if (Array.isArray(data)) {
|
|
676
675
|
return data.map(firestoreToCMSModel).filter(v => v !== undefined);
|