@umituz/react-native-subscription 2.38.2 → 2.38.4

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.38.2",
3
+ "version": "2.38.4",
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",
@@ -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
  },
@@ -7,8 +7,9 @@ import { usePaywallFeedback } from "../../../../../presentation/hooks/feedback/u
7
7
  import { createPaywallFeedbackStyles } from "./paywallFeedbackStyles";
8
8
  import { FeedbackOption } from "./FeedbackOption";
9
9
  import type { PaywallFeedbackTranslations, PaywallFeedbackModalProps } from "./PaywallFeedbackModal.types";
10
+ import type { PaywallFeedbackScreenProps } from "./PaywallFeedbackScreen.types";
10
11
 
11
- export type { PaywallFeedbackTranslations, PaywallFeedbackModalProps };
12
+ export type { PaywallFeedbackTranslations, PaywallFeedbackModalProps, PaywallFeedbackScreenProps };
12
13
 
13
14
  const FEEDBACK_OPTION_IDS = [
14
15
  "too_expensive",
@@ -16,5 +16,6 @@ export interface PaywallFeedbackModalProps {
16
16
  translations: PaywallFeedbackTranslations;
17
17
  visible: boolean;
18
18
  onClose: () => void;
19
- onSubmit: (reason: string) => void;
19
+ onSubmit: (data: { reason: string; otherText?: string }) => void;
20
20
  }
21
+
@@ -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
+ });
@@ -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,
@@ -1,7 +1,7 @@
1
1
  import { useState, useCallback } from "react";
2
2
 
3
3
  interface UsePaywallFeedbackProps {
4
- onSubmit: (reason: string) => void;
4
+ onSubmit: (data: { reason: string; otherText?: string }) => void;
5
5
  onClose: () => void;
6
6
  }
7
7
 
@@ -15,12 +15,10 @@ export const usePaywallFeedback = ({
15
15
  const handleSubmit = useCallback(() => {
16
16
  if (!selectedReason) return;
17
17
 
18
- const finalReason =
19
- selectedReason === "other" && otherText.trim().length > 0
20
- ? `other: ${otherText.trim()}`
21
- : selectedReason;
22
-
23
- onSubmit(finalReason);
18
+ onSubmit({
19
+ reason: selectedReason,
20
+ otherText: selectedReason === "other" ? otherText.trim() : undefined,
21
+ });
24
22
  setSelectedReason(null);
25
23
  setOtherText("");
26
24
  onClose();