@umituz/react-native-subscription 2.11.23 → 2.11.25
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.11.
|
|
3
|
+
"version": "2.11.25",
|
|
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",
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// =============================================================================
|
|
11
11
|
|
|
12
12
|
// =============================================================================
|
|
13
|
-
//
|
|
13
|
+
// DOMAIN LAYER - Subscription Status
|
|
14
14
|
// =============================================================================
|
|
15
15
|
|
|
16
16
|
export {
|
|
@@ -129,13 +129,6 @@ export {
|
|
|
129
129
|
// UTILS - Date & Price
|
|
130
130
|
// =============================================================================
|
|
131
131
|
|
|
132
|
-
/*
|
|
133
|
-
export {
|
|
134
|
-
isSubscriptionExpired,
|
|
135
|
-
getDaysUntilExpiration,
|
|
136
|
-
} from "./utils/dateValidationUtils";
|
|
137
|
-
*/
|
|
138
|
-
|
|
139
132
|
export { formatPrice } from "./utils/priceUtils";
|
|
140
133
|
|
|
141
134
|
// =============================================================================
|
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
* Premium status from TanStack Query (credits)
|
|
4
4
|
* Subscription state from TanStack Query
|
|
5
5
|
* Generic implementation for 100+ apps with auth provider abstraction
|
|
6
|
+
*
|
|
7
|
+
* Note: Credit allocation is handled by CustomerInfo Listener (onCreditRenewal)
|
|
8
|
+
* configured in SubscriptionManager. Manual credit initialization removed to
|
|
9
|
+
* prevent duplicate allocation.
|
|
6
10
|
*/
|
|
7
11
|
|
|
8
12
|
import { useCallback } from "react";
|
|
9
13
|
import type { PurchasesPackage } from "react-native-purchases";
|
|
10
14
|
import type { UserCredits } from "../../domain/entities/Credits";
|
|
11
15
|
import { useCredits } from "./useCredits";
|
|
12
|
-
import { useInitializeCredits } from "./useDeductCredit";
|
|
13
16
|
import {
|
|
14
17
|
useSubscriptionPackages,
|
|
15
18
|
usePurchasePackage,
|
|
@@ -48,8 +51,6 @@ export const usePremiumWithConfig = (
|
|
|
48
51
|
enabled: enabled && !!userId,
|
|
49
52
|
});
|
|
50
53
|
|
|
51
|
-
const { initializeCredits } = useInitializeCredits({ userId });
|
|
52
|
-
|
|
53
54
|
const { data: packages = [], isLoading: packagesLoading } =
|
|
54
55
|
useSubscriptionPackages(userId);
|
|
55
56
|
const purchaseMutation = usePurchasePackage(userId);
|
|
@@ -66,21 +67,17 @@ export const usePremiumWithConfig = (
|
|
|
66
67
|
const handlePurchase = useCallback(
|
|
67
68
|
async (pkg: PurchasesPackage): Promise<boolean> => {
|
|
68
69
|
const success = await purchaseMutation.mutateAsync(pkg);
|
|
69
|
-
|
|
70
|
-
await initializeCredits({ productId: pkg.product.identifier });
|
|
71
|
-
}
|
|
70
|
+
// Credit allocation handled by CustomerInfo Listener (onCreditRenewal)
|
|
72
71
|
return success;
|
|
73
72
|
},
|
|
74
|
-
[purchaseMutation
|
|
73
|
+
[purchaseMutation],
|
|
75
74
|
);
|
|
76
75
|
|
|
77
76
|
const handleRestore = useCallback(async (): Promise<boolean> => {
|
|
78
77
|
const success = await restoreMutation.mutateAsync();
|
|
79
|
-
|
|
80
|
-
await initializeCredits();
|
|
81
|
-
}
|
|
78
|
+
// Credit allocation handled by CustomerInfo Listener (onCreditRenewal)
|
|
82
79
|
return success;
|
|
83
|
-
}, [restoreMutation
|
|
80
|
+
}, [restoreMutation]);
|
|
84
81
|
|
|
85
82
|
return {
|
|
86
83
|
isPremium,
|