@umituz/react-native-auth 2.6.12 → 2.6.14
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-auth",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.14",
|
|
4
4
|
"description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design with dependency injection, configurable validation, and comprehensive error handling.",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -35,9 +35,10 @@
|
|
|
35
35
|
"@react-navigation/native": ">=6.0.0",
|
|
36
36
|
"@react-navigation/stack": ">=6.0.0",
|
|
37
37
|
"@umituz/react-native-design-system": "latest",
|
|
38
|
-
"@umituz/react-native-firebase
|
|
38
|
+
"@umituz/react-native-firebase": "latest",
|
|
39
39
|
"@umituz/react-native-localization": "latest",
|
|
40
40
|
"@umituz/react-native-avatar": "latest",
|
|
41
|
+
"@umituz/react-native-sentry": "latest",
|
|
41
42
|
"@umituz/react-native-storage": "latest",
|
|
42
43
|
"@umituz/react-native-validation": "latest",
|
|
43
44
|
"expo-linear-gradient": ">=13.0.0",
|
|
@@ -60,7 +61,6 @@
|
|
|
60
61
|
"@umituz/react-native-avatar": "latest",
|
|
61
62
|
"@umituz/react-native-design-system": "latest",
|
|
62
63
|
"@umituz/react-native-firebase": "latest",
|
|
63
|
-
"@umituz/react-native-firebase-auth": "latest",
|
|
64
64
|
"@umituz/react-native-localization": "latest",
|
|
65
65
|
"@umituz/react-native-storage": "latest",
|
|
66
66
|
"@umituz/react-native-validation": "latest",
|
|
@@ -13,6 +13,10 @@ import { AuthCoreService } from "./AuthCoreService";
|
|
|
13
13
|
import { GuestModeService, type IStorageProvider } from "./GuestModeService";
|
|
14
14
|
import { authEventService } from "./AuthEventService";
|
|
15
15
|
import { initializeAuthPackage, getAuthPackage } from "./AuthPackage";
|
|
16
|
+
import {
|
|
17
|
+
trackPackageError,
|
|
18
|
+
addPackageBreadcrumb,
|
|
19
|
+
} from "@umituz/react-native-sentry";
|
|
16
20
|
|
|
17
21
|
export class AuthService implements IAuthService {
|
|
18
22
|
private coreService: AuthCoreService;
|
|
@@ -56,35 +60,90 @@ export class AuthService implements IAuthService {
|
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
async signUp(params: SignUpParams): Promise<AuthUser> {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
addPackageBreadcrumb("auth", "Sign up started", {
|
|
64
|
+
email: params.email,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
const user = await this.coreService.signUp(params);
|
|
69
|
+
|
|
70
|
+
// Clear guest mode when user signs up
|
|
71
|
+
if (this.guestModeService.getIsGuestMode() && this.storageProvider) {
|
|
72
|
+
await this.guestModeService.clear(this.storageProvider);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
addPackageBreadcrumb("auth", "Sign up successful", {
|
|
76
|
+
userId: user.uid,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
authEventService.emitUserAuthenticated(user.uid);
|
|
80
|
+
return user;
|
|
81
|
+
} catch (error) {
|
|
82
|
+
trackPackageError(
|
|
83
|
+
error instanceof Error ? error : new Error("Sign up failed"),
|
|
84
|
+
{
|
|
85
|
+
packageName: "auth",
|
|
86
|
+
operation: "sign-up",
|
|
87
|
+
email: params.email,
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
throw error;
|
|
64
91
|
}
|
|
65
|
-
|
|
66
|
-
authEventService.emitUserAuthenticated(user.uid);
|
|
67
|
-
return user;
|
|
68
92
|
}
|
|
69
93
|
|
|
70
94
|
async signIn(params: SignInParams): Promise<AuthUser> {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
95
|
+
addPackageBreadcrumb("auth", "Sign in started", {
|
|
96
|
+
email: params.email,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
const user = await this.coreService.signIn(params);
|
|
101
|
+
|
|
102
|
+
// Clear guest mode when user signs in
|
|
103
|
+
if (this.guestModeService.getIsGuestMode() && this.storageProvider) {
|
|
104
|
+
await this.guestModeService.clear(this.storageProvider);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
addPackageBreadcrumb("auth", "Sign in successful", {
|
|
108
|
+
userId: user.uid,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
authEventService.emitUserAuthenticated(user.uid);
|
|
112
|
+
return user;
|
|
113
|
+
} catch (error) {
|
|
114
|
+
trackPackageError(
|
|
115
|
+
error instanceof Error ? error : new Error("Sign in failed"),
|
|
116
|
+
{
|
|
117
|
+
packageName: "auth",
|
|
118
|
+
operation: "sign-in",
|
|
119
|
+
email: params.email,
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
throw error;
|
|
76
123
|
}
|
|
77
|
-
|
|
78
|
-
authEventService.emitUserAuthenticated(user.uid);
|
|
79
|
-
return user;
|
|
80
124
|
}
|
|
81
125
|
|
|
82
126
|
async signOut(): Promise<void> {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
127
|
+
addPackageBreadcrumb("auth", "Sign out started");
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
await this.coreService.signOut();
|
|
131
|
+
|
|
132
|
+
// Clear guest mode if signing out explicitly
|
|
133
|
+
if (this.guestModeService.getIsGuestMode() && this.storageProvider) {
|
|
134
|
+
await this.guestModeService.clear(this.storageProvider);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
addPackageBreadcrumb("auth", "Sign out successful");
|
|
138
|
+
} catch (error) {
|
|
139
|
+
trackPackageError(
|
|
140
|
+
error instanceof Error ? error : new Error("Sign out failed"),
|
|
141
|
+
{
|
|
142
|
+
packageName: "auth",
|
|
143
|
+
operation: "sign-out",
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
throw error;
|
|
88
147
|
}
|
|
89
148
|
}
|
|
90
149
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { useCallback, useState } from "react";
|
|
8
8
|
import { useAuth } from "./useAuth";
|
|
9
|
-
import { deleteCurrentUser } from "@umituz/react-native-firebase
|
|
9
|
+
import { deleteCurrentUser } from "@umituz/react-native-firebase";
|
|
10
10
|
|
|
11
11
|
export interface UseAccountManagementOptions {
|
|
12
12
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { useState, useEffect, useRef, useMemo } from "react";
|
|
7
7
|
import { DeviceEventEmitter } from "react-native";
|
|
8
8
|
import { getAuthService } from "../../infrastructure/services/AuthService";
|
|
9
|
-
import { useFirebaseAuth } from "@umituz/react-native-firebase
|
|
9
|
+
import { useFirebaseAuth } from "@umituz/react-native-firebase";
|
|
10
10
|
import { mapToAuthUser } from "../../infrastructure/utils/UserMapper";
|
|
11
11
|
import type { AuthUser } from "../../domain/entities/AuthUser";
|
|
12
12
|
|
package/src/types/external.d.ts
CHANGED