@umituz/react-native-subscription 2.14.99 → 2.14.100
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/README.md +211 -394
- package/package.json +1 -1
- package/src/application/README.md +46 -225
- package/src/application/ports/README.md +42 -97
- package/src/domain/README.md +36 -384
- package/src/domain/constants/README.md +0 -56
- package/src/domain/entities/README.md +43 -169
- package/src/domain/errors/README.md +33 -287
- package/src/domain/value-objects/README.md +43 -179
- package/src/domains/README.md +50 -238
- package/src/domains/README.md.bak +274 -0
- package/src/domains/config/README.md +93 -383
- package/src/domains/config/domain/README.md +23 -376
- package/src/domains/config/domain/entities/README.md +34 -343
- package/src/domains/paywall/README.md +99 -369
- package/src/domains/paywall/components/README.md +34 -178
- package/src/domains/paywall/entities/README.md +34 -193
- package/src/domains/paywall/hooks/README.md +34 -122
- package/src/domains/wallet/README.md +34 -275
- package/src/domains/wallet/README.md.bak +209 -0
- package/src/domains/wallet/domain/README.md +34 -101
- package/src/domains/wallet/domain/entities/README.md +34 -115
- package/src/domains/wallet/domain/errors/README.md +34 -151
- package/src/domains/wallet/infrastructure/README.md +34 -89
- package/src/domains/wallet/presentation/components/README.md +34 -224
- package/src/domains/wallet/presentation/hooks/README.md +34 -248
- package/src/infrastructure/README.md +37 -496
- package/src/infrastructure/mappers/README.md +0 -13
- package/src/infrastructure/repositories/README.md +74 -360
- package/src/infrastructure/services/README.md +95 -370
- package/src/presentation/README.md +123 -408
- package/src/presentation/README.md.bak +172 -0
- package/src/presentation/components/README.md +151 -179
- package/src/presentation/components/README.md.bak +217 -0
- package/src/presentation/components/details/CreditRow.md +65 -310
- package/src/presentation/components/details/DetailRow.md +63 -255
- package/src/presentation/components/details/PremiumDetailsCard.md +65 -238
- package/src/presentation/components/details/PremiumStatusBadge.md +64 -239
- package/src/presentation/components/details/README.md +97 -447
- package/src/presentation/components/feedback/PaywallFeedbackModal.md +63 -287
- package/src/presentation/components/feedback/README.md +97 -445
- package/src/presentation/components/paywall/PaywallModal.md +66 -416
- package/src/presentation/components/paywall/README.md +50 -186
- package/src/presentation/components/sections/README.md +97 -466
- package/src/presentation/components/sections/SubscriptionSection.md +92 -244
- package/src/presentation/hooks/README.md +154 -741
- package/src/presentation/hooks/useAuthAwarePurchase.md +58 -325
- package/src/presentation/hooks/useAuthGate.md +61 -375
- package/src/presentation/hooks/useAuthSubscriptionSync.md +66 -370
- package/src/presentation/hooks/useCreditChecker.md +73 -378
- package/src/presentation/hooks/useCredits.md +74 -313
- package/src/presentation/hooks/useCredits.md.bak +231 -0
- package/src/presentation/hooks/useCreditsGate.md +66 -318
- package/src/presentation/hooks/useDeductCredit.md +0 -76
- package/src/presentation/hooks/useDevTestCallbacks.md +63 -394
- package/src/presentation/hooks/useFeatureGate.md +105 -150
- package/src/presentation/hooks/useFeatureGate.md.bak +284 -0
- package/src/presentation/hooks/useInitializeCredits.md +64 -430
- package/src/presentation/hooks/usePaywall.md +61 -306
- package/src/presentation/hooks/usePaywallOperations.md +64 -458
- package/src/presentation/hooks/usePaywallVisibility.md +67 -316
- package/src/presentation/hooks/usePremium.md +84 -226
- package/src/presentation/hooks/usePremiumGate.md +60 -395
- package/src/presentation/hooks/usePremiumWithCredits.md +64 -401
- package/src/presentation/hooks/useSubscription.md +66 -422
- package/src/presentation/hooks/useSubscriptionDetails.md +65 -410
- package/src/presentation/hooks/useSubscriptionGate.md +80 -164
- package/src/presentation/hooks/useSubscriptionSettingsConfig.md +66 -346
- package/src/presentation/hooks/useSubscriptionStatus.md +66 -396
- package/src/presentation/hooks/useUserTier.md +63 -328
- package/src/presentation/hooks/useUserTierWithRepository.md +64 -424
- package/src/presentation/screens/README.md +48 -190
- package/src/presentation/types/README.md +0 -16
- package/src/presentation/utils/README.md +0 -21
- package/src/revenuecat/README.md +99 -518
- package/src/revenuecat/application/README.md +35 -150
- package/src/revenuecat/application/ports/README.md +34 -162
- package/src/revenuecat/domain/README.md +42 -141
- package/src/revenuecat/domain/constants/README.md +34 -176
- package/src/revenuecat/domain/entities/README.md +34 -374
- package/src/revenuecat/domain/errors/README.md +47 -191
- package/src/revenuecat/domain/types/README.md +34 -366
- package/src/revenuecat/domain/value-objects/README.md +34 -434
- package/src/revenuecat/infrastructure/README.md +34 -43
- package/src/revenuecat/infrastructure/config/README.md +32 -23
- package/src/revenuecat/infrastructure/handlers/README.md +34 -211
- package/src/revenuecat/infrastructure/managers/README.md +34 -42
- package/src/revenuecat/infrastructure/services/README.md +35 -318
- package/src/revenuecat/infrastructure/utils/README.md +34 -375
- package/src/revenuecat/presentation/README.md +34 -176
- package/src/revenuecat/presentation/hooks/README.md +29 -35
- package/src/utils/README.md +38 -525
|
@@ -1,246 +1,94 @@
|
|
|
1
1
|
# SubscriptionSection Component
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}}
|
|
96
|
-
/>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Complete Configuration
|
|
102
|
-
|
|
103
|
-
```typescript
|
|
104
|
-
function CompleteSubscriptionSection() {
|
|
105
|
-
const { user } = useAuth();
|
|
106
|
-
const { isPremium } = usePremium();
|
|
107
|
-
const { credits } = useCredits();
|
|
108
|
-
|
|
109
|
-
const config = {
|
|
110
|
-
statusType: isPremium ? 'active' : 'none',
|
|
111
|
-
isPremium,
|
|
112
|
-
expirationDate: isPremium ? 'January 15, 2025' : null,
|
|
113
|
-
purchaseDate: isPremium ? 'January 15, 2024' : null,
|
|
114
|
-
isLifetime: false,
|
|
115
|
-
daysRemaining: isPremium ? 30 : null,
|
|
116
|
-
credits: [
|
|
117
|
-
{
|
|
118
|
-
id: 'monthly',
|
|
119
|
-
label: 'Monthly Credits',
|
|
120
|
-
current: credits,
|
|
121
|
-
total: 100,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
translations: {
|
|
125
|
-
title: 'Subscription',
|
|
126
|
-
statusLabel: 'Status',
|
|
127
|
-
statusActive: 'Active',
|
|
128
|
-
statusExpired: 'Expired',
|
|
129
|
-
statusFree: 'Free',
|
|
130
|
-
statusCanceled: 'Canceled',
|
|
131
|
-
expiresLabel: 'Expires on',
|
|
132
|
-
purchasedLabel: 'Purchased on',
|
|
133
|
-
lifetimeLabel: 'Lifetime Access',
|
|
134
|
-
creditsTitle: 'Credits',
|
|
135
|
-
remainingLabel: 'remaining',
|
|
136
|
-
manageButton: 'Manage Subscription',
|
|
137
|
-
upgradeButton: 'Upgrade to Premium',
|
|
138
|
-
freeDescription: 'Upgrade to access all features',
|
|
139
|
-
},
|
|
140
|
-
onManageSubscription: () => {
|
|
141
|
-
Linking.openURL('https://apps.apple.com/account/subscriptions');
|
|
142
|
-
},
|
|
143
|
-
onUpgrade: () => {
|
|
144
|
-
navigation.navigate('Paywall');
|
|
145
|
-
},
|
|
146
|
-
onPress: () => {
|
|
147
|
-
navigation.navigate('SubscriptionDetails');
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
return <SubscriptionSection config={config} />;
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Examples
|
|
156
|
-
|
|
157
|
-
### Settings Integration
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
function AppSettings() {
|
|
161
|
-
const { user } = useAuth();
|
|
162
|
-
|
|
163
|
-
const config = useSubscriptionSettingsConfig({
|
|
164
|
-
userId: user?.uid,
|
|
165
|
-
translations: {
|
|
166
|
-
title: 'Subscription',
|
|
167
|
-
description: 'Manage your subscription',
|
|
168
|
-
statusLabel: 'Status',
|
|
169
|
-
statusActive: 'Active',
|
|
170
|
-
statusExpired: 'Expired',
|
|
171
|
-
statusFree: 'Free',
|
|
172
|
-
statusCanceled: 'Canceled',
|
|
173
|
-
expiresLabel: 'Expires',
|
|
174
|
-
purchasedLabel: 'Purchased',
|
|
175
|
-
lifetimeLabel: 'Lifetime',
|
|
176
|
-
creditsTitle: 'Credits',
|
|
177
|
-
remainingLabel: 'remaining',
|
|
178
|
-
manageButton: 'Manage',
|
|
179
|
-
upgradeButton: 'Upgrade',
|
|
180
|
-
freeDescription: 'Upgrade for premium features',
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
return (
|
|
185
|
-
<ScrollView>
|
|
186
|
-
<Section title="Account">
|
|
187
|
-
<SettingsItem label="Email" value={user?.email} />
|
|
188
|
-
<SettingsItem label="Subscription" value={config.settingsItem.statusLabel} />
|
|
189
|
-
</Section>
|
|
190
|
-
|
|
191
|
-
<SubscriptionSection
|
|
192
|
-
config={config.sectionConfig}
|
|
193
|
-
onPress={() => navigation.navigate('SubscriptionDetails')}
|
|
194
|
-
/>
|
|
195
|
-
</ScrollView>
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### With Conditional Display
|
|
201
|
-
|
|
202
|
-
```typescript
|
|
203
|
-
function ConditionalSubscriptionSection() {
|
|
204
|
-
const { user } = useAuth();
|
|
205
|
-
const { isPremium } = usePremium();
|
|
206
|
-
|
|
207
|
-
const config = useSubscriptionSettingsConfig({
|
|
208
|
-
userId: user?.uid,
|
|
209
|
-
translations: englishTranslations,
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
// Only show if user is authenticated
|
|
213
|
-
if (!user) return null;
|
|
214
|
-
|
|
215
|
-
return (
|
|
216
|
-
<SubscriptionSection
|
|
217
|
-
config={config.sectionConfig}
|
|
218
|
-
containerStyle={{
|
|
219
|
-
backgroundColor: isPremium ? '#FFF8E1' : '#F5F5F5',
|
|
220
|
-
}}
|
|
221
|
-
/>
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
## Best Practices
|
|
227
|
-
|
|
228
|
-
1. **Use hook** - Get config from `useSubscriptionSettingsConfig`
|
|
229
|
-
2. **Provide translations** - Ensure all strings are localized
|
|
230
|
-
3. **Handle navigation** - Implement onPress for detail screen
|
|
231
|
-
4. **Test states** - Active, expired, free, lifetime
|
|
232
|
-
5. **Style consistently** - Match app design system
|
|
233
|
-
6. **Handle actions** - Implement manage and upgrade handlers
|
|
234
|
-
|
|
235
|
-
## Related Components
|
|
236
|
-
|
|
237
|
-
- **PremiumDetailsCard** - The card component rendered inside
|
|
238
|
-
- **PremiumStatusBadge** - Status badge component
|
|
239
|
-
- **DetailRow** - Row component for details
|
|
240
|
-
- **CreditRow** - Row component for credits
|
|
241
|
-
|
|
242
|
-
## See Also
|
|
243
|
-
|
|
244
|
-
- [useSubscriptionSettingsConfig](../../hooks/useSubscriptionSettingsConfig.md)
|
|
245
|
-
- [Settings Screen](../../screens/README.md)
|
|
246
|
-
- [Config Types](../../types/SubscriptionSettingsTypes.md)
|
|
3
|
+
Section component displaying subscription status with details and actions.
|
|
4
|
+
|
|
5
|
+
## Location
|
|
6
|
+
|
|
7
|
+
**Import Path**: `@umituz/react-native-subscription`
|
|
8
|
+
|
|
9
|
+
**File**: `src/presentation/components/sections/SubscriptionSection.tsx`
|
|
10
|
+
|
|
11
|
+
**Type**: Component
|
|
12
|
+
|
|
13
|
+
## Strategy
|
|
14
|
+
|
|
15
|
+
### Subscription Information Display
|
|
16
|
+
|
|
17
|
+
1. **Status Detection**: Display current subscription status (active/inactive/free)
|
|
18
|
+
2. **Detail Rendering**: Show expiration date, renewal status, product info
|
|
19
|
+
3. **Action Buttons**: Display manage or upgrade button based on status
|
|
20
|
+
4. **Loading States**: Handle loading and error states gracefully
|
|
21
|
+
5. **Translation Support**: Support custom translations for all text
|
|
22
|
+
6. **Visual Hierarchy**: Clear structure with status badge, details, and actions
|
|
23
|
+
|
|
24
|
+
### Integration Points
|
|
25
|
+
|
|
26
|
+
- **useSubscriptionStatus**: For subscription status data
|
|
27
|
+
- **usePremium**: For premium status check
|
|
28
|
+
- **DetailRow**: For displaying individual detail items
|
|
29
|
+
- **PremiumStatusBadge**: For status badge display
|
|
30
|
+
- **Navigation**: For manage/upgrade button actions
|
|
31
|
+
|
|
32
|
+
## Restrictions
|
|
33
|
+
|
|
34
|
+
### REQUIRED
|
|
35
|
+
|
|
36
|
+
- **Config Prop**: MUST provide valid subscription config object
|
|
37
|
+
- **Callback Handling**: MUST implement button callbacks
|
|
38
|
+
- **Loading State**: MUST handle loading state in UI
|
|
39
|
+
- **Null Handling**: MUST handle null status values
|
|
40
|
+
|
|
41
|
+
### PROHIBITED
|
|
42
|
+
|
|
43
|
+
- **NEVER** display without config data (show loading instead)
|
|
44
|
+
- **NEVER** hardcode status text (use translations)
|
|
45
|
+
- **DO NOT** show both manage and upgrade buttons simultaneously
|
|
46
|
+
- **DO NOT** show buttons for loading state
|
|
47
|
+
|
|
48
|
+
### CRITICAL SAFETY
|
|
49
|
+
|
|
50
|
+
- **ALWAYS** handle loading state before displaying data
|
|
51
|
+
- **MUST** validate config object before rendering
|
|
52
|
+
- **ALWAYS** provide clear button labels
|
|
53
|
+
- **NEVER** expose sensitive implementation details
|
|
54
|
+
|
|
55
|
+
## AI Agent Guidelines
|
|
56
|
+
|
|
57
|
+
### When Implementing Subscription Sections
|
|
58
|
+
|
|
59
|
+
1. **Always** provide valid subscription config
|
|
60
|
+
2. **Always** handle loading state
|
|
61
|
+
3. **Always** implement both button callbacks
|
|
62
|
+
4. **Always** use translations for localization
|
|
63
|
+
5. **Never** hardcode status strings
|
|
64
|
+
|
|
65
|
+
### Integration Checklist
|
|
66
|
+
|
|
67
|
+
- [ ] Import from correct path: `@umituz/react-native-subscription`
|
|
68
|
+
- [ ] Provide valid subscription config
|
|
69
|
+
- [ ] Implement onUpgradePress callback
|
|
70
|
+
- [ ] Implement onManagePress callback
|
|
71
|
+
- [ ] Handle loading state
|
|
72
|
+
- [ ] Handle null dates
|
|
73
|
+
- [ ] Provide translations for localization
|
|
74
|
+
- [ ] Test with active subscription
|
|
75
|
+
- [ ] Test with expired subscription
|
|
76
|
+
- [ ] Test with free user
|
|
77
|
+
- [ ] Test with lifetime subscription
|
|
78
|
+
|
|
79
|
+
### Common Patterns
|
|
80
|
+
|
|
81
|
+
1. **Settings Integration**: Add to settings screen
|
|
82
|
+
2. **Profile Display**: Show in user profile
|
|
83
|
+
3. **Status Card**: Display as standalone card
|
|
84
|
+
4. **With Navigation**: Navigate to detailed management
|
|
85
|
+
5. **Localized Display**: Use with i18n libraries
|
|
86
|
+
6. **Conditional Rendering**: Show/hide based on auth state
|
|
87
|
+
|
|
88
|
+
## Related Documentation
|
|
89
|
+
|
|
90
|
+
- **PremiumDetailsCard**: Detailed premium card
|
|
91
|
+
- **DetailRow**: Individual detail item
|
|
92
|
+
- **PremiumStatusBadge**: Status badge component
|
|
93
|
+
- **Subscription Hooks**: `../../hooks/README.md`
|
|
94
|
+
- **Sections README**: `./README.md`
|