@umituz/react-native-subscription 2.10.11 → 2.10.12

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": "2.10.11",
3
+ "version": "2.10.12",
4
4
  "description": "Complete subscription management with RevenueCat, paywall UI, and credits system for React Native apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -15,6 +15,8 @@ interface SubscriptionPackageListProps {
15
15
  onSelect: (pkg: PurchasesPackage) => void;
16
16
  /** Optional: Manually specify which package should show "Best Value" badge by identifier */
17
17
  bestValueIdentifier?: string;
18
+ /** Optional: Map of product identifier to credit amount (e.g., { "weekly": 6, "monthly": 25, "yearly": 300 }) */
19
+ creditAmounts?: Record<string, number>;
18
20
  }
19
21
 
20
22
  export const SubscriptionPackageList: React.FC<SubscriptionPackageListProps> = React.memo(
@@ -26,6 +28,7 @@ export const SubscriptionPackageList: React.FC<SubscriptionPackageListProps> = R
26
28
  emptyText,
27
29
  onSelect,
28
30
  bestValueIdentifier,
31
+ creditAmounts,
29
32
  }) => {
30
33
  const tokens = useAppDesignTokens();
31
34
  const hasPackages = packages.length > 0;
@@ -85,6 +88,9 @@ export const SubscriptionPackageList: React.FC<SubscriptionPackageListProps> = R
85
88
  isBestValue = isYearlyPackage(pkg);
86
89
  }
87
90
 
91
+ // Get credit amount for this package if provided
92
+ const creditAmount = creditAmounts?.[pkg.product.identifier];
93
+
88
94
  return (
89
95
  <SubscriptionPlanCard
90
96
  key={pkg.product.identifier}
@@ -92,6 +98,7 @@ export const SubscriptionPackageList: React.FC<SubscriptionPackageListProps> = R
92
98
  isSelected={selectedPkg?.product.identifier === pkg.product.identifier}
93
99
  onSelect={() => onSelect(pkg)}
94
100
  isBestValue={isBestValue}
101
+ creditAmount={creditAmount}
95
102
  />
96
103
  );
97
104
  })}
@@ -21,10 +21,12 @@ interface SubscriptionPlanCardProps {
21
21
  isSelected: boolean;
22
22
  onSelect: () => void;
23
23
  isBestValue?: boolean;
24
+ /** Optional: Number of credits/generations included with this package */
25
+ creditAmount?: number;
24
26
  }
25
27
 
26
28
  export const SubscriptionPlanCard: React.FC<SubscriptionPlanCardProps> =
27
- React.memo(({ package: pkg, isSelected, onSelect, isBestValue = false }) => {
29
+ React.memo(({ package: pkg, isSelected, onSelect, isBestValue = false, creditAmount }) => {
28
30
  const tokens = useAppDesignTokens();
29
31
  const { t } = useLocalization();
30
32
 
@@ -105,6 +107,25 @@ export const SubscriptionPlanCard: React.FC<SubscriptionPlanCardProps> =
105
107
  </View>
106
108
 
107
109
  <View style={styles.rightSection}>
110
+ {creditAmount && (
111
+ <View
112
+ style={[
113
+ styles.creditBadge,
114
+ { backgroundColor: tokens.colors.primary + "15" },
115
+ ]}
116
+ >
117
+ <AtomicText
118
+ type="labelSmall"
119
+ style={{
120
+ color: tokens.colors.primary,
121
+ fontWeight: "700",
122
+ fontSize: 11,
123
+ }}
124
+ >
125
+ {creditAmount} {t("paywall.credits")}
126
+ </AtomicText>
127
+ </View>
128
+ )}
108
129
  <AtomicText
109
130
  type="titleMedium"
110
131
  style={[styles.price, { color: tokens.colors.textPrimary }]}
@@ -164,6 +185,12 @@ const styles = StyleSheet.create({
164
185
  fontWeight: "600",
165
186
  marginBottom: 2,
166
187
  },
188
+ creditBadge: {
189
+ paddingHorizontal: 10,
190
+ paddingVertical: 4,
191
+ borderRadius: 12,
192
+ marginBottom: 4,
193
+ },
167
194
  rightSection: {
168
195
  alignItems: "flex-end",
169
196
  },