@umituz/react-native-subscription 2.11.6 → 2.11.7

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.6",
3
+ "version": "2.11.7",
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",
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
2
  import { StyleSheet } from "react-native";
3
3
  import { AtomicText, useAppDesignTokens } from "@umituz/react-native-design-system";
4
- // @ts-ignore
5
4
  import { LinearGradient } from "expo-linear-gradient";
6
5
 
7
6
  interface BestValueBadgeProps {
@@ -18,9 +18,6 @@ interface PaywallFeaturesListProps {
18
18
 
19
19
  export const PaywallFeaturesList: React.FC<PaywallFeaturesListProps> = React.memo(
20
20
  ({ features, containerStyle, gap = 12 }) => {
21
- if (__DEV__) {
22
- console.log("[PaywallFeaturesList] Rendering features count:", features.length);
23
- }
24
21
  return (
25
22
  <View style={[styles.container, containerStyle]}>
26
23
  {features.map((feature, index) => (
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { View, StyleSheet, TouchableOpacity } from "react-native";
3
+ import type { PurchasesPackage } from "react-native-purchases";
3
4
  import { AtomicText } from "@umituz/react-native-design-system";
4
5
  import { useAppDesignTokens } from "@umituz/react-native-design-system";
5
6
  import { PaywallLegalFooter } from "./PaywallLegalFooter";
@@ -10,7 +11,7 @@ interface SubscriptionFooterProps {
10
11
  processingText: string;
11
12
  purchaseButtonText: string;
12
13
  hasPackages: boolean;
13
- selectedPkg: any; // Using any to avoid circular deps if needed, but preferably strict
14
+ selectedPkg: PurchasesPackage | null;
14
15
  restoreButtonText: string;
15
16
  showRestoreButton: boolean;
16
17
  privacyUrl?: string;
@@ -21,7 +22,6 @@ interface SubscriptionFooterProps {
21
22
  onRestore: () => void;
22
23
  }
23
24
 
24
- // @ts-ignore
25
25
  import { LinearGradient } from "expo-linear-gradient";
26
26
 
27
27
  export const SubscriptionFooter: React.FC<SubscriptionFooterProps> = React.memo(
@@ -79,16 +79,6 @@ export const SubscriptionModal: React.FC<SubscriptionModalProps> = React.memo((p
79
79
  onClose,
80
80
  });
81
81
 
82
- if (__DEV__) {
83
- console.log("[SubscriptionModal] State:", {
84
- visible,
85
- isLoading,
86
- packagesCount: packages?.length ?? 0,
87
- selectedPkg: selectedPkg?.identifier ?? null,
88
- isProcessing,
89
- });
90
- }
91
-
92
82
  return (
93
83
  <BaseModal visible={visible} onClose={onClose}>
94
84
  <View style={styles.container}>
@@ -13,7 +13,6 @@ import { useLocalization } from "@umituz/react-native-localization";
13
13
  import { BestValueBadge } from "./BestValueBadge";
14
14
 
15
15
  import { getPeriodLabel, isYearlyPackage } from "../../../utils/packagePeriodUtils";
16
- // @ts-ignore
17
16
  import { LinearGradient } from "expo-linear-gradient";
18
17
 
19
18
  interface SubscriptionPlanCardProps {
@@ -5,6 +5,7 @@
5
5
  * Generic and reusable - uses module-level repository.
6
6
  */
7
7
 
8
+ import { useCallback } from "react";
8
9
  import { useMutation, useQueryClient } from "@tanstack/react-query";
9
10
  import type { CreditType, UserCredits } from "../../domain/entities/Credits";
10
11
  import { getCreditsRepository } from "../../infrastructure/repositories/CreditsRepositoryProvider";
@@ -78,7 +79,7 @@ export const useDeductCredit = ({
78
79
  },
79
80
  });
80
81
 
81
- const deductCredit = async (creditType: CreditType): Promise<boolean> => {
82
+ const deductCredit = useCallback(async (creditType: CreditType): Promise<boolean> => {
82
83
  try {
83
84
  const result = await mutation.mutateAsync(creditType);
84
85
 
@@ -93,7 +94,7 @@ export const useDeductCredit = ({
93
94
  } catch {
94
95
  return false;
95
96
  }
96
- };
97
+ }, [mutation, onCreditsExhausted]);
97
98
 
98
99
  return {
99
100
  deductCredit,
@@ -135,14 +136,14 @@ export const useInitializeCredits = ({
135
136
  },
136
137
  });
137
138
 
138
- const initializeCredits = async (purchaseId?: string): Promise<boolean> => {
139
+ const initializeCredits = useCallback(async (purchaseId?: string): Promise<boolean> => {
139
140
  try {
140
141
  const result = await mutation.mutateAsync(purchaseId);
141
142
  return result.success;
142
143
  } catch {
143
144
  return false;
144
145
  }
145
- };
146
+ }, [mutation]);
146
147
 
147
148
  return {
148
149
  initializeCredits,
@@ -7,6 +7,7 @@
7
7
 
8
8
  import { useCallback } from "react";
9
9
  import type { PurchasesPackage } from "react-native-purchases";
10
+ import type { UserCredits } from "../../domain/entities/Credits";
10
11
  import { useCredits } from "./useCredits";
11
12
  import { useInitializeCredits } from "./useDeductCredit";
12
13
  import {
@@ -27,7 +28,7 @@ export interface UsePremiumWithConfigResult {
27
28
  isPremium: boolean;
28
29
  isLoading: boolean;
29
30
  packages: PurchasesPackage[];
30
- credits: any; // UserCredits from subscription package
31
+ credits: UserCredits | null;
31
32
  showPaywall: boolean;
32
33
  purchasePackage: (pkg: PurchasesPackage) => Promise<boolean>;
33
34
  restorePurchase: () => Promise<boolean>;
@@ -23,7 +23,7 @@ export const useSubscriptionModal = ({
23
23
  } finally {
24
24
  setIsProcessing(false);
25
25
  }
26
- }, [selectedPkg, isProcessing, onPurchase, onClose]);
26
+ }, [selectedPkg, onPurchase, onClose]);
27
27
 
28
28
  const handleRestore = useCallback(async () => {
29
29
  if (isProcessing) return;
@@ -33,7 +33,7 @@ export const useSubscriptionModal = ({
33
33
  } finally {
34
34
  setIsProcessing(false);
35
35
  }
36
- }, [isProcessing, onRestore, onClose]);
36
+ }, [onRestore, onClose]);
37
37
 
38
38
  return {
39
39
  selectedPkg,