@umituz/react-native-subscription 2.2.47 → 2.3.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 +23 -8
- package/src/presentation/components/paywall/SubscriptionModal.tsx +0 -11
- package/src/presentation/components/paywall/SubscriptionModalOverlay.tsx +1 -10
- package/src/presentation/components/paywall/SubscriptionPackageList.tsx +1 -11
- package/src/revenuecat/application/ports/IRevenueCatService.ts +5 -0
- package/src/revenuecat/infrastructure/services/RevenueCatService.ts +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
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",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@tanstack/react-query": ">=5.0.0",
|
|
31
|
-
"@umituz/react-native-design-system": "
|
|
31
|
+
"@umituz/react-native-design-system": "*",
|
|
32
32
|
"@umituz/react-native-firestore": "*",
|
|
33
33
|
"@umituz/react-native-legal": "*",
|
|
34
|
-
"@umituz/react-native-localization": "
|
|
34
|
+
"@umituz/react-native-localization": "*",
|
|
35
35
|
"expo-constants": ">=18.0.0",
|
|
36
36
|
"firebase": ">=10.0.0",
|
|
37
37
|
"react": ">=18.2.0",
|
|
@@ -40,15 +40,30 @@
|
|
|
40
40
|
"react-native-safe-area-context": ">=4.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
+
"@expo/vector-icons": "^15.0.3",
|
|
44
|
+
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
45
|
+
"@react-native-community/datetimepicker": "^8.5.1",
|
|
46
|
+
"@react-native-firebase/analytics": "^23.7.0",
|
|
47
|
+
"@react-native-firebase/app": "^23.7.0",
|
|
48
|
+
"@react-native-firebase/crashlytics": "^23.7.0",
|
|
49
|
+
"@react-native-firebase/firestore": "^23.7.0",
|
|
50
|
+
"@react-navigation/native": "^7.1.26",
|
|
43
51
|
"@tanstack/react-query": "^5.90.12",
|
|
44
52
|
"@types/node": "^25.0.3",
|
|
45
53
|
"@types/react": "~19.1.10",
|
|
46
|
-
"@umituz/react-native-design-system": "
|
|
47
|
-
"@umituz/react-native-
|
|
48
|
-
"@umituz/react-native-
|
|
49
|
-
"@umituz/react-native-
|
|
54
|
+
"@umituz/react-native-design-system": "^2.0.7",
|
|
55
|
+
"@umituz/react-native-device": "^1.5.2",
|
|
56
|
+
"@umituz/react-native-firebase": "*",
|
|
57
|
+
"@umituz/react-native-firestore": "^1.13.4",
|
|
58
|
+
"@umituz/react-native-icons": "^1.1.2",
|
|
59
|
+
"@umituz/react-native-legal": "*",
|
|
60
|
+
"@umituz/react-native-localization": "^3.5.21",
|
|
61
|
+
"@umituz/react-native-storage": "^2.4.4",
|
|
50
62
|
"expo-constants": "~18.0.12",
|
|
63
|
+
"expo-localization": "^17.0.8",
|
|
51
64
|
"firebase": "^12.6.0",
|
|
65
|
+
"i18next": "^25.7.3",
|
|
66
|
+
"react-i18next": "^16.5.0",
|
|
52
67
|
"react-native": "0.81.5",
|
|
53
68
|
"react-native-purchases": "^9.6.10",
|
|
54
69
|
"react-native-safe-area-context": "~5.6.0",
|
|
@@ -62,4 +77,4 @@
|
|
|
62
77
|
"README.md",
|
|
63
78
|
"LICENSE"
|
|
64
79
|
]
|
|
65
|
-
}
|
|
80
|
+
}
|
|
@@ -97,17 +97,6 @@ export const SubscriptionModal: React.FC<SubscriptionModalProps> = React.memo((p
|
|
|
97
97
|
onClose,
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
if (__DEV__) {
|
|
101
|
-
console.log("[SubscriptionModal] Rendering", {
|
|
102
|
-
visible,
|
|
103
|
-
variant,
|
|
104
|
-
packagesCount: packages.length,
|
|
105
|
-
featuresCount: features.length,
|
|
106
|
-
isLoading,
|
|
107
|
-
layoutConfig,
|
|
108
|
-
styleConfig: styles_,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
100
|
|
|
112
101
|
if (!visible) return null;
|
|
113
102
|
|
|
@@ -55,21 +55,12 @@ export const SubscriptionModalOverlay: React.FC<SubscriptionModalOverlayProps> =
|
|
|
55
55
|
const tokens = useAppDesignTokens();
|
|
56
56
|
const config = { ...DEFAULT_LAYOUT, ...layoutConfig };
|
|
57
57
|
|
|
58
|
-
if (__DEV__) {
|
|
59
|
-
console.log("[SubscriptionModalOverlay] Rendering", {
|
|
60
|
-
variant,
|
|
61
|
-
visible,
|
|
62
|
-
layoutConfig: config,
|
|
63
|
-
screenHeight: SCREEN_HEIGHT,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
58
|
|
|
67
59
|
const isFullScreen = variant === "fullscreen";
|
|
68
60
|
|
|
69
61
|
const getFullscreenContentStyle = (): ViewStyle => ({
|
|
70
62
|
width: Math.min(SCREEN_WIDTH * (config.widthPercent ?? 0.92), config.maxWidth ?? 480),
|
|
71
|
-
|
|
72
|
-
height: SCREEN_HEIGHT * (config.maxHeightPercent ?? 0.88),
|
|
63
|
+
maxHeight: SCREEN_HEIGHT * (config.maxHeightPercent ?? 0.88),
|
|
73
64
|
borderRadius: config.borderRadius ?? 32,
|
|
74
65
|
overflow: "hidden",
|
|
75
66
|
borderWidth: 1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { View, StyleSheet, ActivityIndicator } from "react-native";
|
|
3
3
|
import { AtomicText } from "@umituz/react-native-design-system";
|
|
4
4
|
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
@@ -27,14 +27,6 @@ export const SubscriptionPackageList: React.FC<SubscriptionPackageListProps> = R
|
|
|
27
27
|
const hasPackages = packages.length > 0;
|
|
28
28
|
const showLoading = isLoading && !hasPackages;
|
|
29
29
|
|
|
30
|
-
// Log state for debugging production issues
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
console.log("[SubscriptionPackageList] render state:", {
|
|
33
|
-
isLoading,
|
|
34
|
-
packagesCount: packages.length,
|
|
35
|
-
hasSelectedPkg: !!selectedPkg,
|
|
36
|
-
});
|
|
37
|
-
}, [isLoading, packages.length, selectedPkg]);
|
|
38
30
|
|
|
39
31
|
if (showLoading) {
|
|
40
32
|
return (
|
|
@@ -51,8 +43,6 @@ export const SubscriptionPackageList: React.FC<SubscriptionPackageListProps> = R
|
|
|
51
43
|
}
|
|
52
44
|
|
|
53
45
|
if (!hasPackages) {
|
|
54
|
-
// Log warning for debugging
|
|
55
|
-
console.warn("[SubscriptionPackageList] No packages available to display");
|
|
56
46
|
return (
|
|
57
47
|
<View style={styles.centerContent}>
|
|
58
48
|
<AtomicText
|
|
@@ -43,7 +43,19 @@ export class RevenueCatService implements IRevenueCatService {
|
|
|
43
43
|
return this.stateManager.isUsingTestStore();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
getCurrentUserId(): string | null {
|
|
47
|
+
return this.stateManager.getCurrentUserId();
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
async initialize(userId: string, apiKey?: string): Promise<InitializeResult> {
|
|
51
|
+
// If already initialized for this user, return success immediately
|
|
52
|
+
if (this.isInitialized() && this.getCurrentUserId() === userId) {
|
|
53
|
+
if (__DEV__) {
|
|
54
|
+
console.log("[RevenueCat] Already initialized for user:", userId);
|
|
55
|
+
}
|
|
56
|
+
return { success: true, offering: (await this.fetchOfferings()), hasPremium: false }; // fetchOfferings handles cache usually
|
|
57
|
+
}
|
|
58
|
+
|
|
47
59
|
const result = await initializeSDK(
|
|
48
60
|
{
|
|
49
61
|
config: this.stateManager.getConfig(),
|