@umituz/react-native-subscription 2.14.98 → 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 -395
  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 +52 -0
  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 +37 -0
  14. package/src/domains/config/domain/entities/README.md +41 -0
  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 +96 -156
  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 +43 -0
  77. package/src/revenuecat/application/ports/README.md +41 -0
  78. package/src/revenuecat/domain/README.md +42 -141
  79. package/src/revenuecat/domain/constants/README.md +41 -0
  80. package/src/revenuecat/domain/entities/README.md +42 -0
  81. package/src/revenuecat/domain/errors/README.md +47 -191
  82. package/src/revenuecat/domain/types/README.md +41 -0
  83. package/src/revenuecat/domain/value-objects/README.md +41 -0
  84. package/src/revenuecat/infrastructure/README.md +41 -0
  85. package/src/revenuecat/infrastructure/config/README.md +32 -23
  86. package/src/revenuecat/infrastructure/handlers/README.md +41 -0
  87. package/src/revenuecat/infrastructure/managers/README.md +34 -42
  88. package/src/revenuecat/infrastructure/services/README.md +42 -0
  89. package/src/revenuecat/infrastructure/utils/README.md +41 -0
  90. package/src/revenuecat/presentation/README.md +42 -0
  91. package/src/revenuecat/presentation/hooks/README.md +29 -35
  92. package/src/utils/README.md +38 -525
@@ -2,39 +2,48 @@
2
2
 
3
3
  RevenueCat SDK configuration and initialization.
4
4
 
5
- ## Overview
5
+ ## Location
6
6
 
7
- This directory contains configuration utilities and setup for the RevenueCat SDK.
7
+ `src/revenuecat/infrastructure/config/`
8
8
 
9
- ## Contents
9
+ ## Strategy
10
10
 
11
- - **revenueCatConfig.ts** - RevenueCat configuration object and setup
11
+ Configuration utilities and setup for the RevenueCat SDK, providing centralized configuration management for the subscription system.
12
12
 
13
- ## Configuration
13
+ ## Restrictions
14
14
 
15
- ```typescript
16
- interface RevenueCatConfig {
17
- apiKey: string;
18
- entitlementId: string;
19
- [key: string]: any;
20
- }
21
- ```
15
+ ### REQUIRED
22
16
 
23
- ## Usage
17
+ - MUST configure RevenueCat at app startup
18
+ - MUST use valid API keys from environment configuration
19
+ - MUST initialize before any purchase operations
20
+ - MUST handle configuration errors gracefully
24
21
 
25
- Configure RevenueCat at app startup:
22
+ ### PROHIBITED
26
23
 
27
- ```typescript
28
- import { revenueCatConfig } from './config/revenueCatConfig';
24
+ - MUST NOT expose API keys in source code
25
+ - MUST NOT hardcode configuration values
26
+ - MUST NOT initialize RevenueCat multiple times
27
+ - MUST NOT bypass configuration validation
29
28
 
30
- // In your app initializer
31
- await Purchases.configure({
32
- apiKey: revenueCatConfig.apiKey,
33
- appUserID: userId,
34
- });
35
- ```
29
+ ### CRITICAL
36
30
 
37
- ## Related
31
+ - Always validate configuration before initialization
32
+ - Never expose sensitive API keys or tokens
33
+ - Handle all configuration errors gracefully
34
+ - Ensure configuration is loaded before any operations
35
+
36
+ ## AI Agent Guidelines
37
+
38
+ When working with RevenueCat configuration:
39
+ 1. Always validate configuration before use
40
+ 2. Never hardcode API keys or secrets
41
+ 3. Handle all configuration errors gracefully
42
+ 4. Ensure proper initialization order
43
+ 5. Test with both valid and invalid configurations
44
+
45
+ ## Related Documentation
38
46
 
39
47
  - [Managers](../managers/README.md)
40
48
  - [Services](../services/README.md)
