@umituz/react-native-firebase 2.1.0 → 2.1.1

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.1.0",
3
+ "version": "2.1.1",
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",
@@ -74,23 +74,47 @@ async function attemptReauth(user: User, options: AccountDeletionOptions): Promi
74
74
  if (provider === "apple.com") {
75
75
  res = await reauthenticateWithApple(user);
76
76
  } else if (provider === "google.com") {
77
- if (!options.googleIdToken) {
77
+ let googleToken = options.googleIdToken;
78
+ if (!googleToken && options.onGoogleReauthRequired) {
79
+ const token = await options.onGoogleReauthRequired();
80
+ if (!token) {
81
+ return {
82
+ success: false,
83
+ error: { code: "auth/google-reauth-cancelled", message: "Google reauth cancelled" },
84
+ requiresReauth: true
85
+ };
86
+ }
87
+ googleToken = token;
88
+ }
89
+ if (!googleToken) {
78
90
  return {
79
91
  success: false,
80
92
  error: { code: "auth/google-reauth", message: "Google reauth required" },
81
93
  requiresReauth: true
82
94
  };
83
95
  }
84
- res = await reauthenticateWithGoogle(user, options.googleIdToken);
96
+ res = await reauthenticateWithGoogle(user, googleToken);
85
97
  } else if (provider === "password") {
86
- if (!options.password) {
98
+ let password = options.password;
99
+ if (!password && options.onPasswordRequired) {
100
+ const pwd = await options.onPasswordRequired();
101
+ if (!pwd) {
102
+ return {
103
+ success: false,
104
+ error: { code: "auth/password-reauth-cancelled", message: "Password reauth cancelled" },
105
+ requiresReauth: true
106
+ };
107
+ }
108
+ password = pwd;
109
+ }
110
+ if (!password) {
87
111
  return {
88
112
  success: false,
89
113
  error: { code: "auth/password-reauth", message: "Password required" },
90
114
  requiresReauth: true
91
115
  };
92
116
  }
93
- res = await reauthenticateWithPassword(user, options.password);
117
+ res = await reauthenticateWithPassword(user, password);
94
118
  } else {
95
119
  return null;
96
120
  }
@@ -55,7 +55,7 @@ export const usePasswordPrompt = (options: UsePasswordPromptOptions = {}): UsePa
55
55
  confirmText={options.confirmText}
56
56
  cancelText={options.cancelText}
57
57
  />
58
- ), [isVisible, handleConfirm, handleCancel, options]);
58
+ ), [isVisible, handleConfirm, handleCancel, options.title, options.message, options.confirmText, options.cancelText]);
59
59
 
60
60
  return {
61
61
  showPasswordPrompt,