@rebasepro/client-firebase 0.1.0 → 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/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("fast-equals"), require("@firebase/auth"), require("@firebase/storage"), require("@firebase/app"), require("@firebase/app-check"), require("@rebasepro/types"), require("@firebase/firestore"), require("@rebasepro/common"), require("fuse.js"), require("@firebase/functions"), require("react-compiler-runtime"), require("@firebase/database"), require("@rebasepro/utils"), require("react/jsx-runtime"), require("@rebasepro/core"), require("@rebasepro/admin"), require("@rebasepro/ui"), require("react-router-dom"), require("lucide-react")) : typeof define === "function" && define.amd ? define(["exports", "react", "fast-equals", "@firebase/auth", "@firebase/storage", "@firebase/app", "@firebase/app-check", "@rebasepro/types", "@firebase/firestore", "@rebasepro/common", "fuse.js", "@firebase/functions", "react-compiler-runtime", "@firebase/database", "@rebasepro/utils", "react/jsx-runtime", "@rebasepro/core", "@rebasepro/admin", "@rebasepro/ui", "react-router-dom", "lucide-react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["Rebase Firebase"] = {}, global.React, global.fastEquals, global.auth, global.storage, global.app, global.appCheck, global.types, global.firestore, global.common, global.Fuse, global.functions, global.reactCompilerRuntime, global.database, global.utils, global.jsxRuntime, global.core, global.admin, global.ui, global.reactRouterDom, global.lucideReact));
3
- })(this, (function(exports2, React, fastEquals, auth, storage, app, appCheck, types, firestore, common, Fuse, functions, reactCompilerRuntime, database, utils, jsxRuntime, core, admin, ui, reactRouterDom, lucideReact) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("fast-equals"), require("@firebase/auth"), require("@firebase/storage"), require("@firebase/app"), require("@firebase/app-check"), require("@rebasepro/types"), require("@firebase/firestore"), require("@rebasepro/common"), require("fuse.js"), require("@firebase/functions"), require("react-compiler-runtime"), require("@firebase/database"), require("@rebasepro/utils"), require("react/jsx-runtime"), require("@rebasepro/core"), require("@rebasepro/admin"), require("@rebasepro/ui"), require("react-router-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "fast-equals", "@firebase/auth", "@firebase/storage", "@firebase/app", "@firebase/app-check", "@rebasepro/types", "@firebase/firestore", "@rebasepro/common", "fuse.js", "@firebase/functions", "react-compiler-runtime", "@firebase/database", "@rebasepro/utils", "react/jsx-runtime", "@rebasepro/core", "@rebasepro/admin", "@rebasepro/ui", "react-router-dom"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["Rebase Firebase"] = {}, global.React, global.fastEquals, global.auth, global.storage, global.app, global.appCheck, global.types, global.firestore, global.common, global.Fuse, global.functions, global.reactCompilerRuntime, global.database, global.utils, global.jsxRuntime, global.core, global.admin, global.ui, global.reactRouterDom));
3
+ })(this, (function(exports2, React, fastEquals, auth, storage, app, appCheck, types, firestore, common, Fuse, functions, reactCompilerRuntime, database, utils, jsxRuntime, core, admin, ui, reactRouterDom) {
4
4
  "use strict";
5
5
  const useFirebaseAuthController = ({
6
6
  loading,
@@ -738,7 +738,7 @@
738
738
  destroyListener(currentPath);
739
739
  }
740
740
  currentPath = path;
741
- return new Promise(async (resolve, reject) => {
741
+ return new Promise((resolve, reject) => {
742
742
  if (collectionProp) {
743
743
  console.debug("Init local search controller", path);
744
744
  const firestore$1 = databaseId ? firestore.getFirestore(firebaseApp, databaseId) : firestore.getFirestore(firebaseApp);
@@ -2090,11 +2090,12 @@
2090
2090
  const entitiesToUsers = (docs) => {
2091
2091
  return docs.map((doc) => {
2092
2092
  const data = doc.values;
2093
+ const record = data;
2093
2094
  const newVar = {
2094
2095
  uid: doc.id,
2095
2096
  ...data,
2096
- created_on: data?.created_on,
2097
- updated_on: data?.updated_on
2097
+ created_on: record.created_on,
2098
+ updated_on: record.updated_on
2098
2099
  };
2099
2100
  return newVar;
2100
2101
  });
@@ -2252,9 +2253,9 @@
2252
2253
  buildErrorView(),
2253
2254
  !passwordLoginSelected && !phoneLoginSelected && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-4 w-full", children: [
2254
2255
  buildOauthLoginButtons(authController, resolvedSignInOptions, modeState.mode, disabled),
2255
- resolvedSignInOptions.includes("password") && /* @__PURE__ */ jsxRuntime.jsx(LoginButton, { disabled, text: "Email/password", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MailIcon, { size: ui.iconSize.medium }), onClick: () => setPasswordLoginSelected(true) }),
2256
- resolvedSignInOptions.includes("phone") && /* @__PURE__ */ jsxRuntime.jsx(LoginButton, { disabled, text: "PhoneIcon number", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PhoneIcon, { size: ui.iconSize.medium }), onClick: () => setPhoneLoginSelected(true) }),
2257
- resolvedSignInOptions.includes("anonymous") && /* @__PURE__ */ jsxRuntime.jsx(LoginButton, { disabled, text: "Log in anonymously", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserIcon, { size: "medium" }), onClick: authController.anonymousLogin }),
2256
+ resolvedSignInOptions.includes("password") && /* @__PURE__ */ jsxRuntime.jsx(LoginButton, { disabled, text: "Email/password", icon: /* @__PURE__ */ jsxRuntime.jsx(ui.MailIcon, { size: ui.iconSize.medium }), onClick: () => setPasswordLoginSelected(true) }),
2257
+ resolvedSignInOptions.includes("phone") && /* @__PURE__ */ jsxRuntime.jsx(LoginButton, { disabled, text: "PhoneIcon number", icon: /* @__PURE__ */ jsxRuntime.jsx(ui.PhoneIcon, { size: ui.iconSize.medium }), onClick: () => setPhoneLoginSelected(true) }),
2258
+ resolvedSignInOptions.includes("anonymous") && /* @__PURE__ */ jsxRuntime.jsx(LoginButton, { disabled, text: "Log in anonymously", icon: /* @__PURE__ */ jsxRuntime.jsx(ui.UserIcon, { size: "medium" }), onClick: authController.anonymousLogin }),
2258
2259
  allowSkipLogin && /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { className: "m-1 mb-4", variant: "text", disabled, onClick: authController.skipLogin, children: "Skip login" })
2259
2260
  ] }),
2260
2261
  passwordLoginSelected && /* @__PURE__ */ jsxRuntime.jsx(LoginForm, { authController, onClose: () => setPasswordLoginSelected(false), mode: modeState.mode, noUserComponent, disableSignupScreen, disableResetPassword }),
@@ -2384,7 +2385,7 @@
2384
2385
  }
2385
2386
  let t4;
2386
2387
  if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2387
- t4 = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeftIcon, { className: "w-5 h-5" });
2388
+ t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.ArrowLeftIcon, { className: "w-5 h-5" });
2388
2389
  $[7] = t4;
2389
2390
  } else {
2390
2391
  t4 = $[7];
@@ -2517,7 +2518,7 @@
2517
2518
  React.useEffect(() => {
2518
2519
  if (!document) return;
2519
2520
  const escFunction = (event) => {
2520
- if (event.keyCode === 27) {
2521
+ if (event.key === "Escape") {
2521
2522
  onClose();
2522
2523
  }
2523
2524
  };
@@ -2565,7 +2566,7 @@
2565
2566
  };
2566
2567
  const label = loginState === "registration" ? "Please enter your email and password to create an account" : loginState === "password" ? "Please enter your password" : "Please enter your email";
2567
2568
  return /* @__PURE__ */ jsxRuntime.jsx("form", { className: "w-full", onSubmit: handleSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-[480px] w-full flex flex-col gap-4", children: [
2568
- /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: onBackPressed, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeftIcon, { className: "w-5 h-5" }) }),
2569
+ /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: onBackPressed, children: /* @__PURE__ */ jsxRuntime.jsx(ui.ArrowLeftIcon, { className: "w-5 h-5" }) }),
2569
2570
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: loginState === "registration" && noUserComponent }),
2570
2571
  /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { className: `${loginState === "registration" && disableSignupScreen ? "hidden" : "flex"}`, variant: "subtitle2", children: label }),
2571
2572
  (loginState === "email" || loginState === "registration") && /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { placeholder: "Email", autoFocus: true, value: email ?? "", disabled: authController.authLoading, type: "email", onChange: (event_1) => setEmail(event_1.target.value) }),
@@ -2583,7 +2584,7 @@
2583
2584
  });
2584
2585
  } catch (e) {
2585
2586
  snackbarController.open({
2586
- message: e.message,
2587
+ message: e instanceof Error ? e.message : String(e),
2587
2588
  type: "error"
2588
2589
  });
2589
2590
  }