49
+ - [RevenueCat README](../../README.md)
@@ -0,0 +1,41 @@
1
+ # RevenueCat Infrastructure Handlers
2
+
3
+ ## Location
4
+ Event handlers for RevenueCat lifecycle events.
5
+
6
+ ## Strategy
7
+ This directory contains handler implementations for managing RevenueCat events including purchase callbacks, customer info changes, and error handling with proper data validation and recovery.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must handle all events gracefully
13
+ - Must validate incoming data before processing
14
+ - Must log all events for debugging
15
+ - Must invoke callbacks appropriately
16
+
17
+ ### PROHIBITED
18
+ - DO NOT mutate incoming event data
19
+ - DO NOT ignore event handling errors
20
+ - DO NOT skip callback invocation
21
+ - DO NOT process unvalidated data
22
+
23
+ ### CRITICAL SAFETY
24
+ - All incoming data MUST be validated
25
+ - All events MUST be logged for debugging
26
+ - All callbacks MUST be invoked appropriately
27
+ - Recovery options MUST be provided when possible
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Never mutate incoming event data
31
+ 2. Handle all errors gracefully with proper boundaries
32
+ 3. Log all events for debugging and monitoring
33
+ 4. Invoke registered callbacks appropriately
34
+ 5. Use async/await for asynchronous operations
35
+ 6. Validate all incoming data before processing
36
+ 7. Provide recovery options when possible
37
+
38
+ ## Related Documentation
39
+ - [RevenueCat Infrastructure](../README.md)
40
+ - [RevenueCat Services](../services/README.md)
41
+ - [RevenueCat Errors](../../domain/errors/README.md)
@@ -1,49 +1,41 @@
1
1
  # RevenueCat Infrastructure Managers
2
2
 
3
+ ## Location
3
4
  Manager classes for coordinating RevenueCat operations.
4
5
 
5
- ## Overview
6
-
7
- This directory contains high-level manager classes that coordinate between different RevenueCat services and handle complex operations.
8
-
9
- ## Contents
10
-
11
- - **SubscriptionManager.ts** - Manages RevenueCat configuration and entitlement access
12
-
13
- ## SubscriptionManager
14
-
15
- Manages RevenueCat SDK configuration and provides access to entitlement IDs.
16
-
17
- ### Key Methods
18
-
19
- ```typescript
20
- class SubscriptionManager {
21
- static configure(config: RevenueCatConfig): void;
22
- static getEntitlementId(): string | null;
23
- static getOfferings(): Promise<Offerings>;
24
- }
25
- ```
26
-
27
- ### Usage
28
-
29
- ```typescript
30
- import { SubscriptionManager } from './managers/SubscriptionManager';
31
-
32
- // Configure at app startup
33
- SubscriptionManager.configure({
34
- apiKey: 'your_api_key',
35
- entitlementId: 'premium',
36
- });
37
-
38
- // Get entitlement ID
39
- const entitlementId = SubscriptionManager.getEntitlementId();
40
-
41
- // Get offerings
42
- const offerings = await SubscriptionManager.getOfferings();
43
- ```
44
-
45
- ## Related
46
-
6
+ ## Strategy
7
+ This directory contains high-level manager classes that coordinate between different RevenueCat services and handle complex operations like SDK configuration and entitlement access.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must coordinate between services properly
13
+ - Must manage SDK configuration correctly
14
+ - Must provide access to entitlement IDs
15
+ - Must handle complex operations safely
16
+
17
+ ### PROHIBITED
18
+ - DO NOT bypass service coordination
19
+ - DO NOT misconfigure SDK
20
+ - DO NOT expose invalid entitlement IDs
21
+ - DO NOT oversimplify complex operations
22
+
23
+ ### CRITICAL SAFETY
24
+ - Service coordination MUST be correct
25
+ - SDK configuration MUST be valid
26
+ - Entitlement access MUST be safe
27
+ - Complex operations MUST be handled properly
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Coordinate properly between RevenueCat services
31
+ 2. Manage SDK configuration with correct parameters
32
+ 3. Provide safe access to entitlement IDs
33
+ 4. Handle complex operations with proper error handling
34
+ 5. Test coordination logic thoroughly
35
+ 6. Document manager responsibilities clearly
36
+ 7. Maintain separation of concerns
37
+
38
+ ## Related Documentation
47
39
  - [Services](../services/README.md)
