@umituz/react-native-subscription 2.27.140 → 2.27.141
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 +1 -1
- package/src/domains/credits/presentation/creditsQueryKeys.ts +4 -0
- package/src/domains/credits/presentation/useCredits.ts +5 -24
- package/src/domains/credits/presentation/useCredits.types.ts +15 -0
- package/src/domains/subscription/core/SubscriptionDisplayConfig.ts +7 -0
- package/src/domains/subscription/presentation/components/feedback/FeedbackConstants.ts +6 -0
- package/src/domains/wallet/presentation/WalletDisplayConfig.ts +1 -0
- /package/src/domains/config/utils/{helpers.ts → planSelectors.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.141",
|
|
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",
|
|
@@ -2,7 +2,6 @@ import { useQuery, useQueryClient } from "@umituz/react-native-design-system";
|
|
|
2
2
|
import { useCallback, useMemo, useEffect, useRef } from "react";
|
|
3
3
|
import { useAuthStore, selectUserId } from "@umituz/react-native-auth";
|
|
4
4
|
import { subscriptionEventBus, SUBSCRIPTION_EVENTS } from "../../../shared/infrastructure/SubscriptionEventBus";
|
|
5
|
-
import type { UserCredits } from "../core/Credits";
|
|
6
5
|
import {
|
|
7
6
|
getCreditsRepository,
|
|
8
7
|
getCreditsConfig,
|
|
@@ -11,35 +10,18 @@ import {
|
|
|
11
10
|
import { calculateCreditPercentage, canAfford as canAffordCheck } from "../../../shared/utils/numberUtils";
|
|
12
11
|
import { createUserQueryKey } from "../../../shared/utils/queryKeyFactory";
|
|
13
12
|
import { isAuthenticated } from "../../subscription/utils/authGuards";
|
|
13
|
+
import { creditsQueryKeys } from "./creditsQueryKeys";
|
|
14
|
+
import type { UseCreditsResult, CreditsLoadStatus } from "./useCredits.types";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
all: ["credits"] as const,
|
|
17
|
-
user: (userId: string) => ["credits", userId] as const,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type CreditsLoadStatus = "idle" | "loading" | "ready" | "error";
|
|
21
|
-
|
|
22
|
-
export interface UseCreditsResult {
|
|
23
|
-
credits: UserCredits | null;
|
|
24
|
-
isLoading: boolean;
|
|
25
|
-
isCreditsLoaded: boolean;
|
|
26
|
-
loadStatus: CreditsLoadStatus;
|
|
27
|
-
error: Error | null;
|
|
28
|
-
hasCredits: boolean;
|
|
29
|
-
creditsPercent: number;
|
|
30
|
-
refetch: () => void;
|
|
31
|
-
canAfford: (cost: number) => boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function deriveLoadStatus(
|
|
16
|
+
const deriveLoadStatus = (
|
|
35
17
|
queryStatus: "pending" | "error" | "success",
|
|
36
18
|
queryEnabled: boolean
|
|
37
|
-
): CreditsLoadStatus {
|
|
19
|
+
): CreditsLoadStatus => {
|
|
38
20
|
if (!queryEnabled) return "idle";
|
|
39
21
|
if (queryStatus === "pending") return "loading";
|
|
40
22
|
if (queryStatus === "error") return "error";
|
|
41
23
|
return "ready";
|
|
42
|
-
}
|
|
24
|
+
};
|
|
43
25
|
|
|
44
26
|
export const useCredits = (): UseCreditsResult => {
|
|
45
27
|
const userId = useAuthStore(selectUserId);
|
|
@@ -122,4 +104,3 @@ export const useHasCredits = (): boolean => {
|
|
|
122
104
|
const { hasCredits } = useCredits();
|
|
123
105
|
return hasCredits;
|
|
124
106
|
};
|
|
125
|
-
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UserCredits } from "../core/Credits";
|
|
2
|
+
|
|
3
|
+
export type CreditsLoadStatus = "idle" | "loading" | "ready" | "error";
|
|
4
|
+
|
|
5
|
+
export interface UseCreditsResult {
|
|
6
|
+
credits: UserCredits | null;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
isCreditsLoaded: boolean;
|
|
9
|
+
loadStatus: CreditsLoadStatus;
|
|
10
|
+
error: Error | null;
|
|
11
|
+
hasCredits: boolean;
|
|
12
|
+
creditsPercent: number;
|
|
13
|
+
refetch: () => void;
|
|
14
|
+
canAfford: (cost: number) => boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const TRANSACTION_LIST_MAX_HEIGHT = 400;
|
|
File without changes
|