@umituz/react-native-settings 4.5.0 → 4.7.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-settings",
3
- "version": "4.5.0",
3
+ "version": "4.7.0",
4
4
  "description": "Settings management for React Native apps - user preferences, theme, language, notifications",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -39,7 +39,6 @@
39
39
  "@umituz/react-native-design-system-theme": "*",
40
40
  "@umituz/react-native-design-system-typography": "*",
41
41
  "@umituz/react-native-legal": "*",
42
- "@umituz/react-native-disclaimer": "*",
43
42
  "@umituz/react-native-localization": "*",
44
43
  "@umituz/react-native-storage": "*",
45
44
  "react": ">=18.2.0",
@@ -70,7 +69,6 @@
70
69
  "@umituz/react-native-design-system-theme": "latest",
71
70
  "@umituz/react-native-design-system-typography": "latest",
72
71
  "@umituz/react-native-legal": "^2.0.3",
73
- "@umituz/react-native-disclaimer": "latest",
74
72
  "@umituz/react-native-localization": "latest",
75
73
  "@umituz/react-native-notifications": "latest",
76
74
  "@umituz/react-native-storage": "latest",
@@ -16,35 +16,35 @@ export interface UserProfileHeaderProps {
16
16
  displayName?: string;
17
17
  /** User ID */
18
18
  userId?: string;
19
- /** Whether user is guest */
20
- isGuest?: boolean;
19
+ /** Whether user is anonymous (device-based ID) */
20
+ isAnonymous?: boolean;
21
21
  /** Avatar URL (optional) */
22
22
  avatarUrl?: string;
23
23
  /** Navigation route for account settings */
24
24
  accountSettingsRoute?: string;
25
25
  /** Custom onPress handler */
26
26
  onPress?: () => void;
27
- /** Custom guest user display name */
28
- guestDisplayName?: string;
27
+ /** Custom anonymous user display name */
28
+ anonymousDisplayName?: string;
29
29
  /** Custom avatar service URL */
30
30
  avatarServiceUrl?: string;
31
31
  /** Default user display name when no displayName provided */
32
32
  defaultUserDisplayName?: string;
33
- /** Default guest display name */
34
- defaultGuestDisplayName?: string;
33
+ /** Default anonymous display name */
34
+ defaultAnonymousDisplayName?: string;
35
35
  }
36
36
 
