@rebasepro/client-firebase 0.1.2 → 0.2.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/client-firebase",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.2.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -10,14 +10,16 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "source": "src/index.ts",
12
12
  "dependencies": {
13
- "@firebase/auth": "*",
14
- "react-router-dom": "^7.13.1",
15
- "@rebasepro/admin": "0.1.2",
16
- "@rebasepro/common": "0.1.2",
17
- "@rebasepro/ui": "0.1.2",
18
- "@rebasepro/utils": "0.1.2",
19
- "@rebasepro/types": "0.1.2",
20
- "@rebasepro/core": "0.1.2"
13
+ "@firebase/auth": "^1.13.1",
14
+ "fast-equals": "6.0.0",
15
+ "fuse.js": "^7.3.0",
16
+ "react-router-dom": "^7.15.1",
17
+ "@rebasepro/admin": "0.2.1",
18
+ "@rebasepro/core": "0.2.1",
19
+ "@rebasepro/common": "0.2.1",
20
+ "@rebasepro/types": "0.2.1",
21
+ "@rebasepro/ui": "0.2.1",
22
+ "@rebasepro/utils": "0.2.1"
21
23
  },
22
24
  "peerDependencies": {
23
25
  "firebase": "^10.12.2 || ^11.0.0 || ^12.0.0",
@@ -33,21 +35,29 @@
33
35
  "exports": {
34
36
  ".": {
35
37
  "types": "./dist/index.d.ts",
36
- "development": "./src/index.ts",
38
+ "development": "./dist/index.es.js",
37
39
  "import": "./dist/index.es.js",
38
40
  "require": "./dist/index.umd.js"
39
41
  },
40
42
  "./package.json": "./package.json"
41
43
  },
42
44
  "devDependencies": {
43
- "@types/node": "^20.19.17",
44
- "@types/react": "^19.0.8",
45
- "@types/react-dom": "^19.0.3",
46
- "babel-plugin-react-compiler": "^19.0.0-beta-af1b7da-20250417",
47
- "eslint-plugin-react-compiler": "^19.1.0-rc.2",
48
- "typescript": "^5.9.3",
45
+ "@firebase/app": "^0.14.12",
46
+ "@firebase/app-check": "^0.11.3",
47
+ "@firebase/database": "^1.1.3",
48
+ "@firebase/firestore": "^4.14.1",
49
+ "@firebase/functions": "^0.13.4",
50
+ "@firebase/storage": "^0.14.3",
51
+ "@types/jest": "^29.5.14",
52
+ "@types/node": "^20.19.41",
53
+ "@types/react": "^19.2.15",
54
+ "@types/react-dom": "^19.2.3",
55
+ "@vitejs/plugin-react": "^4.7.0",
56
+ "babel-plugin-react-compiler": "19.0.0-beta-ebf51a3-20250411",
57
+ "firebase": "^12.13.0",
49
58
  "typesense": "^2.1.0",
50
- "vite": "^7.2.4"
59
+ "typescript": "^5.9.3",
60
+ "vite": "^7.3.3"
51
61
  },
52
62
  "files": [
53
63
  "dist",
@@ -3,8 +3,20 @@ import React, { ReactNode, useCallback, useEffect, useRef, useState } from "reac
3
3
 
4
4
  import { FirebaseApp, FirebaseError } from "@firebase/app";
5
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";
6
+ import {
7
+ ArrowLeftIcon,
8
+ Button,
9
+ CircularProgress,
10
+ cls,
11
+ IconButton,
12
+ iconSize,
13
+ LoadingButton,
14
+ MailIcon,
15
+ PhoneIcon,
16
+ TextField,
17
+ Typography,
18
+ UserIcon
19
+ } from "@rebasepro/ui";
8
20
  import { appleIcon, facebookIcon, githubIcon, googleIcon, microsoftIcon, twitterIcon } from "./social_icons";
9
21
  import {
10
22
  getAuth,
@@ -87,7 +99,7 @@ export interface FirebaseLoginViewProps {
87
99
  */
88
100
  additionalComponent?: ReactNode;
89
101
 
90
- notAllowedError?: any;
102
+ notAllowedError?: string | Error;
91
103
 
92
104
  className?: string;
93
105
 
@@ -172,7 +184,7 @@ export function FirebaseLoginView({
172
184
  }, [authController.authProviderError]);
173
185
 
174
186
  function buildErrorView() {
175
- let errorView: any;
187
+ let errorView: React.ReactNode;
176
188
  if (authController.user != null) return errorView; // if the user is logged in via MFA
177
189
  const ignoredCodes = ["auth/popup-closed-by-user", "auth/cancelled-popup-request"];
178
190
  if (authController.authProviderError) {
@@ -388,7 +400,7 @@ function PhoneLoginForm({
388
400
  const [code, setCode] = useState<string>();
389
401
  const [isInvalidCode, setIsInvalidCode] = useState(false);
390
402
 
391
- const handleSubmit = async (event: any) => {
403
+ const handleSubmit = async (event: React.FormEvent) => {
392
404
  event.preventDefault();
393
405
 
394
406
  if (code && authController.confirmationResult) {
@@ -428,7 +440,7 @@ function PhoneLoginForm({
428
440
  value={phone ?? ""}
429
441
  disabled={Boolean(phone && (authController.authLoading || authController.confirmationResult))}
430
442
  type="phone"
431
- onChange={(event: any) => setPhone(event.target.value)}/>
443
+ onChange={(event) => setPhone(event.target.value)}/>
432
444
  {Boolean(phone && authController.confirmationResult) &&
433
445
  <>
434
446
  <div className="mt-2 p-1 flex">
@@ -438,7 +450,7 @@ function PhoneLoginForm({
438
450
  <TextField placeholder=""
439
451
  value={code ?? ""}
440
452
  type="text"
441
- onChange={(event: any) => setCode(event.target.value)}/>
453
+ onChange={(event) => setCode(event.target.value)}/>
442
454
  </>
443
455
  }
444
456
 
@@ -494,8 +506,8 @@ function LoginForm({
494
506
 
495
507
  useEffect(() => {
496
508
  if (!document) return;
497
- const escFunction = (event: any) => {
498
- if (event.keyCode === 27) {
509
+ const escFunction = (event: KeyboardEvent) => {
510
+ if (event.key === "Escape") {
499
511
  onClose();
500
512
  }
501
513
  };
@@ -536,7 +548,7 @@ function LoginForm({
536
548
  }
537
549
  }
538
550
 
539
- const handleSubmit = (event: any) => {
551
+ const handleSubmit = (event: React.FormEvent) => {
540
552
  event.preventDefault();
541
553
  if (loginState === "email") {
542
554
  handleEnterEmail();
@@ -574,7 +586,7 @@ function LoginForm({
574
586
  value={email ?? ""}
575
587
  disabled={authController.authLoading}
576
588
  type="email"
577
- onChange={(event: any) => setEmail(event.target.value)}/>}
589
+ onChange={(event) => setEmail(event.target.value)}/>}
578
590
 
579
591
  <div
580
592
  className={`${loginState === "password" || (loginState === "registration" && !disableSignupScreen) ? "block" : "hidden"}`}>
@@ -583,7 +595,7 @@ function LoginForm({
583
595
  disabled={authController.authLoading}
584
596
  inputRef={passwordRef}
585
597
  type="password"
586
- onChange={(event: any) => setPassword(event.target.value)}/>
598
+ onChange={(event) => setPassword(event.target.value)}/>
587
599
  </div>
588
600
 
589
601
  <div
@@ -605,9 +617,9 @@ function LoginForm({
605
617
  message: "Password reset email sent",
606
618
  type: "success"
607
619
  });
608
- } catch (e: any) {
620
+ } catch (e: unknown) {
609
621
  snackbarController.open({
610
- message: e.message,
622
+ message: e instanceof Error ? e.message : String(e),
611
623
  type: "error"
612
624
  });
613
625
  }
@@ -27,7 +27,7 @@ import {
27
27
  SideEntityProvider,
28
28
  RebaseRoute
29
29
  } from "@rebasepro/admin";
30
- import { Entity, PropertyConfig } from "@rebasepro/types";
30
+ import { Entity, PropertyConfig, UserManagementDelegate } from "@rebasepro/types";
31
31
  import { CenteredView, CircularProgressCenter } from "@rebasepro/ui";
32
32
  import { buildRebaseData } from "@rebasepro/common";
33
33
  import { Route, Outlet, Navigate } from "react-router-dom";
@@ -198,7 +198,7 @@ export function RebaseFirebaseApp({
198
198
  collectionRegistryController,
199
199
  urlController,
200
200
  adminMode: adminModeController.mode,
201
- userManagement: activeUserManagement as any
201
+ userManagement: activeUserManagement as unknown as UserManagementDelegate
202
202
  });
203
203
 
204
204
  if (firebaseConfigLoading || !firebaseApp || loading) {
@@ -91,7 +91,7 @@ export function useBuildUserManagement<CONTROLLER extends AuthController<any> =
91
91
 
92
92
  const users = usersWithRoleIds.map(u => ({
93
93
  ...u,
94
- }) as unknown as USER);
94
+ }) as USER);
95
95
 
96
96
  const [rolesError, setRolesError] = React.useState<Error | undefined>();
97
97
  const [usersError, setUsersError] = React.useState<Error | undefined>();
@@ -355,14 +355,15 @@ export function useBuildUserManagement<CONTROLLER extends AuthController<any> =
355
355
 
356
356
  const entitiesToUsers = (docs: Entity<Omit<UserWithRoleIds, "id">>[]): (UserWithRoleIds)[] => {
357
357
  return docs.map((doc) => {
358
- const data = doc.values as any;
358
+ const data = doc.values;
359
+ const record = data as Record<string, unknown>;
359
360
  const newVar = {
360
361
  uid: doc.id,
361
362
  ...data,
362
- created_on: data?.created_on,
363
- updated_on: data?.updated_on
363
+ created_on: record.created_on as Date | undefined,
364
+ updated_on: record.updated_on as Date | undefined
364
365
  };
365
- return newVar as (UserWithRoleIds);
366
+ return newVar as unknown as UserWithRoleIds;
366
367
  });
367
368
  }
368
369
 
@@ -42,7 +42,7 @@ export const localSearchControllerBuilder: FirestoreTextSearchControllerBuilder
42
42
 
43
43
  currentPath = path;
44
44
 
45
- return new Promise(async (resolve, reject) => {
45
+ return new Promise((resolve, reject) => {
46
46
  if (collectionProp) {
47
47
  console.debug("Init local search controller", path);
48
48
  const firestore = databaseId ? getFirestore(firebaseApp, databaseId) : getFirestore(firebaseApp);