@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,266 +1,91 @@
|
|
|
1
1
|
# PremiumStatusBadge Component
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Compact badge component displaying premium status.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Location
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import { PremiumStatusBadge } from '@umituz/react-native-subscription';
|
|
9
|
-
```
|
|
7
|
+
**Import Path**: `@umituz/react-native-subscription`
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
**File**: `src/presentation/components/details/PremiumStatusBadge.tsx`
|
|
12
10
|
|
|
13
|
-
|
|
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
|
-
|
|
23
|
-
```
|
|
13
|
+
## Strategy
|
|
24
14
|
|
|
25
|
-
|
|
15
|
+
### Status Badge Display
|
|
26
16
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
24
|
+
### Integration Points
|
|
36
25
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
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
|
-
|
|
34
|
+
### REQUIRED
|
|
54
35
|
|
|
55
|
-
|
|
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
|
-
|
|
58
|
-
function DynamicStatusBadge() {
|
|
59
|
-
const { status, isActive, isExpired } = useSubscriptionStatus();
|
|
41
|
+
### PROHIBITED
|
|
60
42
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
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
|
-
|
|
50
|
+
- **ALWAYS** validate status prop
|
|
51
|
+
- **MUST** include accessibility support
|
|
52
|
+
- **ALWAYS** use approved color schemes
|
|
53
|
+
- **NEVER** expose implementation logic
|
|
81
54
|
|
|
82
|
-
|
|
83
|
-
function CustomStatusBadge() {
|
|
84
|
-
const { isActive } = usePremium();
|
|
55
|
+
## AI Agent Guidelines
|
|
85
56
|
|
|
86
|
-
|
|
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
|
-
|
|
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
|
-
|
|
101
|
-
function LocalizedStatusBadge() {
|
|
102
|
-
const { t } = useTranslation();
|
|
103
|
-
const { status } = useSubscriptionStatus();
|
|
65
|
+
### Integration Checklist
|
|
104
66
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
78
|
+
### Common Patterns
|
|
118
79
|
|
|
119
|
-
|
|
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
|
-
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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`
|