@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.
Files changed (92) hide show
  1. package/README.md +211 -394
  2. package/package.json +1 -1
  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/errors/README.md +33 -287
  9. package/src/domain/value-objects/README.md +43 -179
  10. package/src/domains/README.md +50 -238
  11. package/src/domains/README.md.bak +274 -0
  12. package/src/domains/config/README.md +93 -383
  13. package/src/domains/config/domain/README.md +23 -376
  14. package/src/domains/config/domain/entities/README.md +34 -343
  15. package/src/domains/paywall/README.md +99 -369
  16. package/src/domains/paywall/components/README.md +34 -178
  17. package/src/domains/paywall/entities/README.md +34 -193
  18. package/src/domains/paywall/hooks/README.md +34 -122
  19. package/src/domains/wallet/README.md +34 -275
  20. package/src/domains/wallet/README.md.bak +209 -0
  21. package/src/domains/wallet/domain/README.md +34 -101
  22. package/src/domains/wallet/domain/entities/README.md +34 -115
  23. package/src/domains/wallet/domain/errors/README.md +34 -151
  24. package/src/domains/wallet/infrastructure/README.md +34 -89
  25. package/src/domains/wallet/presentation/components/README.md +34 -224
  26. package/src/domains/wallet/presentation/hooks/README.md +34 -248
  27. package/src/infrastructure/README.md +37 -496
  28. package/src/infrastructure/mappers/README.md +0 -13
  29. package/src/infrastructure/repositories/README.md +74 -360
  30. package/src/infrastructure/services/README.md +95 -370
  31. package/src/presentation/README.md +123 -408
  32. package/src/presentation/README.md.bak +172 -0
  33. package/src/presentation/components/README.md +151 -179
  34. package/src/presentation/components/README.md.bak +217 -0
  35. package/src/presentation/components/details/CreditRow.md +65 -310
  36. package/src/presentation/components/details/DetailRow.md +63 -255
  37. package/src/presentation/components/details/PremiumDetailsCard.md +65 -238
  38. package/src/presentation/components/details/PremiumStatusBadge.md +64 -239
  39. package/src/presentation/components/details/README.md +97 -447
  40. package/src/presentation/components/feedback/PaywallFeedbackModal.md +63 -287
  41. package/src/presentation/components/feedback/README.md +97 -445
  42. package/src/presentation/components/paywall/PaywallModal.md +66 -416
  43. package/src/presentation/components/paywall/README.md +50 -186
  44. package/src/presentation/components/sections/README.md +97 -466
  45. package/src/presentation/components/sections/SubscriptionSection.md +92 -244
  46. package/src/presentation/hooks/README.md +154 -741
  47. package/src/presentation/hooks/useAuthAwarePurchase.md +58 -325
  48. package/src/presentation/hooks/useAuthGate.md +61 -375
  49. package/src/presentation/hooks/useAuthSubscriptionSync.md +66 -370
  50. package/src/presentation/hooks/useCreditChecker.md +73 -378
  51. package/src/presentation/hooks/useCredits.md +74 -313
  52. package/src/presentation/hooks/useCredits.md.bak +231 -0
  53. package/src/presentation/hooks/useCreditsGate.md +66 -318
  54. package/src/presentation/hooks/useDeductCredit.md +0 -76
  55. package/src/presentation/hooks/useDevTestCallbacks.md +63 -394
  56. package/src/presentation/hooks/useFeatureGate.md +105 -150
  57. package/src/presentation/hooks/useFeatureGate.md.bak +284 -0
  58. package/src/presentation/hooks/useInitializeCredits.md +64 -430
  59. package/src/presentation/hooks/usePaywall.md +61 -306
  60. package/src/presentation/hooks/usePaywallOperations.md +64 -458
  61. package/src/presentation/hooks/usePaywallVisibility.md +67 -316
  62. package/src/presentation/hooks/usePremium.md +84 -226
  63. package/src/presentation/hooks/usePremiumGate.md +60 -395
  64. package/src/presentation/hooks/usePremiumWithCredits.md +64 -401
  65. package/src/presentation/hooks/useSubscription.md +66 -422
  66. package/src/presentation/hooks/useSubscriptionDetails.md +65 -410
  67. package/src/presentation/hooks/useSubscriptionGate.md +80 -164
  68. package/src/presentation/hooks/useSubscriptionSettingsConfig.md +66 -346
  69. package/src/presentation/hooks/useSubscriptionStatus.md +66 -396
  70. package/src/presentation/hooks/useUserTier.md +63 -328
  71. package/src/presentation/hooks/useUserTierWithRepository.md +64 -424
  72. package/src/presentation/screens/README.md +48 -190
  73. package/src/presentation/types/README.md +0 -16
  74. package/src/presentation/utils/README.md +0 -21
  75. package/src/revenuecat/README.md +99 -518
  76. package/src/revenuecat/application/README.md +35 -150
  77. package/src/revenuecat/application/ports/README.md +34 -162
  78. package/src/revenuecat/domain/README.md +42 -141
  79. package/src/revenuecat/domain/constants/README.md +34 -176
  80. package/src/revenuecat/domain/entities/README.md +34 -374
  81. package/src/revenuecat/domain/errors/README.md +47 -191
  82. package/src/revenuecat/domain/types/README.md +34 -366
  83. package/src/revenuecat/domain/value-objects/README.md +34 -434
  84. package/src/revenuecat/infrastructure/README.md +34 -43
  85. package/src/revenuecat/infrastructure/config/README.md +32 -23
  86. package/src/revenuecat/infrastructure/handlers/README.md +34 -211
  87. package/src/revenuecat/infrastructure/managers/README.md +34 -42
  88. package/src/revenuecat/infrastructure/services/README.md +35 -318
  89. package/src/revenuecat/infrastructure/utils/README.md +34 -375
  90. package/src/revenuecat/presentation/README.md +34 -176
  91. package/src/revenuecat/presentation/hooks/README.md +29 -35
  92. package/src/utils/README.md +38 -525
