@umituz/react-native-settings 4.23.37 → 4.23.40
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/presentation/utils/config-creators/base-configs.ts +90 -0
- package/src/presentation/utils/config-creators/feature-configs.ts +61 -0
- package/src/presentation/utils/config-creators/index.ts +28 -0
- package/src/presentation/utils/config-creators/support-configs.ts +53 -0
- package/src/presentation/utils/config-creators/types.ts +18 -0
- package/src/presentation/utils/index.ts +1 -1
- package/src/presentation/utils/configCreators.ts +0 -206
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.40",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Settings Config Creators
|
|
3
|
+
* Standard settings: appearance, language, notifications, about, legal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
AppearanceConfig,
|
|
8
|
+
LanguageConfig,
|
|
9
|
+
NotificationsConfig,
|
|
10
|
+
AboutConfig,
|
|
11
|
+
LegalConfig,
|
|
12
|
+
} from "../../screens/types";
|
|
13
|
+
import type { TranslationFunction } from "./types";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create appearance configuration
|
|
17
|
+
*/
|
|
18
|
+
export const createAppearanceConfig = (
|
|
19
|
+
t: TranslationFunction,
|
|
20
|
+
routeOrOnPress?: string | (() => void),
|
|
21
|
+
): AppearanceConfig => ({
|
|
22
|
+
enabled: true,
|
|
23
|
+
title: t("settings.appearance.title"),
|
|
24
|
+
description: t("settings.appearance.description"),
|
|
25
|
+
icon: "color-palette-outline",
|
|
26
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
27
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Create language configuration
|
|
32
|
+
*/
|
|
33
|
+
export const createLanguageConfig = (
|
|
34
|
+
t: TranslationFunction,
|
|
35
|
+
routeOrOnPress?: string | (() => void),
|
|
36
|
+
): LanguageConfig => ({
|
|
37
|
+
enabled: true,
|
|
38
|
+
title: t("settings.language.title"),
|
|
39
|
+
description: t("settings.language.description"),
|
|
40
|
+
icon: "globe-outline",
|
|
41
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
42
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Create notifications configuration
|
|
47
|
+
*/
|
|
48
|
+
export const createNotificationsConfig = (
|
|
49
|
+
t: TranslationFunction,
|
|
50
|
+
routeOrOnPress?: string | (() => void),
|
|
51
|
+
): NotificationsConfig => ({
|
|
52
|
+
enabled: true,
|
|
53
|
+
showToggle: false,
|
|
54
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : "Notifications",
|
|
55
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
56
|
+
title: t("settings.notifications.title"),
|
|
57
|
+
description: t("settings.notifications.description"),
|
|
58
|
+
sectionTitle: t("settings.notifications.sectionTitle"),
|
|
59
|
+
icon: "notifications-outline",
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Create about configuration
|
|
64
|
+
*/
|
|
65
|
+
export const createAboutConfig = (
|
|
66
|
+
t: TranslationFunction,
|
|
67
|
+
routeOrOnPress?: string | (() => void),
|
|
68
|
+
): AboutConfig => ({
|
|
69
|
+
enabled: true,
|
|
70
|
+
title: t("settings.about.title"),
|
|
71
|
+
description: t("settings.about.description"),
|
|
72
|
+
icon: "information-circle-outline",
|
|
73
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
74
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Create legal configuration
|
|
79
|
+
*/
|
|
80
|
+
export const createLegalConfig = (
|
|
81
|
+
t: TranslationFunction,
|
|
82
|
+
routeOrOnPress?: string | (() => void),
|
|
83
|
+
): LegalConfig => ({
|
|
84
|
+
enabled: true,
|
|
85
|
+
title: t("settings.legal.title"),
|
|
86
|
+
description: t("settings.legal.description"),
|
|
87
|
+
icon: "document-text-outline",
|
|
88
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
89
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
90
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature Settings Config Creators
|
|
3
|
+
* Subscription, gamification
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { SubscriptionConfig } from "../../screens/types";
|
|
7
|
+
import type {
|
|
8
|
+
GamificationConfig,
|
|
9
|
+
AchievementDefinition,
|
|
10
|
+
LevelDefinition,
|
|
11
|
+
} from "../../../domains/gamification/types";
|
|
12
|
+
import type { TranslationFunction } from "./types";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Create subscription configuration
|
|
16
|
+
* @param route - Navigation route name (preferred for stack navigation)
|
|
17
|
+
* @param onPress - Callback function (use route instead when possible)
|
|
18
|
+
*/
|
|
19
|
+
export const createSubscriptionConfig = (
|
|
20
|
+
t: TranslationFunction,
|
|
21
|
+
isPremium: boolean,
|
|
22
|
+
routeOrOnPress: string | (() => void),
|
|
23
|
+
): SubscriptionConfig => ({
|
|
24
|
+
enabled: true,
|
|
25
|
+
title: t("settings.subscription.title"),
|
|
26
|
+
description: isPremium
|
|
27
|
+
? t("subscription.premiumDetails.statusActive")
|
|
28
|
+
: t("settings.subscription.description"),
|
|
29
|
+
icon: "diamond",
|
|
30
|
+
sectionTitle: t("settings.sections.subscription").toUpperCase(),
|
|
31
|
+
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
32
|
+
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
33
|
+
isPremium,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Create gamification configuration
|
|
38
|
+
*/
|
|
39
|
+
export const createGamificationConfig = (
|
|
40
|
+
t: TranslationFunction,
|
|
41
|
+
storageKey: string,
|
|
42
|
+
achievements: AchievementDefinition[],
|
|
43
|
+
levels: LevelDefinition[],
|
|
44
|
+
enabled = true,
|
|
45
|
+
): GamificationConfig => ({
|
|
46
|
+
enabled,
|
|
47
|
+
storageKey,
|
|
48
|
+
achievements,
|
|
49
|
+
levels,
|
|
50
|
+
translations: {
|
|
51
|
+
title: t("settings.gamification.title"),
|
|
52
|
+
statsTitle: t("settings.gamification.stats.title"),
|
|
53
|
+
achievementsTitle: t("settings.gamification.achievements.title"),
|
|
54
|
+
streakTitle: t("settings.gamification.streak.title"),
|
|
55
|
+
bestStreak: t("settings.gamification.streak.best"),
|
|
56
|
+
currentStreak: t("settings.gamification.streak.current"),
|
|
57
|
+
days: t("settings.gamification.streak.days"),
|
|
58
|
+
levelTitle: t("settings.gamification.level.title"),
|
|
59
|
+
emptyAchievements: t("settings.gamification.achievements.empty"),
|
|
60
|
+
},
|
|
61
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Creators - Barrel export
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Types
|
|
6
|
+
export type { TranslationFunction, FeedbackFormData } from "./types";
|
|
7
|
+
|
|
8
|
+
// Base configs
|
|
9
|
+
export {
|
|
10
|
+
createAppearanceConfig,
|
|
11
|
+
createLanguageConfig,
|
|
12
|
+
createNotificationsConfig,
|
|
13
|
+
createAboutConfig,
|
|
14
|
+
createLegalConfig,
|
|
15
|
+
} from "./base-configs";
|
|
16
|
+
|
|
17
|
+
// Support configs
|
|
18
|
+
export {
|
|
19
|
+
createFeedbackConfig,
|
|
20
|
+
createRatingConfig,
|
|
21
|
+
createFAQConfig,
|
|
22
|
+
} from "./support-configs";
|
|
23
|
+
|
|
24
|
+
// Feature configs
|
|
25
|
+
export {
|
|
26
|
+
createSubscriptionConfig,
|
|
27
|
+
createGamificationConfig,
|
|
28
|
+
} from "./feature-configs";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Support Settings Config Creators
|
|
3
|
+
* Feedback, rating, FAQ
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
FeedbackConfig,
|
|
8
|
+
RatingConfig,
|
|
9
|
+
FAQConfig,
|
|
10
|
+
} from "../../screens/types";
|
|
11
|
+
import type { TranslationFunction, FeedbackFormData } from "./types";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Create feedback configuration
|
|
15
|
+
*/
|
|
16
|
+
export const createFeedbackConfig = (
|
|
17
|
+
t: TranslationFunction,
|
|
18
|
+
onSubmit: (data: FeedbackFormData) => Promise<void>,
|
|
19
|
+
): FeedbackConfig => ({
|
|
20
|
+
enabled: true,
|
|
21
|
+
title: t("settings.feedback.title"),
|
|
22
|
+
description: t("settings.feedback.description"),
|
|
23
|
+
icon: "chatbubble-outline",
|
|
24
|
+
sectionTitle: t("settings.sections.support"),
|
|
25
|
+
onSubmit,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create rating configuration
|
|
30
|
+
*/
|
|
31
|
+
export const createRatingConfig = (
|
|
32
|
+
t: TranslationFunction,
|
|
33
|
+
onRate: () => void,
|
|
34
|
+
storeUrl?: string,
|
|
35
|
+
): RatingConfig => ({
|
|
36
|
+
enabled: true,
|
|
37
|
+
onRate,
|
|
38
|
+
storeUrl,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Create FAQ configuration
|
|
43
|
+
* Navigation is handled internally by the package - no callback needed
|
|
44
|
+
*/
|
|
45
|
+
export const createFAQConfig = (
|
|
46
|
+
t: TranslationFunction,
|
|
47
|
+
): FAQConfig => ({
|
|
48
|
+
enabled: true,
|
|
49
|
+
title: t("settings.faqs.title"),
|
|
50
|
+
description: t("settings.faqs.description"),
|
|
51
|
+
icon: "help-circle-outline",
|
|
52
|
+
sectionTitle: t("settings.sections.support").toUpperCase(),
|
|
53
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Creator Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Translation function type
|
|
7
|
+
*/
|
|
8
|
+
export type TranslationFunction = (key: string) => string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Feedback form data interface
|
|
12
|
+
*/
|
|
13
|
+
export interface FeedbackFormData {
|
|
14
|
+
type: string;
|
|
15
|
+
rating: number;
|
|
16
|
+
description: string;
|
|
17
|
+
title: string;
|
|
18
|
+
}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings Config Creators
|
|
3
|
-
* Utility functions to create standard settings configurations
|
|
4
|
-
* Used across 100+ apps - keep generic and flexible
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type {
|
|
8
|
-
AppearanceConfig,
|
|
9
|
-
LanguageConfig,
|
|
10
|
-
NotificationsConfig,
|
|
11
|
-
AboutConfig,
|
|
12
|
-
LegalConfig,
|
|
13
|
-
FeedbackConfig,
|
|
14
|
-
UserProfileConfig,
|
|
15
|
-
RatingConfig,
|
|
16
|
-
FAQConfig,
|
|
17
|
-
SubscriptionConfig,
|
|
18
|
-
} from "../screens/types";
|
|
19
|
-
import type {
|
|
20
|
-
GamificationConfig,
|
|
21
|
-
AchievementDefinition,
|
|
22
|
-
LevelDefinition,
|
|
23
|
-
} from "../../domains/gamification/types";
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Translation function type
|
|
27
|
-
*/
|
|
28
|
-
export type TranslationFunction = (key: string) => string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Create appearance configuration
|
|
32
|
-
*/
|
|
33
|
-
export const createAppearanceConfig = (
|
|
34
|
-
t: TranslationFunction,
|
|
35
|
-
routeOrOnPress?: string | (() => void),
|
|
36
|
-
): AppearanceConfig => ({
|
|
37
|
-
enabled: true,
|
|
38
|
-
title: t("settings.appearance.title"),
|
|
39
|
-
description: t("settings.appearance.description"),
|
|
40
|
-
icon: "color-palette-outline",
|
|
41
|
-
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
42
|
-
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Create language configuration
|
|
47
|
-
*/
|
|
48
|
-
export const createLanguageConfig = (
|
|
49
|
-
t: TranslationFunction,
|
|
50
|
-
routeOrOnPress?: string | (() => void),
|
|
51
|
-
): LanguageConfig => ({
|
|
52
|
-
enabled: true,
|
|
53
|
-
title: t("settings.language.title"),
|
|
54
|
-
description: t("settings.language.description"),
|
|
55
|
-
icon: "globe-outline",
|
|
56
|
-
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
57
|
-
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Create notifications configuration
|
|
62
|
-
*/
|
|
63
|
-
export const createNotificationsConfig = (
|
|
64
|
-
t: TranslationFunction,
|
|
65
|
-
routeOrOnPress?: string | (() => void),
|
|
66
|
-
): NotificationsConfig => ({
|
|
67
|
-
enabled: true,
|
|
68
|
-
showToggle: false,
|
|
69
|
-
route: typeof routeOrOnPress === "string" ? routeOrOnPress : "Notifications",
|
|
70
|
-
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
71
|
-
title: t("settings.notifications.title"),
|
|
72
|
-
description: t("settings.notifications.description"),
|
|
73
|
-
sectionTitle: t("settings.notifications.sectionTitle"),
|
|
74
|
-
icon: "notifications-outline",
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Create about configuration
|
|
79
|
-
*/
|
|
80
|
-
export const createAboutConfig = (
|
|
81
|
-
t: TranslationFunction,
|
|
82
|
-
routeOrOnPress?: string | (() => void),
|
|
83
|
-
): AboutConfig => ({
|
|
84
|
-
enabled: true,
|
|
85
|
-
title: t("settings.about.title"),
|
|
86
|
-
description: t("settings.about.description"),
|
|
87
|
-
icon: "information-circle-outline",
|
|
88
|
-
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
89
|
-
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Create legal configuration
|
|
94
|
-
*/
|
|
95
|
-
export const createLegalConfig = (
|
|
96
|
-
t: TranslationFunction,
|
|
97
|
-
routeOrOnPress?: string | (() => void),
|
|
98
|
-
): LegalConfig => ({
|
|
99
|
-
enabled: true,
|
|
100
|
-
title: t("settings.legal.title"),
|
|
101
|
-
description: t("settings.legal.description"),
|
|
102
|
-
icon: "document-text-outline",
|
|
103
|
-
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
104
|
-
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Feedback form data interface
|
|
109
|
-
*/
|
|
110
|
-
export interface FeedbackFormData {
|
|
111
|
-
type: string;
|
|
112
|
-
rating: number;
|
|
113
|
-
description: string;
|
|
114
|
-
title: string;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Create feedback configuration
|
|
119
|
-
*/
|
|
120
|
-
export const createFeedbackConfig = (
|
|
121
|
-
t: TranslationFunction,
|
|
122
|
-
onSubmit: (data: FeedbackFormData) => Promise<void>,
|
|
123
|
-
): FeedbackConfig => ({
|
|
124
|
-
enabled: true,
|
|
125
|
-
title: t("settings.feedback.title"),
|
|
126
|
-
description: t("settings.feedback.description"),
|
|
127
|
-
icon: "chatbubble-outline",
|
|
128
|
-
sectionTitle: t("settings.sections.support"),
|
|
129
|
-
onSubmit,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Create rating configuration
|
|
134
|
-
*/
|
|
135
|
-
export const createRatingConfig = (
|
|
136
|
-
t: TranslationFunction,
|
|
137
|
-
onRate: () => void,
|
|
138
|
-
storeUrl?: string,
|
|
139
|
-
): RatingConfig => ({
|
|
140
|
-
enabled: true,
|
|
141
|
-
onRate,
|
|
142
|
-
storeUrl,
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Create FAQ configuration
|
|
147
|
-
* Navigation is handled internally by the package - no callback needed
|
|
148
|
-
*/
|
|
149
|
-
export const createFAQConfig = (
|
|
150
|
-
t: TranslationFunction,
|
|
151
|
-
): FAQConfig => ({
|
|
152
|
-
enabled: true,
|
|
153
|
-
title: t("settings.faqs.title"),
|
|
154
|
-
description: t("settings.faqs.description"),
|
|
155
|
-
icon: "help-circle-outline",
|
|
156
|
-
sectionTitle: t("settings.sections.support").toUpperCase(),
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Create subscription configuration
|
|
161
|
-
* @param route - Navigation route name (preferred for stack navigation)
|
|
162
|
-
* @param onPress - Callback function (use route instead when possible)
|
|
163
|
-
*/
|
|
164
|
-
export const createSubscriptionConfig = (
|
|
165
|
-
t: TranslationFunction,
|
|
166
|
-
isPremium: boolean,
|
|
167
|
-
routeOrOnPress: string | (() => void),
|
|
168
|
-
): SubscriptionConfig => ({
|
|
169
|
-
enabled: true,
|
|
170
|
-
title: t("settings.subscription.title"),
|
|
171
|
-
description: isPremium
|
|
172
|
-
? t("subscription.premiumDetails.statusActive")
|
|
173
|
-
: t("settings.subscription.description"),
|
|
174
|
-
icon: "diamond",
|
|
175
|
-
sectionTitle: t("settings.sections.subscription").toUpperCase(),
|
|
176
|
-
route: typeof routeOrOnPress === "string" ? routeOrOnPress : undefined,
|
|
177
|
-
onPress: typeof routeOrOnPress === "function" ? routeOrOnPress : undefined,
|
|
178
|
-
isPremium,
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Create gamification configuration
|
|
183
|
-
*/
|
|
184
|
-
export const createGamificationConfig = (
|
|
185
|
-
t: TranslationFunction,
|
|
186
|
-
storageKey: string,
|
|
187
|
-
achievements: AchievementDefinition[],
|
|
188
|
-
levels: LevelDefinition[],
|
|
189
|
-
enabled = true,
|
|
190
|
-
): GamificationConfig => ({
|
|
191
|
-
enabled,
|
|
192
|
-
storageKey,
|
|
193
|
-
achievements,
|
|
194
|
-
levels,
|
|
195
|
-
translations: {
|
|
196
|
-
title: t("settings.gamification.title"),
|
|
197
|
-
statsTitle: t("settings.gamification.stats.title"),
|
|
198
|
-
achievementsTitle: t("settings.gamification.achievements.title"),
|
|
199
|
-
streakTitle: t("settings.gamification.streak.title"),
|
|
200
|
-
bestStreak: t("settings.gamification.streak.best"),
|
|
201
|
-
currentStreak: t("settings.gamification.streak.current"),
|
|
202
|
-
days: t("settings.gamification.streak.days"),
|
|
203
|
-
levelTitle: t("settings.gamification.level.title"),
|
|
204
|
-
emptyAchievements: t("settings.gamification.achievements.empty"),
|
|
205
|
-
},
|
|
206
|
-
});
|