48
40
  - [Config](../config/README.md)
49
41
  - [Domain](../../domain/README.md)
@@ -0,0 +1,42 @@
1
+ # RevenueCat Infrastructure Services
2
+
3
+ ## Location
4
+ Service implementations for RevenueCat operations.
5
+
6
+ ## Strategy
7
+ This directory contains concrete implementations of RevenueCat interfaces, providing the actual integration with the RevenueCat SDK using singleton pattern with proper error handling and caching.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must use singleton pattern for service instance
13
+ - Must wrap all service calls in try-catch
14
+ - Must use TypeScript types for all operations
15
+ - Must log all RevenueCat operations
16
+
17
+ ### PROHIBITED
18
+ - DO NOT create multiple service instances
19
+ - DO NOT skip error handling
20
+ - DO NOT bypass type safety
21
+ - DO NOT skip logging operations
22
+
23
+ ### CRITICAL SAFETY
24
+ - Service MUST be configured only once
25
+ - All calls MUST be wrapped in error handling
26
+ - All operations MUST be type-safe
27
+ - All operations MUST be logged
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Use singleton pattern for service instance
31
+ 2. Wrap all service calls in try-catch blocks
32
+ 3. Use TypeScript types for all operations
33
+ 4. Log all RevenueCat operations for debugging
34
+ 5. Cache customer info and offerings appropriately
35
+ 6. Validate parameters before calling SDK
36
+ 7. Configure service only once at startup
37
+ 8. Use mock implementations for testing
38
+
39
+ ## Related Documentation
40
+ - [RevenueCat Infrastructure](../README.md)
41
+ - [RevenueCat Handlers](../handlers/README.md)
42
+ - [RevenueCat Application Ports](../../application/ports/README.md)
@@ -0,0 +1,41 @@
1
+ # RevenueCat Infrastructure Utils
2
+
3
+ ## Location
4
+ Utility functions for RevenueCat operations.
5
+
6
+ ## Strategy
7
+ This directory contains utility functions for common RevenueCat operations including error mapping, data transformation, validation, and formatting with proper type safety.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must use error mapping for user-facing messages
13
+ - Must ensure types are validated before use
14
+ - Must respect user locale for formatting
15
+ - Must check for null/undefined values
16
+
17
+ ### PROHIBITED
18
+ - DO NOT show SDK errors directly to users
19
+ - DO NOT use data without type validation
20
+ - DO NOT ignore locale settings
21
+ - DO NOT skip null checks
22
+
23
+ ### CRITICAL SAFETY
24
+ - All errors MUST be mapped to domain errors
25
+ - All types MUST be validated before use
26
+ - Locale MUST be respected for formatting
27
+ - Null checks MUST be performed consistently
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Always map SDK errors to domain errors for user-facing messages
31
+ 2. Ensure type safety by validating types before use
32
+ 3. Respect user locale when formatting prices and periods
33
+ 4. Always check for null/undefined values before processing
34
+ 5. Use debug helpers in development for troubleshooting
35
+ 6. Validate all data before processing
36
+ 7. Test utility functions with edge cases
37
+
38
+ ## Related Documentation
39
+ - [RevenueCat Infrastructure](../README.md)
40
+ - [RevenueCat Domain Types](../../domain/types/README.md)
41
+ - [RevenueCat Errors](../../domain/errors/README.md)
@@ -0,0 +1,42 @@
1
+ # RevenueCat Presentation
2
+
3
+ ## Location
4
+ Presentation layer for RevenueCat integration.
5
+
6
+ ## Strategy
7
+ This directory contains React hooks, components, and utilities for integrating RevenueCat functionality into the UI layer with proper loading states, error handling, and caching.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must show loading states during async operations
13
+ - Must handle and display errors appropriately
14
+ - Must cache customer info and offerings
15
+ - Must re-render on entitlement changes
16
+
17
+ ### PROHIBITED
18
+ - DO NOT skip loading states
19
+ - DO NOT show technical errors to users
20
+ - DO NOT ignore cache invalidation
21
+ - DO NOT prevent re-renders on state changes
22
+
23
+ ### CRITICAL SAFETY
24
+ - All async operations MUST show loading states
25
+ - All errors MUST be handled and displayed appropriately
26
+ - Data MUST be cached appropriately
27
+ - UI MUST re-render on entitlement changes
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Always show loading states during async operations
31
+ 2. Handle and display errors appropriately to users
32
+ 3. Update UI optimistically where possible
33
+ 4. Cache customer info and offerings appropriately
34
+ 5. Re-render on entitlement changes
35
+ 6. Provide clear feedback during purchases
36
+ 7. Validate data before displaying to users
37
+
38
+ ## Related Documentation
39
+ - [RevenueCat Integration](../README.md)
40
+ - [RevenueCat Application](../application/README.md)
41
+ - [RevenueCat Infrastructure](../infrastructure/README.md)
42
+ - [RevenueCat Domain](../domain/README.md)
@@ -2,54 +2,48 @@
2
2
 
