@umituz/react-native-settings 4.17.33 → 4.19.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 +1 -1
- package/src/index.ts +0 -5
- package/src/presentation/navigation/SettingsStackNavigator.tsx +10 -2
- package/src/presentation/screens/components/SettingsContent.tsx +0 -2
- package/src/presentation/screens/components/sections/FeatureSettingsSection.tsx +0 -9
- package/src/presentation/screens/hooks/useFeatureDetection.ts +0 -5
- package/src/presentation/screens/types/FeatureConfig.ts +0 -57
- package/src/presentation/screens/types/SettingsConfig.ts +0 -8
- package/src/presentation/screens/types/index.ts +0 -2
- package/src/presentation/screens/utils/normalizeConfig.ts +0 -7
- package/src/presentation/screens/components/sections/SubscriptionSettingsItem.tsx +0 -157
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.19.0",
|
|
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
|
@@ -63,8 +63,6 @@ export type {
|
|
|
63
63
|
export type {
|
|
64
64
|
SettingsConfig,
|
|
65
65
|
CustomSettingsSection,
|
|
66
|
-
SubscriptionConfig,
|
|
67
|
-
SubscriptionSettingsItemConfig,
|
|
68
66
|
} from './presentation/screens/types';
|
|
69
67
|
|
|
70
68
|
// =============================================================================
|
|
@@ -88,9 +86,6 @@ export type { StorageClearSettingProps } from './presentation/components/Storage
|
|
|
88
86
|
export { DevSettingsSection } from './presentation/components/DevSettingsSection';
|
|
89
87
|
export type { DevSettingsProps } from './presentation/components/DevSettingsSection';
|
|
90
88
|
|
|
91
|
-
export { SubscriptionSettingsItem } from './presentation/screens/components/sections/SubscriptionSettingsItem';
|
|
92
|
-
export type { SubscriptionSettingsItemProps } from './presentation/screens/components/sections/SubscriptionSettingsItem';
|
|
93
|
-
|
|
94
89
|
// =============================================================================
|
|
95
90
|
// DOMAIN EXPORTS - Consolidated Features
|
|
96
91
|
// =============================================================================
|
|
@@ -10,7 +10,7 @@ import { createStackNavigator } from "@react-navigation/stack";
|
|
|
10
10
|
import { useResponsiveDesignTokens } from "@umituz/react-native-design-system";
|
|
11
11
|
import { SettingsScreen } from "../screens/SettingsScreen";
|
|
12
12
|
import { AppearanceScreen } from "../screens/AppearanceScreen";
|
|
13
|
-
import type { SettingsConfig } from "../screens/types";
|
|
13
|
+
import type { SettingsConfig, CustomSettingsSection } from "../screens/types";
|
|
14
14
|
import type { DevSettingsProps } from "../components/DevSettingsSection";
|
|
15
15
|
|
|
16
16
|
// Default param list - can be extended by apps
|
|
@@ -64,6 +64,12 @@ export interface SettingsStackNavigatorProps {
|
|
|
64
64
|
* Dev settings (only shown in __DEV__ mode)
|
|
65
65
|
*/
|
|
66
66
|
devSettings?: DevSettingsProps;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Custom sections to render in settings list
|
|
70
|
+
* Use this to add app-specific items like subscription
|
|
71
|
+
*/
|
|
72
|
+
customSections?: CustomSettingsSection[];
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
const Stack = createStackNavigator<SettingsStackParamList>();
|
|
@@ -75,6 +81,7 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
|
75
81
|
userProfile,
|
|
76
82
|
additionalScreens = [],
|
|
77
83
|
devSettings,
|
|
84
|
+
customSections = [],
|
|
78
85
|
}) => {
|
|
79
86
|
const tokens = useResponsiveDesignTokens();
|
|
80
87
|
|
|
@@ -101,11 +108,12 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = ({
|
|
|
101
108
|
showUserProfile={showUserProfile}
|
|
102
109
|
userProfile={userProfile}
|
|
103
110
|
devSettings={devSettings}
|
|
111
|
+
customSections={customSections}
|
|
104
112
|
/>
|
|
105
113
|
);
|
|
106
114
|
Wrapper.displayName = "SettingsScreenWrapper";
|
|
107
115
|
return Wrapper;
|
|
108
|
-
}, [config, appVersion, showUserProfile, userProfile, devSettings]);
|
|
116
|
+
}, [config, appVersion, showUserProfile, userProfile, devSettings, customSections]);
|
|
109
117
|
|
|
110
118
|
return (
|
|
111
119
|
<Stack.Navigator screenOptions={screenOptions}>
|
|
@@ -26,7 +26,6 @@ interface SettingsContentProps {
|
|
|
26
26
|
legal: boolean;
|
|
27
27
|
disclaimer: boolean;
|
|
28
28
|
userProfile: boolean;
|
|
29
|
-
subscription: boolean;
|
|
30
29
|
feedback: boolean;
|
|
31
30
|
rating: boolean;
|
|
32
31
|
faqs: boolean;
|
|
@@ -65,7 +64,6 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
65
64
|
features.about ||
|
|
66
65
|
features.legal ||
|
|
67
66
|
features.disclaimer ||
|
|
68
|
-
features.subscription ||
|
|
69
67
|
features.feedback ||
|
|
70
68
|
features.rating ||
|
|
71
69
|
features.faqs ||
|
|
@@ -3,7 +3,6 @@ import { AppearanceSection } from "../../../../domains/appearance/presentation/c
|
|
|
3
3
|
import { LanguageSection } from "@umituz/react-native-localization";
|
|
4
4
|
import { NotificationsSection } from "@umituz/react-native-notifications";
|
|
5
5
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
6
|
-
import { SubscriptionSettingsItem } from "./SubscriptionSettingsItem";
|
|
7
6
|
import type { NormalizedConfig } from "../../utils/normalizeConfig";
|
|
8
7
|
|
|
9
8
|
interface FeatureSettingsSectionProps {
|
|
@@ -12,7 +11,6 @@ interface FeatureSettingsSectionProps {
|
|
|
12
11
|
appearance: boolean;
|
|
13
12
|
language: boolean;
|
|
14
13
|
notifications: boolean;
|
|
15
|
-
subscription: boolean;
|
|
16
14
|
};
|
|
17
15
|
}
|
|
18
16
|
|
|
@@ -56,13 +54,6 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
|
|
|
56
54
|
}}
|
|
57
55
|
/>
|
|
58
56
|
)}
|
|
59
|
-
|
|
60
|
-
{features.subscription && normalizedConfig.subscription.config?.settingsItem && (
|
|
61
|
-
<SubscriptionSettingsItem
|
|
62
|
-
config={normalizedConfig.subscription.config.settingsItem}
|
|
63
|
-
sectionTitle={t("settings.subscription.title")}
|
|
64
|
-
/>
|
|
65
|
-
)}
|
|
66
57
|
</>
|
|
67
58
|
);
|
|
68
59
|
};
|
|
@@ -55,7 +55,6 @@ export function useFeatureDetection(
|
|
|
55
55
|
legal,
|
|
56
56
|
disclaimer,
|
|
57
57
|
userProfile,
|
|
58
|
-
subscription,
|
|
59
58
|
feedback,
|
|
60
59
|
rating,
|
|
61
60
|
faqs,
|
|
@@ -108,10 +107,6 @@ export function useFeatureDetection(
|
|
|
108
107
|
disclaimer.config?.route || "Disclaimer",
|
|
109
108
|
))),
|
|
110
109
|
userProfile: userProfile.enabled,
|
|
111
|
-
subscription:
|
|
112
|
-
subscription.enabled &&
|
|
113
|
-
(subscription.config?.settingsItem !== undefined ||
|
|
114
|
-
subscription.config?.sectionConfig !== undefined),
|
|
115
110
|
feedback: feedback.enabled,
|
|
116
111
|
rating: rating.enabled,
|
|
117
112
|
faqs: faqs.enabled,
|
|
@@ -149,63 +149,6 @@ export interface UserProfileConfig {
|
|
|
149
149
|
accountSettingsRoute?: string;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
/**
|
|
153
|
-
* Subscription Settings Item Config
|
|
154
|
-
* Simplified config for settings list item display
|
|
155
|
-
*/
|
|
156
|
-
export interface SubscriptionSettingsItemConfig {
|
|
157
|
-
title: string;
|
|
158
|
-
description?: string;
|
|
159
|
-
isPremium: boolean;
|
|
160
|
-
statusLabel: string;
|
|
161
|
-
icon?: string;
|
|
162
|
-
onPress?: () => void;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Subscription Settings Configuration
|
|
167
|
-
* App must provide all data via props (no internal fetch)
|
|
168
|
-
*/
|
|
169
|
-
export interface SubscriptionConfig {
|
|
170
|
-
/** Show subscription section */
|
|
171
|
-
enabled?: FeatureVisibility;
|
|
172
|
-
/** Settings item configuration (for settings list display) */
|
|
173
|
-
settingsItem?: SubscriptionSettingsItemConfig;
|
|
174
|
-
/** Detail section configuration (for detail screen) */
|
|
175
|
-
sectionConfig?: {
|
|
176
|
-
statusType: "active" | "expired" | "none" | "canceled";
|
|
177
|
-
isPremium: boolean;
|
|
178
|
-
expirationDate?: string | null;
|
|
179
|
-
purchaseDate?: string | null;
|
|
180
|
-
isLifetime?: boolean;
|
|
181
|
-
daysRemaining?: number | null;
|
|
182
|
-
willRenew?: boolean;
|
|
183
|
-
credits?: Array<{
|
|
184
|
-
id: string;
|
|
185
|
-
label: string;
|
|
186
|
-
current: number;
|
|
187
|
-
total: number;
|
|
188
|
-
}>;
|
|
189
|
-
translations: {
|
|
190
|
-
title: string;
|
|
191
|
-
statusLabel: string;
|
|
192
|
-
expiresLabel: string;
|
|
193
|
-
purchasedLabel: string;
|
|
194
|
-
creditsTitle?: string;
|
|
195
|
-
remainingLabel?: string;
|
|
196
|
-
manageButton?: string;
|
|
197
|
-
upgradeButton?: string;
|
|
198
|
-
lifetimeLabel?: string;
|
|
199
|
-
statusActive?: string;
|
|
200
|
-
statusExpired?: string;
|
|
201
|
-
statusFree?: string;
|
|
202
|
-
statusCanceled?: string;
|
|
203
|
-
};
|
|
204
|
-
onManageSubscription?: () => void;
|
|
205
|
-
onUpgrade?: () => void;
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
|
|
209
152
|
import type { FeedbackType } from "../../../domains/feedback/domain/entities/FeedbackEntity";
|
|
210
153
|
|
|
211
154
|
/**
|
|
@@ -12,7 +12,6 @@ import type {
|
|
|
12
12
|
LegalConfig,
|
|
13
13
|
DisclaimerConfig,
|
|
14
14
|
UserProfileConfig,
|
|
15
|
-
SubscriptionConfig,
|
|
16
15
|
FeedbackConfig,
|
|
17
16
|
RatingConfig,
|
|
18
17
|
FAQConfig,
|
|
@@ -93,13 +92,6 @@ export interface SettingsConfig {
|
|
|
93
92
|
*/
|
|
94
93
|
userProfile?: boolean | UserProfileConfig;
|
|
95
94
|
|
|
96
|
-
/**
|
|
97
|
-
* Subscription/Premium settings
|
|
98
|
-
* App must provide all data via sectionConfig
|
|
99
|
-
* @default false
|
|
100
|
-
*/
|
|
101
|
-
subscription?: FeatureVisibility | SubscriptionConfig;
|
|
102
|
-
|
|
103
95
|
/**
|
|
104
96
|
* Feedback settings
|
|
105
97
|
* @default 'auto'
|
|
@@ -12,7 +12,6 @@ import type {
|
|
|
12
12
|
LegalConfig,
|
|
13
13
|
DisclaimerConfig,
|
|
14
14
|
UserProfileConfig,
|
|
15
|
-
SubscriptionConfig,
|
|
16
15
|
FeedbackConfig,
|
|
17
16
|
RatingConfig,
|
|
18
17
|
FAQConfig,
|
|
@@ -48,10 +47,6 @@ export interface NormalizedConfig {
|
|
|
48
47
|
enabled: boolean;
|
|
49
48
|
config?: UserProfileConfig;
|
|
50
49
|
};
|
|
51
|
-
subscription: {
|
|
52
|
-
enabled: boolean;
|
|
53
|
-
config?: SubscriptionConfig;
|
|
54
|
-
};
|
|
55
50
|
feedback: {
|
|
56
51
|
enabled: boolean;
|
|
57
52
|
config?: FeedbackConfig;
|
|
@@ -105,10 +100,8 @@ export function normalizeSettingsConfig(
|
|
|
105
100
|
legal: normalizeConfigValue(config?.legal, "auto"),
|
|
106
101
|
disclaimer: normalizeConfigValue(config?.disclaimer, false),
|
|
107
102
|
userProfile: normalizeConfigValue(config?.userProfile, false),
|
|
108
|
-
subscription: normalizeConfigValue(config?.subscription, false),
|
|
109
103
|
feedback: normalizeConfigValue(config?.feedback, false),
|
|
110
104
|
rating: normalizeConfigValue(config?.rating, false),
|
|
111
105
|
faqs: normalizeConfigValue(config?.faqs, false),
|
|
112
106
|
};
|
|
113
107
|
}
|
|
114
|
-
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Subscription Settings Item
|
|
3
|
-
* Settings-style item for subscription/premium status display
|
|
4
|
-
* Follows same visual pattern as other settings items
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from "react";
|
|
8
|
-
import { View, Pressable, StyleSheet } from "react-native";
|
|
9
|
-
import {
|
|
10
|
-
useResponsiveDesignTokens,
|
|
11
|
-
AtomicIcon,
|
|
12
|
-
AtomicText,
|
|
13
|
-
} from "@umituz/react-native-design-system";
|
|
14
|
-
|
|
15
|
-
export interface SubscriptionSettingsItemConfig {
|
|
16
|
-
title: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
isPremium: boolean;
|
|
19
|
-
statusLabel: string;
|
|
20
|
-
icon?: string;
|
|
21
|
-
onPress?: () => void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface SubscriptionSettingsItemProps {
|
|
25
|
-
config: SubscriptionSettingsItemConfig;
|
|
26
|
-
sectionTitle?: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const SubscriptionSettingsItem: React.FC<SubscriptionSettingsItemProps> = ({
|
|
30
|
-
config,
|
|
31
|
-
sectionTitle,
|
|
32
|
-
}) => {
|
|
33
|
-
const tokens = useResponsiveDesignTokens();
|
|
34
|
-
const colors = tokens.colors;
|
|
35
|
-
|
|
36
|
-
const { title, description, isPremium, statusLabel, icon, onPress } = config;
|
|
37
|
-
const displaySectionTitle = sectionTitle || title;
|
|
38
|
-
|
|
39
|
-
if (!title) return null;
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<View style={[styles.sectionContainer, { backgroundColor: colors.surface }]}>
|
|
43
|
-
{!!displaySectionTitle && (
|
|
44
|
-
<View style={styles.headerContainer}>
|
|
45
|
-
<AtomicText type="titleMedium" color="primary">
|
|
46
|
-
{displaySectionTitle}
|
|
47
|
-
</AtomicText>
|
|
48
|
-
</View>
|
|
49
|
-
)}
|
|
50
|
-
<Pressable
|
|
51
|
-
style={({ pressed }) => [
|
|
52
|
-
styles.itemContainer,
|
|
53
|
-
{ backgroundColor: pressed ? `${colors.primary}08` : "transparent" },
|
|
54
|
-
]}
|
|
55
|
-
onPress={onPress}
|
|
56
|
-
>
|
|
57
|
-
<View style={styles.content}>
|
|
58
|
-
<View
|
|
59
|
-
style={[
|
|
60
|
-
styles.iconContainer,
|
|
61
|
-
{ backgroundColor: isPremium ? `${colors.primary}15` : `${colors.textTertiary}15` },
|
|
62
|
-
]}
|
|
63
|
-
>
|
|
64
|
-
<AtomicIcon
|
|
65
|
-
name={icon || "diamond"}
|
|
66
|
-
size="lg"
|
|
67
|
-
color={isPremium ? "primary" : "secondary"}
|
|
68
|
-
/>
|
|
69
|
-
</View>
|
|
70
|
-
<View style={styles.textContainer}>
|
|
71
|
-
<View style={styles.titleRow}>
|
|
72
|
-
<AtomicText
|
|
73
|
-
type="bodyLarge"
|
|
74
|
-
color="primary"
|
|
75
|
-
numberOfLines={1}
|
|
76
|
-
style={styles.title}
|
|
77
|
-
>
|
|
78
|
-
{title}
|
|
79
|
-
</AtomicText>
|
|
80
|
-
<View
|
|
81
|
-
style={[
|
|
82
|
-
styles.statusBadge,
|
|
83
|
-
{ backgroundColor: isPremium ? colors.success : colors.textTertiary },
|
|
84
|
-
]}
|
|
85
|
-
>
|
|
86
|
-
<AtomicText type="labelSmall" style={styles.statusText}>
|
|
87
|
-
{statusLabel}
|
|
88
|
-
</AtomicText>
|
|
89
|
-
</View>
|
|
90
|
-
</View>
|
|
91
|
-
{!!description && (
|
|
92
|
-
<AtomicText type="bodyMedium" color="secondary" numberOfLines={2}>
|
|
93
|
-
{description}
|
|
94
|
-
</AtomicText>
|
|
95
|
-
)}
|
|
96
|
-
</View>
|
|
97
|
-
<AtomicIcon name="chevron-forward" size="md" color="secondary" />
|
|
98
|
-
</View>
|
|
99
|
-
</Pressable>
|
|
100
|
-
</View>
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const styles = StyleSheet.create({
|
|
105
|
-
sectionContainer: {
|
|
106
|
-
marginBottom: 16,
|
|
107
|
-
borderRadius: 12,
|
|
108
|
-
overflow: "hidden",
|
|
109
|
-
},
|
|
110
|
-
headerContainer: {
|
|
111
|
-
paddingHorizontal: 16,
|
|
112
|
-
paddingTop: 16,
|
|
113
|
-
paddingBottom: 8,
|
|
114
|
-
},
|
|
115
|
-
itemContainer: {
|
|
116
|
-
flexDirection: "row",
|
|
117
|
-
alignItems: "center",
|
|
118
|
-
paddingHorizontal: 16,
|
|
119
|
-
paddingVertical: 16,
|
|
120
|
-
minHeight: 72,
|
|
121
|
-
},
|
|
122
|
-
content: {
|
|
123
|
-
flex: 1,
|
|
124
|
-
flexDirection: "row",
|
|
125
|
-
alignItems: "center",
|
|
126
|
-
},
|
|
127
|
-
iconContainer: {
|
|
128
|
-
width: 48,
|
|
129
|
-
height: 48,
|
|
130
|
-
borderRadius: 12,
|
|
131
|
-
justifyContent: "center",
|
|
132
|
-
alignItems: "center",
|
|
133
|
-
marginRight: 16,
|
|
134
|
-
},
|
|
135
|
-
textContainer: {
|
|
136
|
-
flex: 1,
|
|
137
|
-
marginRight: 8,
|
|
138
|
-
},
|
|
139
|
-
titleRow: {
|
|
140
|
-
flexDirection: "row",
|
|
141
|
-
alignItems: "center",
|
|
142
|
-
marginBottom: 4,
|
|
143
|
-
},
|
|
144
|
-
title: {
|
|
145
|
-
flex: 1,
|
|
146
|
-
},
|
|
147
|
-
statusBadge: {
|
|
148
|
-
paddingHorizontal: 8,
|
|
149
|
-
paddingVertical: 2,
|
|
150
|
-
borderRadius: 4,
|
|
151
|
-
marginLeft: 8,
|
|
152
|
-
},
|
|
153
|
-
statusText: {
|
|
154
|
-
color: "#FFFFFF",
|
|
155
|
-
fontWeight: "600",
|
|
156
|
-
},
|
|
157
|
-
});
|