@umituz/react-native-subscription 2.38.1 → 2.38.3
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 +1 -1
- package/src/domains/paywall/components/PaywallScreen.tsx +25 -16
- package/src/domains/subscription/presentation/components/feedback/FeedbackTextInput.tsx +1 -0
- package/src/domains/subscription/presentation/components/feedback/PaywallFeedbackScreen.tsx +193 -0
- package/src/domains/subscription/presentation/components/feedback/PaywallFeedbackScreen.types.ts +7 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.38.
|
|
3
|
+
"version": "2.38.3",
|
|
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",
|
|
@@ -160,29 +160,38 @@ export const PaywallScreen: React.FC<PaywallScreenProps> = React.memo((props) =>
|
|
|
160
160
|
return (
|
|
161
161
|
<PlanCard
|
|
162
162
|
key={pid}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
pkg={pkg}
|
|
164
|
+
isSelected={isSelected}
|
|
165
|
+
badge={isBestValue ? translations.bestValueBadgeText : undefined}
|
|
166
|
+
creditAmount={credits}
|
|
167
167
|
creditsLabel={creditsLabel}
|
|
168
|
-
|
|
168
|
+
onSelect={() => setSelectedPlanId(pid)}
|
|
169
169
|
/>
|
|
170
170
|
);
|
|
171
171
|
})
|
|
172
172
|
)}
|
|
173
173
|
</View>
|
|
174
174
|
|
|
175
|
-
{/*
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
175
|
+
{/* Sticky footer — always visible, never hidden behind scroll content */}
|
|
176
|
+
<View style={[styles.stickyFooter, { paddingBottom: Math.max(insets.bottom, 16) }]}>
|
|
177
|
+
<TouchableOpacity
|
|
178
|
+
onPress={handlePurchase}
|
|
179
|
+
disabled={isProcessing || isLoadingPackages || !selectedPlanId}
|
|
180
|
+
style={[styles.cta, { backgroundColor: tokens.colors.primary }, (isProcessing || isLoadingPackages || !selectedPlanId) && styles.ctaDisabled]}
|
|
181
|
+
activeOpacity={0.75}
|
|
182
|
+
>
|
|
183
|
+
<AtomicText type="titleLarge" style={[styles.ctaText, { color: tokens.colors.onPrimary }]}>
|
|
184
|
+
{isProcessing ? translations.processingText : translations.purchaseButtonText}
|
|
185
|
+
</AtomicText>
|
|
186
|
+
</TouchableOpacity>
|
|
187
|
+
<PaywallFooter
|
|
188
|
+
translations={translations}
|
|
189
|
+
legalUrls={legalUrls}
|
|
190
|
+
isProcessing={isProcessing}
|
|
191
|
+
onRestore={onRestore ? handleRestore : undefined}
|
|
192
|
+
onLegalClick={handleLegalUrl}
|
|
193
|
+
/>
|
|
194
|
+
</View>
|
|
186
195
|
</ScrollView>
|
|
187
196
|
</View>
|
|
188
197
|
);
|
|
@@ -23,6 +23,7 @@ export const FeedbackTextInput: React.FC<FeedbackTextInputProps> = ({ placeholde
|
|
|
23
23
|
borderRadius: tokens.borderRadius.sm,
|
|
24
24
|
padding: tokens.spacing.sm,
|
|
25
25
|
color: tokens.colors.textPrimary,
|
|
26
|
+
borderColor: tokens.colors.border,
|
|
26
27
|
minHeight: FEEDBACK_INPUT_MIN_HEIGHT,
|
|
27
28
|
textAlignVertical: "top",
|
|
28
29
|
},
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paywall Feedback Screen Component
|
|
3
|
+
*
|
|
4
|
+
* Full-screen feedback form (not modal). Use when you want the feedback
|
|
5
|
+
* form to be a standalone screen instead of a modal overlay.
|
|
6
|
+
* Collects user feedback after they decline the paywall.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React, { useMemo, useCallback } from "react";
|
|
10
|
+
import { View, ScrollView, TouchableOpacity, StyleSheet, Linking } from "react-native";
|
|
11
|
+
import { AtomicText, AtomicIcon } from "@umituz/react-native-design-system/atoms";
|
|
12
|
+
import { useSafeAreaInsets } from "@umituz/react-native-design-system/safe-area";
|
|
13
|
+
import { useAppDesignTokens } from "@umituz/react-native-design-system/theme";
|
|
14
|
+
import { usePaywallFeedback } from "../../../../../presentation/hooks/feedback/usePaywallFeedback";
|
|
15
|
+
import { FeedbackOption } from "./FeedbackOption";
|
|
16
|
+
import type { PaywallFeedbackScreenProps } from "./PaywallFeedbackScreen.types";
|
|
17
|
+
|
|
18
|
+
const FEEDBACK_OPTION_IDS = [
|
|
19
|
+
"too_expensive",
|
|
20
|
+
"no_need",
|
|
21
|
+
"trying_out",
|
|
22
|
+
"technical_issues",
|
|
23
|
+
"other",
|
|
24
|
+
] as const;
|
|
25
|
+
|
|
26
|
+
export const PaywallFeedbackScreen: React.FC<PaywallFeedbackScreenProps> = React.memo(({
|
|
27
|
+
translations,
|
|
28
|
+
onClose,
|
|
29
|
+
onSubmit,
|
|
30
|
+
}) => {
|
|
31
|
+
const tokens = useAppDesignTokens();
|
|
32
|
+
const insets = useSafeAreaInsets();
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
selectedReason,
|
|
36
|
+
otherText,
|
|
37
|
+
setOtherText,
|
|
38
|
+
selectReason,
|
|
39
|
+
handleSubmit,
|
|
40
|
+
handleSkip,
|
|
41
|
+
canSubmit,
|
|
42
|
+
} = usePaywallFeedback({ onSubmit, onClose });
|
|
43
|
+
|
|
44
|
+
const screenStyles = useMemo(() => createScreenStyles(tokens, insets), [tokens, insets]);
|
|
45
|
+
|
|
46
|
+
const handleSkipPress = useCallback(() => {
|
|
47
|
+
handleSkip();
|
|
48
|
+
}, [handleSkip]);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<View style={[screenStyles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
|
|
52
|
+
{/* Close button */}
|
|
53
|
+
<TouchableOpacity
|
|
54
|
+
onPress={handleSkipPress}
|
|
55
|
+
style={[screenStyles.closeBtn, { backgroundColor: tokens.colors.surfaceSecondary, top: Math.max(insets.top, 12) }]}
|
|
56
|
+
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
57
|
+
>
|
|
58
|
+
<AtomicIcon name="close-outline" size="md" customColor={tokens.colors.textPrimary} />
|
|
59
|
+
</TouchableOpacity>
|
|
60
|
+
|
|
61
|
+
{/* Scrollable content */}
|
|
62
|
+
<ScrollView
|
|
63
|
+
style={screenStyles.scrollContainer}
|
|
64
|
+
contentContainerStyle={screenStyles.scrollContent}
|
|
65
|
+
showsVerticalScrollIndicator={false}
|
|
66
|
+
>
|
|
67
|
+
{/* Header */}
|
|
68
|
+
<View style={screenStyles.header}>
|
|
69
|
+
<AtomicText
|
|
70
|
+
type="headlineMedium"
|
|
71
|
+
style={[screenStyles.title, { color: tokens.colors.textPrimary }]}
|
|
72
|
+
>
|
|
73
|
+
{translations.title}
|
|
74
|
+
</AtomicText>
|
|
75
|
+
{translations.subtitle && (
|
|
76
|
+
<AtomicText
|
|
77
|
+
type="bodyMedium"
|
|
78
|
+
style={[screenStyles.subtitle, { color: tokens.colors.textSecondary }]}
|
|
79
|
+
>
|
|
80
|
+
{translations.subtitle}
|
|
81
|
+
</AtomicText>
|
|
82
|
+
)}
|
|
83
|
+
</View>
|
|
84
|
+
|
|
85
|
+
{/* Feedback options */}
|
|
86
|
+
<View style={screenStyles.optionsContainer}>
|
|
87
|
+
{FEEDBACK_OPTION_IDS.map((optionId) => {
|
|
88
|
+
const isSelected = selectedReason === optionId;
|
|
89
|
+
const isOther = optionId === "other";
|
|
90
|
+
const showInput = isSelected && isOther;
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<FeedbackOption
|
|
94
|
+
key={optionId}
|
|
95
|
+
isSelected={isSelected}
|
|
96
|
+
text={translations.reasons[optionId]}
|
|
97
|
+
showInput={showInput}
|
|
98
|
+
placeholder={translations.otherPlaceholder}
|
|
99
|
+
inputValue={otherText}
|
|
100
|
+
onSelect={() => selectReason(optionId)}
|
|
101
|
+
onChangeText={setOtherText}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
})}
|
|
105
|
+
</View>
|
|
106
|
+
</ScrollView>
|
|
107
|
+
|
|
108
|
+
{/* Sticky footer - Submit button */}
|
|
109
|
+
<View style={[screenStyles.footer, { paddingBottom: Math.max(insets.bottom, 16) }]}>
|
|
110
|
+
<TouchableOpacity
|
|
111
|
+
style={[
|
|
112
|
+
screenStyles.submitButton,
|
|
113
|
+
{
|
|
114
|
+
backgroundColor: canSubmit ? tokens.colors.primary : tokens.colors.surfaceVariant,
|
|
115
|
+
opacity: canSubmit ? 1 : 0.6,
|
|
116
|
+
}
|
|
117
|
+
]}
|
|
118
|
+
onPress={handleSubmit}
|
|
119
|
+
disabled={!canSubmit}
|
|
120
|
+
activeOpacity={0.8}
|
|
121
|
+
>
|
|
122
|
+
<AtomicText
|
|
123
|
+
type="titleLarge"
|
|
124
|
+
style={[
|
|
125
|
+
screenStyles.submitText,
|
|
126
|
+
{ color: canSubmit ? tokens.colors.onPrimary : tokens.colors.textDisabled }
|
|
127
|
+
]}
|
|
128
|
+
>
|
|
129
|
+
{translations.submit}
|
|
130
|
+
</AtomicText>
|
|
131
|
+
</TouchableOpacity>
|
|
132
|
+
</View>
|
|
133
|
+
</View>
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
PaywallFeedbackScreen.displayName = "PaywallFeedbackScreen";
|
|
138
|
+
|
|
139
|
+
const createScreenStyles = (tokens: any, insets: any) => ({
|
|
140
|
+
container: {
|
|
141
|
+
flex: 1,
|
|
142
|
+
},
|
|
143
|
+
closeBtn: {
|
|
144
|
+
position: 'absolute' as const,
|
|
145
|
+
top: 12,
|
|
146
|
+
right: 12,
|
|
147
|
+
width: 36,
|
|
148
|
+
height: 36,
|
|
149
|
+
borderRadius: 18,
|
|
150
|
+
zIndex: 1000,
|
|
151
|
+
justifyContent: 'center' as const,
|
|
152
|
+
alignItems: 'center' as const,
|
|
153
|
+
},
|
|
154
|
+
scrollContainer: {
|
|
155
|
+
flex: 1,
|
|
156
|
+
},
|
|
157
|
+
scrollContent: {
|
|
158
|
+
paddingTop: 60,
|
|
159
|
+
paddingBottom: 100,
|
|
160
|
+
},
|
|
161
|
+
header: {
|
|
162
|
+
paddingHorizontal: tokens.spacing.xl,
|
|
163
|
+
marginBottom: tokens.spacing.xl,
|
|
164
|
+
},
|
|
165
|
+
title: {
|
|
166
|
+
marginBottom: tokens.spacing.sm,
|
|
167
|
+
},
|
|
168
|
+
subtitle: {
|
|
169
|
+
lineHeight: 22,
|
|
170
|
+
},
|
|
171
|
+
optionsContainer: {
|
|
172
|
+
paddingHorizontal: tokens.spacing.xl,
|
|
173
|
+
},
|
|
174
|
+
footer: {
|
|
175
|
+
position: 'absolute' as const,
|
|
176
|
+
bottom: 0,
|
|
177
|
+
left: 0,
|
|
178
|
+
right: 0,
|
|
179
|
+
paddingHorizontal: tokens.spacing.xl,
|
|
180
|
+
paddingTop: tokens.spacing.md,
|
|
181
|
+
backgroundColor: tokens.colors.backgroundPrimary,
|
|
182
|
+
borderTopWidth: 1,
|
|
183
|
+
borderTopColor: tokens.colors.border,
|
|
184
|
+
},
|
|
185
|
+
submitButton: {
|
|
186
|
+
borderRadius: 14,
|
|
187
|
+
paddingVertical: 16,
|
|
188
|
+
alignItems: 'center' as const,
|
|
189
|
+
},
|
|
190
|
+
submitText: {
|
|
191
|
+
fontWeight: "600",
|
|
192
|
+
},
|
|
193
|
+
});
|
package/src/domains/subscription/presentation/components/feedback/PaywallFeedbackScreen.types.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PaywallFeedbackTranslations } from "./PaywallFeedbackModal.types";
|
|
2
|
+
|
|
3
|
+
export interface PaywallFeedbackScreenProps {
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onSubmit: (data: { reason: string; otherText?: string }) => void | Promise<void>;
|
|
6
|
+
translations: PaywallFeedbackTranslations;
|
|
7
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -53,6 +53,7 @@ export { PremiumStatusBadge } from "./domains/subscription/presentation/componen
|
|
|
53
53
|
export type { PremiumStatusBadgeProps } from "./domains/subscription/presentation/components/details/PremiumStatusBadge.types";
|
|
54
54
|
export * from "./domains/subscription/presentation/components/sections/SubscriptionSection";
|
|
55
55
|
export * from "./domains/subscription/presentation/components/feedback/PaywallFeedbackModal";
|
|
56
|
+
export * from "./domains/subscription/presentation/components/feedback/PaywallFeedbackScreen";
|
|
56
57
|
export * from "./domains/subscription/presentation/screens/SubscriptionDetailScreen";
|
|
57
58
|
export type {
|
|
58
59
|
SubscriptionDetailConfig,
|