@umituz/react-native-subscription 2.14.99 → 2.14.101

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.
Files changed (98) hide show
  1. package/README.md +211 -394
  2. package/package.json +3 -3
  3. package/src/application/README.md +46 -225
  4. package/src/application/ports/README.md +42 -97
  5. package/src/domain/README.md +36 -384
  6. package/src/domain/constants/README.md +0 -56
  7. package/src/domain/entities/README.md +43 -169
  8. package/src/domain/entities/SubscriptionStatus.ts +1 -1
  9. package/src/domain/errors/README.md +33 -287
  10. package/src/domain/value-objects/README.md +43 -179
  11. package/src/domains/README.md +50 -238
  12. package/src/domains/README.md.bak +274 -0
  13. package/src/domains/config/README.md +93 -383
  14. package/src/domains/config/domain/README.md +23 -376
  15. package/src/domains/config/domain/entities/README.md +34 -343
  16. package/src/domains/paywall/README.md +99 -369
  17. package/src/domains/paywall/components/README.md +34 -178
  18. package/src/domains/paywall/entities/README.md +34 -193
  19. package/src/domains/paywall/hooks/README.md +34 -122
  20. package/src/domains/wallet/README.md +34 -275
  21. package/src/domains/wallet/README.md.bak +209 -0
  22. package/src/domains/wallet/domain/README.md +34 -101
  23. package/src/domains/wallet/domain/entities/README.md +34 -115
  24. package/src/domains/wallet/domain/errors/README.md +34 -151
  25. package/src/domains/wallet/infrastructure/README.md +34 -89
  26. package/src/domains/wallet/presentation/components/README.md +34 -224
  27. package/src/domains/wallet/presentation/components/TransactionItem.tsx +1 -1
  28. package/src/domains/wallet/presentation/hooks/README.md +34 -248
  29. package/src/infrastructure/README.md +37 -496
  30. package/src/infrastructure/mappers/README.md +0 -13
  31. package/src/infrastructure/repositories/README.md +74 -360
  32. package/src/infrastructure/services/ActivationHandler.ts +1 -1
  33. package/src/infrastructure/services/README.md +95 -370
  34. package/src/infrastructure/services/SubscriptionService.ts +1 -1
  35. package/src/presentation/README.md +123 -408
  36. package/src/presentation/README.md.bak +172 -0
  37. package/src/presentation/components/README.md +151 -179
  38. package/src/presentation/components/README.md.bak +217 -0
  39. package/src/presentation/components/details/CreditRow.md +65 -310
  40. package/src/presentation/components/details/DetailRow.md +63 -255
  41. package/src/presentation/components/details/PremiumDetailsCard.md +65 -238
  42. package/src/presentation/components/details/PremiumStatusBadge.md +64 -239
  43. package/src/presentation/components/details/README.md +97 -447
  44. package/src/presentation/components/feedback/PaywallFeedbackModal.md +63 -287
  45. package/src/presentation/components/feedback/README.md +97 -445
  46. package/src/presentation/components/paywall/PaywallModal.md +66 -416
  47. package/src/presentation/components/paywall/README.md +50 -186
  48. package/src/presentation/components/sections/README.md +97 -466
  49. package/src/presentation/components/sections/SubscriptionSection.md +92 -244
  50. package/src/presentation/hooks/README.md +154 -741
  51. package/src/presentation/hooks/useAuthAwarePurchase.md +58 -325
  52. package/src/presentation/hooks/useAuthGate.md +61 -375
  53. package/src/presentation/hooks/useAuthSubscriptionSync.md +66 -370
  54. package/src/presentation/hooks/useCreditChecker.md +73 -378
  55. package/src/presentation/hooks/useCredits.md +74 -313
  56. package/src/presentation/hooks/useCredits.md.bak +231 -0
  57. package/src/presentation/hooks/useCreditsGate.md +66 -318
  58. package/src/presentation/hooks/useDeductCredit.md +0 -76
  59. package/src/presentation/hooks/useDeductCredit.ts +1 -1
  60. package/src/presentation/hooks/useDevTestCallbacks.md +63 -394
  61. package/src/presentation/hooks/useFeatureGate.md +105 -150
  62. package/src/presentation/hooks/useFeatureGate.md.bak +284 -0
  63. package/src/presentation/hooks/useInitializeCredits.md +64 -430
  64. package/src/presentation/hooks/usePaywall.md +61 -306
  65. package/src/presentation/hooks/usePaywallOperations.md +64 -458
  66. package/src/presentation/hooks/usePaywallVisibility.md +67 -316
  67. package/src/presentation/hooks/usePremium.md +84 -226
  68. package/src/presentation/hooks/usePremiumGate.md +60 -395
  69. package/src/presentation/hooks/usePremiumWithCredits.md +64 -401
  70. package/src/presentation/hooks/useSubscription.md +66 -422
  71. package/src/presentation/hooks/useSubscriptionDetails.md +65 -410
  72. package/src/presentation/hooks/useSubscriptionGate.md +80 -164
  73. package/src/presentation/hooks/useSubscriptionSettingsConfig.md +66 -346
  74. package/src/presentation/hooks/useSubscriptionStatus.md +66 -396
  75. package/src/presentation/hooks/useUserTier.md +63 -328
  76. package/src/presentation/hooks/useUserTierWithRepository.md +64 -424
  77. package/src/presentation/screens/README.md +48 -190
  78. package/src/presentation/types/README.md +0 -16
  79. package/src/presentation/utils/README.md +0 -21
  80. package/src/presentation/utils/subscriptionDateUtils.ts +1 -1
  81. package/src/revenuecat/README.md +99 -518
  82. package/src/revenuecat/application/README.md +35 -150
  83. package/src/revenuecat/application/ports/README.md +34 -162
  84. package/src/revenuecat/domain/README.md +42 -141
  85. package/src/revenuecat/domain/constants/README.md +34 -176
  86. package/src/revenuecat/domain/entities/README.md +34 -374
  87. package/src/revenuecat/domain/errors/README.md +47 -191
  88. package/src/revenuecat/domain/types/README.md +34 -366
  89. package/src/revenuecat/domain/value-objects/README.md +34 -434
  90. package/src/revenuecat/infrastructure/README.md +34 -43
  91. package/src/revenuecat/infrastructure/config/README.md +32 -23
  92. package/src/revenuecat/infrastructure/handlers/README.md +34 -211
  93. package/src/revenuecat/infrastructure/managers/README.md +34 -42
  94. package/src/revenuecat/infrastructure/services/README.md +35 -318
  95. package/src/revenuecat/infrastructure/utils/README.md +34 -375
  96. package/src/revenuecat/presentation/README.md +34 -176
  97. package/src/revenuecat/presentation/hooks/README.md +29 -35
  98. package/src/utils/README.md +38 -525