37
37
  export const UserProfileHeader: React.FC<UserProfileHeaderProps> = ({
38
38
  displayName,
39
39
  userId,
40
- isGuest = false,
40
+ isAnonymous = false,
41
41
  avatarUrl,
42
42
  accountSettingsRoute,
43
43
  onPress,
44
- guestDisplayName,
44
+ anonymousDisplayName,
45
45
  avatarServiceUrl,
46
46
  defaultUserDisplayName,
47
- defaultGuestDisplayName,
47
+ defaultAnonymousDisplayName,
48
48
  }) => {
49
49
  const tokens = useAppDesignTokens();
50
50
  const navigation = useNavigation();
@@ -52,8 +52,8 @@ export const UserProfileHeader: React.FC<UserProfileHeaderProps> = ({
52
52
  const spacing = tokens.spacing;
53
53
  const [imageError, setImageError] = useState(false);
54
54
 
55
- const finalDisplayName = displayName || (isGuest ? guestDisplayName || defaultGuestDisplayName || "Guest" : defaultUserDisplayName || "User");
56
- const avatarName = isGuest ? guestDisplayName || defaultGuestDisplayName || defaultGuestDisplayName || "Guest" : finalDisplayName;
55
+ const finalDisplayName = displayName || (isAnonymous ? anonymousDisplayName || defaultAnonymousDisplayName || "Anonymous" : defaultUserDisplayName || "User");
56
+ const avatarName = isAnonymous ? anonymousDisplayName || defaultAnonymousDisplayName || "Anonymous" : finalDisplayName;
57
57
 
58
58
  const defaultAvatarService = avatarServiceUrl || "https://ui-avatars.com/api";
59
59
  const finalAvatarUrl =
@@ -30,6 +30,25 @@ export interface SettingsStackNavigatorProps {
30
30
  */
31
31
  appVersion?: string;
32
32
 
33
+ /**
34
+ * Show user profile header
35
+ */
36
+ showUserProfile?: boolean;
37
+
38
+ /**
39
+ * User profile props for anonymous/authenticated users
40
+ */
41
+ userProfile?: {
42
+ displayName?: string;
43
+ userId?: string;
44
+ isAnonymous?: boolean;
45
+ avatarUrl?: string;
46
+ accountSettingsRoute?: string;
47
+ onPress?: () => void;
48
+ anonymousDisplayName?: string;
49
+ avatarServiceUrl?: string;
50
+ };
51
+
33
52
  /**
34
53
  * Additional screens to register
35
54
  * Apps can add their own screens here
@@ -46,6 +65,8 @@ const Stack = createStackNavigator<SettingsStackParamList>();
46
65
  export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
47
66
  config = {},
48
67
  appVersion,
68
+ showUserProfile = false,
69
+ userProfile,
49
70
  additionalScreens = [],
50
71
  }) => {
51
72
  const tokens = useAppDesignTokens();
@@ -66,10 +87,17 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
66
87
 
67
88
  // Memoize SettingsScreen wrapper to prevent remounting on every render
68
89
  const SettingsScreenWrapper = React.useMemo(() => {
69
- const Wrapper = () => <SettingsScreen config={config} appVersion={appVersion} />;
90
+ const Wrapper = () => (
91
+ <SettingsScreen
92
+ config={config}
93
+ appVersion={appVersion}
94
+ showUserProfile={showUserProfile}
95
+ userProfile={userProfile}
96
+ />
97
+ );
70
98
  Wrapper.displayName = "SettingsScreenWrapper";
71
99
  return Wrapper;
72
- }, [config, appVersion]);
100
+ }, [config, appVersion, showUserProfile, userProfile]);
73
101
 
74
102
  return (
75
103
  <Stack.Navigator screenOptions={screenOptions}>
@@ -25,11 +25,11 @@ export interface SettingsScreenProps {
25
25
  userProfile?: {
26
26
  displayName?: string;
27
27
  userId?: string;
28
- isGuest?: boolean;
28
+ isAnonymous?: boolean;
29
29
  avatarUrl?: string;
30
30
  accountSettingsRoute?: string;
31
31
  onPress?: () => void;
32
- guestDisplayName?: string;
32
+ anonymousDisplayName?: string;
33
33
  avatarServiceUrl?: string;
34
34
  };
35
35
  /** Show footer with version */
@@ -16,7 +16,6 @@ import { AboutSection } from "@umituz/react-native-about";
16
16
  import { LegalSection } from "@umituz/react-native-legal";
17
17
  import { AppearanceSection } from "@umituz/react-native-appearance";
18
18
  import { LanguageSection } from "@umituz/react-native-localization";
19
- import { DisclaimerSetting } from "@umituz/react-native-disclaimer";
20
19
  import type { NormalizedConfig } from "../utils/normalizeConfig";
21
20
  import type { CustomSettingsSection } from "../types";
22
21
 
@@ -29,17 +28,16 @@ interface SettingsContentProps {
29
28
  notifications: boolean;
30
29
  about: boolean;
31
30
  legal: boolean;
32
- disclaimer: boolean;
33
31
  };
34
32
  showUserProfile?: boolean;
35
33
  userProfile?: {
36
34
  displayName?: string;
37
35
  userId?: string;
38
- isGuest?: boolean;
36
+ isAnonymous?: boolean;
39
37
  avatarUrl?: string;
40
38
  accountSettingsRoute?: string;
41
39
  onPress?: () => void;
42
- guestDisplayName?: string;
40
+ anonymousDisplayName?: string;
43
41
  avatarServiceUrl?: string;
44
42
  };
45
43
  showFooter?: boolean;
@@ -71,7 +69,6 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
71
69
  features.notifications ||
72
70
  features.about ||
73
71
  features.legal ||
74
- features.disclaimer ||
75
72
  customSections.length > 0,
76
73
  [features, customSections.length]
77
74
  );
@@ -99,10 +96,12 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
99
96
  <UserProfileHeader
100
97
  displayName={userProfile?.displayName}
101
98
  userId={userProfile?.userId}
102
- isGuest={userProfile?.isGuest}
99
+ isAnonymous={userProfile?.isAnonymous}
103
100
  avatarUrl={userProfile?.avatarUrl}
104
101
  accountSettingsRoute={userProfile?.accountSettingsRoute}
105
102
  onPress={userProfile?.onPress}
103
+ anonymousDisplayName={userProfile?.anonymousDisplayName}
104
+ avatarServiceUrl={userProfile?.avatarServiceUrl}
106
105
  />
107
106
  </View>
108
107
  )}
@@ -127,10 +126,6 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
127
126
  <LegalSection config={normalizedConfig.legal.config} />
128
127
  )}
129
128
 
