@umituz/react-native-subscription 2.27.121 → 2.27.123

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.27.121",
3
+ "version": "2.27.123",
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",
@@ -11,6 +11,7 @@ import { useRevenueCatTrialEligibility } from "../../subscription/infrastructure
11
11
  import { createCreditAmountsFromPackages } from "../../../utils/creditMapper";
12
12
  import { PaywallModal, type TrialEligibilityInfo } from "./PaywallModal";
13
13
  import { usePaywallActions } from "../hooks/usePaywallActions";
14
+ import { useAuthAwarePurchase } from "../../subscription/presentation/useAuthAwarePurchase";
14
15
  import type { PaywallContainerProps } from "./PaywallContainer.types";
15
16
 
16
17
  export const PaywallContainer: React.FC<PaywallContainerProps> = (props) => {
@@ -40,7 +41,15 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = (props) => {
40
41
 
41
42
  const { data: packages = [], isLoading } = useSubscriptionPackages();
42
43
  const { eligibilityMap, checkEligibility } = useRevenueCatTrialEligibility();
44
+
45
+ const { handlePurchase: performPurchase, handleRestore: performRestore } = useAuthAwarePurchase({
46
+ source: purchaseSource
47
+ });
48
+
43
49
  const { handlePurchase, handleRestore } = usePaywallActions({
50
+ packages,
51
+ onPurchase: performPurchase,
52
+ onRestore: performRestore,
44
53
  source: purchaseSource,
45
54
  onPurchaseSuccess,
46
55
  onPurchaseError,
@@ -14,6 +14,7 @@ import {
14
14
  } from "@umituz/react-native-auth";
15
15
  import { SubscriptionManager } from "../../infrastructure/managers/SubscriptionManager";
16
16
  import { SUBSCRIPTION_QUERY_KEYS } from "./subscriptionQueryKeys";
17
+ import { subscriptionStatusQueryKeys } from "../../presentation/useSubscriptionStatus";
17
18
  import { creditsQueryKeys } from "../../../credits/presentation/useCredits";
18
19
 
19
20
  /** Purchase mutation result - simplified for presentation layer */
@@ -51,6 +52,9 @@ export const usePurchasePackage = () => {
51
52
  queryKey: SUBSCRIPTION_QUERY_KEYS.packages,
52
53
  });
53
54
  if (userId) {
55
+ queryClient.invalidateQueries({
56
+ queryKey: subscriptionStatusQueryKeys.user(userId),
57
+ });
54
58
  queryClient.invalidateQueries({
55
59
  queryKey: creditsQueryKeys.user(userId),
56
60
  });
@@ -12,6 +12,7 @@ import {
12
12
  } from "@umituz/react-native-auth";
13
13
  import { SubscriptionManager } from "../../infrastructure/managers/SubscriptionManager";
14
14
  import { SUBSCRIPTION_QUERY_KEYS } from "./subscriptionQueryKeys";
15
+ import { subscriptionStatusQueryKeys } from "../../presentation/useSubscriptionStatus";
15
16
  import { creditsQueryKeys } from "../../../credits/presentation/useCredits";
16
17
 
17
18
  interface RestoreResult {
@@ -43,6 +44,9 @@ export const useRestorePurchase = () => {
43
44
  queryKey: SUBSCRIPTION_QUERY_KEYS.packages,
44
45
  });
45
46
  if (userId) {
47
+ queryClient.invalidateQueries({
48
+ queryKey: subscriptionStatusQueryKeys.user(userId),
49
+ });
46
50
  queryClient.invalidateQueries({
47
51
  queryKey: creditsQueryKeys.user(userId),
48
52
  });