@@ -1,246 +1,94 @@
1
1
  # SubscriptionSection Component
2
2
 
3
- Generic section component that renders subscription/premium details in settings screens.
4
-
5
- ## Import
6
-
7
- ```typescript
8
- import { SubscriptionSection } from '@umituz/react-native-subscription';
9
- ```
10
-
11
- ## Signature
12
-
13
- ```typescript
14
- interface SubscriptionSectionConfig {
15
- statusType: 'active' | 'expired' | 'none' | 'canceled';
16
- isPremium: boolean;
17
- expirationDate?: string | null;
18
- purchaseDate?: string | null;
19
- isLifetime?: boolean;
20
- daysRemaining?: number | null;
21
- credits?: CreditInfo[];
22
- translations: PremiumDetailsTranslations;
23
- onManageSubscription?: () => void;
24
- onUpgrade?: () => void;
25
- onPress?: () => void;
26
- }
27
-
28
- interface SubscriptionSectionProps {
29
- config: SubscriptionSectionConfig;
30
- containerStyle?: StyleProp<ViewStyle>;
31
- }
32
- ```
33
-
34
- ## Props
35
-
36
- | Prop | Type | Default | Description |
37
- |------|------|---------|-------------|
38
- | `config` | `SubscriptionSectionConfig` | **Required** | Subscription configuration |
39
- | `containerStyle` | `StyleProp<ViewStyle>` | `undefined` | Optional container style |
40
-
41
- ## Basic Usage
42
-
43
- ```typescript
44
- function SettingsScreen() {
45
- const config = useSubscriptionSettingsConfig({
46
- userId: user?.uid,
47
- translations: englishTranslations,
48
- });
49
-
50
- return (
51
- <ScrollView>
52
- <SubscriptionSection config={config.sectionConfig} />
53
- </ScrollView>
54
- );
55
- }
56
- ```
57
-
58
- ## Advanced Usage
59
-
60
- ### With Navigation
61
-
62
- ```typescript
63
- function SettingsScreen() {
64
- const config = useSubscriptionSettingsConfig({
65
- userId: user?.uid,
66
- translations: englishTranslations,
67
- });
68
-
69
- return (
70
- <SubscriptionSection
71
- config={config.sectionConfig}
72
- onPress={() => navigation.navigate('SubscriptionDetails')}
73
- />
74
- );
75
- }
76
- ```
77
-
78
- ### With Custom Styling
79
-
80
- ```typescript
81
- function StyledSettings() {
82
- const config = useSubscriptionSettingsConfig({
83
- userId: user?.uid,
84
- translations: englishTranslations,
85
- });
86
-
87
- return (
88
- <SubscriptionSection
89
- config={config.sectionConfig}
90
- containerStyle={{
91
- marginHorizontal: 16,
92
- marginVertical: 8,
93
- borderRadius: 12,
94
- overflow: 'hidden',
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`