@umituz/react-native-subscription 2.11.3 → 2.11.5
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.11.
|
|
3
|
+
"version": "2.11.5",
|
|
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",
|
|
@@ -88,11 +88,40 @@ export const SubscriptionPackageList: React.FC<SubscriptionPackageListProps> = R
|
|
|
88
88
|
isBestValue = isYearlyPackage(pkg);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
// Smart matching for credit amounts
|
|
92
|
+
const findCreditAmount = () => {
|
|
93
|
+
if (!creditAmounts) return undefined;
|
|
94
|
+
|
|
95
|
+
const productId = pkg.product.identifier;
|
|
96
|
+
const packageId = pkg.identifier;
|
|
97
|
+
|
|
98
|
+
// 1. Exact match (case sensitive)
|
|
99
|
+
if (creditAmounts[productId] !== undefined) return creditAmounts[productId];
|
|
100
|
+
if (creditAmounts[packageId] !== undefined) return creditAmounts[packageId];
|
|
101
|
+
|
|
102
|
+
// 2. Case-insensitive match
|
|
103
|
+
const lowerProductId = productId.toLowerCase();
|
|
104
|
+
const lowerPackageId = packageId.toLowerCase();
|
|
105
|
+
|
|
106
|
+
for (const [key, value] of Object.entries(creditAmounts)) {
|
|
107
|
+
const lowerKey = key.toLowerCase();
|
|
108
|
+
if (lowerProductId === lowerKey || lowerPackageId === lowerKey) {
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 3. Partial match (if key is contained in identifier)
|
|
114
|
+
for (const [key, value] of Object.entries(creditAmounts)) {
|
|
115
|
+
const lowerKey = key.toLowerCase();
|
|
116
|
+
if (lowerKey.length > 3 && (lowerProductId.includes(lowerKey) || lowerPackageId.includes(lowerKey))) {
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return undefined;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const creditAmount = findCreditAmount();
|
|
96
125
|
|
|
97
126
|
return (
|
|
98
127
|
<SubscriptionPlanCard
|
|
@@ -7,7 +7,7 @@ import React from "react";
|
|
|
7
7
|
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
8
8
|
import type { PurchasesPackage } from "react-native-purchases";
|
|
9
9
|
import { AtomicText } from "@umituz/react-native-design-system";
|
|
10
|
-
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
10
|
+
import { useAppDesignTokens, withAlpha } from "@umituz/react-native-design-system";
|
|
11
11
|
import { formatPrice } from "../../../utils/priceUtils";
|
|
12
12
|
import { useLocalization } from "@umituz/react-native-localization";
|
|
13
13
|
import { BestValueBadge } from "./BestValueBadge";
|
|
@@ -49,7 +49,7 @@ export const SubscriptionPlanCard: React.FC<SubscriptionPlanCardProps> =
|
|
|
49
49
|
const CardComponent = isSelected ? LinearGradient : View;
|
|
50
50
|
const cardProps = isSelected
|
|
51
51
|
? {
|
|
52
|
-
colors: [tokens.colors.primary
|
|
52
|
+
colors: [withAlpha(tokens.colors.primary, 0.2), tokens.colors.surface],
|
|
53
53
|
start: { x: 0, y: 0 },
|
|
54
54
|
end: { x: 1, y: 1 },
|
|
55
55
|
}
|
|
@@ -117,7 +117,7 @@ export const SubscriptionPlanCard: React.FC<SubscriptionPlanCardProps> =
|
|
|
117
117
|
<View
|
|
118
118
|
style={[
|
|
119
119
|
styles.creditBadge,
|
|
120
|
-
{ backgroundColor: tokens.colors.primary
|
|
120
|
+
{ backgroundColor: withAlpha(tokens.colors.primary, 0.15) },
|
|
121
121
|
]}
|
|
122
122
|
>
|
|
123
123
|
<AtomicText
|