@umituz/react-native-ai-generation-content 1.84.14 → 1.84.15
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-ai-generation-content",
|
|
3
|
-
"version": "1.84.
|
|
3
|
+
"version": "1.84.15",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
* Uses `hasFirebaseUser` for auth check — anonymous users (autoAnonymousSignIn)
|
|
6
6
|
* pass the gate and go straight to credit/subscription checks.
|
|
7
7
|
* Auth modal is only shown if there is NO Firebase user at all.
|
|
8
|
+
*
|
|
9
|
+
* Paywall presentation:
|
|
10
|
+
* - Default: uses `openPaywall()` from `usePaywallVisibility` (React-based PaywallContainer)
|
|
11
|
+
* - Custom: accepts `onShowPaywall` option for native paywalls (e.g. RevenueCat `presentPaywall()`)
|
|
8
12
|
*/
|
|
9
13
|
|
|
10
14
|
import { useCallback, useMemo } from "react";
|
|
@@ -38,7 +42,7 @@ const handlePromiseResult = (
|
|
|
38
42
|
};
|
|
39
43
|
|
|
40
44
|
export function useAIFeatureGate(options: AIFeatureGateOptions): AIFeatureGateReturn {
|
|
41
|
-
const { creditCost, onNetworkError, onSuccess, onError } = options;
|
|
45
|
+
const { creditCost, onNetworkError, onSuccess, onError, onShowPaywall: customShowPaywall } = options;
|
|
42
46
|
|
|
43
47
|
const { isOffline } = useOffline();
|
|
44
48
|
const { hasFirebaseUser } = useAuth();
|
|
@@ -55,7 +59,7 @@ export function useAIFeatureGate(options: AIFeatureGateOptions): AIFeatureGateRe
|
|
|
55
59
|
hasSubscription: isPremium,
|
|
56
60
|
creditBalance,
|
|
57
61
|
requiredCredits: creditCost,
|
|
58
|
-
onShowPaywall: () => openPaywall(),
|
|
62
|
+
onShowPaywall: customShowPaywall ?? (() => openPaywall()),
|
|
59
63
|
isCreditsLoaded,
|
|
60
64
|
});
|
|
61
65
|
|
|
@@ -23,6 +23,15 @@ export interface AIFeatureGateOptions {
|
|
|
23
23
|
* Callback fired when feature access fails or execution errors
|
|
24
24
|
*/
|
|
25
25
|
onError?: (error: Error) => void;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Custom paywall presentation.
|
|
29
|
+
* When provided, this is called instead of the default `openPaywall()` from
|
|
30
|
+
* `usePaywallVisibility`. Use this for apps that present the native
|
|
31
|
+
* RevenueCat paywall (e.g. `presentPaywall()`) instead of rendering a
|
|
32
|
+
* React-based PaywallContainer.
|
|
33
|
+
*/
|
|
34
|
+
onShowPaywall?: () => void;
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
export interface AIFeatureGateReturn {
|