@umituz/react-native-subscription 2.26.0 → 2.26.1
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 +1 -1
- package/src/domains/wallet/infrastructure/services/ProductMetadataService.ts +2 -0
- package/src/domains/wallet/presentation/hooks/index.ts +8 -0
- package/src/domains/wallet/presentation/hooks/useProductMetadata.ts +8 -1
- package/src/domains/wallet/presentation/hooks/useTransactionHistory.ts +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.26.
|
|
3
|
+
"version": "2.26.1",
|
|
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",
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { useQuery } from "@umituz/react-native-design-system";
|
|
9
|
+
import { useMemo } from "react";
|
|
9
10
|
import type {
|
|
10
11
|
ProductMetadata,
|
|
11
12
|
ProductMetadataConfig,
|
|
@@ -13,6 +14,8 @@ import type {
|
|
|
13
14
|
} from "../../domain/types/wallet.types";
|
|
14
15
|
import { ProductMetadataService } from "../../infrastructure/services/ProductMetadataService";
|
|
15
16
|
|
|
17
|
+
declare const __DEV__: boolean;
|
|
18
|
+
|
|
16
19
|
const CACHE_CONFIG = {
|
|
17
20
|
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
18
21
|
gcTime: 30 * 60 * 1000, // 30 minutes
|
|
@@ -43,7 +46,11 @@ export function useProductMetadata({
|
|
|
43
46
|
type,
|
|
44
47
|
enabled = true,
|
|
45
48
|
}: UseProductMetadataParams): UseProductMetadataResult {
|
|
46
|
-
|
|
49
|
+
// Memoize service to prevent recreation on every render
|
|
50
|
+
const service = useMemo(
|
|
51
|
+
() => new ProductMetadataService(config),
|
|
52
|
+
[config]
|
|
53
|
+
);
|
|
47
54
|
|
|
48
55
|
const queryKey = type
|
|
49
56
|
? productMetadataQueryKeys.byType(type)
|
|
@@ -6,12 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { useQuery } from "@umituz/react-native-design-system";
|
|
9
|
+
import { useMemo } from "react";
|
|
9
10
|
import type {
|
|
10
11
|
CreditLog,
|
|
11
12
|
TransactionRepositoryConfig,
|
|
12
13
|
} from "../../domain/types/transaction.types";
|
|
13
14
|
import { TransactionRepository } from "../../infrastructure/repositories/TransactionRepository";
|
|
14
15
|
|
|
16
|
+
declare const __DEV__: boolean;
|
|
17
|
+
|
|
15
18
|
const CACHE_CONFIG = {
|
|
16
19
|
staleTime: 60 * 1000, // 1 minute
|
|
17
20
|
gcTime: 5 * 60 * 1000, // 5 minutes
|
|
@@ -43,7 +46,11 @@ export function useTransactionHistory({
|
|
|
43
46
|
limit = 50,
|
|
44
47
|
enabled = true,
|
|
45
48
|
}: UseTransactionHistoryParams): UseTransactionHistoryResult {
|
|
46
|
-
|
|
49
|
+
// Memoize repository to prevent recreation on every render
|
|
50
|
+
const repository = useMemo(
|
|
51
|
+
() => new TransactionRepository(config),
|
|
52
|
+
[config]
|
|
53
|
+
);
|
|
47
54
|
|
|
48
55
|
const { data, isLoading, error, refetch } = useQuery({
|
|
49
56
|
queryKey: [...transactionQueryKeys.user(userId ?? ""), limit],
|