@umituz/react-native-auth 1.0.3 → 1.1.0

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": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Firebase Authentication wrapper for React Native apps - Secure, type-safe, and production-ready",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -9,6 +9,7 @@ export interface SignUpParams {
9
9
  email: string;
10
10
  password: string;
11
11
  displayName?: string;
12
+ username?: string;
12
13
  }
13
14
 
14
15
  export interface SignInParams {
@@ -15,11 +15,15 @@ export interface AuthConfig {
15
15
  /** Require special characters in password */
16
16
  requireSpecialChars?: boolean;
17
17
  /** Callback for user profile creation after signup */
18
- onUserCreated?: (user: any) => Promise<void> | void;
18
+ onUserCreated?: (user: any, context?: { username?: string; displayName?: string }) => Promise<void> | void;
19
19
  /** Callback for user profile update */
20
20
  onUserUpdated?: (user: any) => Promise<void> | void;
21
+ /** Callback after successful sign in */
22
+ onSignIn?: (user: any) => Promise<void> | void;
21
23
  /** Callback for sign out cleanup */
22
24
  onSignOut?: () => Promise<void> | void;
25
+ /** Callback when guest mode is enabled */
26
+ onGuestModeEnabled?: () => Promise<void> | void;
23
27
  }
24
28
 
25
29
  export const DEFAULT_AUTH_CONFIG: Required<Omit<AuthConfig, 'onUserCreated' | 'onUserUpdated' | 'onSignOut'>> = {
@@ -201,7 +201,10 @@ export class AuthService implements IAuthService {
201
201
  // Call user created callback if provided
202
202
  if (this.config.onUserCreated) {
203
203
  try {
204
- await this.config.onUserCreated(userCredential.user);
204
+ await this.config.onUserCreated(userCredential.user, {
205
+ username: params.username,
206
+ displayName: params.displayName,
207
+ });
205
208
  } catch (callbackError) {
206
209
  // Don't fail signup if callback fails
207
210
  }
@@ -240,6 +243,16 @@ export class AuthService implements IAuthService {
240
243
  );
241
244
 
242
245
  this.isGuestMode = false;
246
+
247
+ // Call sign in callback if provided
248
+ if (this.config.onSignIn) {
249
+ try {
250
+ await this.config.onSignIn(userCredential.user);
251
+ } catch (callbackError) {
252
+ // Don't fail signin if callback fails
253
+ }
254
+ }
255
+
243
256
  return userCredential.user;
244
257
  } catch (error: any) {
245
258
  throw mapFirebaseAuthError(error);
@@ -290,6 +303,15 @@ export class AuthService implements IAuthService {
290
303
  }
291
304
 
292
305
  this.isGuestMode = true;
306
+
307
+ // Call guest mode enabled callback if provided
308
+ if (this.config.onGuestModeEnabled) {
309
+ try {
310
+ await this.config.onGuestModeEnabled();
311
+ } catch (callbackError) {
312
+ // Don't fail guest mode if callback fails
313
+ }
314
+ }
293
315
  }
294
316
 
295
317
  /**