130
- {features.disclaimer && (
131
- <DisclaimerSetting />
132
- )}
133
-
134
129
  {customSections && customSections.length > 0 && (
135
130
  <>
136
131
  {sortedSections.map((section, index) => (
@@ -61,9 +61,9 @@ export function useFeatureDetection(
61
61
  },
62
62
  ) {
63
63
  return useMemo(() => {
64
- const { appearance, language, notifications, about, legal, disclaimer, account, support, developer } =
64
+ const { appearance, language, notifications, about, legal } =
65
65
  normalizedConfig;
66
-
66
+
67
67
  const notificationServiceAvailable = options?.notificationServiceAvailable ?? notificationService !== null;
68
68
 
69
69
  return {
@@ -102,21 +102,6 @@ export function useFeatureDetection(
102
102
  (legal.config?.enabled === true ||
103
103
  (legal.config?.enabled !== false &&
104
104
  hasNavigationScreen(navigation, legal.config?.route || "Legal"))),
105
- disclaimer:
106
- disclaimer.enabled &&
107
- (disclaimer.config?.enabled === true ||
108
- (disclaimer.config?.enabled !== false &&
109
- hasNavigationScreen(navigation, disclaimer.config?.route || "Disclaimer"))),
110
- account:
111
- account.enabled &&
112
- (account.config?.enabled === true ||
113
- (account.config?.enabled !== false &&
114
- hasNavigationScreen(
115
- navigation,
116
- account.config?.route || "AccountSettings",
117
- ))),
118
- support: support.enabled,
119
- developer: developer.enabled && __DEV__,
120
105
  };
121
106
  }, [normalizedConfig, navigation, options]);
122
107
  }
@@ -101,20 +101,3 @@ export interface LegalConfig {
101
101
  defaultRoute?: string;
102
102
  }
103
103
 
104
- /**
105
- * Disclaimer Settings Configuration
106
- */
107
- export interface DisclaimerConfig {
108
- /** Show disclaimer section */
109
- enabled?: FeatureVisibility;
110
- /** Custom navigation route for disclaimer screen */
111
- route?: string;
112
- /** Custom disclaimer title */
113
- title?: string;
114
- /** Custom disclaimer description */
115
- description?: string;
116
- /** Custom short message for card display */
117
- shortMessage?: string;
118
- /** Default route name when no custom route provided */
119
- defaultRoute?: string;
120
- }
@@ -10,22 +10,16 @@ import type {
10
10
  NotificationsConfig,
11
11
  AboutConfig,
12
12
  LegalConfig,
13
- DisclaimerConfig,
14
13
  } from "./FeatureConfig";
15
- import type {
16
- AccountConfig,
17
- SupportConfig,
18
- DeveloperConfig,
19
- } from "./ExtendedConfig";
20
14
 
21
15
  /**
22
16
  * Main Settings Configuration
23
- *
17
+ *
24
18
  * Controls which settings features are visible in the SettingsScreen.
25
19
  * Each feature can be configured with:
26
20
  * - Simple: boolean | 'auto' (quick setup)
27
21
  * - Advanced: Detailed config object (full control)
28
- *
22
+ *
29
23
  * @example
30
24
  * // Simple configuration
31
25
  * const config: SettingsConfig = {
@@ -33,31 +27,19 @@ import type {
33
27
  * notifications: 'auto',
34
28
  * about: false,
35
29
  * };
36
- *
30
+ *
37
31
  * @example
38
32
  * // Advanced configuration
39
33
  * const config: SettingsConfig = {
40
34
  * appearance: {
41
35
  * enabled: true,
42
36
  * route: 'CustomAppearance',
43
- * showLanguage: true,
44
37
  * showTheme: true,
45
38
  * },
46
39
  * notifications: {
47
40
  * enabled: 'auto',
48
41
  * showToggle: true,
49
42
  * initialValue: false,
50
- * onToggleChange: (value) => console.log(value),
51
- * },
52
- * support: {
53
- * enabled: true,
54
- * items: {
55
- * liveSupport: {
56
- * enabled: true,
57
- * route: 'ChatSupport',
58
- * title: 'Live Chat',
59
- * },
60
- * },
61
43
  * },
62
44
  * };
63
45
  */
@@ -92,30 +74,6 @@ export interface SettingsConfig {
92
74
  */
93
75
  legal?: FeatureVisibility | LegalConfig;
94
76
 
95
- /**
96
- * Disclaimer settings (Important notices, warnings)
97
- * @default false
98
- */
99
- disclaimer?: FeatureVisibility | DisclaimerConfig;
100
-
101
- /**
102
- * Account settings
103
- * @default false
104
- */
105
- account?: FeatureVisibility | AccountConfig;
106
-
107
- /**
108
- * Support settings
109
- * @default false
110
- */
111
- support?: FeatureVisibility | SupportConfig;
112
-
113
- /**
114
- * Developer settings (only shown in __DEV__ mode)
115
- * @default false
116
- */
117
- developer?: boolean | DeveloperConfig;
118
-
119
77
  /**
120
78
  * Custom empty state text when no settings are available
121
79
  */
@@ -10,12 +10,6 @@ export type {
10
10
  NotificationsConfig,
11
11
  AboutConfig,
12
12
  LegalConfig,
13
- DisclaimerConfig,
14
13
  } from "./FeatureConfig";
15
- export type {
16
- AccountConfig,
17
- SupportConfig,
18
- DeveloperConfig,
19
- } from "./ExtendedConfig";
20
14
  export type { SettingsConfig } from "./SettingsConfig";
21
15
  export type { CustomSettingsSection } from "./CustomSection";
@@ -10,10 +10,6 @@ import type {
10
10
  NotificationsConfig,
11
11
  AboutConfig,
12
12
  LegalConfig,
13
- DisclaimerConfig,
14
- AccountConfig,
15
- SupportConfig,
16
- DeveloperConfig,
17
13
  SettingsConfig,
18
14
  } from "../types";
19
15
 
@@ -38,22 +34,6 @@ export interface NormalizedConfig {
38
34
  enabled: boolean;
39
35
  config?: LegalConfig;
40
36
  };
41
- disclaimer: {
42
- enabled: boolean;
43
- config?: DisclaimerConfig;
44
- };
45
- account: {
46
- enabled: boolean;
47
- config?: AccountConfig;
48
- };
49
- support: {
50
- enabled: boolean;
51
- config?: SupportConfig;
52
- };
53
- developer: {
54
- enabled: boolean;
55
- config?: DeveloperConfig;
56
- };
57
37
  }
58
38
 
59
39
  /**
@@ -93,10 +73,6 @@ export function normalizeSettingsConfig(
93
73
  notifications: normalizeConfigValue(config?.notifications, "auto"),
94
74
  about: normalizeConfigValue(config?.about, "auto"),
95
75
  legal: normalizeConfigValue(config?.legal, "auto"),
96
- disclaimer: normalizeConfigValue(config?.disclaimer, false),
97
- account: normalizeConfigValue(config?.account, false),
98
- support: normalizeConfigValue(config?.support, false),
99
- developer: normalizeConfigValue(config?.developer, false),
100
76
  };
101
77
  }
102
78
 
@@ -1,68 +0,0 @@
1
- /**
2
- * Extended Configuration Types
3
- * Account, Support, and Developer configurations
4
- */
5
-
6
- import type { ComponentType } from "react";
7
- import type { FeatureVisibility } from "./FeatureConfig";
8
-
9
- /**
10
- * Account Settings Configuration
11
- */
12
- export interface AccountConfig {
13
- /** Show account section */
14
- enabled?: FeatureVisibility;
15
- /** Custom navigation route for account screen */
16
- route?: string;
17
- /** Custom account title */
18
- title?: string;
19
- /** Custom account description */
20
- description?: string;
21
- }
22
-
23
- /**
24
- * Support Settings Configuration
25
- */
26
- export interface SupportConfig {
27
- /** Show support section */
28
- enabled?: FeatureVisibility;
29
- /** Support items configuration */
30
- items?: {
31
- /** Live support configuration */
32
- liveSupport?: {
33
- enabled?: boolean;
34
- route?: string;
35
- title?: string;
36
- description?: string;
37
- };
38
- /** Help support configuration */
39
- helpSupport?: {
40
- enabled?: boolean;
41
- route?: string;
42
- title?: string;
43
- description?: string;
44
- };
45
- };
46
- /** Custom support section title */
47
- title?: string;
48
- }
49
-
50
- /**
51
- * Developer Settings Configuration
52
- */
53
- export interface DeveloperConfig {
54
- /** Show developer section (only in __DEV__ mode) */
55
- enabled?: boolean;
56
- /** Developer settings items */
57
- items?: Array<{
58
- title: string;
59
- description?: string;
60
- route?: string;
61
- onPress?: () => void;
62
- icon?: ComponentType<{ size?: number; color?: string }>;
63
- iconColor?: string;
64
- titleColor?: string;
65
- }>;
66
- /** Custom developer section title */
67
- title?: string;
68
- }