@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-subscription",
3
- "version": "2.27.140",
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",
@@ -0,0 +1,4 @@
1
+ export const creditsQueryKeys = {
2
+ all: ["credits"] as const,
3
+ user: (userId: string) => ["credits", userId] as const,
4
+ };
@@ -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
- export const creditsQueryKeys = {
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,7 @@
1
+ export const EXPIRATION_WARNING_DAYS = 7;
2
+
3
+ export const REVENUE_CAT_IGNORED_LOG_MESSAGES = [
4
+ 'Purchase was cancelled',
5
+ 'AppTransaction',
6
+ "Couldn't find previous transactions",
7
+ ] as const;
@@ -0,0 +1,6 @@
1
+ export const FEEDBACK_TEXT_MAX_LENGTH = 200;
2
+
3
+ export const FEEDBACK_CHECKBOX_SIZE = 22;
4
+ export const FEEDBACK_CHECKBOX_RADIUS = 11;
5
+
6
+ export const FEEDBACK_TEXT_MIN_HEIGHT = 80;
@@ -0,0 +1 @@
1
+ export const TRANSACTION_LIST_MAX_HEIGHT = 400;