@umituz/react-native-settings 4.23.95 → 4.23.97

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-settings",
3
- "version": "4.23.95",
3
+ "version": "4.23.97",
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",
@@ -10,13 +10,17 @@ import { compareGamificationProps } from "../../../infrastructure/utils/memoComp
10
10
  export interface GamificationSettingsItemProps {
11
11
  config: GamificationItemConfig;
12
12
  gamificationConfig?: GamificationSettingsConfig;
13
- t: (key: string) => string;
13
+ t?: (key: string) => string;
14
+ noBackground?: boolean;
15
+ hideMargin?: boolean;
14
16
  }
15
17
 
16
18
  const GamificationSettingsItemComponent: React.FC<GamificationSettingsItemProps> = ({
17
19
  config,
18
20
  gamificationConfig,
19
- t
21
+ t,
22
+ noBackground,
23
+ hideMargin,
20
24
  }) => {
21
25
  const navigation = useAppNavigation();
22
26
  const { level } = useGamification(gamificationConfig);
@@ -41,6 +45,8 @@ const GamificationSettingsItemComponent: React.FC<GamificationSettingsItemProps>
41
45
  icon={icon}
42
46
  onPress={handlePress}
43
47
  sectionTitle={config.sectionTitle}
48
+ noBackground={noBackground}
49
+ hideMargin={hideMargin}
44
50
  />
45
51
  );
46
52
  };
@@ -70,7 +70,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
70
70
  devSettings,
71
71
  gamificationConfig,
