@umituz/react-native-subscription 2.27.91 → 2.27.93
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 +1 -1
- package/src/domains/credits/application/CreditsInitializer.ts +91 -38
- package/src/domains/credits/core/UserCreditsDocument.ts +33 -33
- package/src/domains/credits/infrastructure/CreditsRepository.ts +44 -58
- package/src/domains/paywall/components/PaywallModal.tsx +1 -1
- package/src/domains/subscription/application/SubscriptionInitializer.ts +59 -18
- package/src/domains/subscription/core/RevenueCatTypes.ts +2 -1
- package/src/domains/subscription/core/SubscriptionConstants.ts +12 -0
- package/src/domains/subscription/infrastructure/handlers/PackageHandler.ts +46 -27
- package/src/domains/subscription/infrastructure/managers/SubscriptionManager.ts +106 -42
- package/src/domains/subscription/infrastructure/services/RestoreHandler.ts +4 -2
- package/src/domains/subscription/infrastructure/services/RevenueCatInitializer.ts +1 -2
- package/src/domains/subscription/infrastructure/utils/RenewalDetector.ts +1 -1
- package/src/{presentation → domains/subscription/presentation}/components/details/PremiumStatusBadge.tsx +6 -4
- package/src/{presentation → domains/subscription/presentation}/components/feedback/PaywallFeedbackModal.tsx +1 -1
- package/src/{presentation → domains/subscription/presentation}/types/SubscriptionDetailTypes.ts +4 -2
- package/src/{presentation → domains/subscription/presentation}/types/SubscriptionSettingsTypes.ts +1 -1
- package/src/domains/subscription/presentation/usePremiumGate.ts +1 -1
- package/src/domains/subscription/presentation/useSavedPurchaseAutoExecution.ts +1 -1
- package/src/domains/subscription/presentation/useSubscriptionSettingsConfig.ts +4 -3
- package/src/domains/subscription/presentation/useSubscriptionSettingsConfig.utils.ts +1 -1
- package/src/domains/trial/application/TrialEligibilityService.ts +1 -1
- package/src/domains/trial/infrastructure/DeviceTrialRepository.ts +2 -2
- package/src/index.ts +5 -5
- package/src/shared/application/ports/IRevenueCatService.ts +2 -0
- package/src/shared/infrastructure/SubscriptionEventBus.ts +5 -2
- package/src/utils/tierUtils.ts +3 -3
- package/src/utils/types.ts +4 -1
- package/src/utils/validation.ts +2 -2
- package/src/domains/config/README.md +0 -100
- package/src/presentation/README.md +0 -125
- package/src/presentation/hooks/README.md +0 -156
- package/src/presentation/hooks/useAuthSubscriptionSync.md +0 -94
- package/src/presentation/hooks/useCredits.md +0 -103
- package/src/presentation/hooks/useDeductCredit.md +0 -100
- package/src/presentation/hooks/useFeatureGate.md +0 -112
- package/src/presentation/hooks/usePaywall.md +0 -89
- package/src/presentation/hooks/usePaywallOperations.md +0 -92
- package/src/presentation/hooks/usePaywallVisibility.md +0 -95
- package/src/presentation/hooks/usePremium.md +0 -88
- package/src/presentation/hooks/useSubscriptionSettingsConfig.md +0 -94
- package/src/utils/README.md +0 -42
- /package/src/{presentation → domains/subscription/presentation}/components/README.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/details/CreditRow.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/details/CreditRow.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/details/DetailRow.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/details/DetailRow.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumDetailsCard.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumDetailsCard.styles.ts +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumDetailsCard.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumDetailsCardTypes.ts +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumStatusBadge.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/details/README.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/feedback/PaywallFeedbackModal.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/feedback/README.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/feedback/paywallFeedbackStyles.ts +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/overlay/PurchaseLoadingOverlay.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/overlay/index.ts +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/paywall/PaywallModal.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/paywall/README.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/sections/README.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/sections/SubscriptionSection.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/components/sections/SubscriptionSection.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/screens/README.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/screens/SubscriptionDetailScreen.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/screens/components/CreditsList.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/screens/components/DevTestSection.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/screens/components/SubscriptionActions.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/screens/components/SubscriptionHeader.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/screens/components/UpgradePrompt.tsx +0 -0
- /package/src/{presentation → domains/subscription/presentation}/stores/index.ts +0 -0
- /package/src/{presentation → domains/subscription/presentation}/stores/purchaseLoadingStore.ts +0 -0
- /package/src/{presentation → domains/subscription/presentation}/types/README.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/utils/README.md +0 -0
- /package/src/{presentation → domains/subscription/presentation}/utils/subscriptionDateUtils.ts +0 -0
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# usePaywall Hook
|
|
2
|
-
|
|
3
|
-
Hook for controlling paywall visibility and state.
|
|
4
|
-
|
|
5
|
-
## Location
|
|
6
|
-
|
|
7
|
-
**Import Path**: `@umituz/react-native-subscription`
|
|
8
|
-
|
|
9
|
-
**File**: `src/presentation/hooks/usePaywall.ts`
|
|
10
|
-
|
|
11
|
-
**Type**: Hook
|
|
12
|
-
|
|
13
|
-
## Strategy
|
|
14
|
-
|
|
15
|
-
### Paywall State Management
|
|
16
|
-
|
|
17
|
-
1. **Visibility Control**: Show/hide paywall on demand
|
|
18
|
-
2. **Trigger Tracking**: Record what triggered paywall display
|
|
19
|
-
3. **Context Management**: Store paywall context and metadata
|
|
20
|
-
4. **Dynamic Configuration**: Support custom paywall configs per trigger
|
|
21
|
-
5. **State Persistence**: Maintain paywall state across component renders
|
|
22
|
-
6. **Event Tracking**: Enable analytics for paywall interactions
|
|
23
|
-
|
|
24
|
-
### Integration Points
|
|
25
|
-
|
|
26
|
-
- **Paywall Context**: Global paywall state management
|
|
27
|
-
- **Paywall Domain**: `src/domains/paywall/README.md`
|
|
28
|
-
- **Analytics**: For tracking paywall impressions and conversions
|
|
29
|
-
- **Navigation**: For paywall screen routing
|
|
30
|
-
|
|
31
|
-
## Restrictions
|
|
32
|
-
|
|
33
|
-
### REQUIRED
|
|
34
|
-
|
|
35
|
-
- **State Management**: MUST use showPaywall/hidePaywall functions
|
|
36
|
-
- **Trigger Tracking**: SHOULD include trigger information for analytics
|
|
37
|
-
- **Context**: SHOULD provide relevant context for paywall display
|
|
38
|
-
|
|
39
|
-
### PROHIBITED
|
|
40
|
-
|
|
41
|
-
- **NEVER** manage paywall state locally (use this hook instead)
|
|
42
|
-
- **NEVER** show paywall without user action or clear trigger
|
|
43
|
-
- **DO NOT** show paywall too frequently (respect user experience)
|
|
44
|
-
|
|
45
|
-
### CRITICAL SAFETY
|
|
46
|
-
|
|
47
|
-
- **ALWAYS** hide paywall on successful purchase
|
|
48
|
-
- **NEVER** trap users in paywall (provide clear exit)
|
|
49
|
-
- **MUST** track paywall triggers for analytics
|
|
50
|
-
- **ALWAYS** provide close/dismiss option
|
|
51
|
-
|
|
52
|
-
## AI Agent Guidelines
|
|
53
|
-
|
|
54
|
-
### When Implementing Paywall Triggers
|
|
55
|
-
|
|
56
|
-
1. **Always** include trigger source/context
|
|
57
|
-
2. **Always** track paywall impressions
|
|
58
|
-
3. **Always** provide clear close button
|
|
59
|
-
4. **Never** show paywall without clear reason
|
|
60
|
-
5. **Always** hide paywall after successful purchase
|
|
61
|
-
|
|
62
|
-
### Integration Checklist
|
|
63
|
-
|
|
64
|
-
- [ ] Import from correct path: `@umituz/react-native-subscription`
|
|
65
|
-
- [ ] Use showPaywall with trigger information
|
|
66
|
-
- [ ] Implement hidePaywall callback
|
|
67
|
-
- [ ] Track paywall impressions in analytics
|
|
68
|
-
- [ ] Track paywall dismissals
|
|
69
|
-
- [ ] Provide clear close button
|
|
70
|
-
- [ ] Test manual trigger
|
|
71
|
-
- [ ] Test automatic trigger (usage limit, etc.)
|
|
72
|
-
- [ ] Test purchase flow completion
|
|
73
|
-
- [ ] Verify paywall hides after purchase
|
|
74
|
-
|
|
75
|
-
### Common Patterns
|
|
76
|
-
|
|
77
|
-
1. **Manual Trigger**: User clicks upgrade button
|
|
78
|
-
2. **Usage Limit**: Show after N free uses
|
|
79
|
-
3. **Feature Gate**: Show when accessing premium feature
|
|
80
|
-
4. **Time-based**: Show after certain time/usage
|
|
81
|
-
5. **Event-driven**: Show on specific app events
|
|
82
|
-
|
|
83
|
-
## Related Documentation
|
|
84
|
-
|
|
85
|
-
- **usePaywallActions**: Paywall purchase actions
|
|
86
|
-
- **usePaywallVisibility**: Conditional paywall display logic
|
|
87
|
-
- **usePaywallOperations**: Complete paywall operations
|
|
88
|
-
- **Paywall Domain**: `src/domains/paywall/README.md`
|
|
89
|
-
- **Paywall Components**: `src/presentation/components/paywall/README.md`
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# usePaywallOperations Hook
|
|
2
|
-
|
|
3
|
-
Complete paywall purchase operations with authentication handling.
|
|
4
|
-
|
|
5
|
-
## Location
|
|
6
|
-
|
|
7
|
-
**Import Path**: `@umituz/react-native-subscription`
|
|
8
|
-
|
|
9
|
-
**File**: `src/presentation/hooks/usePaywallOperations.ts`
|
|
10
|
-
|
|
11
|
-
**Type**: Hook
|
|
12
|
-
|
|
13
|
-
## Strategy
|
|
14
|
-
|
|
15
|
-
### Paywall Purchase Flow with Auth
|
|
16
|
-
|
|
17
|
-
1. **Auth Check**: Verify if user is authenticated before purchase
|
|
18
|
-
2. **Pending Package Management**: Store package when auth is required
|
|
19
|
-
3. **Auth Flow Trigger**: Show auth modal for unauthenticated users
|
|
20
|
-
4. **Purchase Execution**: Complete purchase after authentication
|
|
21
|
-
5. **Restore Support**: Handle purchase restoration with auth check
|
|
22
|
-
6. **Callback Handling**: Execute appropriate callbacks at each stage
|
|
23
|
-
|
|
24
|
-
### Integration Points
|
|
25
|
-
|
|
26
|
-
- **usePremium**: For purchase and restore operations
|
|
27
|
-
- **Auth Context**: User authentication state
|
|
28
|
-
- **Paywall Domain**: For paywall display and management
|
|
29
|
-
- **Auth UI**: For authentication modal
|
|
30
|
-
- **RevenueCat**: For purchase transactions
|
|
31
|
-
|
|
32
|
-
## Restrictions
|
|
33
|
-
|
|
34
|
-
### REQUIRED
|
|
35
|
-
|
|
36
|
-
- **User ID**: MUST provide valid userId parameter
|
|
37
|
-
- **Anonymous Check**: MUST provide isAnonymous parameter
|
|
38
|
-
- **Auth Required Callback**: MUST implement onAuthRequired callback
|
|
39
|
-
- **Error Handling**: MUST handle purchase failures
|
|
40
|
-
|
|
41
|
-
### PROHIBITED
|
|
42
|
-
|
|
43
|
-
- **NEVER** call without valid userId
|
|
44
|
-
- **NEVER** call without isAnonymous parameter
|
|
45
|
-
- **DO NOT** proceed with purchase without auth check
|
|
46
|
-
- **DO NOT** ignore pending package state
|
|
47
|
-
|
|
48
|
-
### CRITICAL SAFETY
|
|
49
|
-
|
|
50
|
-
- **ALWAYS** check authentication status before purchase
|
|
51
|
-
- **MUST** handle pending package after auth
|
|
52
|
-
- **ALWAYS** provide clear auth flow for users
|
|
53
|
-
- **NEVER** allow anonymous purchases without auth
|
|
54
|
-
|
|
55
|
-
## AI Agent Guidelines
|
|
56
|
-
|
|
57
|
-
### When Implementing Paywall Operations
|
|
58
|
-
|
|
59
|
-
1. **Always** provide valid userId
|
|
60
|
-
2. **Always** provide isAnonymous status
|
|
61
|
-
3. **Always** implement onAuthRequired with pending package handling
|
|
62
|
-
4. **Always** implement onPurchaseSuccess callback
|
|
63
|
-
5. **Always** handle purchase and restore failures
|
|
64
|
-
|
|
65
|
-
### Integration Checklist
|
|
66
|
-
|
|
67
|
-
- [ ] Import from correct path: `@umituz/react-native-subscription`
|
|
68
|
-
- [ ] Provide valid userId
|
|
69
|
-
- [ ] Provide isAnonymous status
|
|
70
|
-
- [ ] Implement onAuthRequired callback
|
|
71
|
-
- [ ] Implement onPurchaseSuccess callback
|
|
72
|
-
- [ ] Implement onPaywallClose callback
|
|
73
|
-
- [ ] Handle pending package state
|
|
74
|
-
- [ ] Test purchase with authenticated user
|
|
75
|
-
- [ ] Test purchase with anonymous user
|
|
76
|
-
- [ ] Test purchase flow after authentication
|
|
77
|
-
|
|
78
|
-
### Common Patterns
|
|
79
|
-
|
|
80
|
-
1. **Pending Purchase Flow**: Store package, show auth, complete purchase
|
|
81
|
-
2. **In-App Purchases**: Use handleInAppPurchase for modal paywalls
|
|
82
|
-
3. **Purchase Analytics**: Track purchase attempts and completions
|
|
83
|
-
4. **Error Recovery**: Handle failures and provide retry options
|
|
84
|
-
5. **Post-Onboarding**: Handle purchases after onboarding flow
|
|
85
|
-
|
|
86
|
-
## Related Documentation
|
|
87
|
-
|
|
88
|
-
- **usePremium**: For purchase and restore operations
|
|
89
|
-
- **useAuthAwarePurchase**: For auth-gated purchases
|
|
90
|
-
- **usePaywallVisibility**: For paywall visibility control
|
|
91
|
-
- **Paywall Screen**: `src/presentation/screens/README.md`
|
|
92
|
-
- **Purchase Flow**: `src/docs/PURCHASE_FLOW.md`
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# usePaywallVisibility Hook
|
|
2
|
-
|
|
3
|
-
Simple global state management for paywall visibility using external store.
|
|
4
|
-
|
|
5
|
-
## Location
|
|
6
|
-
|
|
7
|
-
**Import Path**: `@umituz/react-native-subscription`
|
|
8
|
-
|
|
9
|
-
**File**: `src/presentation/hooks/usePaywallVisibility.ts`
|
|
10
|
-
|
|
11
|
-
**Type**: Hook
|
|
12
|
-
|
|
13
|
-
## Strategy
|
|
14
|
-
|
|
15
|
-
### Global Paywall State Management
|
|
16
|
-
|
|
17
|
-
1. **External Store**: Use Zustand or similar for global state
|
|
18
|
-
2. **Visibility Control**: Simple boolean for show/hide
|
|
19
|
-
3. **Global Access**: Available from any component
|
|
20
|
-
4. **Direct Control**: Provide paywallControl for non-React contexts
|
|
21
|
-
5. **Single Instance**: One paywall modal at app root
|
|
22
|
-
6. **State Persistence**: Maintain visibility across component unmounts
|
|
23
|
-
|
|
24
|
-
### Integration Points
|
|
25
|
-
|
|
26
|
-
- **App Root**: Paywall modal should be placed at app root
|
|
27
|
-
- **Any Component**: Can trigger paywall from anywhere
|
|
28
|
-
- **Deep Links**: Can open paywall from URLs
|
|
29
|
-
- **Push Notifications**: Can open paywall from notifications
|
|
30
|
-
- **usePremium**: For conditional display based on status
|
|
31
|
-
|
|
32
|
-
## Restrictions
|
|
33
|
-
|
|
34
|
-
### REQUIRED
|
|
35
|
-
|
|
36
|
-
- **Single Modal**: MUST place paywall modal once at app root
|
|
37
|
-
- **Close Handler**: MUST provide close button in paywall
|
|
38
|
-
- **Premium Check**: SHOULD hide paywall when user becomes premium
|
|
39
|
-
- **Back Handler**: SHOULD handle Android back button
|
|
40
|
-
|
|
41
|
-
### PROHIBITED
|
|
42
|
-
|
|
43
|
-
- **NEVER** place multiple paywall modals in component tree
|
|
44
|
-
- **NEVER** manage visibility locally (use this hook instead)
|
|
45
|
-
- **DO NOT** show paywall too frequently
|
|
46
|
-
- **DO NOT** trap users without exit option
|
|
47
|
-
|
|
48
|
-
### CRITICAL SAFETY
|
|
49
|
-
|
|
50
|
-
- **ALWAYS** provide close button
|
|
51
|
-
- **NEVER** trap users in paywall
|
|
52
|
-
- **MUST** handle back button on Android
|
|
53
|
-
- **ALWAYS** hide paywall after successful purchase
|
|
54
|
-
|
|
55
|
-
## AI Agent Guidelines
|
|
56
|
-
|
|
57
|
-
### When Implementing Paywall Visibility
|
|
58
|
-
|
|
59
|
-
1. **Always** place paywall modal once at app root
|
|
60
|
-
2. **Always** provide close button
|
|
61
|
-
3. **Always** use openPaywall/closePaywall functions
|
|
62
|
-
4. **Always** hide paywall after successful purchase
|
|
63
|
-
5. **Never** manage visibility locally in components
|
|
64
|
-
|
|
65
|
-
### Integration Checklist
|
|
66
|
-
|
|
67
|
-
- [ ] Import from correct path: `@umituz/react-native-subscription`
|
|
68
|
-
- [ ] Place paywall modal once at app root
|
|
69
|
-
- [ ] Use openPaywall to show paywall
|
|
70
|
-
- [ ] Use closePaywall to hide paywall
|
|
71
|
-
- [ ] Provide close button in paywall
|
|
72
|
-
- [ ] Handle Android back button
|
|
73
|
-
- [ ] Hide paywall when user becomes premium
|
|
74
|
-
- [ ] Test paywall opens from any component
|
|
75
|
-
- [ ] Test paywallControl for non-React contexts
|
|
76
|
-
- [ ] Test deep link integration
|
|
77
|
-
|
|
78
|
-
### Common Patterns
|
|
79
|
-
|
|
80
|
-
1. **App Root Setup**: Single modal instance at app root
|
|
81
|
-
2. **Trigger Button**: Any component can open paywall
|
|
82
|
-
3. **Direct Control**: Use paywallControl in non-React code
|
|
83
|
-
4. **Conditional Display**: Auto-show based on user status
|
|
84
|
-
5. **History/Navigation**: Handle navigation with paywall
|
|
85
|
-
6. **Timeout/Auto-Close**: Auto-close after timeout
|
|
86
|
-
7. **Deep Links**: Open from URL schemes
|
|
87
|
-
|
|
88
|
-
## Related Documentation
|
|
89
|
-
|
|
90
|
-
- **usePaywallOperations**: For paywall purchase operations
|
|
91
|
-
- **usePremium**: For subscription status
|
|
92
|
-
- **usePaywall**: For complete paywall management
|
|
93
|
-
- **Paywall Screen**: `src/presentation/screens/README.md`
|
|
94
|
-
- **Paywall Components**: `src/presentation/components/paywall/README.md`
|
|
95
|
-
- **Modal Integration**: `src/docs/MODAL_INTEGRATION.md`
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# usePremium Hook
|
|
2
|
-
|
|
3
|
-
Hook for checking and managing premium subscription status.
|
|
4
|
-
|
|
5
|
-
## Location
|
|
6
|
-
|
|
7
|
-
**Import Path**: `@umituz/react-native-subscription`
|
|
8
|
-
|
|
9
|
-
**File**: `src/presentation/hooks/usePremium.ts`
|
|
10
|
-
|
|
11
|
-
**Type**: Hook
|
|
12
|
-
|
|
13
|
-
## Strategy
|
|
14
|
-
|
|
15
|
-
### Premium Status Flow
|
|
16
|
-
|
|
17
|
-
1. **Initial Check**: Fetch current subscription status from repository
|
|
18
|
-
2. **Status Evaluation**: Determine if user has active premium subscription
|
|
19
|
-
3. **Real-time Updates**: Automatically update when user logs in/out or subscription changes
|
|
20
|
-
4. **Caching**: Cache status for 5 minutes (configurable) to reduce API calls
|
|
21
|
-
5. **Loading States**: Provide loading indicators during data fetch
|
|
22
|
-
6. **Error Handling**: Handle fetch errors gracefully
|
|
23
|
-
|
|
24
|
-
### Integration Points
|
|
25
|
-
|
|
26
|
-
- **Subscription Repository**: `src/infrastructure/repositories/SubscriptionRepository.ts`
|
|
27
|
-
- **TanStack Query**: For caching and real-time updates
|
|
28
|
-
- **Auth Context**: Sync with user authentication state
|
|
29
|
-
- **RevenueCat**: For subscription data source
|
|
30
|
-
|
|
31
|
-
## Restrictions
|
|
32
|
-
|
|
33
|
-
### REQUIRED
|
|
34
|
-
|
|
35
|
-
- **Loading State**: MUST handle loading state in UI
|
|
36
|
-
- **Error Handling**: MUST handle error state
|
|
37
|
-
- **Check Before Access**: MUST verify isPremium before showing premium features
|
|
38
|
-
|
|
39
|
-
### PROHIBITED
|
|
40
|
-
|
|
41
|
-
- **NEVER** use for security decisions (server-side validation required)
|
|
42
|
-
- **NEVER** assume instant data availability (always check loading state)
|
|
43
|
-
- **DO NOT** use for anonymous users without proper handling
|
|
44
|
-
|
|
45
|
-
### CRITICAL SAFETY
|
|
46
|
-
|
|
47
|
-
- **ALWAYS** handle loading state before rendering premium content
|
|
48
|
-
- **NEVER** trust client-side state for security enforcement
|
|
49
|
-
- **MUST** implement error boundaries when using this hook
|
|
50
|
-
|
|
51
|
-
## AI Agent Guidelines
|
|
52
|
-
|
|
53
|
-
### When Implementing Premium Features
|
|
54
|
-
|
|
55
|
-
1. **Always** check loading state first
|
|
56
|
-
2. **Always** handle error state
|
|
57
|
-
3. **Always** verify isPremium before showing premium content
|
|
58
|
-
4. **Never** use for security decisions without server validation
|
|
59
|
-
5. **Always** provide upgrade path for non-premium users
|
|
60
|
-
|
|
61
|
-
### Integration Checklist
|
|
62
|
-
|
|
63
|
-
- [ ] Import from correct path: `@umituz/react-native-subscription`
|
|
64
|
-
- [ ] Handle loading state (show ActivityIndicator or skeleton)
|
|
65
|
-
- [ ] Handle error state (show error message)
|
|
66
|
-
- [ ] Check isPremium before rendering premium content
|
|
67
|
-
- [ ] Provide upgrade path for free users
|
|
68
|
-
- [ ] Test with premium user
|
|
69
|
-
- [ ] Test with free user
|
|
70
|
-
- [ ] Test with anonymous user
|
|
71
|
-
- [ ] Test offline scenario
|
|
72
|
-
|
|
73
|
-
### Common Patterns
|
|
74
|
-
|
|
75
|
-
1. **Conditional Rendering**: Show/hide features based on isPremium
|
|
76
|
-
2. **Premium Badge**: Display premium status badge
|
|
77
|
-
3. **Feature Gating**: Use usePremiumGate instead of manual checks
|
|
78
|
-
4. **Status Display**: Show subscription details with useSubscriptionDetails
|
|
79
|
-
5. **Upgrade Prompts**: Guide free users to paywall
|
|
80
|
-
|
|
81
|
-
## Related Documentation
|
|
82
|
-
|
|
83
|
-
- **usePremiumGate**: Gating premium features
|
|
84
|
-
- **useSubscription**: Detailed subscription status
|
|
85
|
-
- **useSubscriptionStatus**: Subscription status details
|
|
86
|
-
- **usePremiumWithCredits**: Hybrid premium/credits access
|
|
87
|
-
- **Subscription Repository**: `src/infrastructure/repositories/README.md`
|
|
88
|
-
- **Domain Layer**: `src/domain/README.md`
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# useSubscriptionSettingsConfig Hook
|
|
2
|
-
|
|
3
|
-
Returns ready-to-use configuration for subscription settings screens.
|
|
4
|
-
|
|
5
|
-
## Location
|
|
6
|
-
|
|
7
|
-
**Import Path**: `@umituz/react-native-subscription`
|
|
8
|
-
|
|
9
|
-
**File**: `src/presentation/hooks/useSubscriptionSettingsConfig.ts`
|
|
10
|
-
|
|
11
|
-
**Type**: Hook
|
|
12
|
-
|
|
13
|
-
## Strategy
|
|
14
|
-
|
|
15
|
-
### Settings Configuration Generation
|
|
16
|
-
|
|
17
|
-
1. **Data Aggregation**: Combine subscription, credits, and tier information
|
|
18
|
-
2. **Status Determination**: Calculate status type (active/expired/free/canceled)
|
|
19
|
-
3. **Date Formatting**: Format expiration and purchase dates
|
|
20
|
-
4. **Credit Items**: Generate credit item list with optional limit
|
|
21
|
-
5. **Translation Support**: Apply provided translations to all strings
|
|
22
|
-
6. **Upgrade Prompt**: Optional upgrade prompt configuration
|
|
23
|
-
|
|
24
|
-
### Integration Points
|
|
25
|
-
|
|
26
|
-
- **useSubscriptionStatus**: For subscription status details
|
|
27
|
-
- **useCredits**: For credits information
|
|
28
|
-
- **useUserTier**: For tier determination
|
|
29
|
-
- **Settings UI**: For settings screen integration
|
|
30
|
-
- **Translation System**: For localization support
|
|
31
|
-
|
|
32
|
-
## Restrictions
|
|
33
|
-
|
|
34
|
-
### REQUIRED
|
|
35
|
-
|
|
36
|
-
- **User ID**: MUST provide valid userId parameter
|
|
37
|
-
- **Translations**: MUST provide all translation strings
|
|
38
|
-
- **Null Handling**: MUST handle null dates and values
|
|
39
|
-
- **Enabled Check**: MUST check config.enabled before use
|
|
40
|
-
|
|
41
|
-
### PROHIBITED
|
|
42
|
-
|
|
43
|
-
- **NEVER** use without providing all translations
|
|
44
|
-
- **NEVER** assume config is enabled (check enabled flag)
|
|
45
|
-
- **DO NOT** hardcode translation strings
|
|
46
|
-
- **DO NOT** use without userId
|
|
47
|
-
|
|
48
|
-
### CRITICAL SAFETY
|
|
49
|
-
|
|
50
|
-
- **ALWAYS** check config.enabled before rendering
|
|
51
|
-
- **MUST** provide complete translation objects
|
|
52
|
-
- **ALWAYS** handle null dates gracefully
|
|
53
|
-
- **NEVER** trust client-side config for security
|
|
54
|
-
|
|
55
|
-
## AI Agent Guidelines
|
|
56
|
-
|
|
57
|
-
### When Implementing Settings Config
|
|
58
|
-
|
|
59
|
-
1. **Always** provide complete translations
|
|
60
|
-
2. **Always** check config.enabled
|
|
61
|
-
3. **Always** handle null dates
|
|
62
|
-
4. **Always** format dates appropriately
|
|
63
|
-
5. **Never** use for security decisions without server validation
|
|
64
|
-
|
|
65
|
-
### Integration Checklist
|
|
66
|
-
|
|
67
|
-
- [ ] Import from correct path: `@umituz/react-native-subscription`
|
|
68
|
-
- [ ] Provide valid userId
|
|
69
|
-
- [ ] Provide complete translations
|
|
70
|
-
- [ ] Check config.enabled
|
|
71
|
-
- [ ] Handle null dates
|
|
72
|
-
- [ ] Format dates appropriately
|
|
73
|
-
- [ ] Apply credit limit if needed
|
|
74
|
-
- [ ] Configure upgrade prompt if needed
|
|
75
|
-
- [ ] Test with active subscription
|
|
76
|
-
- [ ] Test with expired subscription
|
|
77
|
-
- [ ] Test with free user
|
|
78
|
-
- [ ] Test with lifetime subscription
|
|
79
|
-
|
|
80
|
-
### Common Patterns
|
|
81
|
-
|
|
82
|
-
1. **Settings List Item**: Quick access item in settings
|
|
83
|
-
2. **Detailed Section**: Comprehensive subscription section
|
|
84
|
-
3. **Localized Settings**: Use with translation libraries
|
|
85
|
-
4. **Credit Limit**: Limit displayed credit items
|
|
86
|
-
5. **Upgrade Prompt**: Show upgrade prompt for free users
|
|
87
|
-
|
|
88
|
-
## Related Documentation
|
|
89
|
-
|
|
90
|
-
- **useSubscriptionStatus**: For subscription status details
|
|
91
|
-
- **useCredits**: For credits information
|
|
92
|
-
- **useSubscriptionDetails**: For package and pricing info
|
|
93
|
-
- **Settings Screen**: `src/presentation/screens/README.md`
|
|
94
|
-
- **Subscription Utilities**: `src/utils/subscriptionDateUtils.md`
|
package/src/utils/README.md
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Utils
|
|
2
|
-
|
|
3
|
-
## Location
|
|
4
|
-
Abonelik sistemi için yardımcı fonksiyonlar ve utility araçları.
|
|
5
|
-
|
|
6
|
-
## Strategy
|
|
7
|
-
Bu dizin, premium durum kontrolü, kullanıcı tier yönetimi, paket işlemleri, fiyat hesaplama, periyot formatlama, asenkron işlemler, validasyon ve veri dönüşümü için yardımcı fonksiyonlar içerir.
|
|
8
|
-
|
|
9
|
-
## Restrictions
|
|
10
|
-
|
|
11
|
-
### REQUIRED
|
|
12
|
-
- Must maintain type safety for all functions
|
|
13
|
-
- Must handle null checks safely
|
|
14
|
-
- Must support localization
|
|
15
|
-
- Must validate all inputs
|
|
16
|
-
|
|
17
|
-
### PROHIBITED
|
|
18
|
-
- DO NOT bypass null safety checks
|
|
19
|
-
- DO NOT ignore error handling
|
|
20
|
-
- DO NOT hardcode locale values
|
|
21
|
-
- DO NOT skip validation
|
|
22
|
-
|
|
23
|
-
### CRITICAL SAFETY
|
|
24
|
-
- All functions MUST be type-safe
|
|
25
|
-
- Null checks MUST be performed safely
|
|
26
|
-
- Errors MUST be caught and handled
|
|
27
|
-
- Validation MUST return clear results
|
|
28
|
-
|
|
29
|
-
## AI Agent Guidelines
|
|
30
|
-
1. Maintain type safety for all utility functions
|
|
31
|
-
2. Perform null checks safely with proper guards
|
|
32
|
-
3. Catch and handle errors appropriately
|
|
33
|
-
4. Support localization for different locales
|
|
34
|
-
5. Write JSDoc comments for all functions
|
|
35
|
-
6. Test utility functions thoroughly with edge cases
|
|
36
|
-
7. Provide clear validation error messages
|
|
37
|
-
|
|
38
|
-
## Related Documentation
|
|
39
|
-
- Premium utilities for status checks
|
|
40
|
-
- User tier utilities for tier management
|
|
41
|
-
- Package utilities for RevenueCat integration
|
|
42
|
-
- Price utilities for formatting and calculation
|
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/components/details/CreditRow.md
RENAMED
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/components/details/CreditRow.tsx
RENAMED
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/components/details/DetailRow.md
RENAMED
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/components/details/DetailRow.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/components/details/README.md
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/components/feedback/README.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/components/paywall/PaywallModal.md
RENAMED
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/components/paywall/README.md
RENAMED
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/components/sections/README.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/screens/SubscriptionDetailScreen.tsx
RENAMED
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/screens/components/CreditsList.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/screens/components/UpgradePrompt.tsx
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/stores/purchaseLoadingStore.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{presentation → domains/subscription/presentation}/utils/subscriptionDateUtils.ts
RENAMED
|
File without changes
|