@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-subscription",
3
- "version": "2.26.0",
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",
@@ -13,6 +13,8 @@ import type {
13
13
  ProductType,
14
14
  } from "../../domain/types/wallet.types";
15
15
 
16
+ declare const __DEV__: boolean;
17
+
16
18
  interface CacheEntry {
17
19
  data: ProductMetadata[];
18
20
  timestamp: number;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Wallet Presentation Hooks
3
+ * Barrel export for all wallet-related React hooks
4
+ */
5
+
6
+ export * from "./useProductMetadata";
7
+ export * from "./useTransactionHistory";
8
+ export * from "./useWallet";
@@ -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
- const service = new ProductMetadataService(config);
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
- const repository = new TransactionRepository(config);
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],