@umituz/react-native-firebase 1.13.27 → 1.13.28

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": "1.13.27",
3
+ "version": "1.13.28",
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",
@@ -38,7 +38,14 @@
38
38
  "react-native": ">=0.74.0"
39
39
  },
40
40
  "devDependencies": {
41
+ "@react-native-async-storage/async-storage": "^2.2.0",
42
+ "@sentry/react-native": "^7.8.0",
43
+ "@sentry/types": "^10.32.1",
44
+ "@types/jest": "^30.0.0",
41
45
  "@types/react": "~19.1.10",
46
+ "@umituz/react-native-sentry": "^1.4.2",
47
+ "expo-apple-authentication": "^8.0.8",
48
+ "expo-crypto": "^15.0.8",
42
49
  "firebase": "^12.6.0",
43
50
  "react": "19.1.0",
44
51
  "react-native": "0.81.5",
@@ -167,7 +167,10 @@ export class AppleAuthService {
167
167
  let result = "";
168
168
 
169
169
  for (let i = 0; i < randomBytes.length; i++) {
170
- result += chars.charAt(randomBytes[i] % chars.length);
170
+ const byte = randomBytes[i];
171
+ if (byte !== undefined) {
172
+ result += chars.charAt(byte % chars.length);
173
+ }
171
174
  }
172
175
 
173
176
  return result;
@@ -126,7 +126,10 @@ async function generateNonce(length: number = 32): Promise<string> {
126
126
  let result = "";
127
127
 
128
128
  for (let i = 0; i < randomBytes.length; i++) {
129
- result += chars.charAt(randomBytes[i] % chars.length);
129
+ const byte = randomBytes[i];
130
+ if (byte !== undefined) {
131
+ result += chars.charAt(byte % chars.length);
132
+ }
130
133
  }
131
134
 
132
135
  return result;
@@ -223,7 +226,7 @@ export async function getAppleReauthCredential(): Promise<{
223
226
  */
224
227
  export async function reauthenticateWithApple(user: User): Promise<ReauthenticationResult> {
225
228
  const result = await getAppleReauthCredential();
226
-
229
+
227
230
  if (!result.success || !result.credential) {
228
231
  return {
229
232
  success: false,
@@ -3,10 +3,11 @@
3
3
  */
4
4
 
5
5
  // Mock __DEV__ for tests
6
- export {};
6
+ export { };
7
7
 
8
8
  declare global {
9
- var __DEV__: boolean | undefined;
9
+ var mockFirestore: () => any;
10
+ var mockFirebaseError: (code: string, message: string) => any;
10
11
  }
11
12
 
12
13
  if (typeof (global as any).__DEV__ === 'undefined') {
@@ -16,20 +17,28 @@ if (typeof (global as any).__DEV__ === 'undefined') {
16
17
  // Mock console methods to avoid noise in tests
17
18
  const originalConsole = { ...console };
18
19
 
19
- beforeEach(() => {
20
- // Restore console methods before each test
21
- Object.assign(console, originalConsole);
22
- });
20
+ const globalAny = global as any;
21
+
22
+ /**
23
+ * We check if beforeEach is available before using it
24
+ * This avoids errors when running tsc or in environments without Jest
25
+ */
26
+ if (typeof globalAny.beforeEach !== 'undefined') {
27
+ globalAny.beforeEach(() => {
28
+ // Restore console methods before each test
29
+ Object.assign(console, originalConsole);
30
+ });
31
+ }
23
32
 
24
33
  // Set up global test utilities
25
- global.mockFirestore = () => ({
26
- collection: jest.fn(),
27
- doc: jest.fn(),
28
- runTransaction: jest.fn(),
29
- batch: jest.fn(),
34
+ globalAny.mockFirestore = () => ({
35
+ collection: globalAny.jest?.fn() || (() => ({})),
36
+ doc: globalAny.jest?.fn() || (() => ({})),
37
+ runTransaction: globalAny.jest?.fn() || (() => Promise.resolve()),
38
+ batch: globalAny.jest?.fn() || (() => ({})),
30
39
  });
31
40
 
32
- global.mockFirebaseError = (code: string, message: string) => {
41
+ globalAny.mockFirebaseError = (code: string, message: string) => {
33
42
  const error = new Error(message) as any;
34
43
  error.code = code;
35
44
  return error;