@umituz/react-native-firebase 2.4.54 → 2.4.56

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-firebase",
3
- "version": "2.4.54",
3
+ "version": "2.4.56",
4
4
  "description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -10,9 +10,20 @@ import {
10
10
  EmailAuthProvider,
11
11
  type User,
12
12
  } from "firebase/auth";
13
- // @ts-ignore - expo-apple-authentication is an optional peer dependency
14
- import * as AppleAuthentication from "expo-apple-authentication";
15
13
  import { Platform } from "react-native";
14
+
15
+ /**
16
+ * Lazy-loads expo-apple-authentication (optional peer dependency).
17
+ * Returns null if the package is not installed.
18
+ */
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ function getAppleAuthModule(): any {
21
+ try {
22
+ return require("expo-apple-authentication");
23
+ } catch {
24
+ return null;
25
+ }
26
+ }
16
27
  import { generateNonce, hashNonce } from "../../../auth/infrastructure/services/crypto.util";
17
28
  import { executeOperation, failureResultFrom, toErrorInfo, ERROR_MESSAGES } from "../../../../shared/domain/utils";
18
29
  import { isCancelledError } from "../../../../shared/domain/utils/error-handlers/error-checkers";
@@ -82,6 +93,14 @@ export async function getAppleReauthCredential(): Promise<ReauthCredentialResult
82
93
  };
83
94
  }
84
95
 
96
+ const AppleAuthentication = getAppleAuthModule();
97
+ if (!AppleAuthentication) {
98
+ return {
99
+ success: false,
100
+ error: { code: "auth/unavailable", message: "expo-apple-authentication is not installed" }
101
+ };
102
+ }
103
+
85
104
  try {
86
105
  const isAvailable = await AppleAuthentication.isAvailableAsync();
87
106
  if (!isAvailable) {