@@ -1,266 +1,91 @@
1
1
  # PremiumStatusBadge Component
2
2
 
3
- Displays subscription status as a colored badge component.
3
+ Compact badge component displaying premium status.
4
4
 
5
- ## Import
5
+ ## Location
6
6
 
7
- ```typescript
8
- import { PremiumStatusBadge } from '@umituz/react-native-subscription';
9
- ```
7
+ **Import Path**: `@umituz/react-native-subscription`
10
8
 
11
- ## Signature
9
+ **File**: `src/presentation/components/details/PremiumStatusBadge.tsx`
12
10
 
13
- ```typescript
14
- interface PremiumStatusBadgeProps {
15
- status: SubscriptionStatusType;
16
- activeLabel: string;
17
- expiredLabel: string;
18
- noneLabel: string;
19
- canceledLabel: string;
20
- }
11
+ **Type**: Component
21
12
 
22
- type SubscriptionStatusType = 'active' | 'expired' | 'none' | 'canceled';
23
- ```
13
+ ## Strategy
24
14
 
25
- ## Props
15
+ ### Status Badge Display
26
16
 
27
- | Prop | Type | Default | Description |
28
- |------|------|---------|-------------|
29
- | `status` | `SubscriptionStatusType` | **Required** | Current subscription status |
30
- | `activeLabel` | `string` | **Required** | Label for active status |
31
- | `expiredLabel` | `string` | **Required** | Label for expired status |
32
- | `noneLabel` | `string` | **Required** | Label for no subscription |
33
- | `canceledLabel` | `string` | **Required** | Label for canceled status |
17
+ 1. **Status Detection**: Display appropriate status (premium/free)
18
+ 2. **Visual Indication**: Use color and icon to indicate status
19
+ 3. **Compact Design**: Small footprint for various use cases
20
+ 4. **Styling Options**: Support different sizes and styles
21
+ 5. **Accessibility**: Include accessibility labels
22
+ 6. **Color Coding**: Use consistent colors for status types
34
23
 
35
- ## Basic Usage
24
+ ### Integration Points
36
25
 
37
- ```typescript
38
- function SubscriptionStatus() {
39
- const { isPremium } = usePremium();
26
+ - **usePremium**: For premium status check
27
+ - **Headers**: Display in screen headers
28
+ - **Cards**: Add to cards as status indicator
29
+ - **Lists**: Use in list items as badge
30
+ - **Buttons**: Add to buttons for premium features
40
31
 
41
- return (
42
- <PremiumStatusBadge
43
- status={isPremium ? 'active' : 'none'}
44
- activeLabel="Active"
45
- expiredLabel="Expired"
46
- noneLabel="Free"
47
- canceledLabel="Canceled"
48
- />
49
- );
50
- }
51
- ```
32
+ ## Restrictions
52
33
 