3
3
  React hooks for accessing RevenueCat data and operations.
4
4
 
5
- ## Overview
5
+ ## Location
6
6
 
7
- This directory contains React hooks that expose RevenueCat functionality to the presentation layer.
7
+ `src/revenuecat/presentation/hooks/`
8
8
 
9
- ## Contents
9
+ ## Strategy
10
10
 
11
- - **useCustomerInfo.ts** - Hook for accessing RevenueCat customer info
12
- - **useSubscriptionPackages.ts** - Hook for accessing subscription packages/offering
11
+ React hooks that expose RevenueCat functionality to the presentation layer, providing access to customer info, subscription packages, and offerings.
13
12
 
14
- ## Key Hooks
13
+ ## Restrictions
15
14
 
16
- ### useCustomerInfo
15
+ ### REQUIRED
17
16
 
18
- Access RevenueCat customer information including entitlements.
17
+ - MUST handle loading states appropriately
18
+ - MUST handle error states gracefully
19
+ - MUST cache responses when appropriate
20
+ - MUST subscribe to real-time updates when needed
21
+ - MUST validate all data before use
19
22
 
20
- ```typescript
21
- function useCustomerInfo() {
22
- const { customerInfo, isLoading } = useCustomerInfo();
23
+ ### PROHIBITED
23
24
 
24
- return (
25
- <View>
26
- <Text>Entitlements: {Object.keys(customerInfo.entitlements.active).join(', ')}</Text>
27
- </View>
28
- );
29
- }
30
- ```
25
+ - MUST NOT expose RevenueCat implementation details to components
26
+ - MUST NOT bypass error handling
27
+ - MUST NOT create infinite loops with subscriptions
28
+ - MUST NOT assume data is always available
31
29
 
32
- ### useSubscriptionPackages
30
+ ### CRITICAL
33
31
 
34
- Access available subscription packages from current offering.
32
+ - Always handle loading and error states
33
+ - Unsubscribe from all listeners on unmount
34
+ - Validate all data before using it in components
35
+ - Handle null/undefined states properly
35
36
 
36
- ```typescript
37
- function PackageList() {
38
- const { packages, isLoading } = useSubscriptionPackages();
37
+ ## AI Agent Guidelines
39
38
 
40
- if (isLoading) return <Loading />;
39
+ When working with RevenueCat hooks:
40
+ 1. Always handle loading and error states
41
+ 2. Unsubscribe from listeners on unmount
42
+ 3. Validate all data before use
43
+ 4. Cache responses appropriately
44
+ 5. Handle null/undefined states gracefully
41
45
 
42
- return (
43
- <View>
44
- {packages.map(pkg => (
45
- <PackageCard key={pkg.identifier} package={pkg} />
46
- ))}
47
- </View>
48
- );
49
- }
50
- ```
51
-
52
- ## Related
46
+ ## Related Documentation
53
47
 
54
48
  - [Main Hooks](../../../presentation/hooks/README.md)
55
49
  - [Domain](../../domain/README.md)