@umituz/react-native-firebase 1.13.8 → 1.13.9
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.
|
|
3
|
+
"version": "1.13.9",
|
|
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",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"url": "https://github.com/umituz/react-native-firebase"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
+
"@umituz/react-native-sentry": "latest",
|
|
33
34
|
"expo-apple-authentication": ">=6.0.0",
|
|
34
35
|
"firebase": ">=10.0.0",
|
|
35
36
|
"react": ">=18.2.0",
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
import { signInAnonymously, type Auth, type User } from "firebase/auth";
|
|
7
7
|
import { toAnonymousUser, type AnonymousUser } from "../../domain/entities/AnonymousUser";
|
|
8
8
|
import { checkAuthState } from "./auth-utils.service";
|
|
9
|
+
import {
|
|
10
|
+
trackPackageError,
|
|
11
|
+
addPackageBreadcrumb,
|
|
12
|
+
} from "@umituz/react-native-sentry";
|
|
9
13
|
|
|
10
14
|
declare const __DEV__: boolean;
|
|
11
15
|
|
|
@@ -66,6 +70,8 @@ export class AnonymousAuthService implements AnonymousAuthServiceInterface {
|
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
// No user exists, sign in anonymously
|
|
73
|
+
addPackageBreadcrumb("firebase-auth", "Starting anonymous sign-in");
|
|
74
|
+
|
|
69
75
|
try {
|
|
70
76
|
const userCredential = await signInAnonymously(auth);
|
|
71
77
|
const anonymousUser = toAnonymousUser(userCredential.user);
|
|
@@ -75,6 +81,10 @@ export class AnonymousAuthService implements AnonymousAuthServiceInterface {
|
|
|
75
81
|
console.log("[AnonymousAuthService] Successfully signed in anonymously", { uid: anonymousUser.uid });
|
|
76
82
|
}
|
|
77
83
|
|
|
84
|
+
addPackageBreadcrumb("firebase-auth", "Anonymous sign-in successful", {
|
|
85
|
+
userId: anonymousUser.uid,
|
|
86
|
+
});
|
|
87
|
+
|
|
78
88
|
return {
|
|
79
89
|
user: userCredential.user,
|
|
80
90
|
anonymousUser,
|
|
@@ -85,6 +95,15 @@ export class AnonymousAuthService implements AnonymousAuthServiceInterface {
|
|
|
85
95
|
// eslint-disable-next-line no-console
|
|
86
96
|
console.error("[AnonymousAuthService] Failed to sign in anonymously", error);
|
|
87
97
|
}
|
|
98
|
+
|
|
99
|
+
trackPackageError(
|
|
100
|
+
error instanceof Error ? error : new Error("Anonymous sign-in failed"),
|
|
101
|
+
{
|
|
102
|
+
packageName: "firebase-auth",
|
|
103
|
+
operation: "anonymous-sign-in",
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
|
|
88
107
|
throw error;
|
|
89
108
|
}
|
|
90
109
|
}
|
|
@@ -13,6 +13,10 @@ import {
|
|
|
13
13
|
import * as AppleAuthentication from "expo-apple-authentication";
|
|
14
14
|
import * as Crypto from "expo-crypto";
|
|
15
15
|
import { Platform } from "react-native";
|
|
16
|
+
import {
|
|
17
|
+
trackPackageError,
|
|
18
|
+
addPackageBreadcrumb,
|
|
19
|
+
} from "@umituz/react-native-sentry";
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
22
|
* Apple Auth result
|
|
@@ -50,10 +54,15 @@ export class AppleAuthService {
|
|
|
50
54
|
* Handles the complete Apple Sign-In flow
|
|
51
55
|
*/
|
|
52
56
|
async signIn(auth: Auth): Promise<AppleAuthResult> {
|
|
57
|
+
addPackageBreadcrumb("firebase-auth", "Apple Sign-In started");
|
|
58
|
+
|
|
53
59
|
try {
|
|
54
60
|
// Check availability
|
|
55
61
|
const isAvailable = await this.isAvailable();
|
|
56
62
|
if (!isAvailable) {
|
|
63
|
+
addPackageBreadcrumb("firebase-auth", "Apple Sign-In not available", {
|
|
64
|
+
platform: Platform.OS,
|
|
65
|
+
});
|
|
57
66
|
return {
|
|
58
67
|
success: false,
|
|
59
68
|
error: "Apple Sign-In is not available on this device",
|
|
@@ -67,6 +76,8 @@ export class AppleAuthService {
|
|
|
67
76
|
nonce,
|
|
68
77
|
);
|
|
69
78
|
|
|
79
|
+
addPackageBreadcrumb("firebase-auth", "Requesting Apple credentials");
|
|
80
|
+
|
|
70
81
|
// Request Apple Sign-In
|
|
71
82
|
const appleCredential = await AppleAuthentication.signInAsync({
|
|
72
83
|
requestedScopes: [
|
|
@@ -78,12 +89,19 @@ export class AppleAuthService {
|
|
|
78
89
|
|
|
79
90
|
// Check for identity token
|
|
80
91
|
if (!appleCredential.identityToken) {
|
|
92
|
+
const error = new Error("No identity token received from Apple");
|
|
93
|
+
trackPackageError(error, {
|
|
94
|
+
packageName: "firebase-auth",
|
|
95
|
+
operation: "apple-sign-in",
|
|
96
|
+
});
|
|
81
97
|
return {
|
|
82
98
|
success: false,
|
|
83
99
|
error: "No identity token received from Apple",
|
|
84
100
|
};
|
|
85
101
|
}
|
|
86
102
|
|
|
103
|
+
addPackageBreadcrumb("firebase-auth", "Creating Firebase credential");
|
|
104
|
+
|
|
87
105
|
// Create Firebase credential
|
|
88
106
|
const provider = new OAuthProvider("apple.com");
|
|
89
107
|
const credential = provider.credential({
|
|
@@ -99,6 +117,11 @@ export class AppleAuthService {
|
|
|
99
117
|
userCredential.user.metadata.creationTime ===
|
|
100
118
|
userCredential.user.metadata.lastSignInTime;
|
|
101
119
|
|
|
120
|
+
addPackageBreadcrumb("firebase-auth", "Apple Sign-In successful", {
|
|
121
|
+
isNewUser,
|
|
122
|
+
userId: userCredential.user.uid,
|
|
123
|
+
});
|
|
124
|
+
|
|
102
125
|
return {
|
|
103
126
|
success: true,
|
|
104
127
|
userCredential,
|
|
@@ -110,12 +133,23 @@ export class AppleAuthService {
|
|
|
110
133
|
error instanceof Error &&
|
|
111
134
|
error.message.includes("ERR_CANCELED")
|
|
112
135
|
) {
|
|
136
|
+
addPackageBreadcrumb("firebase-auth", "Apple Sign-In cancelled by user");
|
|
113
137
|
return {
|
|
114
138
|
success: false,
|
|
115
139
|
error: "Apple Sign-In was cancelled",
|
|
116
140
|
};
|
|
117
141
|
}
|
|
118
142
|
|
|
143
|
+
// Track error in Sentry
|
|
144
|
+
trackPackageError(
|
|
145
|
+
error instanceof Error ? error : new Error("Apple sign-in failed"),
|
|
146
|
+
{
|
|
147
|
+
packageName: "firebase-auth",
|
|
148
|
+
operation: "apple-sign-in",
|
|
149
|
+
platform: Platform.OS,
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
|
|
119
153
|
return {
|
|
120
154
|
success: false,
|
|
121
155
|
error: error instanceof Error ? error.message : "Apple sign-in failed",
|
|
@@ -10,6 +10,10 @@ import {
|
|
|
10
10
|
type Auth,
|
|
11
11
|
type UserCredential,
|
|
12
12
|
} from "firebase/auth";
|
|
13
|
+
import {
|
|
14
|
+
trackPackageError,
|
|
15
|
+
addPackageBreadcrumb,
|
|
16
|
+
} from "@umituz/react-native-sentry";
|
|
13
17
|
|
|
14
18
|
/**
|
|
15
19
|
* Google Auth configuration
|
|
@@ -71,6 +75,8 @@ export class GoogleAuthService {
|
|
|
71
75
|
auth: Auth,
|
|
72
76
|
idToken: string,
|
|
73
77
|
): Promise<GoogleAuthResult> {
|
|
78
|
+
addPackageBreadcrumb("firebase-auth", "Google Sign-In with ID token");
|
|
79
|
+
|
|
74
80
|
try {
|
|
75
81
|
const credential = GoogleAuthProvider.credential(idToken);
|
|
76
82
|
const userCredential = await signInWithCredential(auth, credential);
|
|
@@ -80,12 +86,25 @@ export class GoogleAuthService {
|
|
|
80
86
|
userCredential.user.metadata.creationTime ===
|
|
81
87
|
userCredential.user.metadata.lastSignInTime;
|
|
82
88
|
|
|
89
|
+
addPackageBreadcrumb("firebase-auth", "Google Sign-In successful", {
|
|
90
|
+
isNewUser,
|
|
91
|
+
userId: userCredential.user.uid,
|
|
92
|
+
});
|
|
93
|
+
|
|
83
94
|
return {
|
|
84
95
|
success: true,
|
|
85
96
|
userCredential,
|
|
86
97
|
isNewUser,
|
|
87
98
|
};
|
|
88
99
|
} catch (error) {
|
|
100
|
+
trackPackageError(
|
|
101
|
+
error instanceof Error ? error : new Error("Google sign-in failed"),
|
|
102
|
+
{
|
|
103
|
+
packageName: "firebase-auth",
|
|
104
|
+
operation: "google-sign-in",
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
|
|
89
108
|
return {
|
|
90
109
|
success: false,
|
|
91
110
|
error: error instanceof Error ? error.message : "Google sign-in failed",
|