@umituz/react-native-settings 4.20.33 → 4.20.35
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 +1 -1
- package/src/index.ts +0 -2
- package/src/presentation/screens/components/SettingsContent.tsx +29 -1
- package/src/presentation/screens/hooks/useFeatureDetection.ts +2 -0
- package/src/presentation/screens/types/FeatureConfig.ts +20 -0
- package/src/presentation/screens/types/SettingsConfig.ts +7 -0
- package/src/presentation/screens/types/index.ts +1 -0
- package/src/presentation/screens/utils/normalizeConfig.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.20.
|
|
3
|
+
"version": "4.20.35",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, about, legal, appearance, feedback, FAQs, and rating",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -45,8 +45,6 @@ export {
|
|
|
45
45
|
export { SettingsScreen } from './presentation/screens/SettingsScreen';
|
|
46
46
|
export type { SettingsScreenProps } from './presentation/screens/SettingsScreen';
|
|
47
47
|
export { AppearanceScreen } from './presentation/screens/AppearanceScreen';
|
|
48
|
-
export { AccountScreen } from './presentation/screens/AccountScreen';
|
|
49
|
-
export type { AccountScreenConfig } from './presentation/screens/AccountScreen';
|
|
50
48
|
|
|
51
49
|
// =============================================================================
|
|
52
50
|
// PRESENTATION LAYER - Navigation
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { useNavigation } from "@react-navigation/native";
|
|
3
4
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
4
5
|
import { SettingsFooter } from "../../components/SettingsFooter";
|
|
5
6
|
import { SettingsSection } from "../../components/SettingsSection";
|
|
@@ -13,7 +14,25 @@ import { SettingsItemCard } from "../../components/SettingsItemCard";
|
|
|
13
14
|
import type { IconName } from "@umituz/react-native-design-system";
|
|
14
15
|
import { CustomSettingsList } from "./sections/CustomSettingsList";
|
|
15
16
|
import type { NormalizedConfig } from "../utils/normalizeConfig";
|
|
16
|
-
import type { CustomSettingsSection } from "../types";
|
|
17
|
+
import type { CustomSettingsSection, WalletConfig } from "../types";
|
|
18
|
+
|
|
19
|
+
const WalletSettingsItem: React.FC<{ config: WalletConfig; t: (key: string) => string }> = ({ config, t }) => {
|
|
20
|
+
const navigation = useNavigation();
|
|
21
|
+
const handlePress = () => {
|
|
22
|
+
if (config.route) {
|
|
23
|
+
navigation.navigate(config.route as never);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (
|
|
27
|
+
<SettingsItemCard
|
|
28
|
+
title={config.title || t("wallet.title")}
|
|
29
|
+
description={config.description || t("wallet.description")}
|
|
30
|
+
icon={(config.icon || "wallet") as IconName}
|
|
31
|
+
onPress={handlePress}
|
|
32
|
+
sectionTitle={config.sectionTitle}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
17
36
|
|
|
18
37
|
interface SettingsContentProps {
|
|
19
38
|
normalizedConfig: NormalizedConfig;
|
|
@@ -30,6 +49,7 @@ interface SettingsContentProps {
|
|
|
30
49
|
rating: boolean;
|
|
31
50
|
faqs: boolean;
|
|
32
51
|
subscription: boolean;
|
|
52
|
+
wallet: boolean;
|
|
33
53
|
};
|
|
34
54
|
showUserProfile?: boolean;
|
|
35
55
|
userProfile?: any;
|
|
@@ -67,6 +87,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
67
87
|
features.rating ||
|
|
68
88
|
features.faqs ||
|
|
69
89
|
features.subscription ||
|
|
90
|
+
features.wallet ||
|
|
70
91
|
customSections.length > 0,
|
|
71
92
|
[features, customSections.length]
|
|
72
93
|
);
|
|
@@ -87,6 +108,13 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
87
108
|
/>
|
|
88
109
|
)}
|
|
89
110
|
|
|
111
|
+
{features.wallet && normalizedConfig.wallet.config?.route && (
|
|
112
|
+
<WalletSettingsItem
|
|
113
|
+
config={normalizedConfig.wallet.config}
|
|
114
|
+
t={t}
|
|
115
|
+
/>
|
|
116
|
+
)}
|
|
117
|
+
|
|
90
118
|
<FeatureSettingsSection normalizedConfig={normalizedConfig} features={features} />
|
|
91
119
|
|
|
92
120
|
<IdentitySettingsSection normalizedConfig={normalizedConfig} features={features} />
|
|
@@ -59,6 +59,7 @@ export function useFeatureDetection(
|
|
|
59
59
|
rating,
|
|
60
60
|
faqs,
|
|
61
61
|
subscription,
|
|
62
|
+
wallet,
|
|
62
63
|
} = normalizedConfig;
|
|
63
64
|
|
|
64
65
|
const notificationServiceAvailable = !!options?.notificationServiceAvailable;
|
|
@@ -112,6 +113,7 @@ export function useFeatureDetection(
|
|
|
112
113
|
rating: rating.enabled,
|
|
113
114
|
faqs: faqs.enabled,
|
|
114
115
|
subscription: subscription.enabled,
|
|
116
|
+
wallet: wallet.enabled,
|
|
115
117
|
};
|
|
116
118
|
}, [normalizedConfig, navigation, options]);
|
|
117
119
|
}
|
|
@@ -241,3 +241,23 @@ export interface SubscriptionConfig {
|
|
|
241
241
|
/** Whether user is premium (to show active status) */
|
|
242
242
|
isPremium?: boolean;
|
|
243
243
|
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Wallet Settings Configuration
|
|
247
|
+
*/
|
|
248
|
+
export interface WalletConfig {
|
|
249
|
+
/** Show wallet section */
|
|
250
|
+
enabled?: FeatureVisibility;
|
|
251
|
+
/** Custom title for the wallet section */
|
|
252
|
+
title?: string;
|
|
253
|
+
/** Custom label for the wallet item */
|
|
254
|
+
description?: string;
|
|
255
|
+
/** Custom icon name (Ionicons) */
|
|
256
|
+
icon?: string;
|
|
257
|
+
/** Custom section title for grouping */
|
|
258
|
+
sectionTitle?: string;
|
|
259
|
+
/** Navigation route for wallet screen */
|
|
260
|
+
route?: string;
|
|
261
|
+
/** Current balance to display */
|
|
262
|
+
balance?: number;
|
|
263
|
+
}
|
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
FAQConfig,
|
|
18
18
|
CloudSyncConfig,
|
|
19
19
|
SubscriptionConfig,
|
|
20
|
+
WalletConfig,
|
|
20
21
|
} from "./FeatureConfig";
|
|
21
22
|
|
|
22
23
|
/**
|
|
@@ -121,6 +122,12 @@ export interface SettingsConfig {
|
|
|
121
122
|
*/
|
|
122
123
|
subscription?: FeatureVisibility | SubscriptionConfig;
|
|
123
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Wallet settings configuration
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
129
|
+
wallet?: FeatureVisibility | WalletConfig;
|
|
130
|
+
|
|
124
131
|
/**
|
|
125
132
|
* Custom empty state text when no settings are available
|
|
126
133
|
*/
|
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
RatingConfig,
|
|
17
17
|
FAQConfig,
|
|
18
18
|
SubscriptionConfig,
|
|
19
|
+
WalletConfig,
|
|
19
20
|
SettingsConfig,
|
|
20
21
|
} from "../types";
|
|
21
22
|
|
|
@@ -64,6 +65,10 @@ export interface NormalizedConfig {
|
|
|
64
65
|
enabled: boolean;
|
|
65
66
|
config?: SubscriptionConfig;
|
|
66
67
|
};
|
|
68
|
+
wallet: {
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
config?: WalletConfig;
|
|
71
|
+
};
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
/**
|
|
@@ -109,5 +114,6 @@ export function normalizeSettingsConfig(
|
|
|
109
114
|
rating: normalizeConfigValue(config?.rating, false),
|
|
110
115
|
faqs: normalizeConfigValue(config?.faqs, false),
|
|
111
116
|
subscription: normalizeConfigValue(config?.subscription, false),
|
|
117
|
+
wallet: normalizeConfigValue(config?.wallet, false),
|
|
112
118
|
};
|
|
113
119
|
}
|