@umituz/react-native-subscription 2.18.3 → 2.19.0

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.18.3",
3
+ "version": "2.19.0",
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,7 +13,7 @@ import { usePaywallActions } from "../hooks/usePaywallActions";
13
13
  import type { PaywallContainerProps } from "./PaywallContainer.types";
14
14
 
15
15
  export const PaywallContainer: React.FC<PaywallContainerProps> = (props) => {
16
- const { userId, isAnonymous = false, translations, mode = "subscription", legalUrls, features, heroImage, bestValueIdentifier, creditsLabel, creditAmounts, packageFilterConfig, source, onPurchaseSuccess, onPurchaseError, onAuthRequired, visible, onClose } = props;
16
+ const { userId, isAnonymous: _isAnonymous = false, translations, mode = "subscription", legalUrls, features, heroImage, bestValueIdentifier, creditsLabel, creditAmounts, packageFilterConfig, source, onPurchaseSuccess, onPurchaseError, onAuthRequired, visible, onClose } = props;
17
17
 
18
18
  const { showPaywall, closePaywall, currentSource } = usePaywallVisibility();
19
19
  const isVisible = visible ?? showPaywall;
@@ -24,7 +24,6 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = (props) => {
24
24
  const { data: allPackages = [], isLoading } = useSubscriptionPackages(userId ?? undefined);
25
25
  const { handlePurchase, handleRestore } = usePaywallActions({
26
26
  userId: userId ?? undefined,
27
- isAnonymous,
28
27
  source: purchaseSource,
29
28
  onPurchaseSuccess,
30
29
  onPurchaseError,
@@ -8,7 +8,6 @@ declare const __DEV__: boolean;
8
8
 
9
9
  interface UsePaywallActionsProps {
10
10
  userId?: string;
11
- isAnonymous: boolean;
12
11
  source?: PurchaseSource;
13
12
  onPurchaseSuccess?: () => void;
14
13
  onPurchaseError?: (error: string) => void;
@@ -18,23 +17,16 @@ interface UsePaywallActionsProps {
18
17
 
19
18
  export const usePaywallActions = ({
20
19
  userId,
21
- isAnonymous,
22
20
  source,
23
21
  onPurchaseSuccess,
24
22
  onPurchaseError,
25
- onAuthRequired,
23
+ onAuthRequired: _onAuthRequired,
26
24
  onClose,
27
25
  }: UsePaywallActionsProps) => {
28
26
  const { handlePurchase: authAwarePurchase } = useAuthAwarePurchase({ source, userId });
29
27
  const { mutateAsync: restorePurchases } = useRestorePurchase(userId);
30
28
 
31
29
  const handlePurchase = useCallback(async (pkg: PurchasesPackage) => {
32
- if (isAnonymous) {
33
- if (__DEV__) console.log("[PaywallActions] Anonymous user, redirecting to auth");
34
- onAuthRequired?.();
35
- return;
36
- }
37
-
38
30
  try {
39
31
  if (__DEV__) console.log("[PaywallActions] Purchase started:", pkg.product.identifier);
40
32
  const res = await authAwarePurchase(pkg, source);
@@ -46,7 +38,7 @@ export const usePaywallActions = ({
46
38
  const message = err instanceof Error ? err.message : String(err);
47
39
  onPurchaseError?.(message);
48
40
  }
49
- }, [isAnonymous, authAwarePurchase, source, onClose, onPurchaseSuccess, onPurchaseError, onAuthRequired]);
41
+ }, [authAwarePurchase, source, onClose, onPurchaseSuccess, onPurchaseError]);
50
42
 
51
43
  const handleRestore = useCallback(async () => {
52
44
  try {