@umituz/react-native-settings 4.20.5 → 4.20.6

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.20.5",
3
+ "version": "4.20.6",
4
4
  "description": "Complete settings hub for React Native apps - consolidated package with settings, about, legal, appearance, feedback, FAQs, and rating",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -11,6 +11,7 @@ import { ProfileSectionLoader } from "./sections/ProfileSectionLoader";
11
11
  import { FeatureSettingsSection } from "./sections/FeatureSettingsSection";
12
12
  import { IdentitySettingsSection } from "./sections/IdentitySettingsSection";
13
13
  import { SupportSettingsSection } from "./sections/SupportSettingsSection";
14
+ import { SubscriptionSettingsSection } from "./sections/SubscriptionSettingsSection";
14
15
  import { CustomSettingsList } from "./sections/CustomSettingsList";
15
16
  import type { NormalizedConfig } from "../utils/normalizeConfig";
16
17
  import type { CustomSettingsSection } from "../types";
@@ -29,6 +30,7 @@ interface SettingsContentProps {
29
30
  feedback: boolean;
30
31
  rating: boolean;
31
32
  faqs: boolean;
33
+ subscription: boolean;
32
34
  };
33
35
  showUserProfile?: boolean;
34
36
  userProfile?: any;
@@ -67,6 +69,7 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
67
69
  features.feedback ||
68
70
  features.rating ||
69
71
  features.faqs ||
72
+ features.subscription ||
70
73
  customSections.length > 0,
71
74
  [features, customSections.length]
72
75
  );
@@ -88,6 +91,10 @@ export const SettingsContent: React.FC<SettingsContentProps> = ({
88
91
 
89
92
  <CustomSettingsList customSections={customSections} />
90
93
 
94
+ {features.subscription && (
95
+ <SubscriptionSettingsSection config={normalizedConfig.subscription.config} />
96
+ )}
97
+
91
98
  <FeatureSettingsSection normalizedConfig={normalizedConfig} features={features} />
92
99
 
93
100
  <IdentitySettingsSection normalizedConfig={normalizedConfig} features={features} />
@@ -0,0 +1,49 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import {
4
+ ListItem,
5
+ AtomicBadge,
6
+ useAppDesignTokens,
7
+ } from "@umituz/react-native-design-system";
8
+ import { useLocalization } from "@umituz/react-native-localization";
9
+ import { SettingsSection } from "../../../components/SettingsSection";
10
+ import type { SubscriptionConfig } from "../../types";
11
+
12
+ interface SubscriptionSettingsSectionProps {
13
+ config?: SubscriptionConfig;
14
+ }
15
+
16
+ export const SubscriptionSettingsSection: React.FC<SubscriptionSettingsSectionProps> = ({
17
+ config,
18
+ }) => {
19
+ const { t } = useLocalization();
20
+ const tokens = useAppDesignTokens();
21
+
22
+ if (!config) return null;
23
+
24
+ return (
25
+ <SettingsSection title={config.sectionTitle || t("settings.sections.subscription")}>
26
+ <ListItem
27
+ title={config.title || t("settings.subscription.title")}
28
+ description={config.description || t("settings.subscription.description")}
29
+ leftIcon={config.icon || "star"}
30
+ onPress={config.onPress}
31
+ rightElement={
32
+ config.isPremium ? (
33
+ <AtomicBadge
34
+ label={t("common.premium")}
35
+ variant="success"
36
+ size="small"
37
+ />
38
+ ) : (
39
+ <AtomicBadge
40
+ label={t("common.free")}
41
+ variant="warning"
42
+ size="small"
43
+ />
44
+ )
45
+ }
46
+ />
47
+ </SettingsSection>
48
+ );
49
+ };
@@ -58,6 +58,7 @@ export function useFeatureDetection(
58
58
  feedback,
59
59
  rating,
60
60
  faqs,
61
+ subscription,
61
62
  } = normalizedConfig;
62
63
 
63
64
  const notificationServiceAvailable = !!options?.notificationServiceAvailable;
@@ -110,6 +111,7 @@ export function useFeatureDetection(
110
111
  feedback: feedback.enabled,
111
112
  rating: rating.enabled,
112
113
  faqs: faqs.enabled,
114
+ subscription: subscription.enabled,
113
115
  };
114
116
  }, [normalizedConfig, navigation, options]);
115
117
  }
@@ -218,3 +218,22 @@ export interface CloudSyncConfig {
218
218
  /** Firestore collection name */
219
219
  collectionName?: string;
220
220
  }
221
+ /**
222
+ * Subscription Settings Configuration
223
+ */
224
+ export interface SubscriptionConfig {
225
+ /** Show subscription section */
226
+ enabled?: FeatureVisibility;
227
+ /** Custom title for the subscription section */
228
+ title?: string;
229
+ /** Custom label for the subscription item */
230
+ description?: string;
231
+ /** Custom icon name (Ionicons) */
232
+ icon?: string;
233
+ /** Custom section title for grouping */
234
+ sectionTitle?: string;
235
+ /** Handler to open subscription screen */
236
+ onPress?: () => void;
237
+ /** Whether user is premium (to show active status) */
238
+ isPremium?: boolean;
239
+ }
@@ -16,6 +16,7 @@ import type {
16
16
  RatingConfig,
17
17
  FAQConfig,
18
18
  CloudSyncConfig,
19
+ SubscriptionConfig,
19
20
  } from "./FeatureConfig";
20
21
 
21
22
  /**
@@ -113,6 +114,12 @@ export interface SettingsConfig {
113
114
  * @default false
114
115
  */
115
116
  cloudSync?: FeatureVisibility | CloudSyncConfig;
117
+
118
+ /**
119
+ * Subscription settings configuration
120
+ * @default false
121
+ */
122
+ subscription?: FeatureVisibility | SubscriptionConfig;
116
123
 
117
124
  /**
118
125
  * Custom empty state text when no settings are available
@@ -15,6 +15,7 @@ import type {
15
15
  FeedbackConfig,
16
16
  RatingConfig,
17
17
  FAQConfig,
18
+ SubscriptionConfig,
18
19
  SettingsConfig,
19
20
  } from "../types";
20
21
 
@@ -59,6 +60,10 @@ export interface NormalizedConfig {
59
60
  enabled: boolean;
60
61
  config?: FAQConfig;
61
62
  };
63
+ subscription: {
64
+ enabled: boolean;
65
+ config?: SubscriptionConfig;
66
+ };
62
67
  }
63
68
 
64
69
  /**
@@ -103,5 +108,6 @@ export function normalizeSettingsConfig(
103
108
  feedback: normalizeConfigValue(config?.feedback, false),
104
109
  rating: normalizeConfigValue(config?.rating, false),
105
110
  faqs: normalizeConfigValue(config?.faqs, false),
111
+ subscription: normalizeConfigValue(config?.subscription, false),
106
112
  };
107
113
  }