53
- ## Advanced Usage
34
+ ### REQUIRED
54
35
 
55
- ### With Dynamic Status
36
+ - **Status Prop**: MUST provide valid status boolean
37
+ - **Accessibility**: MUST include accessibility label
38
+ - **Color Consistency**: MUST use consistent colors
39
+ - **Size Constraint**: SHOULD maintain compact size
56
40
 
57
- ```typescript
58
- function DynamicStatusBadge() {
59
- const { status, isActive, isExpired } = useSubscriptionStatus();
41
+ ### PROHIBITED
60
42
 
61
- const getStatusType = (): SubscriptionStatusType => {
62
- if (!status) return 'none';
63
- if (isExpired) return 'expired';
64
- if (isActive) return 'active';
65
- return 'canceled';
66
- };
43
+ - **NEVER** display without status prop
44
+ - **NEVER** use inconsistent colors
45
+ - **DO NOT** make badge too large
46
+ - **DO NOT** use for non-premium status
67
47
 
68
- return (
69
- <PremiumStatusBadge
70
- status={getStatusType()}
71
- activeLabel="Active"
72
- expiredLabel="Expired"
73
- noneLabel="Free"
74
- canceledLabel="Canceled"
75
- />
76
- );
77
- }
78
- ```
48
+ ### CRITICAL SAFETY
79
49
 
80
- ### With Custom Labels
50
+ - **ALWAYS** validate status prop
51
+ - **MUST** include accessibility support
52
+ - **ALWAYS** use approved color schemes
53
+ - **NEVER** expose implementation logic
81
54
 
82
- ```typescript
83
- function CustomStatusBadge() {
84
- const { isActive } = usePremium();
55
+ ## AI Agent Guidelines
85
56
 
86
- return (
87
- <PremiumStatusBadge
88
- status={isActive ? 'active' : 'none'}
89
- activeLabel="✨ Premium"
90
- expiredLabel="⚠️ Expired"
91
- noneLabel="Free Tier"
92
- canceledLabel="❌ Canceled"
93
- />
94
- );
95
- }
96
- ```
57
+ ### When Implementing Status Badges
97
58
 
98
- ### With Localization
59
+ 1. **Always** provide valid status boolean
60
+ 2. **Always** include accessibility label
61
+ 3. **Always** use consistent colors
62
+ 4. **Always** maintain compact size
63
+ 5. **Never** use for non-status indicators
99
64
 
100
- ```typescript
101
- function LocalizedStatusBadge() {
102
- const { t } = useTranslation();
103
- const { status } = useSubscriptionStatus();
65
+ ### Integration Checklist
104
66
 
105
- return (
106
- <PremiumStatusBadge
107
- status={status.type}
108
- activeLabel={t('subscription.status.active')}
109
- expiredLabel={t('subscription.status.expired')}
110
- noneLabel={t('subscription.status.free')}
111
- canceledLabel={t('subscription.status.canceled')}
112
- />
113
- );
114
- }
115
- ```
67
+ - [ ] Import from correct path: `@umituz/react-native-subscription`
68
+ - [ ] Provide valid status prop
69
+ - [ ] Include accessibility label
70
+ - [ ] Apply appropriate styling
71
+ - [ ] Test with premium status
72
+ - [ ] Test with free status
73
+ - [ ] Test in different contexts
74
+ - [ ] Verify color consistency
75
+ - [ ] Check accessibility support
76
+ - [ ] Test size constraints
116
77
 
117
- ## Badge Colors
78
+ ### Common Patterns
118
79
 
119
- The component automatically applies appropriate colors based on status:
80
+ 1. **Header Badge**: Display in screen headers
81
+ 2. **Card Badge**: Add to premium cards
82
+ 3. **List Indicator**: Use in list items
83
+ 4. **Button Badge**: Add to premium feature buttons
84
+ 5. **Profile Badge**: Show in user profile
120
85
 
121
- | Status | Background Color | Text Color |
122
- |--------|-----------------|------------|
123
- | `active` | Success (green) | On-primary |
124
- | `expired` | Error (red) | On-primary |
125
- | `none` | Tertiary text | On-primary |
126
- | `canceled` | Warning (orange) | On-primary |
86
+ ## Related Documentation
127
87
 
