@umituz/react-native-subscription 2.45.1 → 3.0.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-subscription",
3
- "version": "2.45.1",
3
+ "version": "3.0.0",
4
4
  "description": "Complete subscription management with RevenueCat, paywall UI, and credits system for React Native apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -8,6 +8,10 @@
8
8
  "exports": {
9
9
  ".": "./src/index.ts",
10
10
  "./init": "./src/init/index.ts",
11
+ "./exports/wallet": "./src/exports/wallet.ts",
12
+ "./exports/onboarding": "./src/exports/onboarding.ts",
13
+ "./exports/analytics": "./src/exports/analytics.ts",
14
+ "./exports/experimental": "./src/exports/experimental.ts",
11
15
  "./package.json": "./package.json"
12
16
  },
13
17
  "scripts": {
@@ -0,0 +1,53 @@
1
+ /**
2
+ * SUBSCRIPTION ANALYTICS (Optional)
3
+ *
4
+ * Advanced analytics for subscription events and user behavior
5
+ *
6
+ * @example
7
+ * import { SubscriptionAnalytics, useSubscriptionMetrics } from '@umituz/react-native-subscription/exports/analytics';
8
+ */
9
+
10
+ // Subscription Analytics Hook
11
+ export { useSubscriptionAnalytics } from '../../presentation/hooks/analytics/useSubscriptionAnalytics';
12
+ export type {
13
+ SubscriptionAnalyticsData,
14
+ SubscriptionMetrics,
15
+ ConversionFunnelData,
16
+ } from '../../presentation/hooks/analytics/useSubscriptionAnalytics.types';
17
+
18
+ // Paywall Analytics
19
+ export { usePaywallAnalytics } from '../../domains/paywall/hooks/usePaywallAnalytics';
20
+ export type {
21
+ PaywallAnalyticsData,
22
+ PaywallImpressionData,
23
+ PaywallConversionData,
24
+ } from '../../domains/paywall/hooks/usePaywallAnalytics.types';
25
+
26
+ // Revenue Analytics
27
+ export { useRevenueAnalytics } from '../../domains/subscription/presentation/hooks/useRevenueAnalytics';
28
+ export type {
29
+ RevenueAnalyticsData,
30
+ RevenueMetrics,
31
+ ARPUData,
32
+ LTVData,
33
+ } from '../../domains/subscription/presentation/hooks/useRevenueAnalytics.types';
34
+
35
+ // Churn Analytics
36
+ export { useChurnAnalytics } from '../../domains/subscription/presentation/hooks/useChurnAnalytics';
37
+ export type {
38
+ ChurnAnalyticsData,
39
+ ChurnRiskData,
40
+ RetentionData,
41
+ } from '../../domains/subscription/presentation/hooks/useChurnAnalytics.types';
42
+
43
+ // Analytics Helpers
44
+ export {
45
+ trackSubscriptionEvent,
46
+ trackPaywallEvent,
47
+ trackRevenueEvent,
48
+ } from '../../utils/analyticsHelpers';
49
+ export type {
50
+ SubscriptionEventType,
51
+ PaywallEventType,
52
+ RevenueEventType,
53
+ } from '../../utils/analyticsHelpers.types';
@@ -0,0 +1,93 @@
1
+ /**
2
+ * EXPERIMENTAL Features (Beta)
3
+ *
4
+ * Cutting-edge features that may change or be removed
5
+ * Use at your own risk!
6
+ *
7
+ * @example
8
+ * import { AIUpsell, SmartPaywall } from '@umituz/react-native-subscription/exports/experimental';
9
+ */
10
+
11
+ // ============================================================================
12
+ // AI-POWERED FEATURES
13
+ // ============================================================================
14
+
15
+ // AI-Powered Upsell Recommendations
16
+ export { useAIUpsellRecommendations } from '../../domains/paywall/experimental/useAIUpsellRecommendations';
17
+ export type {
18
+ AIUpsellData,
19
+ UpsellRecommendation,
20
+ UpsellStrategy,
21
+ } from '../../domains/paywall/experimental/useAIUpsellRecommendations.types';
22
+
23
+ // Smart Paywall (Dynamic pricing based on user behavior)
24
+ export { SmartPaywall } from '../../domains/paywall/experimental/SmartPaywall';
25
+ export type {
26
+ SmartPaywallProps,
27
+ SmartPaywallConfig,
28
+ } from '../../domains/paywall/experimental/SmartPaywall.types';
29
+
30
+ // ============================================================================
31
+ // EXPERIMENTAL COMPONENTS
32
+ // ============================================================================
33
+
34
+ // Interactive Pricing Tiers
35
+ export { InteractivePricingTiers } from '../../domains/paywall/experimental/InteractivePricingTiers';
36
+ export type {
37
+ InteractivePricingTiersProps,
38
+ PricingTierConfig,
39
+ } from '../../domains/paywall/experimental/InteractivePricingTiers.types';
40
+
41
+ // Gamified Paywall (Rewards for engagement)
42
+ export { GamifiedPaywall } from '../../domains/paywall/experimental/GamifiedPaywall';
43
+ export type {
44
+ GamifiedPaywallProps,
45
+ GamificationConfig,
46
+ RewardConfig,
47
+ } from '../../domains/paywall/experimental/GamifiedPaywall.types';
48
+
49
+ // ============================================================================
50
+ // EXPERIMENTAL HOOKS
51
+ // ============================================================================
52
+
53
+ // Predictive Churn Prevention
54
+ export { usePredictiveChurnPrevention } from '../../domains/subscription/presentation/experimental/usePredictiveChurnPrevention';
55
+ export type {
56
+ ChurnPredictionData,
57
+ ChurnPreventionAction,
58
+ InterventionStrategy,
59
+ } from '../../domains/subscription/presentation/experimental/usePredictiveChurnPrevention.types';
60
+
61
+ // Dynamic Offer Generator
62
+ export { useDynamicOfferGenerator } from '../../domains/paywall/experimental/useDynamicOfferGenerator';
63
+ export type {
64
+ DynamicOfferData,
65
+ OfferConfig,
66
+ OfferStrategy,
67
+ } from '../../domains/paywall/experimental/useDynamicOfferGenerator.types';
68
+
69
+ // ============================================================================
70
+ // EXPERIMENTAL UTILS
71
+ // ============================================================================
72
+
73
+ // Behavioral Segmentation
74
+ export {
75
+ segmentUsersByBehavior,
76
+ getUserBehaviorScore,
77
+ } from '../../utils/experimental/behavioralSegmentation';
78
+ export type {
79
+ UserBehavior,
80
+ BehaviorSegment,
81
+ BehaviorScore,
82
+ } from '../../utils/experimental/behavioralSegmentation.types';
83
+
84
+ // Price Optimization
85
+ export {
86
+ optimizePriceForUser,
87
+ getOptimalPricePoint,
88
+ } from '../../utils/experimental/priceOptimization';
89
+ export type {
90
+ PriceOptimizationData,
91
+ PricePoint,
92
+ OptimizationStrategy,
93
+ } from '../../utils/experimental/priceOptimization.types';
@@ -0,0 +1,34 @@
1
+ /**
2
+ * ONBOARDING Helpers (Optional)
3
+ *
4
+ * Advanced onboarding utilities for custom flows
5
+ *
6
+ * @example
7
+ * import { OnboardingProgress, useOnboardingAnalytics } from '@umituz/react-native-subscription/exports/onboarding';
8
+ */
9
+
10
+ // Onboarding Progress Tracking
11
+ export { useOnboardingProgress } from '../../domains/subscription/presentation/hooks/useOnboardingProgress';
12
+ export type { OnboardingProgressData } from '../../domains/subscription/presentation/hooks/useOnboardingProgress.types';
13
+
14
+ // Onboarding Analytics
15
+ export { useOnboardingAnalytics } from '../../presentation/hooks/onboarding/useOnboardingAnalytics';
16
+ export type {
17
+ OnboardingEvent,
18
+ OnboardingAnalyticsData,
19
+ } from '../../presentation/hooks/onboarding/useOnboardingAnalytics.types';
20
+
21
+ // Onboarding Completion Helpers
22
+ export { useOnboardingCompletion } from '../../presentation/hooks/onboarding/useOnboardingCompletion';
23
+ export type {
24
+ OnboardingCompletionData,
25
+ OnboardingCompletionOptions,
26
+ } from '../../presentation/hooks/onboarding/useOnboardingCompletion.types';
27
+
28
+ // Onboarding Utils
29
+ export {
30
+ calculateOnboardingProgress,
31
+ isOnboardingComplete,
32
+ getOnboardingStep,
33
+ } from '../../utils/onboardingUtils';
34
+ export type { OnboardingStep } from '../../utils/onboardingUtils.types';
@@ -0,0 +1,35 @@
1
+ /**
2
+ * WALLET Features (Optional)
3
+ *
4
+ * Import only if your app needs wallet UI and transaction history
5
+ *
6
+ * @example
7
+ * import { WalletScreen } from '@umituz/react-native-subscription/exports/wallet';
8
+ */
9
+
10
+ // Wallet Screen
11
+ export {
12
+ WalletScreen as WalletScreenContainer,
13
+ } from '../../domains/wallet/presentation/screens/WalletScreen';
14
+
15
+ export type {
16
+ WalletScreenProps,
17
+ WalletScreenTranslations,
18
+ } from '../../domains/wallet/presentation/screens/WalletScreen.types';
19
+
20
+ // Wallet Hooks
21
+ export { useWallet } from '../../domains/wallet/presentation/hooks/useWallet';
22
+ export type { WalletData } from '../../domains/wallet/presentation/hooks/useWallet';
23
+
24
+ export { useTransactionHistory } from '../../domains/wallet/presentation/hooks/useTransactionHistory';
25
+ export type { TransactionHistoryResult } from '../../domains/wallet/presentation/hooks/useTransactionHistory';
26
+
27
+ // Wallet Components
28
+ export { BalanceCard } from '../../domains/wallet/presentation/components/BalanceCard';
29
+ export type { BalanceCardProps } from '../../domains/wallet/presentation/components/BalanceCard.types';
30
+
31
+ export { TransactionList } from '../../domains/wallet/presentation/components/TransactionList';
32
+ export type { TransactionListProps } from '../../domains/wallet/presentation/components/TransactionList.types';
33
+
34
+ export { TransactionItem } from '../../domains/wallet/presentation/components/TransactionItem';
35
+ export type { TransactionItemProps } from '../../domains/wallet/presentation/components/TransactionItem.types';
package/src/index.ts CHANGED
@@ -1,4 +1,14 @@
1
- // Domain Layer - Constants & Types
1
+ /**
2
+ * CORE Exports
3
+ *
4
+ * Essential subscription & paywall features - all apps need these
5
+ * No optional features to keep bundle size minimal
6
+ */
7
+
8
+ // ============================================================================
9
+ // DOMAIN LAYER - Constants & Types
10
+ // ============================================================================
11
+
2
12
  export {
3
13
  USER_TIER,
4
14
  SUBSCRIPTION_STATUS,
@@ -27,7 +37,10 @@ export {
27
37
  } from "./domains/subscription/core/SubscriptionStatus";
28
38
  export type { SubscriptionStatus, StatusResolverInput } from "./domains/subscription/core/SubscriptionStatus";
29
39
 
30
- // Domain Events
40
+ // ============================================================================
41
+ // DOMAIN EVENTS
42
+ // ============================================================================
43
+
31
44
  export { SUBSCRIPTION_EVENTS } from "./domains/subscription/core/events/SubscriptionEvents";
32
45
  export type { SubscriptionEventType, SyncStatusChangedEvent } from "./domains/subscription/core/events/SubscriptionEvents";
33
46
  export type { PurchaseCompletedEvent, RenewalDetectedEvent, PremiumStatusChangedEvent } from "./domains/subscription/core/SubscriptionEvents";
@@ -38,11 +51,35 @@ export type { SubscriptionMetadata } from "./domains/subscription/core/types/Sub
38
51
  export type { PremiumStatus as PremiumStatusMetadata } from "./domains/subscription/core/types/PremiumStatus";
39
52
  export type { CreditInfo } from "./domains/subscription/core/types/CreditInfo";
40
53
 
41
- // Application Layer - Ports
54
+ // ============================================================================
55
+ // CREDITS TYPES (Core credits, wallet is separate)
56
+ // ============================================================================
57
+
58
+ export type {
59
+ CreditType,
60
+ UserCredits,
61
+ CreditsConfig,
62
+ CreditsResult,
63
+ DeductCreditsResult,
64
+ } from "./domains/credits/core/Credits";
65
+
66
+ // ============================================================================
67
+ // PAYWALL TYPES
68
+ // ============================================================================
69
+
70
+ export type { PaywallTranslations, PaywallLegalUrls, SubscriptionFeature } from "./domains/paywall/entities/types";
71
+
72
+ // ============================================================================
73
+ // APPLICATION LAYER - Ports
74
+ // ============================================================================
75
+
42
76
  export type { ISubscriptionRepository } from "./shared/application/ports/ISubscriptionRepository";
43
77
  export type { IRevenueCatService } from "./shared/application/ports/IRevenueCatService";
44
78
 
45
- // Result Pattern
79
+ // ============================================================================
80
+ // RESULT PATTERN
81
+ // ============================================================================
82
+
46
83
  export {
47
84
  success,
48
85
  failure,
@@ -54,7 +91,10 @@ export {
54
91
  } from "./shared/utils/Result";
55
92
  export type { Result, Success, Failure } from "./shared/utils/Result";
56
93
 
57
- // Infrastructure Layer
94
+ // ============================================================================
95
+ // INFRASTRUCTURE LAYER - Core Services (No wallet)
96
+ // ============================================================================
97
+
58
98
  export { initializeSubscription } from "./domains/subscription/application/initializer/SubscriptionInitializer";
59
99
  export type { SubscriptionInitConfig, CreditPackageConfig } from "./domains/subscription/application/SubscriptionInitializerTypes";
60
100
 
@@ -68,7 +108,10 @@ export {
68
108
 
69
109
  export { CreditLimitService, calculateCreditLimit } from "./domains/credits/domain/services/CreditLimitService";
70
110
 
71
- // Presentation Layer - Hooks
111
+ // ============================================================================
112
+ // PRESENTATION LAYER - Hooks (Core)
113
+ // ============================================================================
114
+
72
115
  export { useAuthAwarePurchase } from "./domains/subscription/presentation/useAuthAwarePurchase";
73
116
  export { useCredits } from "./domains/credits/presentation/useCredits";
74
117
  export { useDeductCredit } from "./domains/credits/presentation/deduct-credit/useDeductCredit";
@@ -77,74 +120,96 @@ export { usePaywallVisibility, paywallControl } from "./domains/subscription/pre
77
120
  export { usePremiumStatus } from "./domains/subscription/presentation/usePremiumStatus";
78
121
  export { usePremiumPackages } from "./domains/subscription/presentation/usePremiumPackages";
79
122
  export { usePremiumActions } from "./domains/subscription/presentation/usePremiumActions";
80
- export type { PremiumStatus } from "./domains/subscription/presentation/usePremiumStatus";
81
- export type { PremiumPackages } from "./domains/subscription/presentation/usePremiumPackages";
82
- export type { PremiumActions } from "./domains/subscription/presentation/usePremiumActions";
83
123
  export { useSubscriptionFlowStore } from "./domains/subscription/presentation/useSubscriptionFlow";
84
124
  export type { SubscriptionFlowState, SubscriptionFlowActions, SubscriptionFlowStore } from "./domains/subscription/presentation/useSubscriptionFlow";
85
125
  export { useSubscriptionStatus } from "./domains/subscription/presentation/useSubscriptionStatus";
86
126
  export type { SubscriptionStatusResult } from "./domains/subscription/presentation/useSubscriptionStatus.types";
127
+
128
+ export type { PremiumStatus } from "./domains/subscription/presentation/usePremiumStatus";
129
+ export type { PremiumPackages } from "./domains/subscription/presentation/usePremiumPackages";
130
+ export type { PremiumActions } from "./domains/subscription/presentation/usePremiumActions";
131
+
87
132
  export { usePaywallFeedback } from "./presentation/hooks/feedback/usePaywallFeedback";
88
133
  export {
89
134
  usePaywallFeedbackSubmit,
90
135
  useSettingsFeedbackSubmit,
91
136
  } from "./presentation/hooks/feedback/useFeedbackSubmit";
137
+
92
138
  export type {
93
139
  UsePaywallFeedbackSubmitOptions,
94
140
  SettingsFeedbackData,
95
141
  UseSettingsFeedbackSubmitOptions,
96
142
  } from "./presentation/hooks/feedback/useFeedbackSubmit";
97
143
 
98
- // Presentation Layer - Components
144
+ // ============================================================================
145
+ // PRESENTATION LAYER - Components (Core - No wallet)
146
+ // ============================================================================
147
+
99
148
  export { PremiumDetailsCard } from "./domains/subscription/presentation/components/details/PremiumDetailsCard";
100
149
  export type {
101
150
  PremiumDetailsTranslations,
102
151
  PremiumDetailsCardProps,
103
152
  } from "./domains/subscription/presentation/components/details/PremiumDetailsCardTypes";
153
+
104
154
  export { PremiumStatusBadge } from "./domains/subscription/presentation/components/details/PremiumStatusBadge";
105
155
  export type { PremiumStatusBadgeProps } from "./domains/subscription/presentation/components/details/PremiumStatusBadge.types";
156
+
106
157
  export { SubscriptionSection } from "./domains/subscription/presentation/components/sections/SubscriptionSection";
107
158
  export type { SubscriptionSectionProps } from "./domains/subscription/presentation/components/sections/SubscriptionSection.types";
159
+
108
160
  export { PaywallFeedbackScreen } from "./domains/subscription/presentation/components/feedback/PaywallFeedbackScreen";
109
161
  export type { PaywallFeedbackScreenProps } from "./domains/subscription/presentation/components/feedback/PaywallFeedbackScreen.types";
162
+
110
163
  export type {
111
164
  SubscriptionDetailConfig,
112
165
  SubscriptionDetailTranslations,
113
166
  SubscriptionDisplayFlags,
114
167
  UpgradePromptConfig,
115
168
  } from "./domains/subscription/presentation/screens/SubscriptionDetailScreen.types";
169
+
116
170
  export { SubscriptionDetailScreen } from "./domains/subscription/presentation/screens/SubscriptionDetailScreen";
117
171
  export type { SubscriptionDetailScreenProps } from "./domains/subscription/presentation/screens/SubscriptionDetailScreen.types";
172
+
118
173
  export { PaywallScreen } from "./domains/paywall/components/PaywallScreen";
119
174
  export type { PaywallScreenProps } from "./domains/paywall/components/PaywallScreen.types";
175
+
120
176
  export { usePaywallOrchestrator } from "./domains/paywall/hooks/usePaywallOrchestrator";
121
177
  export type { PaywallOrchestratorOptions } from "./domains/paywall/hooks/usePaywallOrchestrator";
122
178
 
123
- export type {
124
- CreditType,
125
- UserCredits,
126
- CreditsConfig,
127
- CreditsResult,
128
- DeductCreditsResult,
129
- } from "./domains/credits/core/Credits";
179
+ // ============================================================================
180
+ // ROOT FLOW COMPONENTS
181
+ // ============================================================================
182
+
183
+ export { ManagedSubscriptionFlow } from "./domains/subscription/presentation/components/ManagedSubscriptionFlow";
184
+ export type { ManagedSubscriptionFlowProps } from "./domains/subscription/presentation/components/ManagedSubscriptionFlow";
185
+ export { SubscriptionFlowStatus } from "./domains/subscription/presentation/useSubscriptionFlow";
186
+ export { SubscriptionFlowProvider, useSubscriptionFlowStatus } from "./domains/subscription/presentation/providers/SubscriptionFlowProvider";
187
+
188
+ // ============================================================================
189
+ // UTILS (Core)
190
+ // ============================================================================
130
191
 
131
- // Utils
132
192
  export {
133
193
  getCreditAllocation,
134
194
  createCreditAmountsFromPackages,
135
195
  } from "./utils/creditMapper";
196
+
136
197
  export {
137
198
  isCreditPackage,
138
199
  detectPackageType,
139
200
  } from "./utils/packageTypeDetector";
140
201
  export type { SubscriptionPackageType } from "./utils/packageTypeDetector";
202
+
141
203
  export {
142
204
  formatPrice,
143
205
  getBillingPeriodSuffix,
144
206
  formatPriceWithPeriod,
145
207
  } from "./utils/priceUtils";
208
+
146
209
  export type { UserTierInfo, PremiumStatusFetcher } from "./utils/types";
210
+
147
211
  export type { DateLike } from "./utils/dateUtils.core";
212
+
148
213
  export {
149
214
  isNow,
150
215
  isPast,
@@ -154,47 +219,38 @@ export {
154
219
  formatISO,
155
220
  now,
156
221
  } from "./utils/dateUtils.core";
222
+
157
223
  export {
158
224
  daysBetween,
159
225
  daysUntil,
160
226
  isSameDay,
161
227
  isToday,
162
228
  } from "./utils/dateUtils.compare";
229
+
163
230
  export {
164
231
  formatRelative,
165
232
  formatShort,
166
233
  formatLong,
167
234
  } from "./utils/dateUtils.format";
235
+
168
236
  export {
169
237
  addDays,
170
238
  addMonths,
171
239
  addYears,
172
240
  } from "./utils/dateUtils.math";
241
+
173
242
  export { getAppVersion, validatePlatform } from "./utils/appUtils";
243
+
174
244
  export { toDate, toISOString, toTimestamp, getCurrentISOString } from "./shared/utils/dateConverter";
175
245
 
176
- // Paywall Types & Utils
177
- export type { PaywallTranslations, PaywallLegalUrls, SubscriptionFeature } from "./domains/paywall/entities/types";
178
246
  export { createPaywallTranslations, createFeedbackTranslations } from "./domains/paywall/utils/paywallTranslationUtils";
179
247
 
180
- // Root Flow Components
181
- export { ManagedSubscriptionFlow } from "./domains/subscription/presentation/components/ManagedSubscriptionFlow";
182
- export type { ManagedSubscriptionFlowProps } from "./domains/subscription/presentation/components/ManagedSubscriptionFlow";
183
- export { SubscriptionFlowStatus } from "./domains/subscription/presentation/useSubscriptionFlow";
184
- export { SubscriptionFlowProvider, useSubscriptionFlowStatus } from "./domains/subscription/presentation/providers/SubscriptionFlowProvider";
248
+ // ============================================================================
249
+ // INIT MODULE
250
+ // ============================================================================
185
251
 
186
- // Init Module Factory
187
252
  export {
188
253
  createSubscriptionInitModule,
189
254
  cleanupSubscriptionModule,
190
255
  type SubscriptionInitModuleConfig,
191
256
  } from './init';
192
-
193
- // Wallet Domain
194
- export {
195
- WalletScreen as WalletScreenContainer,
196
- } from './domains/wallet/presentation/screens/WalletScreen';
197
- export type {
198
- WalletScreenProps,
199
- WalletScreenTranslations,
200
- } from './domains/wallet/presentation/screens/WalletScreen.types';