@umituz/react-native-subscription 2.31.23 → 2.31.24
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.31.
|
|
3
|
+
"version": "2.31.24",
|
|
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",
|
|
@@ -44,11 +44,11 @@ export const useCredits = (): UseCreditsResult => {
|
|
|
44
44
|
return result.data ?? null;
|
|
45
45
|
},
|
|
46
46
|
enabled: queryEnabled,
|
|
47
|
-
gcTime:
|
|
48
|
-
staleTime:
|
|
49
|
-
refetchOnMount:
|
|
50
|
-
refetchOnWindowFocus:
|
|
51
|
-
refetchOnReconnect:
|
|
47
|
+
gcTime: 10 * 60 * 1000,
|
|
48
|
+
staleTime: 30 * 1000,
|
|
49
|
+
refetchOnMount: true,
|
|
50
|
+
refetchOnWindowFocus: false,
|
|
51
|
+
refetchOnReconnect: true,
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
const queryClient = useQueryClient();
|
|
@@ -40,10 +40,10 @@ export const useSubscriptionPackages = () => {
|
|
|
40
40
|
return SubscriptionManager.getPackages();
|
|
41
41
|
},
|
|
42
42
|
enabled: isConfigured,
|
|
43
|
-
gcTime:
|
|
44
|
-
staleTime:
|
|
45
|
-
refetchOnMount:
|
|
46
|
-
refetchOnWindowFocus:
|
|
47
|
-
refetchOnReconnect:
|
|
43
|
+
gcTime: 5 * 60 * 1000,
|
|
44
|
+
staleTime: 2 * 60 * 1000,
|
|
45
|
+
refetchOnMount: true,
|
|
46
|
+
refetchOnWindowFocus: false,
|
|
47
|
+
refetchOnReconnect: true,
|
|
48
48
|
});
|
|
49
49
|
};
|
|
@@ -8,7 +8,17 @@ export async function fetchOfferings(deps: OfferingsFetcherDeps): Promise<Purcha
|
|
|
8
8
|
if (!deps.isInitialized()) return null;
|
|
9
9
|
try {
|
|
10
10
|
const offerings = await Purchases.getOfferings();
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
if (offerings.current) {
|
|
13
|
+
return offerings.current;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const allOfferings = Object.values(offerings.all);
|
|
17
|
+
if (allOfferings.length > 0) {
|
|
18
|
+
return allOfferings[0];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return null;
|
|
12
22
|
} catch (error) {
|
|
13
23
|
throw new Error(`Failed to fetch offerings: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
14
24
|
}
|