@umituz/react-native-subscription 1.6.0 → 1.7.0

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-subscription",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Subscription management and paywall UI for React Native apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -108,6 +108,16 @@ export {
108
108
  type SubscriptionStatusType,
109
109
  } from "./presentation/components/details/PremiumStatusBadge";
110
110
 
111
+ // =============================================================================
112
+ // PRESENTATION LAYER - Settings Section Component
113
+ // =============================================================================
114
+
115
+ export {
116
+ SubscriptionSection,
117
+ type SubscriptionSectionProps,
118
+ type SubscriptionSectionConfig,
119
+ } from "./presentation/components/sections/SubscriptionSection";
120
+
111
121
  // =============================================================================
112
122
  // UTILS - Date & Price
113
123
  // =============================================================================
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Subscription Section for Settings Screen
3
+ * Generic component that renders subscription/premium details
4
+ * App passes all data via config props (credits, translations, handlers)
5
+ */
6
+
7
+ import React from "react";
8
+ import { View } from "react-native";
9
+ import type { StyleProp, ViewStyle } from "react-native";
10
+ import {
11
+ PremiumDetailsCard,
12
+ type CreditInfo,
13
+ type PremiumDetailsTranslations,
14
+ } from "../details/PremiumDetailsCard";
15
+ import type { SubscriptionStatusType } from "../details/PremiumStatusBadge";
16
+
17
+ export interface SubscriptionSectionConfig {
18
+ /** Subscription status type */
19
+ statusType: SubscriptionStatusType;
20
+ /** Whether user has premium */
21
+ isPremium: boolean;
22
+ /** Formatted expiration date string */
23
+ expirationDate?: string | null;
24
+ /** Formatted purchase date string */
25
+ purchaseDate?: string | null;
26
+ /** Whether subscription is lifetime */
27
+ isLifetime?: boolean;
28
+ /** Days remaining until expiration */
29
+ daysRemaining?: number | null;
30
+ /** Credit info array (app-specific, passed from app) */
31
+ credits?: CreditInfo[];
32
+ /** All translations (app must provide these) */
33
+ translations: PremiumDetailsTranslations;
34
+ /** Handler for manage subscription button */
35
+ onManageSubscription?: () => void;
36
+ /** Handler for upgrade button */
37
+ onUpgrade?: () => void;
38
+ }
39
+
40
+ export interface SubscriptionSectionProps {
41
+ config: SubscriptionSectionConfig;
42
+ containerStyle?: StyleProp<ViewStyle>;
43
+ }
44
+
45
+ export const SubscriptionSection: React.FC<SubscriptionSectionProps> = ({
46
+ config,
47
+ containerStyle,
48
+ }) => {
49
+ return (
50
+ <View style={containerStyle}>
51
+ <PremiumDetailsCard
52
+ statusType={config.statusType}
53
+ isPremium={config.isPremium}
54
+ expirationDate={config.expirationDate}
55
+ purchaseDate={config.purchaseDate}
56
+ isLifetime={config.isLifetime}
57
+ daysRemaining={config.daysRemaining}
58
+ credits={config.credits}
59
+ translations={config.translations}
60
+ onManageSubscription={config.onManageSubscription}
61
+ onUpgrade={config.onUpgrade}
62
+ />
63
+ </View>
64
+ );
65
+ };