@umituz/react-native-subscription 2.18.1 → 2.18.3
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
|
+
"version": "2.18.3",
|
|
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",
|
|
@@ -25,7 +25,7 @@ export const usePaywallActions = ({
|
|
|
25
25
|
onAuthRequired,
|
|
26
26
|
onClose,
|
|
27
27
|
}: UsePaywallActionsProps) => {
|
|
28
|
-
const { handlePurchase: authAwarePurchase } = useAuthAwarePurchase({ source });
|
|
28
|
+
const { handlePurchase: authAwarePurchase } = useAuthAwarePurchase({ source, userId });
|
|
29
29
|
const { mutateAsync: restorePurchases } = useRestorePurchase(userId);
|
|
30
30
|
|
|
31
31
|
const handlePurchase = useCallback(async (pkg: PurchasesPackage) => {
|
|
@@ -30,6 +30,7 @@ export const configureAuthProvider = (provider: PurchaseAuthProvider): void => {
|
|
|
30
30
|
|
|
31
31
|
export interface UseAuthAwarePurchaseParams {
|
|
32
32
|
source?: PurchaseSource;
|
|
33
|
+
userId?: string;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export interface UseAuthAwarePurchaseResult {
|
|
@@ -40,7 +41,7 @@ export interface UseAuthAwarePurchaseResult {
|
|
|
40
41
|
export const useAuthAwarePurchase = (
|
|
41
42
|
params?: UseAuthAwarePurchaseParams
|
|
42
43
|
): UseAuthAwarePurchaseResult => {
|
|
43
|
-
const { purchasePackage, restorePurchase, closePaywall } = usePremium();
|
|
44
|
+
const { purchasePackage, restorePurchase, closePaywall } = usePremium(params?.userId);
|
|
44
45
|
const { setPendingPurchase } = usePendingPurchaseStore();
|
|
45
46
|
|
|
46
47
|
const handlePurchase = useCallback(
|
|
@@ -27,7 +27,7 @@ export const usePendingPurchaseHandler = ({
|
|
|
27
27
|
clearPendingPurchase,
|
|
28
28
|
hasPendingPurchase,
|
|
29
29
|
} = usePendingPurchaseStore();
|
|
30
|
-
const { purchasePackage } = usePremium();
|
|
30
|
+
const { purchasePackage } = usePremium(userId);
|
|
31
31
|
|
|
32
32
|
useEffect(() => {
|
|
33
33
|
if (!isAuthenticated || !userId || !hasPendingPurchase()) {
|