72
72
  }) => {
73
- const { t } = useLocalization();
73
+ const translations = normalizedConfig.translations;
74
74
 
75
75
  // Optimize: Only track individual feature flags instead of entire object
76
76
  const hasAnyFeatures = useMemo(() =>
@@ -113,33 +113,40 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
113
113
  <CustomSettingsList customSections={customSections} />
114
114
 
115
115
  {features.subscription && (normalizedConfig.subscription.config?.route || normalizedConfig.subscription.config?.onPress) && (
116
- <SubscriptionSettingsItem config={normalizedConfig.subscription.config} t={t} />
116
+ <SubscriptionSettingsItem
117
+ config={normalizedConfig.subscription.config}
118
+ />
117
119
  )}
118
120
 
119
121
  {features.wallet && normalizedConfig.wallet.config?.route && (
120
122
  <WalletSettingsItem
121
123
  config={normalizedConfig.wallet.config}
122
- t={t}
123
124
  />
124
125
  )}
125
126
 
126
- {features.gamification && (
127
- <GamificationSettingsItem
128
- config={normalizedConfig.gamification.config || {}}
129
- gamificationConfig={gamificationConfig}
130
- t={t}
131
- />
132
- )}
127
+ <FeatureSettingsSection normalizedConfig={normalizedConfig} features={features} />
133
128
 
134
- {features.videoTutorial && (
135
- <VideoTutorialSettingsItem
136
- config={normalizedConfig.videoTutorial.config || {}}
137
- t={t}
138
- />
129
+ {(features.gamification || features.videoTutorial) && (
130
+ <SettingsSection title={translations?.sections?.progress || "Progress"}>
131
+ {features.gamification && (
132
+ <GamificationSettingsItem
133
+ config={normalizedConfig.gamification.config || {}}
134
+ gamificationConfig={gamificationConfig}
135
+ noBackground={true}
136
+ hideMargin={true}
137
+ />
138
+ )}
139
+
140
+ {features.videoTutorial && (
141
+ <VideoTutorialSettingsItem
142
+ config={normalizedConfig.videoTutorial.config || {}}
143
+ noBackground={true}
144
+ hideMargin={true}
145
+ />
146
+ )}
147
+ </SettingsSection>
139
148
  )}
140
149
 
141
- <FeatureSettingsSection normalizedConfig={normalizedConfig} features={features} />
142
-
143
150
  <IdentitySettingsSection normalizedConfig={normalizedConfig} features={features} />
144
151
 
145
152
  <SupportSettingsSection normalizedConfig={normalizedConfig} features={features} />
@@ -148,7 +155,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
148
155
 
149
156
  {!hasAnyFeatures && (
150
157
  <View style={styles.emptyContainer}>
151
- <SettingsSection title={emptyStateText || t("settings.noOptionsAvailable")}>
158
+ <SettingsSection title={emptyStateText || translations?.noOptionsAvailable || "No options available"}>
152
159
  <View />
153
160
  </SettingsSection>
154
161
  </View>
@@ -160,7 +167,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
160
167
  <SettingsFooter
161
168
  versionText={footerText}
162
169
  appVersion={appVersion}
163
- versionLabel={t("settings.footer.version")}
170
+ versionLabel={translations?.footer?.version || "Version"}
164
171
  />
165
172
  )}
166
173
  </View>
@@ -7,7 +7,7 @@ import { compareConfigAndTranslate } from "../../../infrastructure/utils/memoCom
7
7
 
8
8
  export interface SubscriptionSettingsItemProps {
9
9
  config: SubscriptionConfig;
10
- t: (key: string) => string;
10
+ t?: (key: string) => string;
11
11
  }
12
12
 
13
13
  const SubscriptionSettingsItemComponent: React.FC<SubscriptionSettingsItemProps> = ({ config, t }) => {
@@ -7,12 +7,16 @@ import { compareConfigAndTranslate } from "../../../infrastructure/utils/memoCom
7
7
 
8
8
  export interface VideoTutorialSettingsItemProps {
9
9
  config: VideoTutorialConfig;
10
- t: (key: string) => string;
10
+ t?: (key: string) => string;
11
+ noBackground?: boolean;
12
+ hideMargin?: boolean;
11
13
  }
12
14
 
13
15
  const VideoTutorialSettingsItemComponent: React.FC<VideoTutorialSettingsItemProps> = ({
14
16
  config,
15
- t
17
+ t,
18
+ noBackground,
19
+ hideMargin,
16
20
  }) => {
17
21
  const navigation = useAppNavigation();
18
22
 
@@ -36,6 +40,8 @@ const VideoTutorialSettingsItemComponent: React.FC<VideoTutorialSettingsItemProp
36
40
  icon={icon}
37
41
  onPress={handlePress}
38
42
  sectionTitle={config.sectionTitle}
43
+ noBackground={noBackground}
44
+ hideMargin={hideMargin}
39
45
  />
40
46
  );
41
47
  };
@@ -7,7 +7,7 @@ import { compareConfigAndTranslate } from "../../../infrastructure/utils/memoCom
7
7
 
8
8
  export interface WalletSettingsItemProps {
9
9
  config: WalletConfig;
10
- t: (key: string) => string;
10
+ t?: (key: string) => string;
11
11
  }
12
12
 
13
13
  const WalletSettingsItemComponent: React.FC<WalletSettingsItemProps> = ({ config, t }) => {
@@ -21,8 +21,8 @@ const WalletSettingsItemComponent: React.FC<WalletSettingsItemProps> = ({ config
21
21
 
22
22
  return (
23
23
  <SettingsItemCard
24
- title={config.title || t("wallet.title")}
25
- description={config.description || t("wallet.description")}
24
+ title={config.title || (t ? t("wallet.title") : "Wallet")}
25
+ description={config.description || (t ? t("wallet.description") : "View your wallet")}
26
26
  icon={(config.icon || "wallet") as IconName}
27
27
  onPress={handlePress}
28
28
  sectionTitle={config.sectionTitle}
@@ -15,13 +15,15 @@ interface FeatureSettingsSectionProps {
15
15
  language: boolean;
16
16
  notifications: boolean;
17
17
  };
18
+ currentLanguage?: string;
18
19
  }
19
20
 
20
21
  export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
21
22
  normalizedConfig,
22
23
  features,
24
+ currentLanguage,
23
25
  }) => {
24
- const { t, currentLanguage } = useLocalization();
26
+ const translations = normalizedConfig.translations;
25
27
  const navigation = useAppNavigation();
26
28
 
27
29
  const handleLanguagePress = React.useCallback(() => {
@@ -33,9 +35,13 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
33
35
  }
34
36
  }, [navigation, normalizedConfig.language.config]);
35
37
 
36
- const currentLanguageData = React.useMemo(() => getLanguageByCode(currentLanguage), [currentLanguage]);
38
+ const currentLanguageData = React.useMemo(() =>
39
+ currentLanguage ? getLanguageByCode(currentLanguage) : null,
40
+ [currentLanguage]
41
+ );
42
+
37
43
  const languageDisplayName = React.useMemo(() => {
38
- if (!currentLanguageData) return currentLanguage;
44
+ if (!currentLanguageData) return currentLanguage || "";
39
45
  return `${currentLanguageData.flag} ${currentLanguageData.nativeName}`;
40
46
  }, [currentLanguageData, currentLanguage]);
41
47
 
@@ -43,14 +49,14 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
43
49
 
44
50
  return (
45
51
  <SettingsSection
46
- title={t("settings.sections.app.title") || t("settings.sections.app") || "App Settings"}
52
+ title={translations?.sections?.app || "App Settings"}
47
53
  >
48
54
  {features.appearance && (
49
55
  <AppearanceSection
50
56
  config={{
51
57
  ...normalizedConfig.appearance.config,
52
- title: t("settings.appearance.title"),
53
- description: t("settings.appearance.description"),
58
+ title: translations?.features?.appearance?.title || "Appearance",
59
+ description: translations?.features?.appearance?.description || "Theme settings",
54
60
  }}
55
61
  noBackground={true}
56
62
  hideMargin={true}
@@ -59,7 +65,7 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
59
65
 
60
66
  {features.language && (
61
67
  <SettingsItemCard
62
- title={t("settings.languageSelection.title")}
68
+ title={translations?.features?.language?.title || "Language"}
63
69
  description={languageDisplayName}
64
70
  icon="globe-outline"
65
71
  onPress={handleLanguagePress}
@@ -72,8 +78,8 @@ export const FeatureSettingsSection: React.FC<FeatureSettingsSectionProps> = ({
72
78
  <NotificationsSection
73
79
  config={{
74
80
  ...normalizedConfig.notifications.config,
75
- title: t("settings.notifications.title"),
76
- description: t("settings.notifications.description"),
81
+ title: translations?.features?.notifications?.title || "Notifications",
82
+ description: translations?.features?.notifications?.description || "Push notification settings",
77
83
  }}
78
84
  noBackground={true}
79
85
  hideMargin={true}
@@ -15,18 +15,18 @@ export const IdentitySettingsSection: React.FC<IdentitySettingsSectionProps> = (
15
15
  normalizedConfig,
16
16
  features,
17
17
  }) => {
18
- const { t } = useLocalization();
18
+ const translations = normalizedConfig.translations;
19
19
 
20
20
  if (!features.about && !features.legal) return null;
21
21
 
22
22
  return (
23
- <SettingsSection title={t("settings.about.title")}>
23
+ <SettingsSection title={translations?.sections?.about || "About"}>
24
24
  {features.about && (
25
25
  <AboutSection
26
26
  config={{
27
27
  ...normalizedConfig.about.config,
28
- title: t("settings.about.title"),
29
- description: t("settings.about.description"),
28
+ title: translations?.features?.about?.title || "About",
29
+ description: translations?.features?.about?.description || "About the app",
30
30
  }}
31
31
  noBackground={true}
32
32
  hideMargin={true}
@@ -37,8 +37,8 @@ export const IdentitySettingsSection: React.FC<IdentitySettingsSectionProps> = (
37
37
  <LegalSection
38
38
  config={{
39
39
  ...normalizedConfig.legal.config,
40
- title: t("settings.legal.title"),
41
- description: t("settings.legal.description"),
40
+ title: translations?.features?.legal?.title || "Legal",
41
+ description: translations?.features?.legal?.description || "Privacy Policy & Terms",
42
42
  }}
43
43
  noBackground={true}
44
44
  hideMargin={true}
@@ -16,7 +16,7 @@ export const SupportSettingsSection: React.FC<SupportSettingsSectionProps> = ({
16
16
  features,
17
17
  normalizedConfig,
18
18
  }) => {
19
- const { t } = useLocalization();
19
+ const translations = normalizedConfig.translations;
20
20
  const navigation = useAppNavigation();
21
21
 
22
22
  const handleFAQPress = useCallback(() => {
@@ -26,7 +26,7 @@ export const SupportSettingsSection: React.FC<SupportSettingsSectionProps> = ({
26
26
  if (!(features.feedback || features.rating || features.faqs)) return null;
27
27
 
28
28
  return (
29
- <SettingsSection title={t("settings.support.title")}>
29
+ <SettingsSection title={translations?.sections?.support || "Support"}>
30
30
  {(features.feedback || features.rating) && (
31
31
  <SupportSection
32
32
  renderSection={(props: { title: string; children: React.ReactNode }) => <>{props.children}</>}
@@ -42,8 +42,8 @@ export const SupportSettingsSection: React.FC<SupportSettingsSectionProps> = ({
42
42
  feedbackConfig={{
43
43
  enabled: features.feedback,
44
44
  config: {
45
- title: normalizedConfig.feedback.config?.title || t("settings.feedback.title"),
46
- description: normalizedConfig.feedback.config?.description || t("settings.feedback.description"),
45
+ title: normalizedConfig.feedback.config?.title || translations?.features?.feedback?.title || "Feedback",
46
+ description: normalizedConfig.feedback.config?.description || translations?.features?.feedback?.description || "Give us your feedback",
47
47
  initialType: normalizedConfig.feedback.config?.initialType,
48
48
  onSubmit: normalizedConfig.feedback.config?.onSubmit,
49
49
  onPress: normalizedConfig.feedback.config?.onPress,
@@ -52,32 +52,32 @@ export const SupportSettingsSection: React.FC<SupportSettingsSectionProps> = ({
52
52
  ratingConfig={{
53
53
  enabled: features.rating,
54
54
  config: {
55
- title: normalizedConfig.rating.config?.title || t("settings.rating.title"),
56
- description: normalizedConfig.rating.config?.description || t("settings.rating.description"),
55
+ title: normalizedConfig.rating.config?.title || translations?.features?.rating?.title || "Rate Us",
56
+ description: normalizedConfig.rating.config?.description || translations?.features?.rating?.description || "Love the app? Rate us!",
57
57
  storeUrl: normalizedConfig.rating.config?.storeUrl,
58
58
  onRate: normalizedConfig.rating.config?.onRate,
59
59
  }
60
60
  }}
61
61
  feedbackModalTexts={{
62
- title: t("settings.feedback.modal.title"),
63
- ratingLabel: t("settings.feedback.modal.ratingLabel"),
64
- descriptionPlaceholder: t("settings.feedback.modal.descriptionPlaceholder"),
65
- submitButton: t("settings.feedback.modal.submitButton"),
66
- submittingButton: t("settings.feedback.modal.submittingButton"),
62
+ title: translations?.feedbackModal?.title || "Send Feedback",
63
+ ratingLabel: translations?.feedbackModal?.ratingLabel || "Rating",
64
+ descriptionPlaceholder: translations?.feedbackModal?.descriptionPlaceholder || "Feedback",
65
+ submitButton: translations?.feedbackModal?.submitButton || "Submit",
66
+ submittingButton: translations?.feedbackModal?.submittingButton || "Submitting...",
67
67
  feedbackTypes: [
68
- { type: 'general', label: t("settings.feedback.types.general") },
69
- { type: 'bug_report', label: t("settings.feedback.types.bugReport") },
70
- { type: 'feature_request', label: t("settings.feedback.types.featureRequest") },
71
- { type: 'improvement', label: t("settings.feedback.types.improvement") },
72
- { type: 'other', label: t("settings.feedback.types.other") },
68
+ { type: 'general', label: translations?.feedbackModal?.types?.general || "General" },
69
+ { type: 'bug_report', label: translations?.feedbackModal?.types?.bugReport || "Bug Report" },
70
+ { type: 'feature_request', label: translations?.feedbackModal?.types?.featureRequest || "Feature Request" },
71
+ { type: 'improvement', label: translations?.feedbackModal?.types?.improvement || "Improvement" },
72
+ { type: 'other', label: translations?.feedbackModal?.types?.other || "Other" },
73
73
  ],
74
74
  defaultTitle: (type) => {
75
75
  const titles: Record<string, string> = {
76
- general: t("settings.feedback.types.general"),
77
- bug_report: t("settings.feedback.types.bugReport"),
78
- feature_request: t("settings.feedback.types.featureRequest"),
79
- improvement: t("settings.feedback.types.improvement"),
80
- other: t("settings.feedback.types.other"),
76
+ general: translations?.feedbackModal?.types?.general || "General",
77
+ bug_report: translations?.feedbackModal?.types?.bugReport || "Bug Report",
78
+ feature_request: translations?.feedbackModal?.types?.featureRequest || "Feature Request",
79
+ improvement: translations?.feedbackModal?.types?.improvement || "Improvement",
80
+ other: translations?.feedbackModal?.types?.other || "Other",
81
81
  };
82
82
  return titles[type] || type;
83
83
  },
@@ -87,8 +87,8 @@ export const SupportSettingsSection: React.FC<SupportSettingsSectionProps> = ({
87
87
 
88
88
  {features.faqs && (
89
89
  <SettingsItemCard
90
- title={normalizedConfig.faqs.config?.title || t("settings.faqs.title")}
91
- description={normalizedConfig.faqs.config?.description || t("settings.faqs.description")}
90
+ title={normalizedConfig.faqs.config?.title || translations?.features?.faqs?.title || "FAQ"}
91
+ description={normalizedConfig.faqs.config?.description || translations?.features?.faqs?.description || "Frequently Asked Questions"}
92
92
  icon="help-circle-outline"
93
93
  onPress={handleFAQPress}
94
94
  noBackground={true}
@@ -55,7 +55,53 @@ import type {
55
55
  * },
56
56
  * };
57
57
  */
58
+ /**
59
+ * Global Settings Translations
60
+ */
61
+ export interface SettingsTranslations {
62
+ sections?: {
63
+ app?: string;
64
+ progress?: string;
65
+ about?: string;
66
+ support?: string;
67
+ subscription?: string;
68
+ };
69
+ features?: {
70
+ appearance?: { title?: string; description?: string };
71
+ language?: { title?: string };
72
+ notifications?: { title?: string; description?: string };
73
+ about?: { title?: string; description?: string };
74
+ legal?: { title?: string; description?: string };
75
+ feedback?: { title?: string; description?: string };
76
+ rating?: { title?: string; description?: string };
77
+ faqs?: { title?: string; description?: string };
78
+ };
79
+ feedbackModal?: {
80
+ title?: string;
81
+ ratingLabel?: string;
82
+ descriptionPlaceholder?: string;
83
+ submitButton?: string;
84
+ submittingButton?: string;
85
+ types?: {
86
+ general?: string;
87
+ bugReport?: string;
88
+ featureRequest?: string;
89
+ improvement?: string;
90
+ other?: string;
91
+ };
92
+ };
93
+ noOptionsAvailable?: string;
94
+ footer?: {
95
+ version?: string;
96
+ };
97
+ }
98
+
58
99
  export interface SettingsConfig {
100
+ /**
101
+ * Application-wide translations
102
+ */
103
+ translations?: SettingsTranslations;
104
+
59
105
  /**
60
106
  * Appearance settings (Theme customization)
61
107
  * @default 'auto'
@@ -24,5 +24,5 @@ export type {
24
24
  VideoTutorialConfig,
25
25
  } from "./UserFeatureConfig";
26
26
  export type { GamificationSettingsConfig as GamificationConfig } from "../../../domains/gamification";
27
- export type { SettingsConfig } from "./SettingsConfig";
27
+ export type { SettingsConfig, SettingsTranslations } from "./SettingsConfig";
28
28
  export type { CustomSettingsSection } from "./CustomSection";
@@ -79,6 +79,7 @@ export interface NormalizedConfig {
79
79
  enabled: boolean;
80
80
  config?: VideoTutorialConfig;
81
81
  };
82
+ translations?: import("../types").SettingsTranslations;
82
83
  }
83
84
 
84
85
  /**
@@ -128,5 +129,6 @@ export function normalizeSettingsConfig(
128
129
  wallet: normalizeConfigValue(config?.wallet, false),
129
130
  gamification: normalizeConfigValue(config?.gamification, "auto"),
130
131
  videoTutorial: normalizeConfigValue(config?.videoTutorial, "auto"),
132
+ translations: config?.translations,
131
133
  };
132
134
  }
@@ -50,6 +50,8 @@ export const createGamificationConfig = (
50
50
  translations: {
51
51
  title: t("settings.gamification.title"),
52
52
  statsTitle: t("settings.gamification.stats.title"),
53
+ pointsLabel: t("settings.gamification.stats.points"),
54
+ totalCompletedLabel: t("settings.gamification.stats.totalCompleted"),
53
55
  achievementsTitle: t("settings.gamification.achievements.title"),
54
56
  streakTitle: t("settings.gamification.streak.title"),
55
57
  bestStreak: t("settings.gamification.streak.best"),