@umituz/react-native-subscription 2.20.2 → 2.20.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.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",
|
|
@@ -49,7 +49,7 @@ export interface UseAuthAwarePurchaseResult {
|
|
|
49
49
|
export const useAuthAwarePurchase = (
|
|
50
50
|
params?: UseAuthAwarePurchaseParams
|
|
51
51
|
): UseAuthAwarePurchaseResult => {
|
|
52
|
-
const { purchasePackage, restorePurchase
|
|
52
|
+
const { purchasePackage, restorePurchase } = usePremium(params?.userId);
|
|
53
53
|
|
|
54
54
|
const handlePurchase = useCallback(
|
|
55
55
|
async (pkg: PurchasesPackage, source?: PurchaseSource): Promise<boolean> => {
|
|
@@ -66,14 +66,13 @@ export const useAuthAwarePurchase = (
|
|
|
66
66
|
}
|
|
67
67
|
savedPackage = pkg;
|
|
68
68
|
savedSource = source || params?.source || "settings";
|
|
69
|
-
closePaywall();
|
|
70
69
|
globalAuthProvider.showAuthModal();
|
|
71
70
|
return false;
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
return purchasePackage(pkg);
|
|
75
74
|
},
|
|
76
|
-
[purchasePackage,
|
|
75
|
+
[purchasePackage, params?.source]
|
|
77
76
|
);
|
|
78
77
|
|
|
79
78
|
const handleRestore = useCallback(async (): Promise<boolean> => {
|
|
@@ -88,13 +87,12 @@ export const useAuthAwarePurchase = (
|
|
|
88
87
|
if (__DEV__) {
|
|
89
88
|
console.log("[useAuthAwarePurchase] Not authenticated for restore");
|
|
90
89
|
}
|
|
91
|
-
closePaywall();
|
|
92
90
|
globalAuthProvider.showAuthModal();
|
|
93
91
|
return false;
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
return restorePurchase();
|
|
97
|
-
}, [restorePurchase
|
|
95
|
+
}, [restorePurchase]);
|
|
98
96
|
|
|
99
97
|
const executeSavedPurchase = useCallback(async (): Promise<boolean> => {
|
|
100
98
|
const saved = getSavedPurchase();
|