@umituz/react-native-settings 4.21.3 → 4.21.5

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-settings",
3
- "version": "4.21.3",
3
+ "version": "4.21.5",
4
4
  "description": "Complete settings hub for React Native apps - consolidated package with settings, about, legal, appearance, feedback, FAQs, rating, and gamification",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -5,12 +5,12 @@
5
5
  * Receives appInfo and legalUrls from app.
6
6
  */
7
7
 
8
- import React, { useCallback } from "react";
8
+ import React from "react";
9
9
  import { createStackNavigator } from "@react-navigation/stack";
10
10
  import { useLocalization, LanguageSelectionScreen } from "@umituz/react-native-localization";
11
11
  import { NotificationSettingsScreen } from "@umituz/react-native-notifications";
12
- import { AccountScreen, useAuth, useAuthModalStore } from "@umituz/react-native-auth";
13
- import { useAppDesignTokens, AlertService } from "@umituz/react-native-design-system";
12
+ import { AccountScreen } from "@umituz/react-native-auth";
13
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
14
14
  import { AppearanceScreen } from "../screens/AppearanceScreen";
15
15
  import { FAQScreen } from "../../domains/faqs";
16
16
  import { useNavigationHandlers } from "./hooks";
@@ -45,6 +45,7 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
45
45
  config = {},
46
46
  showUserProfile = false,
47
47
  userProfile,
48
+ accountConfig,
48
49
  additionalScreens = [],
49
50
  devSettings,
50
51
  customSections = [],
@@ -53,53 +54,9 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
53
54
  }) => {
54
55
  const tokens = useAppDesignTokens();
55
56
  const { t } = useLocalization();
56
- const { user, deleteAccount, signOut } = useAuth();
57
- const { showAuthModal } = useAuthModalStore();
58
57
  const { handlePrivacyPress, handleTermsPress, handleEulaPress, aboutConfig } =
59
58
  useNavigationHandlers(appInfo, legalUrls);
60
59
 
61
- const handleSignOut = useCallback(async () => {
62
- try {
63
- await signOut();
64
- } catch (error) {
65
- AlertService.createErrorAlert(t("common.error"), t("auth.errors.unknownError"));
66
- }
67
- }, [signOut, t]);
68
-
69
- const handleDeleteAccount = useCallback(async () => {
70
- try {
71
- await deleteAccount();
72
- } catch (error) {
73
- AlertService.createErrorAlert(t("common.error"), t("account.deleteErrorMessage"));
74
- }
75
- }, [deleteAccount, t]);
76
-
77
- const handleSignIn = useCallback(() => {
78
- showAuthModal(() => {}, "login");
79
- }, [showAuthModal]);
80
-
81
- const isAnonymous = user?.isAnonymous ?? true;
82
-
83
- const accountConfig = {
84
- profile: {
85
- displayName: userProfile?.displayName || user?.displayName || t("settings.profile.anonymousName"),
86
- userId: userProfile?.userId || user?.uid,
87
- isAnonymous,
88
- avatarUrl: userProfile?.avatarUrl || user?.photoURL || undefined,
89
- },
90
- isAnonymous,
91
- editProfileText: t("settings.account.editProfile"),
92
- onSignIn: handleSignIn,
93
- accountActions: {
94
- onSignOut: handleSignOut,
95
- onDeleteAccount: handleDeleteAccount,
96
- signOutText: t("auth.signOut"),
97
- deleteAccountText: t("account.deleteAccount"),
98
- confirmDeleteTitle: t("auth.deleteAccountConfirmTitle"),
99
- confirmDeleteMessage: t("auth.deleteAccountConfirmMessage"),
100
- },
101
- };
102
-
103
60
  const screenOptions = React.useMemo(() => createScreenOptions(tokens), [tokens]);
104
61
  const notificationTranslations = React.useMemo(() => createNotificationTranslations(t), [t]);
105
62
  const quietHoursTranslations = React.useMemo(() => createQuietHoursTranslations(t), [t]);
@@ -212,12 +169,14 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
212
169
  )}
213
170
  </Stack.Screen>
214
171
 
215
- <Stack.Screen
216
- name="Account"
217
- options={createAccountScreenOptions(t)}
218
- >
219
- {() => <AccountScreen config={accountConfig} />}
220
- </Stack.Screen>
172
+ {accountConfig && (
173
+ <Stack.Screen
174
+ name="Account"
175
+ options={createAccountScreenOptions(t)}
176
+ >
177
+ {() => <AccountScreen config={accountConfig} />}
178
+ </Stack.Screen>
179
+ )}
221
180
  </Stack.Navigator>
222
181
  );
223
182
  };
@@ -77,6 +77,11 @@ export interface FAQData {
77
77
  categories: FAQCategory[];
78
78
  }
79
79
 
80
+ /**
81
+ * Import AccountScreenConfig from auth package
82
+ */
83
+ export type { AccountScreenConfig as AccountConfig } from "@umituz/react-native-auth";
84
+
80
85
  /**
81
86
  * Settings Stack Navigator Props
82
87
  */
@@ -87,6 +92,7 @@ export interface SettingsStackNavigatorProps {
87
92
  config?: SettingsConfig;
88
93
  showUserProfile?: boolean;
89
94
  userProfile?: UserProfileConfig;
95
+ accountConfig?: AccountConfig;
90
96
  additionalScreens?: AdditionalScreen[];
91
97
  devSettings?: DevSettingsProps;
92
98
  customSections?: CustomSettingsSection[];