@umituz/react-native-subscription 2.31.2 → 2.31.3
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 +4 -4
- package/src/domains/credits/infrastructure/CreditsRepository.ts +1 -1
- package/src/domains/credits/presentation/useCredits.ts +1 -1
- package/src/domains/credits/presentation/useDeductCredit.ts +1 -1
- package/src/domains/paywall/components/PaywallModal.tsx +1 -1
- package/src/domains/subscription/application/SubscriptionSyncService.ts +3 -3
- package/src/domains/subscription/infrastructure/services/CustomerInfoListenerManager.ts +3 -3
- package/src/domains/subscription/infrastructure/utils/PremiumStatusSyncer.ts +3 -3
- package/src/domains/subscription/presentation/useSubscriptionStatus.ts +1 -1
- package/src/domains/wallet/infrastructure/repositories/TransactionRepository.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.31.
|
|
3
|
+
"version": "2.31.3",
|
|
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",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"url": "git+https://github.com/umituz/react-native-subscription.git"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"expo": ">=54.0.0",
|
|
36
35
|
"@tanstack/react-query": ">=5.0.0",
|
|
37
36
|
"@umituz/react-native-auth": ">=3.0.0",
|
|
37
|
+
"expo": ">=54.0.0",
|
|
38
38
|
"expo-constants": ">=17.0.0",
|
|
39
39
|
"expo-image": ">=3.0.0",
|
|
40
40
|
"firebase": ">=10.0.0",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"@types/react-native": "^0.72.8",
|
|
62
62
|
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
63
63
|
"@typescript-eslint/parser": "^8.50.1",
|
|
64
|
-
"@umituz/react-native-auth": "
|
|
64
|
+
"@umituz/react-native-auth": "^3.8.3",
|
|
65
65
|
"@umituz/react-native-design-system": "latest",
|
|
66
|
-
"@umituz/react-native-firebase": "
|
|
66
|
+
"@umituz/react-native-firebase": "^1.14.1",
|
|
67
67
|
"eslint": "^9.39.2",
|
|
68
68
|
"eslint-plugin-react": "^7.37.5",
|
|
69
69
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
@@ -17,7 +17,7 @@ import { SUBSCRIPTION_STATUS } from "../../subscription/core/SubscriptionConstan
|
|
|
17
17
|
*/
|
|
18
18
|
export class CreditsRepository extends BaseRepository {
|
|
19
19
|
constructor(private config: CreditsConfig) {
|
|
20
|
-
super();
|
|
20
|
+
super(config.collectionName);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
private getCollectionConfig(): CollectionConfig {
|
|
@@ -57,7 +57,7 @@ export const useCredits = (): UseCreditsResult => {
|
|
|
57
57
|
}, [queryClient]);
|
|
58
58
|
|
|
59
59
|
useEffect(() => {
|
|
60
|
-
if (!isAuthenticated(userId)) return;
|
|
60
|
+
if (!isAuthenticated(userId)) return undefined;
|
|
61
61
|
|
|
62
62
|
const unsubscribe = subscriptionEventBus.on(SUBSCRIPTION_EVENTS.CREDITS_UPDATED, (updatedUserId) => {
|
|
63
63
|
if (updatedUserId === userId) {
|
|
@@ -47,7 +47,7 @@ export const useDeductCredit = ({
|
|
|
47
47
|
const previousCredits = queryClient.getQueryData<UserCredits>(creditsQueryKeys.user(capturedUserId));
|
|
48
48
|
|
|
49
49
|
if (!previousCredits) {
|
|
50
|
-
return { previousCredits: null, skippedOptimistic: true, capturedUserId };
|
|
50
|
+
return { previousCredits: null as UserCredits | null, skippedOptimistic: true, capturedUserId };
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// Calculate new credits using utility
|
|
@@ -23,7 +23,7 @@ export const PaywallModal: React.FC<PaywallModalProps> = React.memo((props) => {
|
|
|
23
23
|
if (!url) return;
|
|
24
24
|
try {
|
|
25
25
|
if (await Linking.canOpenURL(url)) await Linking.openURL(url);
|
|
26
|
-
} catch (
|
|
26
|
+
} catch (_err) {
|
|
27
27
|
// Silently fail - legal links are non-critical
|
|
28
28
|
}
|
|
29
29
|
}, []);
|
|
@@ -14,7 +14,7 @@ export class SubscriptionSyncService {
|
|
|
14
14
|
try {
|
|
15
15
|
await this.processor.processPurchase(userId, productId, customerInfo, source);
|
|
16
16
|
subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.PURCHASE_COMPLETED, { userId, productId });
|
|
17
|
-
} catch (
|
|
17
|
+
} catch (_err) {
|
|
18
18
|
// Swallow error - event bus consumers handle failures
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -23,7 +23,7 @@ export class SubscriptionSyncService {
|
|
|
23
23
|
try {
|
|
24
24
|
await this.processor.processRenewal(userId, productId, newExpirationDate, customerInfo);
|
|
25
25
|
subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.RENEWAL_DETECTED, { userId, productId });
|
|
26
|
-
} catch (
|
|
26
|
+
} catch (_err) {
|
|
27
27
|
// Swallow error - event bus consumers handle failures
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -39,7 +39,7 @@ export class SubscriptionSyncService {
|
|
|
39
39
|
try {
|
|
40
40
|
await this.processor.processStatusChange(userId, isPremium, productId, expiresAt, willRenew, periodType);
|
|
41
41
|
subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.PREMIUM_STATUS_CHANGED, { userId, isPremium });
|
|
42
|
-
} catch (
|
|
42
|
+
} catch (_err) {
|
|
43
43
|
// Swallow error - event bus consumers handle failures
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -74,7 +74,7 @@ export class CustomerInfoListenerManager {
|
|
|
74
74
|
renewalResult.newExpirationDate!,
|
|
75
75
|
customerInfo
|
|
76
76
|
);
|
|
77
|
-
} catch (
|
|
77
|
+
} catch (_error) {
|
|
78
78
|
// Swallow error to prevent listener crash
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -89,7 +89,7 @@ export class CustomerInfoListenerManager {
|
|
|
89
89
|
renewalResult.isUpgrade,
|
|
90
90
|
customerInfo
|
|
91
91
|
);
|
|
92
|
-
} catch (
|
|
92
|
+
} catch (_error) {
|
|
93
93
|
// Swallow error to prevent listener crash
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -101,7 +101,7 @@ export class CustomerInfoListenerManager {
|
|
|
101
101
|
if (!renewalResult.isRenewal && !renewalResult.isPlanChange) {
|
|
102
102
|
try {
|
|
103
103
|
await syncPremiumStatus(config, this.currentUserId, customerInfo);
|
|
104
|
-
} catch (
|
|
104
|
+
} catch (_error) {
|
|
105
105
|
// Swallow error to prevent listener crash
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -35,7 +35,7 @@ export async function syncPremiumStatus(
|
|
|
35
35
|
} else {
|
|
36
36
|
await config.onPremiumStatusChanged(userId, false, undefined, undefined, undefined, undefined);
|
|
37
37
|
}
|
|
38
|
-
} catch (
|
|
38
|
+
} catch (_error) {
|
|
39
39
|
// Silently fail callback notifications to prevent crashing the main flow
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -53,7 +53,7 @@ export async function notifyPurchaseCompleted(
|
|
|
53
53
|
|
|
54
54
|
try {
|
|
55
55
|
await config.onPurchaseCompleted(userId, productId, customerInfo, source);
|
|
56
|
-
} catch (
|
|
56
|
+
} catch (_error) {
|
|
57
57
|
// Silently fail callback notifications to prevent crashing the main flow
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -70,7 +70,7 @@ export async function notifyRestoreCompleted(
|
|
|
70
70
|
|
|
71
71
|
try {
|
|
72
72
|
await config.onRestoreCompleted(userId, isPremium, customerInfo);
|
|
73
|
-
} catch (
|
|
73
|
+
} catch (_error) {
|
|
74
74
|
// Silently fail callback notifications to prevent crashing the main flow
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -43,7 +43,7 @@ export const useSubscriptionStatus = (): SubscriptionStatusResult => {
|
|
|
43
43
|
}, [userId, queryClient]);
|
|
44
44
|
|
|
45
45
|
useEffect(() => {
|
|
46
|
-
if (!isAuthenticated(userId)) return;
|
|
46
|
+
if (!isAuthenticated(userId)) return undefined;
|
|
47
47
|
|
|
48
48
|
const unsubscribe = subscriptionEventBus.on(
|
|
49
49
|
SUBSCRIPTION_EVENTS.PREMIUM_STATUS_CHANGED,
|