128
- ## Examples
129
-
130
- ### In Header
131
-
132
- ```typescript
133
- function SubscriptionHeader() {
134
- const { status } = useSubscriptionStatus();
135
-
136
- return (
137
- <View style={styles.header}>
138
- <Text style={styles.title}>My Subscription</Text>
139
-
140
- <PremiumStatusBadge
141
- status={status.type}
142
- activeLabel="Active"
143
- expiredLabel="Expired"
144
- noneLabel="Free"
145
- canceledLabel="Canceled"
146
- />
147
- </View>
148
- );
149
- }
150
- ```
151
-
152
- ### With Icon
153
-
154
- ```typescript
155
- function StatusWithIcon() {
156
- const { isActive } = usePremium();
157
-
158
- return (
159
- <View style={styles.container}>
160
- <Icon
161
- name={isActive ? 'check-circle' : 'circle'}
162
- size={20}
163
- color={isActive ? 'green' : 'gray'}
164
- />
165
-
166
- <PremiumStatusBadge
167
- status={isActive ? 'active' : 'none'}
168
- activeLabel="Active"
169
- expiredLabel="Expired"
170
- noneLabel="Free"
171
- canceledLabel="Canceled"
172
- />
173
- </View>
174
- );
175
- }
176
- ```
177
-
178
- ### Status List
179
-
180
- ```typescript
181
- function StatusList() {
182
- const statuses: SubscriptionStatusType[] = ['active', 'expired', 'none', 'canceled'];
183
-
184
- return (
185
- <View>
186
- {statuses.map((status) => (
187
- <View key={status} style={styles.row}>
188
- <Text>{status}</Text>
189
-
190
- <PremiumStatusBadge
191
- status={status}
192
- activeLabel="Active"
193
- expiredLabel="Expired"
194
- noneLabel="Free"
195
- canceledLabel="Canceled"
196
- />
197
- </View>
198
- ))}
199
- </View>
200
- );
201
- }
202
- ```
203
-
204
- ### Compact Badge
205
-
206
- ```typescript
207
- function CompactBadge() {
208
- const { isActive } = usePremium();
209
-
210
- return (
211
- <View style={styles.compactContainer}>
212
- <PremiumStatusBadge
213
- status={isActive ? 'active' : 'none'}
214
- activeLabel="Premium"
215
- expiredLabel="Expired"
216
- noneLabel="Free"
217
- canceledLabel="Canceled"
218
- />
219
- </View>
220
- );
221
- }
222
-
223
- const styles = StyleSheet.create({
224
- compactContainer: {
225
- transform: [{ scale: 0.85 }], // Smaller size
226
- },
227
- });
228
- ```
229
-
230
- ## Styling
231
-
232
- The badge uses design tokens for consistent styling:
233
-
234
- ```typescript
235
- // Internal styles (simplified)
236
- badge: {
237
- paddingHorizontal: tokens.spacing.sm,
238
- paddingVertical: tokens.spacing.xs,
239
- borderRadius: tokens.radius.xs,
240
- backgroundColor: statusColor, // Dynamic based on status
241
- },
242
- badgeText: {
243
- fontWeight: '600',
244
- color: tokens.colors.onPrimary,
245
- }
246
- ```
247
-
248
- ## Best Practices
249
-
250
- 1. **Provide all labels** - Ensure all four status labels are provided
251
- 2. **Use consistent labels** - Keep labels consistent across app
252
- 3. **Localize labels** - Translate labels for i18n
253
- 4. **Check status first** - Determine correct status type
254
- 5. **Handle all states** - Cover active, expired, none, canceled
255
- 6. **Test colors** - Verify colors work with your theme
256
-
257
- ## Related Components
258
-
259
- - **PremiumDetailsCard** - Uses this badge component
260
- - **SubscriptionSection** - Displays badge in settings
261
- - **DetailRow** - Displays status as detail row
262
-
263
- ## See Also
264
-
265
- - [SubscriptionStatus Entity](../../../domain/entities/SubscriptionStatus.md)
266
- - [Status Utilities](../../../utils/subscriptionUtils.md)
88
+ - **PremiumDetailsCard**: Premium status card
89
+ - **DetailRow**: Detail row component
90
+ - **usePremium**: Premium status hook
91
+ - **Details README**: `./README.md`