@umituz/react-native-settings 4.16.6 → 4.16.7
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 +7 -5
- package/src/presentation/screens/components/SettingsContent.tsx +22 -11
- package/src/presentation/screens/hooks/useFeatureDetection.ts +2 -0
- package/src/presentation/screens/types/FeatureConfig.ts +22 -7
- package/src/presentation/screens/types/SettingsConfig.ts +6 -0
- package/src/presentation/screens/types/index.ts +1 -0
- package/src/presentation/screens/utils/normalizeConfig.ts +6 -0
- package/src/presentation/components/FeedbackSupportSection.tsx +0 -59
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.7",
|
|
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",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@react-navigation/native": ">=6.0.0",
|
|
31
31
|
"@react-navigation/stack": ">=6.0.0",
|
|
32
32
|
"@umituz/react-native-about": "^1.11.3",
|
|
33
|
-
"@umituz/react-native-avatar": "*",
|
|
34
33
|
"@umituz/react-native-appearance": "*",
|
|
34
|
+
"@umituz/react-native-avatar": "*",
|
|
35
35
|
"@umituz/react-native-design-system": "*",
|
|
36
36
|
"@umituz/react-native-design-system-atoms": "*",
|
|
37
37
|
"@umituz/react-native-design-system-molecules": "*",
|
|
@@ -40,11 +40,12 @@
|
|
|
40
40
|
"@umituz/react-native-design-system-theme": "*",
|
|
41
41
|
"@umituz/react-native-design-system-typography": "*",
|
|
42
42
|
"@umituz/react-native-exception": "latest",
|
|
43
|
-
"@umituz/react-native-feedback": "
|
|
43
|
+
"@umituz/react-native-feedback": "^1.3.0",
|
|
44
44
|
"@umituz/react-native-legal": "*",
|
|
45
45
|
"@umituz/react-native-localization": "*",
|
|
46
46
|
"@umituz/react-native-notifications": "*",
|
|
47
47
|
"@umituz/react-native-onboarding": "*",
|
|
48
|
+
"@umituz/react-native-rating": "*",
|
|
48
49
|
"@umituz/react-native-storage": "*",
|
|
49
50
|
"lucide-react-native": "*",
|
|
50
51
|
"react": ">=18.2.0",
|
|
@@ -76,11 +77,12 @@
|
|
|
76
77
|
"@umituz/react-native-design-system-responsive": "latest",
|
|
77
78
|
"@umituz/react-native-design-system-theme": "latest",
|
|
78
79
|
"@umituz/react-native-design-system-typography": "latest",
|
|
79
|
-
"@umituz/react-native-feedback": "
|
|
80
|
+
"@umituz/react-native-feedback": "^1.3.0",
|
|
80
81
|
"@umituz/react-native-legal": "^2.0.3",
|
|
81
82
|
"@umituz/react-native-localization": "latest",
|
|
82
83
|
"@umituz/react-native-notifications": "latest",
|
|
83
84
|
"@umituz/react-native-onboarding": "^3.3.0",
|
|
85
|
+
"@umituz/react-native-rating": "^1.4.0",
|
|
84
86
|
"@umituz/react-native-storage": "latest",
|
|
85
87
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
86
88
|
"expo-constants": "^18.0.12",
|
|
@@ -100,4 +102,4 @@
|
|
|
100
102
|
"README.md",
|
|
101
103
|
"LICENSE"
|
|
102
104
|
]
|
|
103
|
-
}
|
|
105
|
+
}
|
|
@@ -17,7 +17,8 @@ import { AboutSection } from "@umituz/react-native-about";
|
|
|
17
17
|
import { LegalSection } from "@umituz/react-native-legal";
|
|
18
18
|
import { AppearanceSection } from "@umituz/react-native-appearance";
|
|
19
19
|
import { LanguageSection } from "@umituz/react-native-localization";
|
|
20
|
-
import {
|
|
20
|
+
import { SupportSection } from "@umituz/react-native-feedback";
|
|
21
|
+
import { SettingItem } from "../../components/SettingItem";
|
|
21
22
|
import type { NormalizedConfig } from "../utils/normalizeConfig";
|
|
22
23
|
import type { CustomSettingsSection } from "../types";
|
|
23
24
|
|
|
@@ -58,6 +59,7 @@ interface SettingsContentProps {
|
|
|
58
59
|
userProfile: boolean;
|
|
59
60
|
subscription: boolean;
|
|
60
61
|
feedback: boolean;
|
|
62
|
+
rating: boolean;
|
|
61
63
|
};
|
|
62
64
|
showUserProfile?: boolean;
|
|
63
65
|
userProfile?: {
|
|
@@ -218,16 +220,25 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
218
220
|
/>
|
|
219
221
|
)}
|
|
220
222
|
|
|
221
|
-
{features.feedback && (
|
|
222
|
-
<
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
normalizedConfig.feedback.config?.
|
|
230
|
-
t("settings.feedback.description") || "Send Feedback",
|
|
223
|
+
{(features.feedback || features.rating) && (
|
|
224
|
+
<SupportSection
|
|
225
|
+
renderSection={(props: any) => <SettingsSection {...props} />}
|
|
226
|
+
renderItem={(props: any) => <SettingItem {...props} />}
|
|
227
|
+
feedbackConfig={{
|
|
228
|
+
enabled: features.feedback,
|
|
229
|
+
config: {
|
|
230
|
+
...normalizedConfig.feedback.config,
|
|
231
|
+
title: normalizedConfig.feedback.config?.title || t("settings.support.title") || "Support",
|
|
232
|
+
description: normalizedConfig.feedback.config?.description || t("settings.feedback.description") || "Send Feedback",
|
|
233
|
+
}
|
|
234
|
+
}}
|
|
235
|
+
ratingConfig={{
|
|
236
|
+
enabled: features.rating,
|
|
237
|
+
config: {
|
|
238
|
+
...normalizedConfig.rating.config,
|
|
239
|
+
title: normalizedConfig.rating.config?.title || t("settings.support.title") || "Support",
|
|
240
|
+
description: normalizedConfig.rating.config?.description || t("settings.rating.description") || "Rate Us",
|
|
241
|
+
}
|
|
231
242
|
}}
|
|
232
243
|
/>
|
|
233
244
|
)}
|
|
@@ -71,6 +71,7 @@ export function useFeatureDetection(
|
|
|
71
71
|
userProfile,
|
|
72
72
|
subscription,
|
|
73
73
|
feedback,
|
|
74
|
+
rating,
|
|
74
75
|
} = normalizedConfig;
|
|
75
76
|
|
|
76
77
|
const notificationServiceAvailable =
|
|
@@ -125,6 +126,7 @@ export function useFeatureDetection(
|
|
|
125
126
|
subscription.enabled &&
|
|
126
127
|
subscription.config?.sectionConfig !== undefined,
|
|
127
128
|
feedback: feedback.enabled,
|
|
129
|
+
rating: rating.enabled,
|
|
128
130
|
};
|
|
129
131
|
}, [normalizedConfig, navigation, options]);
|
|
130
132
|
}
|
|
@@ -169,18 +169,33 @@ export interface SubscriptionConfig {
|
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
import type { FeedbackType } from "@umituz/react-native-feedback";
|
|
173
|
+
|
|
172
174
|
/**
|
|
173
175
|
* Feedback Settings Configuration
|
|
174
176
|
*/
|
|
175
177
|
export interface FeedbackConfig {
|
|
176
|
-
/**
|
|
177
|
-
enabled?:
|
|
178
|
-
/** Custom feedback
|
|
178
|
+
/** Enable feedback feature */
|
|
179
|
+
enabled?: boolean;
|
|
180
|
+
/** Custom title for the feedback section */
|
|
179
181
|
title?: string;
|
|
180
|
-
/** Custom feedback
|
|
182
|
+
/** Custom label for the feedback item */
|
|
181
183
|
description?: string;
|
|
182
184
|
/** Initial feedback type */
|
|
183
|
-
initialType?:
|
|
184
|
-
/**
|
|
185
|
-
onSubmit?: (data: { type:
|
|
185
|
+
initialType?: FeedbackType;
|
|
186
|
+
/** Feedback submission handler */
|
|
187
|
+
onSubmit?: (data: { type: any; rating: number; description: string; title: string }) => Promise<void>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface RatingConfig {
|
|
191
|
+
/** Enable rating feature */
|
|
192
|
+
enabled?: boolean;
|
|
193
|
+
/** Custom title for the rating section */
|
|
194
|
+
title?: string;
|
|
195
|
+
/** Custom label for the rate app button */
|
|
196
|
+
description?: string;
|
|
197
|
+
/** Store URL for direct linking (optional) */
|
|
198
|
+
storeUrl?: string;
|
|
199
|
+
/** Custom handler for rating action (e.g. open store review) */
|
|
200
|
+
onRate?: () => void;
|
|
186
201
|
}
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
UserProfileConfig,
|
|
15
15
|
SubscriptionConfig,
|
|
16
16
|
FeedbackConfig,
|
|
17
|
+
RatingConfig,
|
|
17
18
|
} from "./FeatureConfig";
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -103,6 +104,11 @@ export interface SettingsConfig {
|
|
|
103
104
|
*/
|
|
104
105
|
feedback?: FeatureVisibility | FeedbackConfig;
|
|
105
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Rating settings configuration
|
|
109
|
+
*/
|
|
110
|
+
rating?: FeatureVisibility | RatingConfig;
|
|
111
|
+
|
|
106
112
|
/**
|
|
107
113
|
* Custom empty state text when no settings are available
|
|
108
114
|
*/
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
UserProfileConfig,
|
|
15
15
|
SubscriptionConfig,
|
|
16
16
|
FeedbackConfig,
|
|
17
|
+
RatingConfig,
|
|
17
18
|
SettingsConfig,
|
|
18
19
|
} from "../types";
|
|
19
20
|
|
|
@@ -54,6 +55,10 @@ export interface NormalizedConfig {
|
|
|
54
55
|
enabled: boolean;
|
|
55
56
|
config?: FeedbackConfig;
|
|
56
57
|
};
|
|
58
|
+
rating: {
|
|
59
|
+
enabled: boolean;
|
|
60
|
+
config?: RatingConfig;
|
|
61
|
+
};
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
/**
|
|
@@ -97,6 +102,7 @@ export function normalizeSettingsConfig(
|
|
|
97
102
|
userProfile: normalizeConfigValue(config?.userProfile, false),
|
|
98
103
|
subscription: normalizeConfigValue(config?.subscription, false),
|
|
99
104
|
feedback: normalizeConfigValue(config?.feedback, false),
|
|
105
|
+
rating: normalizeConfigValue(config?.rating, false),
|
|
100
106
|
};
|
|
101
107
|
}
|
|
102
108
|
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Feedback Support Section Component
|
|
3
|
-
* Renders a Feedback Item and Modal
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useState } from "react";
|
|
7
|
-
import { SettingsSection } from "./SettingsSection";
|
|
8
|
-
import { SettingItem } from "./SettingItem";
|
|
9
|
-
import { FeedbackModal } from "@umituz/react-native-feedback";
|
|
10
|
-
import { MessageSquare } from "lucide-react-native";
|
|
11
|
-
import type { FeedbackConfig } from "../screens/types/FeatureConfig";
|
|
12
|
-
|
|
13
|
-
export interface FeedbackSupportSectionProps {
|
|
14
|
-
config: FeedbackConfig;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const FeedbackSupportSection: React.FC<FeedbackSupportSectionProps> = ({ config }) => {
|
|
18
|
-
const [modalVisible, setModalVisible] = useState(false);
|
|
19
|
-
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
20
|
-
|
|
21
|
-
const handleSubmit = async (data: { type: any; rating: number; description: string; title: string }) => {
|
|
22
|
-
if (config.onSubmit) {
|
|
23
|
-
setIsSubmitting(true);
|
|
24
|
-
try {
|
|
25
|
-
await config.onSubmit(data);
|
|
26
|
-
setModalVisible(false);
|
|
27
|
-
} catch (error) {
|
|
28
|
-
console.error("Feedback submission error:", error);
|
|
29
|
-
// Ideally show toast or alert here
|
|
30
|
-
} finally {
|
|
31
|
-
setIsSubmitting(false);
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
console.warn("No onSubmit handler provided for Feedback");
|
|
35
|
-
setModalVisible(false);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<>
|
|
41
|
-
<SettingsSection title={config.title || "Support"}>
|
|
42
|
-
<SettingItem
|
|
43
|
-
title={config.description || "Send Feedback"}
|
|
44
|
-
icon={MessageSquare as any}
|
|
45
|
-
onPress={() => setModalVisible(true)}
|
|
46
|
-
/>
|
|
47
|
-
</SettingsSection>
|
|
48
|
-
|
|
49
|
-
<FeedbackModal
|
|
50
|
-
visible={modalVisible}
|
|
51
|
-
onClose={() => setModalVisible(false)}
|
|
52
|
-
onSubmit={handleSubmit}
|
|
53
|
-
initialType={config.initialType}
|
|
54
|
-
isSubmitting={isSubmitting}
|
|
55
|
-
title={config.title ? undefined : "Send Feedback"} // Use config title if passed? No, modal title usually fixed or different.
|
|
56
|
-
/>
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
};
|