@umituz/react-native-settings 4.23.96 → 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.96",
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,7 +10,7 @@ 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
14
  noBackground?: boolean;
15
15
  hideMargin?: boolean;
16
16
  }
@@ -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,25 +113,25 @@ 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
127
  <FeatureSettingsSection normalizedConfig={normalizedConfig} features={features} />
127
128
 
128
129
  {(features.gamification || features.videoTutorial) && (
129
- <SettingsSection title={t("settings.sections.progress")}>
130
+ <SettingsSection title={translations?.sections?.progress || "Progress"}>
130
131
  {features.gamification && (
131
132
  <GamificationSettingsItem
132
133
  config={normalizedConfig.gamification.config || {}}
133
134
  gamificationConfig={gamificationConfig}
134
- t={t}
135
135
  noBackground={true}
136
136
  hideMargin={true}
137
137
  />
@@ -140,7 +140,6 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
140
140
  {features.videoTutorial && (
141
141
  <VideoTutorialSettingsItem
142
142
  config={normalizedConfig.videoTutorial.config || {}}
143
- t={t}
144
143
  noBackground={true}
145
144
  hideMargin={true}
146
145
  />
@@ -156,7 +155,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
156
155
 
157
156
  {!hasAnyFeatures && (
158
157
  <View style={styles.emptyContainer}>
159
- <SettingsSection title={emptyStateText || t("settings.noOptionsAvailable")}>
158
+ <SettingsSection title={emptyStateText || translations?.noOptionsAvailable || "No options available"}>
160
159
  <View />
161
160
  </SettingsSection>
162
161
  </View>
@@ -168,7 +167,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
168
167
  <SettingsFooter
169
168
  versionText={footerText}
170
169
  appVersion={appVersion}
171
- versionLabel={t("settings.footer.version")}
170
+ versionLabel={translations?.footer?.version || "Version"}
172
171
  />
173
172
  )}
174
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,7 +7,7 @@ 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
11
  noBackground?: boolean;
12
12
  hideMargin?: boolean;
13
13
  }
@@ -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
  }