@umituz/react-native-subscription 2.37.94 → 2.37.96
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.37.
|
|
3
|
+
"version": "2.37.96",
|
|
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",
|
|
@@ -30,7 +30,7 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = (props) => {
|
|
|
30
30
|
|
|
31
31
|
const purchaseSource = source ?? currentSource ?? "settings";
|
|
32
32
|
|
|
33
|
-
const { data: packages = [] } = useSubscriptionPackages();
|
|
33
|
+
const { data: packages = [], isLoading: isLoadingPackages } = useSubscriptionPackages();
|
|
34
34
|
|
|
35
35
|
const { handlePurchase: performPurchase, handleRestore: performRestore } = useAuthAwarePurchase({
|
|
36
36
|
source: purchaseSource
|
|
@@ -68,6 +68,7 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = (props) => {
|
|
|
68
68
|
onPurchaseError={onPurchaseError}
|
|
69
69
|
onAuthRequired={onAuthRequired}
|
|
70
70
|
source={purchaseSource}
|
|
71
|
+
isLoadingPackages={isLoadingPackages}
|
|
71
72
|
/>
|
|
72
73
|
);
|
|
73
74
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
export const paywallModalStyles = StyleSheet.create({
|
|
4
5
|
modalContent: { padding: 0, borderWidth: 0, overflow: "hidden" },
|
|
5
6
|
container: { flex: 1 },
|
|
@@ -34,6 +35,7 @@ export const paywallModalStyles = StyleSheet.create({
|
|
|
34
35
|
loading: { alignItems: "center", paddingVertical: 24 },
|
|
35
36
|
loadingText: { marginTop: 8 },
|
|
36
37
|
plans: { marginBottom: 12 },
|
|
38
|
+
stickyFooter: { paddingHorizontal: 16, paddingTop: 12, borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: "rgba(128,128,128,0.2)" },
|
|
37
39
|
cta: { borderRadius: 12, paddingVertical: 14, alignItems: "center", marginBottom: 12 },
|
|
38
40
|
ctaDisabled: { opacity: 0.5 },
|
|
39
41
|
ctaText: { fontWeight: "700" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from "react";
|
|
2
2
|
import { View, TouchableOpacity, Linking } from "react-native";
|
|
3
|
-
import { AtomicText, AtomicIcon } from "@umituz/react-native-design-system/atoms";
|
|
3
|
+
import { AtomicText, AtomicIcon, AtomicSpinner } from "@umituz/react-native-design-system/atoms";
|
|
4
4
|
import { BaseModal } from "@umituz/react-native-design-system/molecules";
|
|
5
5
|
import { useSafeAreaInsets } from "@umituz/react-native-design-system/safe-area";
|
|
6
6
|
import { useAppDesignTokens } from "@umituz/react-native-design-system/theme";
|
|
@@ -14,7 +14,7 @@ import { usePaywallActions } from "../hooks/usePaywallActions";
|
|
|
14
14
|
import { PaywallModalProps } from "./PaywallModal.types";
|
|
15
15
|
|
|
16
16
|
export const PaywallModal: React.FC<PaywallModalProps> = React.memo((props) => {
|
|
17
|
-
const { visible, onClose, translations, packages = [], features = [], legalUrls = {}, bestValueIdentifier, creditAmounts, creditsLabel, heroImage, onPurchase, onRestore, onPurchaseSuccess, onPurchaseError, onAuthRequired, source } = props;
|
|
17
|
+
const { visible, onClose, translations, packages = [], features = [], legalUrls = {}, bestValueIdentifier, creditAmounts, creditsLabel, heroImage, onPurchase, onRestore, onPurchaseSuccess, onPurchaseError, onAuthRequired, source, isLoadingPackages } = props;
|
|
18
18
|
const tokens = useAppDesignTokens();
|
|
19
19
|
const insets = useSafeAreaInsets();
|
|
20
20
|
const { selectedPlanId, setSelectedPlanId, isProcessing, handlePurchase, handleRestore, resetState } = usePaywallActions({
|
|
@@ -48,7 +48,9 @@ export const PaywallModal: React.FC<PaywallModalProps> = React.memo((props) => {
|
|
|
48
48
|
<TouchableOpacity onPress={onClose} style={[styles.closeBtn, { backgroundColor: tokens.colors.surfaceSecondary, top: Math.max(insets.top, 12) }]} hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}>
|
|
49
49
|
<AtomicIcon name="close-outline" size="md" customColor={tokens.colors.textPrimary} />
|
|
50
50
|
</TouchableOpacity>
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
{/* Scrollable content — plan cards scroll, CTA is always pinned below */}
|
|
53
|
+
<ScreenLayout scrollable={true} edges={[]} backgroundColor="transparent" contentContainerStyle={styles.scroll}>
|
|
52
54
|
{heroImage && <View style={styles.heroContainer}><Image source={heroImage} style={styles.heroImage} contentFit="cover" transition={0} /></View>}
|
|
53
55
|
<View style={styles.header}>
|
|
54
56
|
<AtomicText type="headlineMedium" style={[styles.title, { color: tokens.colors.textPrimary }]}>{translations.title}</AtomicText>
|
|
@@ -56,18 +58,31 @@ export const PaywallModal: React.FC<PaywallModalProps> = React.memo((props) => {
|
|
|
56
58
|
</View>
|
|
57
59
|
<PaywallFeatures features={features} />
|
|
58
60
|
<View style={styles.plans}>
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
{isLoadingPackages ? (
|
|
62
|
+
<View style={styles.loading}>
|
|
63
|
+
<AtomicSpinner size="md" />
|
|
64
|
+
{translations.processingText && (
|
|
65
|
+
<AtomicText type="bodySmall" style={[styles.loadingText, { color: tokens.colors.textSecondary }]}>{translations.processingText}</AtomicText>
|
|
66
|
+
)}
|
|
67
|
+
</View>
|
|
68
|
+
) : (
|
|
69
|
+
packages.map((pkg) => {
|
|
70
|
+
const pid = pkg.product.identifier;
|
|
71
|
+
return (
|
|
72
|
+
<PlanCard key={pid} pkg={pkg} isSelected={selectedPlanId === pid} onSelect={() => setSelectedPlanId(pid)} badge={pid === bestValueIdentifier ? translations.bestValueBadgeText : undefined} creditAmount={creditAmounts?.[pid]} creditsLabel={creditsLabel} />
|
|
73
|
+
);
|
|
74
|
+
})
|
|
75
|
+
)}
|
|
65
76
|
</View>
|
|
66
|
-
|
|
77
|
+
</ScreenLayout>
|
|
78
|
+
|
|
79
|
+
{/* Sticky footer — always visible, never hidden behind scroll content */}
|
|
80
|
+
<View style={[styles.stickyFooter, { paddingBottom: Math.max(insets.bottom, 16) }]}>
|
|
81
|
+
<TouchableOpacity onPress={handlePurchase} disabled={isProcessing || isLoadingPackages} style={[styles.cta, { backgroundColor: tokens.colors.primary }, (isProcessing || isLoadingPackages) && styles.ctaDisabled]} activeOpacity={0.75}>
|
|
67
82
|
<AtomicText type="titleLarge" style={[styles.ctaText, { color: tokens.colors.onPrimary }]}>{isProcessing ? translations.processingText : translations.purchaseButtonText}</AtomicText>
|
|
68
83
|
</TouchableOpacity>
|
|
69
84
|
<PaywallFooter translations={translations} legalUrls={legalUrls} isProcessing={isProcessing} onRestore={onRestore ? handleRestore : undefined} onLegalClick={handleLegalUrl} />
|
|
70
|
-
</
|
|
85
|
+
</View>
|
|
71
86
|
</View>
|
|
72
87
|
</BaseModal>
|
|
73
88
|
);
|