@umituz/react-native-subscription 2.12.16 → 2.12.18
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 +14 -7
- package/src/application/ports/ISubscriptionRepository.ts +1 -1
- package/src/application/ports/ISubscriptionService.ts +1 -1
- package/src/domain/value-objects/SubscriptionConfig.ts +1 -1
- package/src/domains/paywall/components/CreditCard.tsx +5 -2
- package/src/domains/paywall/components/FeatureList.tsx +1 -1
- package/src/domains/paywall/components/PaywallModal.tsx +7 -3
- package/src/domains/paywall/components/PaywallTabBar.tsx +1 -1
- package/src/domains/paywall/components/PlanCard.tsx +3 -1
- package/src/domains/paywall/entities/types.ts +1 -0
- package/src/index.ts +55 -53
- package/src/infrastructure/repositories/CreditsRepository.ts +3 -3
- package/src/infrastructure/repositories/CreditsRepositoryProvider.ts +2 -2
- package/src/infrastructure/services/ActivationHandler.ts +3 -3
- package/src/infrastructure/services/CreditsInitializer.ts +1 -1
- package/src/infrastructure/services/SubscriptionService.ts +6 -6
- package/src/presentation/components/details/PremiumDetailsCard.tsx +19 -48
- package/src/presentation/components/details/PremiumDetailsCardTypes.ts +5 -3
- package/src/presentation/components/details/PremiumStatusBadge.tsx +9 -9
- package/src/presentation/hooks/useCreditChecker.ts +3 -3
- package/src/presentation/hooks/useCredits.ts +2 -2
- package/src/presentation/hooks/useDeductCredit.ts +2 -2
- package/src/presentation/hooks/useDevTestCallbacks.ts +143 -0
- package/src/presentation/hooks/usePremiumWithConfig.ts +2 -2
- package/src/presentation/hooks/useSubscription.ts +3 -3
- package/src/presentation/hooks/useSubscriptionDetails.ts +2 -2
- package/src/presentation/hooks/useUserTier.ts +2 -2
- package/src/presentation/hooks/useUserTierWithRepository.ts +1 -1
- package/src/presentation/screens/SubscriptionDetailScreen.tsx +12 -11
- package/src/presentation/screens/components/CreditItem.tsx +8 -11
- package/src/presentation/screens/components/SubscriptionActions.tsx +10 -22
- package/src/presentation/screens/components/SubscriptionHeader.tsx +22 -22
- package/src/revenuecat/infrastructure/handlers/PackageHandler.ts +2 -2
- package/src/revenuecat/infrastructure/managers/SubscriptionManager.ts +7 -7
- package/src/revenuecat/infrastructure/services/CustomerInfoListenerManager.ts +2 -2
- package/src/revenuecat/infrastructure/services/PurchaseHandler.ts +5 -5
- package/src/revenuecat/infrastructure/services/RestoreHandler.ts +5 -5
- package/src/revenuecat/infrastructure/services/RevenueCatInitializer.ts +4 -4
- package/src/revenuecat/infrastructure/services/RevenueCatService.ts +3 -3
- package/src/revenuecat/infrastructure/services/ServiceStateManager.ts +2 -2
- package/src/revenuecat/infrastructure/utils/ApiKeyResolver.ts +1 -1
- package/src/revenuecat/infrastructure/utils/ExpirationDateCalculator.ts +1 -1
- package/src/revenuecat/infrastructure/utils/PremiumStatusSyncer.ts +2 -2
- package/src/revenuecat/presentation/hooks/useInitializeSubscription.ts +1 -1
- package/src/revenuecat/presentation/hooks/usePurchasePackage.ts +1 -1
- package/src/revenuecat/presentation/hooks/useRestorePurchase.ts +1 -1
- package/src/revenuecat/presentation/hooks/useRevenueCat.ts +2 -2
- package/src/revenuecat/presentation/hooks/useSubscriptionPackages.ts +1 -1
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.18",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"typecheck": "
|
|
9
|
-
"lint": "
|
|
8
|
+
"typecheck": "npx tsc --noEmit",
|
|
9
|
+
"lint": "eslint . --fix",
|
|
10
10
|
"version:patch": "npm version patch -m 'chore: release v%s'",
|
|
11
11
|
"version:minor": "npm version minor -m 'chore: release v%s'",
|
|
12
|
-
"version:major": "npm version major -m 'chore: release v%s'"
|
|
12
|
+
"version:major": "npm version major -m 'chore: release v%s'",
|
|
13
|
+
"publish": "npm publish",
|
|
14
|
+
"push": "git push"
|
|
13
15
|
},
|
|
14
16
|
"keywords": [
|
|
15
17
|
"react-native",
|
|
@@ -47,11 +49,17 @@
|
|
|
47
49
|
"devDependencies": {
|
|
48
50
|
"@tanstack/react-query": "^5.0.0",
|
|
49
51
|
"@types/react": "~19.1.10",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
53
|
+
"@typescript-eslint/parser": "^8.50.1",
|
|
54
|
+
"@umituz/react-native-auth": "^2.7.3",
|
|
50
55
|
"@umituz/react-native-design-system": "*",
|
|
51
56
|
"@umituz/react-native-firebase": "*",
|
|
52
57
|
"@umituz/react-native-legal": "*",
|
|
53
58
|
"@umituz/react-native-localization": "*",
|
|
54
59
|
"@umituz/react-native-sentry": "*",
|
|
60
|
+
"eslint": "^9.39.2",
|
|
61
|
+
"eslint-plugin-react": "^7.37.5",
|
|
62
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
55
63
|
"expo-constants": "~16.0.0",
|
|
56
64
|
"expo-linear-gradient": "~15.0.0",
|
|
57
65
|
"firebase": "^10.0.0",
|
|
@@ -68,6 +76,5 @@
|
|
|
68
76
|
"src",
|
|
69
77
|
"README.md",
|
|
70
78
|
"LICENSE"
|
|
71
|
-
]
|
|
72
|
-
|
|
73
|
-
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ISubscriptionRepository Interface
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { SubscriptionStatus } from '
|
|
5
|
+
import { SubscriptionStatus } from '@domain/entities/SubscriptionStatus';
|
|
6
6
|
|
|
7
7
|
export interface ISubscriptionRepository {
|
|
8
8
|
getSubscriptionStatus(userId: string): Promise<SubscriptionStatus | null>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Defines the contract for subscription service operations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { SubscriptionStatus } from '
|
|
6
|
+
import type { SubscriptionStatus } from '@domain/entities/SubscriptionStatus';
|
|
7
7
|
|
|
8
8
|
export interface ISubscriptionService {
|
|
9
9
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Subscription Config Value Object
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { ISubscriptionRepository } from "
|
|
5
|
+
import { ISubscriptionRepository } from "@application/ports/ISubscriptionRepository";
|
|
6
6
|
import { SubscriptionStatus } from "../entities/SubscriptionStatus";
|
|
7
7
|
|
|
8
8
|
export interface SubscriptionConfig {
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
8
8
|
import { AtomicText, AtomicIcon, AtomicBadge, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
9
|
-
import type { CreditsPackage } from "
|
|
9
|
+
import type { CreditsPackage } from "@domains/paywall/entities";
|
|
10
|
+
|
|
11
|
+
import { formatPrice } from "@utils/priceUtils";
|
|
10
12
|
|
|
11
13
|
interface CreditCardProps {
|
|
12
14
|
pkg: CreditsPackage;
|
|
@@ -17,6 +19,7 @@ interface CreditCardProps {
|
|
|
17
19
|
export const CreditCard: React.FC<CreditCardProps> = React.memo(({ pkg, isSelected, onSelect }) => {
|
|
18
20
|
const tokens = useAppDesignTokens();
|
|
19
21
|
const totalCredits = pkg.credits + (pkg.bonus ?? 0);
|
|
22
|
+
const price = formatPrice(pkg.price, pkg.currency);
|
|
20
23
|
|
|
21
24
|
return (
|
|
22
25
|
<TouchableOpacity onPress={onSelect} activeOpacity={0.7} style={styles.touchable}>
|
|
@@ -52,7 +55,7 @@ export const CreditCard: React.FC<CreditCardProps> = React.memo(({ pkg, isSelect
|
|
|
52
55
|
type="titleLarge"
|
|
53
56
|
style={[styles.price, { color: isSelected ? tokens.colors.primary : tokens.colors.textPrimary }]}
|
|
54
57
|
>
|
|
55
|
-
{
|
|
58
|
+
{price}
|
|
56
59
|
</AtomicText>
|
|
57
60
|
{isSelected && <AtomicIcon name="checkmark-circle" size="md" color="primary" />}
|
|
58
61
|
</View>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { View, StyleSheet } from "react-native";
|
|
8
8
|
import { FeatureItem } from "./FeatureItem";
|
|
9
|
-
import type { SubscriptionFeature } from "
|
|
9
|
+
import type { SubscriptionFeature } from "@domains/paywall/entities";
|
|
10
10
|
|
|
11
11
|
interface FeatureListProps {
|
|
12
12
|
features: SubscriptionFeature[];
|
|
@@ -9,7 +9,7 @@ import { BaseModal, useAppDesignTokens, AtomicText, AtomicIcon } from "@umituz/r
|
|
|
9
9
|
import type { PurchasesPackage } from "react-native-purchases";
|
|
10
10
|
import { PlanCard } from "./PlanCard";
|
|
11
11
|
import { CreditCard } from "./CreditCard";
|
|
12
|
-
import type { PaywallMode, CreditsPackage, SubscriptionFeature, PaywallTranslations, PaywallLegalUrls } from "
|
|
12
|
+
import type { PaywallMode, CreditsPackage, SubscriptionFeature, PaywallTranslations, PaywallLegalUrls } from "@domains/paywall/entities";
|
|
13
13
|
|
|
14
14
|
export interface PaywallModalProps {
|
|
15
15
|
visible: boolean;
|
|
@@ -148,7 +148,7 @@ export const PaywallModal: React.FC<PaywallModalProps> = React.memo((props) => {
|
|
|
148
148
|
pkg={pkg}
|
|
149
149
|
isSelected={selectedPlanId === pkg.product.identifier}
|
|
150
150
|
onSelect={() => setSelectedPlanId(pkg.product.identifier)}
|
|
151
|
-
badge={pkg.product.identifier === bestValueIdentifier ?
|
|
151
|
+
badge={pkg.product.identifier === bestValueIdentifier ? translations.bestValueBadgeText : undefined}
|
|
152
152
|
creditAmount={creditAmounts?.[pkg.product.identifier]}
|
|
153
153
|
creditsLabel={creditsLabel}
|
|
154
154
|
/>
|
|
@@ -167,7 +167,11 @@ export const PaywallModal: React.FC<PaywallModalProps> = React.memo((props) => {
|
|
|
167
167
|
activeOpacity={0.8}
|
|
168
168
|
>
|
|
169
169
|
<AtomicText type="titleLarge" style={[styles.ctaText, { color: tokens.colors.onPrimary }]}>
|
|
170
|
-
{isProcessing
|
|
170
|
+
{isProcessing
|
|
171
|
+
? translations.processingText
|
|
172
|
+
: showSubscription
|
|
173
|
+
? (translations.subscribeButtonText || translations.purchaseButtonText)
|
|
174
|
+
: translations.purchaseButtonText}
|
|
171
175
|
</AtomicText>
|
|
172
176
|
</TouchableOpacity>
|
|
173
177
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { View, TouchableOpacity, StyleSheet, Animated } from "react-native";
|
|
8
8
|
import { AtomicText, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
9
|
-
import type { PaywallTabType } from "
|
|
9
|
+
import type { PaywallTabType } from "@domains/paywall/entities";
|
|
10
10
|
|
|
11
11
|
interface PaywallTabBarProps {
|
|
12
12
|
activeTab: PaywallTabType;
|
|
@@ -8,6 +8,8 @@ import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
|
8
8
|
import { AtomicText, AtomicIcon, AtomicBadge, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
9
9
|
import type { PurchasesPackage } from "react-native-purchases";
|
|
10
10
|
|
|
11
|
+
import { formatPrice } from "@utils/priceUtils";
|
|
12
|
+
|
|
11
13
|
interface PlanCardProps {
|
|
12
14
|
pkg: PurchasesPackage;
|
|
13
15
|
isSelected: boolean;
|
|
@@ -21,7 +23,7 @@ export const PlanCard: React.FC<PlanCardProps> = React.memo(
|
|
|
21
23
|
({ pkg, isSelected, onSelect, badge, creditAmount, creditsLabel }) => {
|
|
22
24
|
const tokens = useAppDesignTokens();
|
|
23
25
|
const title = pkg.product.title;
|
|
24
|
-
const price =
|
|
26
|
+
const price = formatPrice(pkg.product.price, pkg.product.currencyCode);
|
|
25
27
|
|
|
26
28
|
return (
|
|
27
29
|
<TouchableOpacity onPress={onSelect} activeOpacity={0.7} style={styles.touchable}>
|
package/src/index.ts
CHANGED
|
@@ -16,48 +16,48 @@
|
|
|
16
16
|
export {
|
|
17
17
|
createDefaultSubscriptionStatus,
|
|
18
18
|
isSubscriptionValid,
|
|
19
|
-
} from "
|
|
20
|
-
export type { SubscriptionStatus, SubscriptionStatusType } from "
|
|
19
|
+
} from "@domain/entities/SubscriptionStatus";
|
|
20
|
+
export type { SubscriptionStatus, SubscriptionStatusType } from "@domain/entities/SubscriptionStatus";
|
|
21
21
|
|
|
22
|
-
export type { SubscriptionConfig } from "
|
|
22
|
+
export type { SubscriptionConfig } from "@domain/value-objects/SubscriptionConfig";
|
|
23
23
|
|
|
24
|
-
export type { ISubscriptionRepository } from "
|
|
24
|
+
export type { ISubscriptionRepository } from "@application/ports/ISubscriptionRepository";
|
|
25
25
|
|
|
26
26
|
export {
|
|
27
27
|
SubscriptionService,
|
|
28
28
|
initializeSubscriptionService,
|
|
29
|
-
} from "
|
|
29
|
+
} from "@infrastructure/services/SubscriptionService";
|
|
30
30
|
|
|
31
|
-
export { useSubscription } from "
|
|
32
|
-
export type { UseSubscriptionResult } from "
|
|
31
|
+
export { useSubscription } from "@presentation/hooks/useSubscription";
|
|
32
|
+
export type { UseSubscriptionResult } from "@presentation/hooks/useSubscription";
|
|
33
33
|
|
|
34
34
|
export {
|
|
35
35
|
useSubscriptionDetails,
|
|
36
36
|
type SubscriptionDetails,
|
|
37
|
-
} from "
|
|
37
|
+
} from "@presentation/hooks/useSubscriptionDetails";
|
|
38
38
|
|
|
39
39
|
// Feedback
|
|
40
|
-
export * from "
|
|
41
|
-
export * from "
|
|
40
|
+
export * from "@presentation/components/feedback/PaywallFeedbackModal";
|
|
41
|
+
export * from "@presentation/hooks/feedback/usePaywallFeedback";
|
|
42
42
|
|
|
43
43
|
export {
|
|
44
44
|
usePremiumGate,
|
|
45
45
|
type UsePremiumGateParams,
|
|
46
46
|
type UsePremiumGateResult,
|
|
47
|
-
} from "
|
|
47
|
+
} from "@presentation/hooks/usePremiumGate";
|
|
48
48
|
|
|
49
49
|
export {
|
|
50
50
|
useFeatureGate,
|
|
51
51
|
type UseFeatureGateParams,
|
|
52
52
|
type UseFeatureGateResult,
|
|
53
|
-
} from "
|
|
53
|
+
} from "@presentation/hooks/useFeatureGate";
|
|
54
54
|
|
|
55
55
|
export {
|
|
56
56
|
useUserTierWithRepository,
|
|
57
57
|
type UseUserTierWithRepositoryParams,
|
|
58
58
|
type UseUserTierWithRepositoryResult,
|
|
59
59
|
type AuthProvider,
|
|
60
|
-
} from "
|
|
60
|
+
} from "@presentation/hooks/useUserTierWithRepository";
|
|
61
61
|
|
|
62
62
|
// =============================================================================
|
|
63
63
|
// PAYWALL DOMAIN
|
|
@@ -81,7 +81,7 @@ export {
|
|
|
81
81
|
type SubscriptionFeature,
|
|
82
82
|
type PaywallTranslations,
|
|
83
83
|
type PaywallLegalUrls,
|
|
84
|
-
} from "
|
|
84
|
+
} from "@domains/paywall";
|
|
85
85
|
|
|
86
86
|
// =============================================================================
|
|
87
87
|
// PRESENTATION LAYER - Premium Details Components
|
|
@@ -92,12 +92,12 @@ export {
|
|
|
92
92
|
type PremiumDetailsCardProps,
|
|
93
93
|
type PremiumDetailsTranslations,
|
|
94
94
|
type CreditInfo,
|
|
95
|
-
} from "
|
|
95
|
+
} from "@presentation/components/details/PremiumDetailsCard";
|
|
96
96
|
|
|
97
97
|
export {
|
|
98
98
|
PremiumStatusBadge,
|
|
99
99
|
type PremiumStatusBadgeProps,
|
|
100
|
-
} from "
|
|
100
|
+
} from "@presentation/components/details/PremiumStatusBadge";
|
|
101
101
|
|
|
102
102
|
// =============================================================================
|
|
103
103
|
// PRESENTATION LAYER - Settings Section Component
|
|
@@ -107,7 +107,7 @@ export {
|
|
|
107
107
|
SubscriptionSection,
|
|
108
108
|
type SubscriptionSectionProps,
|
|
109
109
|
type SubscriptionSectionConfig,
|
|
110
|
-
} from "
|
|
110
|
+
} from "@presentation/components/sections/SubscriptionSection";
|
|
111
111
|
|
|
112
112
|
// =============================================================================
|
|
113
113
|
// PRESENTATION LAYER - Subscription Detail Screen
|
|
@@ -118,16 +118,16 @@ export {
|
|
|
118
118
|
type SubscriptionDetailScreenProps,
|
|
119
119
|
type SubscriptionDetailConfig,
|
|
120
120
|
type SubscriptionDetailTranslations,
|
|
121
|
-
} from "
|
|
121
|
+
} from "@presentation/screens/SubscriptionDetailScreen";
|
|
122
122
|
|
|
123
|
-
export { type DevTestActions } from "
|
|
123
|
+
export { type DevTestActions } from "@presentation/screens/components/DevTestSection";
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
// =============================================================================
|
|
127
127
|
// UTILS - Date & Price
|
|
128
128
|
// =============================================================================
|
|
129
129
|
|
|
130
|
-
export { formatPrice } from "
|
|
130
|
+
export { formatPrice } from "@utils/priceUtils";
|
|
131
131
|
|
|
132
132
|
// =============================================================================
|
|
133
133
|
// UTILS - User Tier
|
|
@@ -137,24 +137,24 @@ export type {
|
|
|
137
137
|
UserTier,
|
|
138
138
|
UserTierInfo,
|
|
139
139
|
PremiumStatusFetcher,
|
|
140
|
-
} from "
|
|
140
|
+
} from "@utils/types";
|
|
141
141
|
|
|
142
142
|
export {
|
|
143
143
|
getUserTierInfo,
|
|
144
144
|
checkPremiumAccess,
|
|
145
|
-
} from "
|
|
145
|
+
} from "@utils/tierUtils";
|
|
146
146
|
|
|
147
147
|
export {
|
|
148
148
|
hasTierAccess,
|
|
149
149
|
isTierPremium,
|
|
150
150
|
isTierFreemium,
|
|
151
151
|
isTierGuest,
|
|
152
|
-
} from "
|
|
152
|
+
} from "@utils/userTierUtils";
|
|
153
153
|
|
|
154
154
|
export {
|
|
155
155
|
isAuthenticated,
|
|
156
156
|
isGuest,
|
|
157
|
-
} from "
|
|
157
|
+
} from "@utils/authUtils";
|
|
158
158
|
|
|
159
159
|
export {
|
|
160
160
|
isValidUserTier,
|
|
@@ -163,7 +163,7 @@ export {
|
|
|
163
163
|
validateIsGuest,
|
|
164
164
|
validateIsPremium,
|
|
165
165
|
validateFetcher,
|
|
166
|
-
} from "
|
|
166
|
+
} from "@utils/validation";
|
|
167
167
|
|
|
168
168
|
// =============================================================================
|
|
169
169
|
// CREDITS SYSTEM - Domain Entities
|
|
@@ -175,9 +175,9 @@ export type {
|
|
|
175
175
|
CreditsConfig,
|
|
176
176
|
CreditsResult,
|
|
177
177
|
DeductCreditsResult,
|
|
178
|
-
} from "
|
|
178
|
+
} from "@domain/entities/Credits";
|
|
179
179
|
|
|
180
|
-
export { DEFAULT_CREDITS_CONFIG } from "
|
|
180
|
+
export { DEFAULT_CREDITS_CONFIG } from "@domain/entities/Credits";
|
|
181
181
|
|
|
182
182
|
// =============================================================================
|
|
183
183
|
// CREDITS SYSTEM - Repository
|
|
@@ -186,7 +186,7 @@ export { DEFAULT_CREDITS_CONFIG } from "./domain/entities/Credits";
|
|
|
186
186
|
export {
|
|
187
187
|
CreditsRepository,
|
|
188
188
|
createCreditsRepository,
|
|
189
|
-
} from "
|
|
189
|
+
} from "@infrastructure/repositories/CreditsRepository";
|
|
190
190
|
|
|
191
191
|
// =============================================================================
|
|
192
192
|
// CREDITS SYSTEM - Configuration (Module-Level Provider)
|
|
@@ -197,7 +197,7 @@ export {
|
|
|
197
197
|
getCreditsRepository,
|
|
198
198
|
getCreditsConfig,
|
|
199
199
|
resetCreditsRepository,
|
|
200
|
-
} from "
|
|
200
|
+
} from "@infrastructure/repositories/CreditsRepositoryProvider";
|
|
201
201
|
|
|
202
202
|
// =============================================================================
|
|
203
203
|
// CREDITS SYSTEM - Hooks
|
|
@@ -209,7 +209,7 @@ export {
|
|
|
209
209
|
creditsQueryKeys,
|
|
210
210
|
type UseCreditsParams,
|
|
211
211
|
type UseCreditsResult,
|
|
212
|
-
} from "
|
|
212
|
+
} from "@presentation/hooks/useCredits";
|
|
213
213
|
|
|
214
214
|
export {
|
|
215
215
|
useDeductCredit,
|
|
@@ -219,35 +219,37 @@ export {
|
|
|
219
219
|
type UseInitializeCreditsParams,
|
|
220
220
|
type UseInitializeCreditsResult,
|
|
221
221
|
type InitializeCreditsOptions,
|
|
222
|
-
} from "
|
|
222
|
+
} from "@presentation/hooks/useDeductCredit";
|
|
223
223
|
|
|
224
224
|
export {
|
|
225
225
|
usePremiumWithCredits,
|
|
226
226
|
type UsePremiumWithCreditsParams,
|
|
227
227
|
type UsePremiumWithCreditsResult,
|
|
228
|
-
} from "
|
|
228
|
+
} from "@presentation/hooks/usePremiumWithCredits";
|
|
229
229
|
|
|
230
230
|
export {
|
|
231
231
|
useCreditChecker,
|
|
232
232
|
type UseCreditCheckerParams,
|
|
233
233
|
type UseCreditCheckerResult,
|
|
234
|
-
} from "
|
|
234
|
+
} from "@presentation/hooks/useCreditChecker";
|
|
235
235
|
|
|
236
236
|
export {
|
|
237
237
|
usePaywallVisibility,
|
|
238
238
|
type UsePaywallVisibilityResult,
|
|
239
|
-
} from "
|
|
239
|
+
} from "@presentation/hooks/usePaywallVisibility";
|
|
240
240
|
|
|
241
241
|
export {
|
|
242
242
|
usePremiumWithConfig,
|
|
243
243
|
type UsePremiumWithConfigParams,
|
|
244
244
|
type UsePremiumWithConfigResult,
|
|
245
|
-
} from "
|
|
245
|
+
} from "@presentation/hooks/usePremiumWithConfig";
|
|
246
246
|
|
|
247
247
|
export {
|
|
248
248
|
useAuthSubscriptionSync,
|
|
249
249
|
type AuthSubscriptionSyncConfig,
|
|
250
|
-
} from "
|
|
250
|
+
} from "@presentation/hooks/useAuthSubscriptionSync";
|
|
251
|
+
|
|
252
|
+
export { useDevTestCallbacks } from "@presentation/hooks/useDevTestCallbacks";
|
|
251
253
|
|
|
252
254
|
// =============================================================================
|
|
253
255
|
// CREDITS SYSTEM - Utilities
|
|
@@ -258,18 +260,18 @@ export {
|
|
|
258
260
|
type CreditCheckResult,
|
|
259
261
|
type CreditCheckerConfig,
|
|
260
262
|
type CreditChecker,
|
|
261
|
-
} from "
|
|
263
|
+
} from "@utils/creditChecker";
|
|
262
264
|
|
|
263
265
|
export {
|
|
264
266
|
createAICreditHelpers,
|
|
265
267
|
type AICreditHelpersConfig,
|
|
266
268
|
type AICreditHelpers,
|
|
267
|
-
} from "
|
|
269
|
+
} from "@utils/aiCreditHelpers";
|
|
268
270
|
|
|
269
271
|
export {
|
|
270
272
|
detectPackageType,
|
|
271
273
|
type SubscriptionPackageType,
|
|
272
|
-
} from "
|
|
274
|
+
} from "@utils/packageTypeDetector";
|
|
273
275
|
|
|
274
276
|
export {
|
|
275
277
|
getCreditAllocation,
|
|
@@ -277,7 +279,7 @@ export {
|
|
|
277
279
|
getTextCreditsForPackage,
|
|
278
280
|
CREDIT_ALLOCATIONS,
|
|
279
281
|
type CreditAllocation,
|
|
280
|
-
} from "
|
|
282
|
+
} from "@utils/creditMapper";
|
|
281
283
|
|
|
282
284
|
// =============================================================================
|
|
283
285
|
// REVENUECAT - Errors
|
|
@@ -291,26 +293,26 @@ export {
|
|
|
291
293
|
RevenueCatRestoreError,
|
|
292
294
|
RevenueCatNetworkError,
|
|
293
295
|
RevenueCatExpoGoError,
|
|
294
|
-
} from "
|
|
296
|
+
} from "@revenuecat/domain/errors/RevenueCatError";
|
|
295
297
|
|
|
296
298
|
// =============================================================================
|
|
297
299
|
// REVENUECAT - Types & Config
|
|
298
300
|
// =============================================================================
|
|
299
301
|
|
|
300
|
-
export type { RevenueCatConfig } from "
|
|
302
|
+
export type { RevenueCatConfig } from "@revenuecat/domain/value-objects/RevenueCatConfig";
|
|
301
303
|
|
|
302
304
|
export type {
|
|
303
305
|
RevenueCatEntitlement,
|
|
304
306
|
RevenueCatPurchaseErrorInfo,
|
|
305
|
-
} from "
|
|
307
|
+
} from "@revenuecat/domain/types/RevenueCatTypes";
|
|
306
308
|
|
|
307
|
-
export { REVENUECAT_LOG_PREFIX } from "
|
|
309
|
+
export { REVENUECAT_LOG_PREFIX } from "@revenuecat/domain/constants/RevenueCatConstants";
|
|
308
310
|
|
|
309
311
|
export {
|
|
310
312
|
getPremiumEntitlement,
|
|
311
313
|
isUserCancelledError,
|
|
312
314
|
getErrorMessage,
|
|
313
|
-
} from "
|
|
315
|
+
} from "@revenuecat/domain/types/RevenueCatTypes";
|
|
314
316
|
|
|
315
317
|
// =============================================================================
|
|
316
318
|
// REVENUECAT - Ports
|
|
@@ -321,7 +323,7 @@ export type {
|
|
|
321
323
|
InitializeResult,
|
|
322
324
|
PurchaseResult,
|
|
323
325
|
RestoreResult,
|
|
324
|
-
} from "
|
|
326
|
+
} from "@revenuecat/application/ports/IRevenueCatService";
|
|
325
327
|
|
|
326
328
|
// =============================================================================
|
|
327
329
|
// REVENUECAT - Service
|
|
@@ -332,23 +334,23 @@ export {
|
|
|
332
334
|
initializeRevenueCatService,
|
|
333
335
|
getRevenueCatService,
|
|
334
336
|
resetRevenueCatService,
|
|
335
|
-
} from "
|
|
337
|
+
} from "@revenuecat/infrastructure/services/RevenueCatService";
|
|
336
338
|
|
|
337
339
|
export {
|
|
338
340
|
SubscriptionManager,
|
|
339
341
|
type SubscriptionManagerConfig,
|
|
340
342
|
type PremiumStatus,
|
|
341
|
-
} from "
|
|
343
|
+
} from "@revenuecat/infrastructure/managers/SubscriptionManager";
|
|
342
344
|
|
|
343
345
|
// =============================================================================
|
|
344
346
|
// REVENUECAT - Hooks
|
|
345
347
|
// =============================================================================
|
|
346
348
|
|
|
347
|
-
export { useRevenueCat } from "
|
|
348
|
-
export type { UseRevenueCatResult } from "
|
|
349
|
+
export { useRevenueCat } from "@revenuecat/presentation/hooks/useRevenueCat";
|
|
350
|
+
export type { UseRevenueCatResult } from "@revenuecat/presentation/hooks/useRevenueCat";
|
|
349
351
|
|
|
350
|
-
export { useCustomerInfo } from "
|
|
351
|
-
export type { UseCustomerInfoResult } from "
|
|
352
|
+
export { useCustomerInfo } from "@revenuecat/presentation/hooks/useCustomerInfo";
|
|
353
|
+
export type { UseCustomerInfoResult } from "@revenuecat/presentation/hooks/useCustomerInfo";
|
|
352
354
|
|
|
353
355
|
export {
|
|
354
356
|
useInitializeSubscription,
|
|
@@ -356,4 +358,4 @@ export {
|
|
|
356
358
|
usePurchasePackage,
|
|
357
359
|
useRestorePurchase,
|
|
358
360
|
SUBSCRIPTION_QUERY_KEYS,
|
|
359
|
-
} from "
|
|
361
|
+
} from "@revenuecat/presentation/hooks/useSubscriptionQueries";
|
|
@@ -20,11 +20,11 @@ import type {
|
|
|
20
20
|
CreditsConfig,
|
|
21
21
|
CreditsResult,
|
|
22
22
|
DeductCreditsResult,
|
|
23
|
-
} from "
|
|
23
|
+
} from "@domain/entities/Credits";
|
|
24
24
|
import type { UserCreditsDocumentRead } from "../models/UserCreditsDocument";
|
|
25
25
|
import { initializeCreditsTransaction } from "../services/CreditsInitializer";
|
|
26
|
-
import { detectPackageType } from "
|
|
27
|
-
import { getCreditAllocation } from "
|
|
26
|
+
import { detectPackageType } from "@utils/packageTypeDetector";
|
|
27
|
+
import { getCreditAllocation } from "@utils/creditMapper";
|
|
28
28
|
|
|
29
29
|
export class CreditsRepository extends BaseRepository {
|
|
30
30
|
private config: CreditsConfig;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Replaces Context API with a simpler, testable approach
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { CreditsConfig } from "
|
|
8
|
-
import { DEFAULT_CREDITS_CONFIG } from "
|
|
7
|
+
import type { CreditsConfig } from "@domain/entities/Credits";
|
|
8
|
+
import { DEFAULT_CREDITS_CONFIG } from "@domain/entities/Credits";
|
|
9
9
|
import type { CreditsRepository } from "./CreditsRepository";
|
|
10
10
|
import { createCreditsRepository } from "./CreditsRepository";
|
|
11
11
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Handles subscription activation and deactivation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { ISubscriptionRepository } from "
|
|
7
|
-
import type { SubscriptionStatus } from "
|
|
8
|
-
import { SubscriptionRepositoryError } from "
|
|
6
|
+
import type { ISubscriptionRepository } from "@application/ports/ISubscriptionRepository";
|
|
7
|
+
import type { SubscriptionStatus } from "@domain/entities/SubscriptionStatus";
|
|
8
|
+
import { SubscriptionRepositoryError } from "@domain/errors/SubscriptionError";
|
|
9
9
|
|
|
10
10
|
export interface ActivationHandlerConfig {
|
|
11
11
|
repository: ISubscriptionRepository;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type Transaction,
|
|
8
8
|
type DocumentReference,
|
|
9
9
|
} from "firebase/firestore";
|
|
10
|
-
import type { CreditsConfig } from "
|
|
10
|
+
import type { CreditsConfig } from "@domain/entities/Credits";
|
|
11
11
|
import type { UserCreditsDocumentRead } from "../models/UserCreditsDocument";
|
|
12
12
|
|
|
13
13
|
interface InitializationResult {
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* Database-first subscription management
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { ISubscriptionService } from "
|
|
7
|
-
import type { ISubscriptionRepository } from "
|
|
8
|
-
import type { SubscriptionStatus } from "
|
|
9
|
-
import { createDefaultSubscriptionStatus } from "
|
|
6
|
+
import type { ISubscriptionService } from "@application/ports/ISubscriptionService";
|
|
7
|
+
import type { ISubscriptionRepository } from "@application/ports/ISubscriptionRepository";
|
|
8
|
+
import type { SubscriptionStatus } from "@domain/entities/SubscriptionStatus";
|
|
9
|
+
import { createDefaultSubscriptionStatus } from "@domain/entities/SubscriptionStatus";
|
|
10
10
|
import {
|
|
11
11
|
SubscriptionRepositoryError,
|
|
12
12
|
SubscriptionValidationError,
|
|
13
|
-
} from "
|
|
14
|
-
import type { SubscriptionConfig } from "
|
|
13
|
+
} from "@domain/errors/SubscriptionError";
|
|
14
|
+
import type { SubscriptionConfig } from "@domain/value-objects/SubscriptionConfig";
|
|
15
15
|
import {
|
|
16
16
|
activateSubscription,
|
|
17
17
|
deactivateSubscription,
|