@umituz/react-native-settings 4.16.6 → 4.16.8
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 +9 -5
- package/src/presentation/screens/components/SettingsContent.tsx +38 -10
- package/src/presentation/screens/hooks/useFeatureDetection.ts +4 -0
- package/src/presentation/screens/types/FeatureConfig.ts +35 -7
- package/src/presentation/screens/types/SettingsConfig.ts +12 -0
- package/src/presentation/screens/types/index.ts +2 -0
- package/src/presentation/screens/utils/normalizeConfig.ts +12 -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.8",
|
|
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,13 @@
|
|
|
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-
|
|
43
|
+
"@umituz/react-native-faqs": "^1.0.1",
|
|
44
|
+
"@umituz/react-native-feedback": "^1.3.0",
|
|
44
45
|
"@umituz/react-native-legal": "*",
|
|
45
46
|
"@umituz/react-native-localization": "*",
|
|
46
47
|
"@umituz/react-native-notifications": "*",
|
|
47
48
|
"@umituz/react-native-onboarding": "*",
|
|
49
|
+
"@umituz/react-native-rating": "*",
|
|
48
50
|
"@umituz/react-native-storage": "*",
|
|
49
51
|
"lucide-react-native": "*",
|
|
50
52
|
"react": ">=18.2.0",
|
|
@@ -76,11 +78,13 @@
|
|
|
76
78
|
"@umituz/react-native-design-system-responsive": "latest",
|
|
77
79
|
"@umituz/react-native-design-system-theme": "latest",
|
|
78
80
|
"@umituz/react-native-design-system-typography": "latest",
|
|
79
|
-
"@umituz/react-native-
|
|
81
|
+
"@umituz/react-native-faqs": "latest",
|
|
82
|
+
"@umituz/react-native-feedback": "^1.3.0",
|
|
80
83
|
"@umituz/react-native-legal": "^2.0.3",
|
|
81
84
|
"@umituz/react-native-localization": "latest",
|
|
82
85
|
"@umituz/react-native-notifications": "latest",
|
|
83
86
|
"@umituz/react-native-onboarding": "^3.3.0",
|
|
87
|
+
"@umituz/react-native-rating": "^1.4.0",
|
|
84
88
|
"@umituz/react-native-storage": "latest",
|
|
85
89
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
86
90
|
"expo-constants": "^18.0.12",
|
|
@@ -100,4 +104,4 @@
|
|
|
100
104
|
"README.md",
|
|
101
105
|
"LICENSE"
|
|
102
106
|
]
|
|
103
|
-
}
|
|
107
|
+
}
|
|
@@ -17,7 +17,9 @@ 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 { FAQSection } from "@umituz/react-native-faqs";
|
|
22
|
+
import { SettingItem } from "../../components/SettingItem";
|
|
21
23
|
import type { NormalizedConfig } from "../utils/normalizeConfig";
|
|
22
24
|
import type { CustomSettingsSection } from "../types";
|
|
23
25
|
|
|
@@ -58,6 +60,8 @@ interface SettingsContentProps {
|
|
|
58
60
|
userProfile: boolean;
|
|
59
61
|
subscription: boolean;
|
|
60
62
|
feedback: boolean;
|
|
63
|
+
rating: boolean;
|
|
64
|
+
faqs: boolean;
|
|
61
65
|
};
|
|
62
66
|
showUserProfile?: boolean;
|
|
63
67
|
userProfile?: {
|
|
@@ -105,6 +109,8 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
105
109
|
features.disclaimer ||
|
|
106
110
|
features.subscription ||
|
|
107
111
|
features.feedback ||
|
|
112
|
+
features.rating ||
|
|
113
|
+
features.faqs ||
|
|
108
114
|
customSections.length > 0,
|
|
109
115
|
[features, customSections.length]
|
|
110
116
|
);
|
|
@@ -218,16 +224,38 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
|
|
|
218
224
|
/>
|
|
219
225
|
)}
|
|
220
226
|
|
|
221
|
-
{features.feedback && (
|
|
222
|
-
<
|
|
227
|
+
{(features.feedback || features.rating) && (
|
|
228
|
+
<SupportSection
|
|
229
|
+
renderSection={(props: any) => <SettingsSection {...props} />}
|
|
230
|
+
renderItem={(props: any) => <SettingItem {...props} />}
|
|
231
|
+
feedbackConfig={{
|
|
232
|
+
enabled: features.feedback,
|
|
233
|
+
config: {
|
|
234
|
+
...normalizedConfig.feedback.config,
|
|
235
|
+
title: normalizedConfig.feedback.config?.title || t("settings.support.title") || "Support",
|
|
236
|
+
description: normalizedConfig.feedback.config?.description || t("settings.feedback.description") || "Send Feedback",
|
|
237
|
+
}
|
|
238
|
+
}}
|
|
239
|
+
ratingConfig={{
|
|
240
|
+
enabled: features.rating,
|
|
241
|
+
config: {
|
|
242
|
+
...normalizedConfig.rating.config,
|
|
243
|
+
title: normalizedConfig.rating.config?.title || t("settings.support.title") || "Support",
|
|
244
|
+
description: normalizedConfig.rating.config?.description || t("settings.rating.description") || "Rate Us",
|
|
245
|
+
}
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
)}
|
|
249
|
+
|
|
250
|
+
{features.faqs && (
|
|
251
|
+
<FAQSection
|
|
252
|
+
renderSection={(props: any) => <SettingsSection {...props} />}
|
|
253
|
+
renderItem={(props: any) => <SettingItem {...props} />}
|
|
223
254
|
config={{
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
description:
|
|
229
|
-
normalizedConfig.feedback.config?.description ||
|
|
230
|
-
t("settings.feedback.description") || "Send Feedback",
|
|
255
|
+
enabled: features.faqs,
|
|
256
|
+
...normalizedConfig.faqs.config,
|
|
257
|
+
title: normalizedConfig.faqs.config?.title || t("settings.support.title") || "Support",
|
|
258
|
+
description: normalizedConfig.faqs.config?.description || t("settings.faqs.description") || "FAQs",
|
|
231
259
|
}}
|
|
232
260
|
/>
|
|
233
261
|
)}
|
|
@@ -71,6 +71,8 @@ export function useFeatureDetection(
|
|
|
71
71
|
userProfile,
|
|
72
72
|
subscription,
|
|
73
73
|
feedback,
|
|
74
|
+
rating,
|
|
75
|
+
faqs,
|
|
74
76
|
} = normalizedConfig;
|
|
75
77
|
|
|
76
78
|
const notificationServiceAvailable =
|
|
@@ -125,6 +127,8 @@ export function useFeatureDetection(
|
|
|
125
127
|
subscription.enabled &&
|
|
126
128
|
subscription.config?.sectionConfig !== undefined,
|
|
127
129
|
feedback: feedback.enabled,
|
|
130
|
+
rating: rating.enabled,
|
|
131
|
+
faqs: faqs.enabled,
|
|
128
132
|
};
|
|
129
133
|
}, [normalizedConfig, navigation, options]);
|
|
130
134
|
}
|
|
@@ -169,18 +169,46 @@ 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 FAQConfig {
|
|
191
|
+
/** Enable FAQ feature */
|
|
192
|
+
enabled?: boolean;
|
|
193
|
+
/** Custom title for the FAQ section */
|
|
194
|
+
title?: string;
|
|
195
|
+
/** Custom label for the FAQ button */
|
|
196
|
+
description?: string;
|
|
197
|
+
/** FAQ items passed from app */
|
|
198
|
+
items?: any[];
|
|
199
|
+
/** Handler to open FAQ screen */
|
|
200
|
+
onPress?: () => void;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface RatingConfig {
|
|
204
|
+
/** Enable rating feature */
|
|
205
|
+
enabled?: boolean;
|
|
206
|
+
/** Custom title for the rating section */
|
|
207
|
+
title?: string;
|
|
208
|
+
/** Custom label for the rate app button */
|
|
209
|
+
description?: string;
|
|
210
|
+
/** Store URL for direct linking (optional) */
|
|
211
|
+
storeUrl?: string;
|
|
212
|
+
/** Custom handler for rating action (e.g. open store review) */
|
|
213
|
+
onRate?: () => void;
|
|
186
214
|
}
|
|
@@ -14,6 +14,8 @@ import type {
|
|
|
14
14
|
UserProfileConfig,
|
|
15
15
|
SubscriptionConfig,
|
|
16
16
|
FeedbackConfig,
|
|
17
|
+
RatingConfig,
|
|
18
|
+
FAQConfig,
|
|
17
19
|
} from "./FeatureConfig";
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -103,6 +105,16 @@ export interface SettingsConfig {
|
|
|
103
105
|
*/
|
|
104
106
|
feedback?: FeatureVisibility | FeedbackConfig;
|
|
105
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Rating settings configuration
|
|
110
|
+
*/
|
|
111
|
+
rating?: FeatureVisibility | RatingConfig;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* FAQ settings configuration
|
|
115
|
+
*/
|
|
116
|
+
faqs?: FeatureVisibility | FAQConfig;
|
|
117
|
+
|
|
106
118
|
/**
|
|
107
119
|
* Custom empty state text when no settings are available
|
|
108
120
|
*/
|
|
@@ -14,6 +14,8 @@ export type {
|
|
|
14
14
|
UserProfileConfig,
|
|
15
15
|
SubscriptionConfig,
|
|
16
16
|
FeedbackConfig,
|
|
17
|
+
RatingConfig,
|
|
18
|
+
FAQConfig,
|
|
17
19
|
} from "./FeatureConfig";
|
|
18
20
|
export type { SettingsConfig } from "./SettingsConfig";
|
|
19
21
|
export type { CustomSettingsSection } from "./CustomSection";
|
|
@@ -14,6 +14,8 @@ import type {
|
|
|
14
14
|
UserProfileConfig,
|
|
15
15
|
SubscriptionConfig,
|
|
16
16
|
FeedbackConfig,
|
|
17
|
+
RatingConfig,
|
|
18
|
+
FAQConfig,
|
|
17
19
|
SettingsConfig,
|
|
18
20
|
} from "../types";
|
|
19
21
|
|
|
@@ -54,6 +56,14 @@ export interface NormalizedConfig {
|
|
|
54
56
|
enabled: boolean;
|
|
55
57
|
config?: FeedbackConfig;
|
|
56
58
|
};
|
|
59
|
+
rating: {
|
|
60
|
+
enabled: boolean;
|
|
61
|
+
config?: RatingConfig;
|
|
62
|
+
};
|
|
63
|
+
faqs: {
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
config?: FAQConfig;
|
|
66
|
+
};
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
/**
|
|
@@ -97,6 +107,8 @@ export function normalizeSettingsConfig(
|
|
|
97
107
|
userProfile: normalizeConfigValue(config?.userProfile, false),
|
|
98
108
|
subscription: normalizeConfigValue(config?.subscription, false),
|
|
99
109
|
feedback: normalizeConfigValue(config?.feedback, false),
|
|
110
|
+
rating: normalizeConfigValue(config?.rating, false),
|
|
111
|
+
faqs: normalizeConfigValue(config?.faqs, false),
|
|
100
112
|
};
|
|
101
113
|
}
|
|
102
114
|
|
|
@@ -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
|
-
};
|