@umituz/react-native-subscription 2.35.2 → 2.35.4

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.35.2",
3
+ "version": "2.35.4",
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",
@@ -14,7 +14,7 @@ export const executeFeatureAction = (
14
14
  isWaitingForAuthCreditsRef: MutableRefObject<boolean>,
15
15
  isWaitingForPurchaseRef: MutableRefObject<boolean>,
16
16
  isCreditsLoadedRef: MutableRefObject<boolean>
17
- ): void => {
17
+ ): boolean => {
18
18
  if (typeof __DEV__ !== "undefined" && __DEV__) {
19
19
  console.log("[FeatureGate] executeFeatureAction called:", {
20
20
  isAuthenticated,
@@ -58,7 +58,7 @@ export const executeFeatureAction = (
58
58
  isWaitingForAuthCreditsRef.current = true;
59
59
  };
60
60
  onShowAuthModal(postAuthAction);
61
- return;
61
+ return false;
62
62
  }
63
63
 
64
64
  if (hasSubscriptionRef.current) {
@@ -66,7 +66,7 @@ export const executeFeatureAction = (
66
66
  console.log("[FeatureGate] User has subscription, executing action");
67
67
  }
68
68
  action();
69
- return;
69
+ return true;
70
70
  }
71
71
 
72
72
  if (creditBalanceRef.current < requiredCreditsRef.current) {
@@ -76,11 +76,12 @@ export const executeFeatureAction = (
76
76
  pendingActionRef.current = action;
77
77
  isWaitingForPurchaseRef.current = true;
78
78
  onShowPaywallRef.current(requiredCreditsRef.current);
79
- return;
79
+ return false;
80
80
  }
81
81
 
82
82
  if (typeof __DEV__ !== "undefined" && __DEV__) {
83
83
  console.log("[FeatureGate] User has enough credits, executing action");
84
84
  }
85
85
  action();
86
+ return true;
86
87
  };
@@ -113,8 +113,8 @@ export function useFeatureGate(params: UseFeatureGateParams): UseFeatureGateResu
113
113
  }, [creditBalance, hasSubscription]);
114
114
 
115
115
  const requireFeature = useCallback(
116
- (action: () => void | Promise<void>) => {
117
- executeFeatureAction(
116
+ (action: () => void | Promise<void>): boolean => {
117
+ return executeFeatureAction(
118
118
  action,
119
119
  isAuthenticated,
120
120
  onShowAuthModal,
@@ -9,7 +9,7 @@ export interface UseFeatureGateParams {
9
9
  }
10
10
 
11
11
  export interface UseFeatureGateResult {
12
- readonly requireFeature: (action: () => void | Promise<void>) => void;
12
+ readonly requireFeature: (action: () => void | Promise<void>) => boolean;
13
13
  readonly isAuthenticated: boolean;
14
14
  readonly hasSubscription: boolean;
15
15
  readonly hasCredits: boolean;