@umituz/react-native-subscription 2.14.66 → 2.14.67
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.14.
|
|
3
|
+
"version": "2.14.67",
|
|
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",
|
|
@@ -12,6 +12,7 @@ import { usePurchasePackage } from "../../../revenuecat/presentation/hooks/usePu
|
|
|
12
12
|
import { useRestorePurchase } from "../../../revenuecat/presentation/hooks/useRestorePurchase";
|
|
13
13
|
import { SubscriptionManager } from "../../../revenuecat/infrastructure/managers/SubscriptionManager";
|
|
14
14
|
import { filterPackagesByMode } from "../../../utils/packageFilter";
|
|
15
|
+
import { createCreditAmountsFromPackages } from "../../../utils/creditMapper";
|
|
15
16
|
import { PaywallModal } from "./PaywallModal";
|
|
16
17
|
import type { PaywallContainerProps } from "./PaywallContainer.types";
|
|
17
18
|
|
|
@@ -38,9 +39,14 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = ({
|
|
|
38
39
|
const { mutateAsync: purchasePackage } = usePurchasePackage(userId ?? undefined);
|
|
39
40
|
const { mutateAsync: restorePurchases } = useRestorePurchase(userId ?? undefined);
|
|
40
41
|
|
|
41
|
-
const filteredPackages = useMemo(() => {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const { filteredPackages, computedCreditAmounts } = useMemo(() => {
|
|
43
|
+
const filtered = filterPackagesByMode(allPackages, mode, packageFilterConfig);
|
|
44
|
+
const computed = mode !== "subscription" && !creditAmounts
|
|
45
|
+
? createCreditAmountsFromPackages(allPackages)
|
|
46
|
+
: creditAmounts;
|
|
47
|
+
|
|
48
|
+
return { filteredPackages: filtered, computedCreditAmounts: computed };
|
|
49
|
+
}, [allPackages, mode, packageFilterConfig, creditAmounts]);
|
|
44
50
|
|
|
45
51
|
useEffect(() => {
|
|
46
52
|
if (__DEV__ && showPaywall) {
|
|
@@ -52,6 +58,7 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = ({
|
|
|
52
58
|
isInitialized: SubscriptionManager.isInitialized(),
|
|
53
59
|
allPackagesCount: allPackages.length,
|
|
54
60
|
filteredPackagesCount: filteredPackages.length,
|
|
61
|
+
computedCreditAmounts,
|
|
55
62
|
isLoading,
|
|
56
63
|
isFetching,
|
|
57
64
|
status,
|
|
@@ -133,7 +140,7 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = ({
|
|
|
133
140
|
heroImage={heroImage}
|
|
134
141
|
bestValueIdentifier={bestValueIdentifier}
|
|
135
142
|
creditsLabel={creditsLabel}
|
|
136
|
-
creditAmounts={
|
|
143
|
+
creditAmounts={computedCreditAmounts}
|
|
137
144
|
onPurchase={handlePurchase}
|
|
138
145
|
onRestore={handleRestore}
|
|
139
146
|
/>
|