@umituz/react-native-subscription 2.14.82 → 2.14.84
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/paywall/components/PaywallContainer.tsx +26 -159
- package/src/domains/paywall/components/PaywallFeatures.tsx +25 -0
- package/src/domains/paywall/components/PaywallFooter.tsx +46 -93
- package/src/domains/paywall/components/PaywallModal.tsx +14 -99
- package/src/domains/paywall/hooks/usePaywallActions.ts +63 -0
- package/src/domains/wallet/domain/errors/WalletError.ts +12 -20
- package/src/domains/wallet/domain/errors/WalletErrorMessages.ts +17 -0
- package/src/index.ts +23 -461
- package/src/infrastructure/repositories/CreditsRepository.ts +43 -177
- package/src/infrastructure/services/SubscriptionInitializer.ts +32 -186
- package/src/presentation/components/details/PremiumDetailsCard.styles.ts +54 -0
- package/src/presentation/components/details/PremiumDetailsCard.tsx +2 -49
- package/src/presentation/hooks/index.ts +23 -0
- package/src/presentation/hooks/paywall/usePaywallOperations.ts +2 -2
- package/src/presentation/hooks/useDeductCredit.ts +22 -148
- package/src/presentation/hooks/useInitializeCredits.ts +57 -0
- package/src/presentation/hooks/usePremiumWithCredits.ts +1 -1
- package/src/presentation/hooks/useSubscription.ts +59 -79
- package/src/presentation/hooks/useSubscription.utils.ts +78 -0
- package/src/presentation/hooks/useSubscriptionSettingsConfig.ts +3 -15
- package/src/presentation/hooks/useSubscriptionSettingsConfig.utils.ts +48 -0
- package/src/revenuecat/index.ts +12 -0
- package/src/utils/index.ts +15 -0
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* Follows the same pattern as SubscriptionError.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { WALLET_ERROR_MESSAGES } from "./WalletErrorMessages";
|
|
9
|
+
|
|
8
10
|
export type WalletErrorCategory =
|
|
9
11
|
| "PAYMENT"
|
|
10
12
|
| "VALIDATION"
|
|
@@ -39,110 +41,100 @@ export abstract class WalletError extends Error {
|
|
|
39
41
|
export class PaymentValidationError extends WalletError {
|
|
40
42
|
readonly code = "PAYMENT_VALIDATION_ERROR";
|
|
41
43
|
readonly category = "PAYMENT" as const;
|
|
42
|
-
readonly userMessage
|
|
44
|
+
readonly userMessage = WALLET_ERROR_MESSAGES.PAYMENT_VALIDATION_FAILED;
|
|
43
45
|
|
|
44
46
|
constructor(message: string, cause?: Error) {
|
|
45
47
|
super(message, cause);
|
|
46
|
-
this.userMessage = "Payment validation failed. Please try again.";
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
export class PaymentProviderError extends WalletError {
|
|
51
52
|
readonly code = "PAYMENT_PROVIDER_ERROR";
|
|
52
53
|
readonly category = "PAYMENT" as const;
|
|
53
|
-
readonly userMessage
|
|
54
|
+
readonly userMessage = WALLET_ERROR_MESSAGES.PAYMENT_PROVIDER_ERROR;
|
|
54
55
|
|
|
55
56
|
constructor(message: string, cause?: Error) {
|
|
56
57
|
super(message, cause);
|
|
57
|
-
this.userMessage = "Payment provider error. Please try again.";
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export class DuplicatePaymentError extends WalletError {
|
|
62
62
|
readonly code = "DUPLICATE_PAYMENT";
|
|
63
63
|
readonly category = "PAYMENT" as const;
|
|
64
|
-
readonly userMessage
|
|
64
|
+
readonly userMessage = WALLET_ERROR_MESSAGES.DUPLICATE_PAYMENT;
|
|
65
65
|
|
|
66
66
|
constructor(message: string) {
|
|
67
67
|
super(message);
|
|
68
|
-
this.userMessage = "This payment has already been processed.";
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
export class UserValidationError extends WalletError {
|
|
73
72
|
readonly code = "USER_VALIDATION_ERROR";
|
|
74
73
|
readonly category = "VALIDATION" as const;
|
|
75
|
-
readonly userMessage
|
|
74
|
+
readonly userMessage = WALLET_ERROR_MESSAGES.USER_VALIDATION_FAILED;
|
|
76
75
|
|
|
77
76
|
constructor(message: string) {
|
|
78
77
|
super(message);
|
|
79
|
-
this.userMessage = "Invalid user information. Please log in again.";
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
80
|
|
|
83
81
|
export class PackageValidationError extends WalletError {
|
|
84
82
|
readonly code = "PACKAGE_VALIDATION_ERROR";
|
|
85
83
|
readonly category = "VALIDATION" as const;
|
|
86
|
-
readonly userMessage
|
|
84
|
+
readonly userMessage = WALLET_ERROR_MESSAGES.PACKAGE_VALIDATION_FAILED;
|
|
87
85
|
|
|
88
86
|
constructor(message: string) {
|
|
89
87
|
super(message);
|
|
90
|
-
this.userMessage = "Invalid credit package. Please select a valid package.";
|
|
91
88
|
}
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
export class ReceiptValidationError extends WalletError {
|
|
95
92
|
readonly code = "RECEIPT_VALIDATION_ERROR";
|
|
96
93
|
readonly category = "VALIDATION" as const;
|
|
97
|
-
readonly userMessage
|
|
94
|
+
readonly userMessage = WALLET_ERROR_MESSAGES.RECEIPT_VALIDATION_FAILED;
|
|
98
95
|
|
|
99
96
|
constructor(message: string) {
|
|
100
97
|
super(message);
|
|
101
|
-
this.userMessage = "Invalid payment receipt. Please contact support.";
|
|
102
98
|
}
|
|
103
99
|
}
|
|
104
100
|
|
|
105
101
|
export class TransactionError extends WalletError {
|
|
106
102
|
readonly code = "TRANSACTION_ERROR";
|
|
107
103
|
readonly category = "INFRASTRUCTURE" as const;
|
|
108
|
-
readonly userMessage
|
|
104
|
+
readonly userMessage = WALLET_ERROR_MESSAGES.TRANSACTION_FAILED;
|
|
109
105
|
|
|
110
106
|
constructor(message: string, cause?: Error) {
|
|
111
107
|
super(message, cause);
|
|
112
|
-
this.userMessage = "Transaction failed. Please try again.";
|
|
113
108
|
}
|
|
114
109
|
}
|
|
115
110
|
|
|
116
111
|
export class NetworkError extends WalletError {
|
|
117
112
|
readonly code = "NETWORK_ERROR";
|
|
118
113
|
readonly category = "INFRASTRUCTURE" as const;
|
|
119
|
-
readonly userMessage
|
|
114
|
+
readonly userMessage = WALLET_ERROR_MESSAGES.NETWORK_ERROR;
|
|
120
115
|
|
|
121
116
|
constructor(message: string, cause?: Error) {
|
|
122
117
|
super(message, cause);
|
|
123
|
-
this.userMessage = "Network error. Please check your connection.";
|
|
124
118
|
}
|
|
125
119
|
}
|
|
126
120
|
|
|
127
121
|
export class CreditLimitError extends WalletError {
|
|
128
122
|
readonly code = "CREDIT_LIMIT_ERROR";
|
|
129
123
|
readonly category = "BUSINESS" as const;
|
|
130
|
-
readonly userMessage
|
|
124
|
+
readonly userMessage = WALLET_ERROR_MESSAGES.CREDIT_LIMIT_EXCEEDED;
|
|
131
125
|
|
|
132
126
|
constructor(message: string) {
|
|
133
127
|
super(message);
|
|
134
|
-
this.userMessage = "Credit limit exceeded. Please contact support.";
|
|
135
128
|
}
|
|
136
129
|
}
|
|
137
130
|
|
|
138
131
|
export class RefundError extends WalletError {
|
|
139
132
|
readonly code = "REFUND_ERROR";
|
|
140
133
|
readonly category = "BUSINESS" as const;
|
|
141
|
-
readonly userMessage
|
|
134
|
+
readonly userMessage = WALLET_ERROR_MESSAGES.REFUND_FAILED;
|
|
142
135
|
|
|
143
136
|
constructor(message: string, cause?: Error) {
|
|
144
137
|
super(message, cause);
|
|
145
|
-
this.userMessage = "Refund failed. Please contact support.";
|
|
146
138
|
}
|
|
147
139
|
}
|
|
148
140
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet Error Messages
|
|
3
|
+
* Centralized error user messages for wallet operations
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const WALLET_ERROR_MESSAGES = {
|
|
7
|
+
PAYMENT_VALIDATION_FAILED: "Payment validation failed. Please try again.",
|
|
8
|
+
PAYMENT_PROVIDER_ERROR: "Payment provider error. Please try again.",
|
|
9
|
+
DUPLICATE_PAYMENT: "This payment has already been processed.",
|
|
10
|
+
USER_VALIDATION_FAILED: "Invalid user information. Please log in again.",
|
|
11
|
+
PACKAGE_VALIDATION_FAILED: "Invalid credit package. Please select a valid package.",
|
|
12
|
+
RECEIPT_VALIDATION_FAILED: "Invalid payment receipt. Please contact support.",
|
|
13
|
+
TRANSACTION_FAILED: "Transaction failed. Please try again.",
|
|
14
|
+
NETWORK_ERROR: "Network error. Please check your connection.",
|
|
15
|
+
CREDIT_LIMIT_EXCEEDED: "Credit limit exceeded. Please contact support.",
|
|
16
|
+
REFUND_FAILED: "Refund failed. Please contact support.",
|
|
17
|
+
} as const;
|
package/src/index.ts
CHANGED
|
@@ -1,479 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* React Native Subscription - Public API
|
|
3
|
-
*
|
|
4
|
-
* Subscription management and paywall UI for React Native apps
|
|
5
|
-
* Domain-Driven Design (DDD) Architecture
|
|
6
3
|
*/
|
|
7
4
|
|
|
8
|
-
// =============================================================================
|
|
9
|
-
// WALLET DOMAIN (Complete)
|
|
10
|
-
// =============================================================================
|
|
11
|
-
|
|
12
5
|
export * from "./domains/wallet";
|
|
6
|
+
export * from "./domains/paywall";
|
|
7
|
+
export * from "./domains/config";
|
|
13
8
|
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
// =============================================================================
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
createDefaultSubscriptionStatus,
|
|
20
|
-
isSubscriptionValid,
|
|
21
|
-
} from "./domain/entities/SubscriptionStatus";
|
|
9
|
+
// Domain Layer
|
|
10
|
+
export { createDefaultSubscriptionStatus, isSubscriptionValid } from "./domain/entities/SubscriptionStatus";
|
|
22
11
|
export type { SubscriptionStatus, SubscriptionStatusType } from "./domain/entities/SubscriptionStatus";
|
|
23
|
-
|
|
24
12
|
export type { SubscriptionConfig } from "./domain/value-objects/SubscriptionConfig";
|
|
25
|
-
|
|
26
13
|
export type { ISubscriptionRepository } from "./application/ports/ISubscriptionRepository";
|
|
27
14
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} from "./infrastructure/
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
initializeSubscription,
|
|
35
|
-
type SubscriptionInitConfig,
|
|
36
|
-
type CreditPackageConfig,
|
|
37
|
-
} from "./infrastructure/services/SubscriptionInitializer";
|
|
15
|
+
// Infrastructure Layer
|
|
16
|
+
export { SubscriptionService, initializeSubscriptionService } from "./infrastructure/services/SubscriptionService";
|
|
17
|
+
export { initializeSubscription, type SubscriptionInitConfig, type CreditPackageConfig } from "./infrastructure/services/SubscriptionInitializer";
|
|
18
|
+
export { CreditsRepository, createCreditsRepository } from "./infrastructure/repositories/CreditsRepository";
|
|
19
|
+
export { configureCreditsRepository, getCreditsRepository, getCreditsConfig, resetCreditsRepository, isCreditsRepositoryConfigured } from "./infrastructure/repositories/CreditsRepositoryProvider";
|
|
38
20
|
|
|
39
|
-
|
|
40
|
-
export
|
|
21
|
+
// Presentation Layer - Hooks
|
|
22
|
+
export * from "./presentation/hooks";
|
|
41
23
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// Feedback
|
|
24
|
+
// Presentation Layer - Components
|
|
25
|
+
export * from "./presentation/components/details/PremiumDetailsCard";
|
|
26
|
+
export * from "./presentation/components/details/PremiumStatusBadge";
|
|
27
|
+
export * from "./presentation/components/sections/SubscriptionSection";
|
|
48
28
|
export * from "./presentation/components/feedback/PaywallFeedbackModal";
|
|
49
|
-
export * from "./presentation/
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
usePremiumGate,
|
|
53
|
-
type UsePremiumGateParams,
|
|
54
|
-
type UsePremiumGateResult,
|
|
55
|
-
} from "./presentation/hooks/usePremiumGate";
|
|
56
|
-
|
|
57
|
-
export {
|
|
58
|
-
useFeatureGate,
|
|
59
|
-
useAuthGate,
|
|
60
|
-
useSubscriptionGate,
|
|
61
|
-
useCreditsGate,
|
|
62
|
-
type UseFeatureGateParams,
|
|
63
|
-
type UseFeatureGateResult,
|
|
64
|
-
type UseAuthGateParams,
|
|
65
|
-
type UseAuthGateResult,
|
|
66
|
-
type UseSubscriptionGateParams,
|
|
67
|
-
type UseSubscriptionGateResult,
|
|
68
|
-
type UseCreditsGateParams,
|
|
69
|
-
type UseCreditsGateResult,
|
|
70
|
-
} from "./presentation/hooks/useFeatureGate";
|
|
71
|
-
|
|
72
|
-
export {
|
|
73
|
-
useUserTierWithRepository,
|
|
74
|
-
type UseUserTierWithRepositoryParams,
|
|
75
|
-
type UseUserTierWithRepositoryResult,
|
|
76
|
-
type AuthProvider,
|
|
77
|
-
} from "./presentation/hooks/useUserTierWithRepository";
|
|
78
|
-
|
|
79
|
-
// =============================================================================
|
|
80
|
-
// PAYWALL DOMAIN
|
|
81
|
-
// =============================================================================
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
PaywallContainer,
|
|
85
|
-
type PaywallContainerProps,
|
|
86
|
-
PaywallModal,
|
|
87
|
-
type PaywallModalProps,
|
|
88
|
-
PaywallHeader,
|
|
89
|
-
PaywallTabBar,
|
|
90
|
-
PaywallFooter,
|
|
91
|
-
FeatureList,
|
|
92
|
-
FeatureItem,
|
|
93
|
-
PlanCard,
|
|
94
|
-
CreditCard,
|
|
95
|
-
usePaywall,
|
|
96
|
-
useSubscriptionModal,
|
|
97
|
-
usePaywallTranslations,
|
|
98
|
-
type UsePaywallTranslationsParams,
|
|
99
|
-
type UsePaywallTranslationsResult,
|
|
100
|
-
type PaywallMode,
|
|
101
|
-
type PaywallTabType,
|
|
102
|
-
type CreditsPackage,
|
|
103
|
-
type SubscriptionFeature,
|
|
104
|
-
type PaywallTranslations,
|
|
105
|
-
type PaywallLegalUrls,
|
|
106
|
-
} from "./domains/paywall";
|
|
107
|
-
|
|
108
|
-
// =============================================================================
|
|
109
|
-
// CONFIG DOMAIN
|
|
110
|
-
// =============================================================================
|
|
111
|
-
|
|
112
|
-
export type {
|
|
113
|
-
Plan,
|
|
114
|
-
PlanType,
|
|
115
|
-
PlanMetadata,
|
|
116
|
-
Config,
|
|
117
|
-
ConfigTranslations,
|
|
118
|
-
} from "./domains/config";
|
|
119
|
-
|
|
120
|
-
export { calculatePlanMetadata } from "./domains/config";
|
|
121
|
-
|
|
122
|
-
export {
|
|
123
|
-
getPlanByType,
|
|
124
|
-
getPlanById,
|
|
125
|
-
getBestValuePlan,
|
|
126
|
-
getPopularPlan,
|
|
127
|
-
getCreditLimitForPlan,
|
|
128
|
-
determinePlanFromCredits,
|
|
129
|
-
} from "./domains/config";
|
|
130
|
-
|
|
131
|
-
// =============================================================================
|
|
132
|
-
// PRESENTATION LAYER - Premium Details Components
|
|
133
|
-
// =============================================================================
|
|
134
|
-
|
|
135
|
-
export {
|
|
136
|
-
PremiumDetailsCard,
|
|
137
|
-
type PremiumDetailsCardProps,
|
|
138
|
-
type PremiumDetailsTranslations,
|
|
139
|
-
type CreditInfo,
|
|
140
|
-
} from "./presentation/components/details/PremiumDetailsCard";
|
|
141
|
-
|
|
142
|
-
export {
|
|
143
|
-
PremiumStatusBadge,
|
|
144
|
-
type PremiumStatusBadgeProps,
|
|
145
|
-
} from "./presentation/components/details/PremiumStatusBadge";
|
|
146
|
-
|
|
147
|
-
// =============================================================================
|
|
148
|
-
// PRESENTATION LAYER - Settings Section Component
|
|
149
|
-
// =============================================================================
|
|
150
|
-
|
|
151
|
-
export {
|
|
152
|
-
SubscriptionSection,
|
|
153
|
-
type SubscriptionSectionProps,
|
|
154
|
-
type SubscriptionSectionConfig,
|
|
155
|
-
} from "./presentation/components/sections/SubscriptionSection";
|
|
156
|
-
|
|
157
|
-
// =============================================================================
|
|
158
|
-
// PRESENTATION LAYER - Subscription Settings Config Hook
|
|
159
|
-
// =============================================================================
|
|
160
|
-
|
|
161
|
-
export {
|
|
162
|
-
useSubscriptionSettingsConfig,
|
|
163
|
-
type SubscriptionSettingsConfig,
|
|
164
|
-
type SubscriptionSettingsItemConfig,
|
|
165
|
-
type SubscriptionSettingsTranslations,
|
|
166
|
-
type UseSubscriptionSettingsConfigParams,
|
|
167
|
-
} from "./presentation/hooks/useSubscriptionSettingsConfig";
|
|
168
|
-
|
|
169
|
-
// =============================================================================
|
|
170
|
-
// PRESENTATION LAYER - Subscription Detail Screen
|
|
171
|
-
// =============================================================================
|
|
172
|
-
|
|
173
|
-
export {
|
|
174
|
-
SubscriptionDetailScreen,
|
|
175
|
-
type SubscriptionDetailScreenProps,
|
|
176
|
-
type SubscriptionDetailConfig,
|
|
177
|
-
type SubscriptionDetailTranslations,
|
|
178
|
-
type DevTestActions,
|
|
179
|
-
type DevToolsConfig,
|
|
180
|
-
type UpgradeBenefit,
|
|
181
|
-
type UpgradePromptConfig,
|
|
182
|
-
type UpgradePromptProps,
|
|
183
|
-
} from "./presentation/screens/SubscriptionDetailScreen";
|
|
184
|
-
|
|
185
|
-
export type {
|
|
186
|
-
SubscriptionHeaderProps,
|
|
187
|
-
CreditsListProps,
|
|
188
|
-
CreditItemProps,
|
|
189
|
-
SubscriptionActionsProps,
|
|
190
|
-
DevTestSectionProps,
|
|
191
|
-
} from "./presentation/types/SubscriptionDetailTypes";
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
// =============================================================================
|
|
195
|
-
// UTILS - Date & Price
|
|
196
|
-
// =============================================================================
|
|
197
|
-
|
|
198
|
-
export { formatPrice } from "./utils/priceUtils";
|
|
199
|
-
|
|
200
|
-
// =============================================================================
|
|
201
|
-
// UTILS - User Tier
|
|
202
|
-
// =============================================================================
|
|
203
|
-
|
|
204
|
-
export type {
|
|
205
|
-
UserTier,
|
|
206
|
-
UserTierInfo,
|
|
207
|
-
PremiumStatusFetcher,
|
|
208
|
-
} from "./utils/types";
|
|
209
|
-
|
|
210
|
-
export {
|
|
211
|
-
getUserTierInfo,
|
|
212
|
-
checkPremiumAccess,
|
|
213
|
-
} from "./utils/tierUtils";
|
|
214
|
-
|
|
215
|
-
export {
|
|
216
|
-
hasTierAccess,
|
|
217
|
-
isTierPremium,
|
|
218
|
-
isTierFreemium,
|
|
219
|
-
isTierGuest,
|
|
220
|
-
} from "./utils/userTierUtils";
|
|
221
|
-
|
|
222
|
-
export {
|
|
223
|
-
isAuthenticated,
|
|
224
|
-
isGuest,
|
|
225
|
-
} from "./utils/authUtils";
|
|
226
|
-
|
|
227
|
-
export {
|
|
228
|
-
isValidUserTier,
|
|
229
|
-
isUserTierInfo,
|
|
230
|
-
validateUserId,
|
|
231
|
-
validateIsGuest,
|
|
232
|
-
validateIsPremium,
|
|
233
|
-
validateFetcher,
|
|
234
|
-
} from "./utils/validation";
|
|
235
|
-
|
|
236
|
-
// =============================================================================
|
|
237
|
-
// CREDITS SYSTEM - Domain Entities
|
|
238
|
-
// =============================================================================
|
|
239
|
-
|
|
240
|
-
export type {
|
|
241
|
-
CreditType,
|
|
242
|
-
UserCredits,
|
|
243
|
-
CreditsConfig,
|
|
244
|
-
CreditsResult,
|
|
245
|
-
DeductCreditsResult,
|
|
246
|
-
} from "./domain/entities/Credits";
|
|
29
|
+
export * from "./presentation/screens/SubscriptionDetailScreen";
|
|
30
|
+
export * from "./presentation/types/SubscriptionDetailTypes";
|
|
247
31
|
|
|
32
|
+
// Credits Domain
|
|
33
|
+
export type { CreditType, UserCredits, CreditsConfig, CreditsResult, DeductCreditsResult } from "./domain/entities/Credits";
|
|
248
34
|
export { DEFAULT_CREDITS_CONFIG } from "./domain/entities/Credits";
|
|
249
|
-
|
|
250
|
-
// =============================================================================
|
|
251
|
-
// CREDITS SYSTEM - Errors
|
|
252
|
-
// =============================================================================
|
|
253
|
-
|
|
254
35
|
export { InsufficientCreditsError } from "./domain/errors/InsufficientCreditsError";
|
|
255
36
|
|
|
256
|
-
//
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
// =============================================================================
|
|
260
|
-
// CREDITS SYSTEM - Repository
|
|
261
|
-
// =============================================================================
|
|
262
|
-
|
|
263
|
-
export {
|
|
264
|
-
CreditsRepository,
|
|
265
|
-
createCreditsRepository,
|
|
266
|
-
} from "./infrastructure/repositories/CreditsRepository";
|
|
267
|
-
|
|
268
|
-
// TransactionRepository and ProductMetadataService
|
|
269
|
-
// are now exported from "./domains/wallet"
|
|
270
|
-
|
|
271
|
-
// =============================================================================
|
|
272
|
-
// CREDITS SYSTEM - Configuration (Module-Level Provider)
|
|
273
|
-
// =============================================================================
|
|
274
|
-
|
|
275
|
-
export {
|
|
276
|
-
configureCreditsRepository,
|
|
277
|
-
getCreditsRepository,
|
|
278
|
-
getCreditsConfig,
|
|
279
|
-
resetCreditsRepository,
|
|
280
|
-
isCreditsRepositoryConfigured,
|
|
281
|
-
} from "./infrastructure/repositories/CreditsRepositoryProvider";
|
|
282
|
-
|
|
283
|
-
// =============================================================================
|
|
284
|
-
// CREDITS SYSTEM - Hooks
|
|
285
|
-
// =============================================================================
|
|
286
|
-
|
|
287
|
-
export {
|
|
288
|
-
useCredits,
|
|
289
|
-
useHasCredits,
|
|
290
|
-
creditsQueryKeys,
|
|
291
|
-
type UseCreditsParams,
|
|
292
|
-
type UseCreditsResult,
|
|
293
|
-
} from "./presentation/hooks/useCredits";
|
|
294
|
-
|
|
295
|
-
export {
|
|
296
|
-
useDeductCredit,
|
|
297
|
-
useInitializeCredits,
|
|
298
|
-
type UseDeductCreditParams,
|
|
299
|
-
type UseDeductCreditResult,
|
|
300
|
-
type UseInitializeCreditsParams,
|
|
301
|
-
type UseInitializeCreditsResult,
|
|
302
|
-
type InitializeCreditsOptions,
|
|
303
|
-
} from "./presentation/hooks/useDeductCredit";
|
|
304
|
-
|
|
305
|
-
export {
|
|
306
|
-
usePremiumWithCredits,
|
|
307
|
-
type UsePremiumWithCreditsParams,
|
|
308
|
-
type UsePremiumWithCreditsResult,
|
|
309
|
-
} from "./presentation/hooks/usePremiumWithCredits";
|
|
310
|
-
|
|
311
|
-
export {
|
|
312
|
-
useCreditChecker,
|
|
313
|
-
type UseCreditCheckerParams,
|
|
314
|
-
type UseCreditCheckerResult,
|
|
315
|
-
} from "./presentation/hooks/useCreditChecker";
|
|
316
|
-
|
|
317
|
-
export {
|
|
318
|
-
useAuthAwarePurchase,
|
|
319
|
-
configureAuthProvider,
|
|
320
|
-
type UseAuthAwarePurchaseResult,
|
|
321
|
-
type PurchaseAuthProvider,
|
|
322
|
-
} from "./presentation/hooks/useAuthAwarePurchase";
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
export {
|
|
326
|
-
usePaywallVisibility,
|
|
327
|
-
paywallControl,
|
|
328
|
-
type UsePaywallVisibilityResult,
|
|
329
|
-
} from "./presentation/hooks/usePaywallVisibility";
|
|
330
|
-
|
|
331
|
-
export {
|
|
332
|
-
usePremium,
|
|
333
|
-
type UsePremiumResult,
|
|
334
|
-
} from "./presentation/hooks/usePremium";
|
|
335
|
-
|
|
336
|
-
export {
|
|
337
|
-
useSubscriptionStatus,
|
|
338
|
-
subscriptionStatusQueryKeys,
|
|
339
|
-
type SubscriptionStatusResult,
|
|
340
|
-
type UseSubscriptionStatusParams,
|
|
341
|
-
} from "./presentation/hooks/useSubscriptionStatus";
|
|
342
|
-
|
|
343
|
-
export {
|
|
344
|
-
usePaywallOperations,
|
|
345
|
-
type UsePaywallOperationsProps,
|
|
346
|
-
type UsePaywallOperationsResult,
|
|
347
|
-
} from "./presentation/hooks/usePaywallOperations";
|
|
348
|
-
|
|
349
|
-
export {
|
|
350
|
-
useAuthSubscriptionSync,
|
|
351
|
-
type AuthSubscriptionSyncConfig,
|
|
352
|
-
} from "./presentation/hooks/useAuthSubscriptionSync";
|
|
353
|
-
|
|
354
|
-
export { useDevTestCallbacks } from "./presentation/hooks/useDevTestCallbacks";
|
|
355
|
-
|
|
356
|
-
// Wallet hooks, components, and screens
|
|
357
|
-
// are now exported from "./domains/wallet"
|
|
358
|
-
|
|
359
|
-
// =============================================================================
|
|
360
|
-
// CREDITS SYSTEM - Utilities
|
|
361
|
-
// =============================================================================
|
|
362
|
-
|
|
363
|
-
export {
|
|
364
|
-
createCreditChecker,
|
|
365
|
-
type CreditCheckResult,
|
|
366
|
-
type CreditCheckerConfig,
|
|
367
|
-
type CreditChecker,
|
|
368
|
-
} from "./utils/creditChecker";
|
|
369
|
-
|
|
370
|
-
export {
|
|
371
|
-
createAICreditHelpers,
|
|
372
|
-
type AICreditHelpersConfig,
|
|
373
|
-
type AICreditHelpers,
|
|
374
|
-
} from "./utils/aiCreditHelpers";
|
|
375
|
-
|
|
376
|
-
export {
|
|
377
|
-
detectPackageType,
|
|
378
|
-
type SubscriptionPackageType,
|
|
379
|
-
} from "./utils/packageTypeDetector";
|
|
380
|
-
|
|
381
|
-
export {
|
|
382
|
-
filterPackagesByMode,
|
|
383
|
-
separatePackages,
|
|
384
|
-
getPackageCategory,
|
|
385
|
-
type PackageCategory,
|
|
386
|
-
type PackageFilterConfig,
|
|
387
|
-
} from "./utils/packageFilter";
|
|
388
|
-
|
|
389
|
-
export {
|
|
390
|
-
getCreditAllocation,
|
|
391
|
-
getImageCreditsForPackage,
|
|
392
|
-
getTextCreditsForPackage,
|
|
393
|
-
createCreditAmountsFromPackages,
|
|
394
|
-
CREDIT_ALLOCATIONS,
|
|
395
|
-
type CreditAllocation,
|
|
396
|
-
} from "./utils/creditMapper";
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
// =============================================================================
|
|
400
|
-
// REVENUECAT - Errors
|
|
401
|
-
// =============================================================================
|
|
402
|
-
|
|
403
|
-
export {
|
|
404
|
-
RevenueCatError,
|
|
405
|
-
RevenueCatInitializationError,
|
|
406
|
-
RevenueCatConfigurationError,
|
|
407
|
-
RevenueCatPurchaseError,
|
|
408
|
-
RevenueCatRestoreError,
|
|
409
|
-
RevenueCatNetworkError,
|
|
410
|
-
RevenueCatExpoGoError,
|
|
411
|
-
} from "./revenuecat/domain/errors/RevenueCatError";
|
|
412
|
-
|
|
413
|
-
// =============================================================================
|
|
414
|
-
// REVENUECAT - Types & Config
|
|
415
|
-
// =============================================================================
|
|
416
|
-
|
|
417
|
-
export type { RevenueCatConfig } from "./revenuecat/domain/value-objects/RevenueCatConfig";
|
|
418
|
-
|
|
419
|
-
export type {
|
|
420
|
-
RevenueCatEntitlement,
|
|
421
|
-
RevenueCatPurchaseErrorInfo,
|
|
422
|
-
} from "./revenuecat/domain/types/RevenueCatTypes";
|
|
423
|
-
|
|
424
|
-
export { REVENUECAT_LOG_PREFIX } from "./revenuecat/domain/constants/RevenueCatConstants";
|
|
425
|
-
|
|
426
|
-
export {
|
|
427
|
-
getPremiumEntitlement,
|
|
428
|
-
isUserCancelledError,
|
|
429
|
-
getErrorMessage,
|
|
430
|
-
} from "./revenuecat/domain/types/RevenueCatTypes";
|
|
431
|
-
|
|
432
|
-
// =============================================================================
|
|
433
|
-
// REVENUECAT - Ports
|
|
434
|
-
// =============================================================================
|
|
435
|
-
|
|
436
|
-
export type {
|
|
437
|
-
IRevenueCatService,
|
|
438
|
-
InitializeResult,
|
|
439
|
-
PurchaseResult,
|
|
440
|
-
RestoreResult,
|
|
441
|
-
} from "./revenuecat/application/ports/IRevenueCatService";
|
|
442
|
-
|
|
443
|
-
// =============================================================================
|
|
444
|
-
// REVENUECAT - Service
|
|
445
|
-
// =============================================================================
|
|
446
|
-
|
|
447
|
-
export {
|
|
448
|
-
RevenueCatService,
|
|
449
|
-
initializeRevenueCatService,
|
|
450
|
-
getRevenueCatService,
|
|
451
|
-
resetRevenueCatService,
|
|
452
|
-
} from "./revenuecat/infrastructure/services/RevenueCatService";
|
|
453
|
-
|
|
454
|
-
export {
|
|
455
|
-
SubscriptionManager,
|
|
456
|
-
type SubscriptionManagerConfig,
|
|
457
|
-
type PremiumStatus,
|
|
458
|
-
} from "./revenuecat/infrastructure/managers/SubscriptionManager";
|
|
459
|
-
|
|
460
|
-
export type { RestoreResultInfo } from "./revenuecat/infrastructure/handlers/PackageHandler";
|
|
461
|
-
|
|
462
|
-
// =============================================================================
|
|
463
|
-
// REVENUECAT - Hooks
|
|
464
|
-
// =============================================================================
|
|
465
|
-
|
|
466
|
-
export { useRevenueCat } from "./revenuecat/presentation/hooks/useRevenueCat";
|
|
467
|
-
export type { UseRevenueCatResult } from "./revenuecat/presentation/hooks/useRevenueCat";
|
|
468
|
-
|
|
469
|
-
export { useCustomerInfo } from "./revenuecat/presentation/hooks/useCustomerInfo";
|
|
470
|
-
export type { UseCustomerInfoResult } from "./revenuecat/presentation/hooks/useCustomerInfo";
|
|
37
|
+
// Utils
|
|
38
|
+
export * from "./utils";
|
|
471
39
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
useSubscriptionPackages,
|
|
475
|
-
usePurchasePackage,
|
|
476
|
-
useRestorePurchase,
|
|
477
|
-
SUBSCRIPTION_QUERY_KEYS,
|
|
478
|
-
} from "./revenuecat/presentation/hooks/useSubscriptionQueries";
|
|
479
|
-
export { usePaywallFlow, type UsePaywallFlowOptions, type UsePaywallFlowResult } from './revenuecat/presentation/hooks/usePaywallFlow';
|
|
40
|
+
// RevenueCat
|
|
41
|
+
export * from "./revenuecat";
|