@umituz/react-native-subscription 2.2.37 → 2.2.39

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.
Files changed (28) hide show
  1. package/package.json +2 -5
  2. package/src/application/ports/ISubscriptionRepository.ts +11 -0
  3. package/src/domain/entities/SubscriptionStatus.ts +38 -0
  4. package/src/domain/value-objects/SubscriptionConfig.ts +9 -0
  5. package/src/index.ts +1 -39
  6. package/src/presentation/components/details/PremiumDetailsCard.tsx +1 -1
  7. package/src/presentation/components/details/PremiumStatusBadge.tsx +6 -3
  8. package/src/presentation/components/feedback/PaywallFeedbackModal.tsx +2 -2
  9. package/src/presentation/components/feedback/paywallFeedbackStyles.ts +1 -1
  10. package/src/presentation/components/paywall/CreditsPackageCard.tsx +2 -2
  11. package/src/presentation/components/paywall/CreditsTabContent.tsx +2 -2
  12. package/src/presentation/components/paywall/PaywallFeatureItem.tsx +2 -2
  13. package/src/presentation/components/paywall/PaywallHeader.tsx +2 -2
  14. package/src/presentation/components/paywall/PaywallLegalFooter.tsx +2 -2
  15. package/src/presentation/components/paywall/PaywallModal.tsx +1 -1
  16. package/src/presentation/components/paywall/PaywallTabBar.tsx +2 -2
  17. package/src/presentation/components/paywall/SubscriptionFooter.tsx +2 -2
  18. package/src/presentation/components/paywall/SubscriptionModal.tsx +1 -1
  19. package/src/presentation/components/paywall/SubscriptionModalHeader.tsx +2 -2
  20. package/src/presentation/components/paywall/SubscriptionModalOverlay.tsx +1 -1
  21. package/src/presentation/components/paywall/SubscriptionPackageList.tsx +2 -2
  22. package/src/presentation/components/paywall/SubscriptionPlanCard.tsx +2 -2
  23. package/src/presentation/components/paywall/SubscriptionTabContent.tsx +1 -1
  24. package/src/presentation/screens/SubscriptionDetailScreen.tsx +1 -1
  25. package/src/presentation/screens/components/CreditItem.tsx +1 -1
  26. package/src/presentation/screens/components/CreditsList.tsx +1 -1
  27. package/src/presentation/screens/components/SubscriptionActions.tsx +1 -1
  28. package/src/presentation/screens/components/SubscriptionHeader.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-subscription",
3
- "version": "2.2.37",
3
+ "version": "2.2.39",
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",
@@ -28,8 +28,7 @@
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@tanstack/react-query": ">=5.0.0",
31
- "@umituz/react-native-design-system-atoms": "*",
32
- "@umituz/react-native-design-system-theme": "*",
31
+ "@umituz/react-native-design-system": "latest",
33
32
  "@umituz/react-native-firestore": "*",
34
33
  "@umituz/react-native-legal": "*",
35
34
  "expo-constants": ">=18.0.0",
@@ -43,8 +42,6 @@
43
42
  "@tanstack/react-query": "^5.0.0",
44
43
  "@types/node": "^25.0.3",
45
44
  "@types/react": "~19.1.0",
46
- "@umituz/react-native-design-system-atoms": "^1.19.0",
47
- "@umituz/react-native-design-system-theme": "latest",
48
45
  "@umituz/react-native-firestore": "latest",
49
46
  "@umituz/react-native-legal": "^2.1.2",
50
47
  "@umituz/react-native-localization": "^3.5.8",
@@ -0,0 +1,11 @@
1
+ /**
2
+ * ISubscriptionRepository Interface
3
+ */
4
+
5
+ import { SubscriptionStatus } from '../../domain/entities/SubscriptionStatus';
6
+
7
+ export interface ISubscriptionRepository {
8
+ getSubscriptionStatus(userId: string): Promise<SubscriptionStatus>;
9
+ saveSubscriptionStatus(userId: string, status: SubscriptionStatus): Promise<void>;
10
+ syncSubscription(userId: string): Promise<SubscriptionStatus>;
11
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Subscription Status Entity
3
+ */
4
+
5
+ export type SubscriptionStatusType = 'active' | 'expired' | 'canceled' | 'none';
6
+
7
+ export interface SubscriptionStatus {
8
+ isPremium: boolean;
9
+ expiresAt: string | null;
10
+ productId: string | null;
11
+ purchasedAt?: string | null;
12
+ customerId?: string | null;
13
+ syncedAt?: string | null;
14
+ status?: SubscriptionStatusType;
15
+ }
16
+
17
+ export const createDefaultSubscriptionStatus = (): SubscriptionStatus => ({
18
+ isPremium: false,
19
+ expiresAt: null,
20
+ productId: null,
21
+ purchasedAt: null,
22
+ customerId: null,
23
+ syncedAt: null,
24
+ status: 'none',
25
+ });
26
+
27
+ export const isSubscriptionValid = (status: SubscriptionStatus | null): boolean => {
28
+ if (!status || !status.isPremium) return false;
29
+
30
+ if (!status.expiresAt) return true; // Lifetime
31
+
32
+ const expirationDate = new Date(status.expiresAt);
33
+ const now = new Date();
34
+
35
+ // Add 24-hour grace period buffer
36
+ const buffer = 24 * 60 * 60 * 1000;
37
+ return expirationDate.getTime() + buffer > now.getTime();
38
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Subscription Config Value Object
3
+ */
4
+
5
+ export interface SubscriptionConfig {
6
+ revenueCatApiKey?: string;
7
+ entitlements?: string[];
8
+ debugMode?: boolean;
9
+ }
package/src/index.ts CHANGED
@@ -13,30 +13,19 @@
13
13
  // BROKEN EXPORTS - Files missing
14
14
  // =============================================================================
15
15
 
16
- /*
17
- export {
18
- SubscriptionError,
19
- SubscriptionRepositoryError,
20
- SubscriptionValidationError,
21
- SubscriptionConfigurationError,
22
- } from "./domain/errors/SubscriptionError";
23
-
24
16
  export {
25
17
  createDefaultSubscriptionStatus,
26
18
  isSubscriptionValid,
27
19
  } from "./domain/entities/SubscriptionStatus";
28
- export type { SubscriptionStatus } from "./domain/entities/SubscriptionStatus";
20
+ export type { SubscriptionStatus, SubscriptionStatusType } from "./domain/entities/SubscriptionStatus";
29
21
 
30
22
  export type { SubscriptionConfig } from "./domain/value-objects/SubscriptionConfig";
31
23
 
32
24
  export type { ISubscriptionRepository } from "./application/ports/ISubscriptionRepository";
33
- export type { ISubscriptionService } from "./application/ports/ISubscriptionService";
34
25
 
35
26
  export {
36
27
  SubscriptionService,
37
28
  initializeSubscriptionService,
38
- getSubscriptionService,
39
- resetSubscriptionService,
40
29
  } from "./infrastructure/services/SubscriptionService";
41
30
 
42
31
  export { useSubscription } from "./presentation/hooks/useSubscription";
@@ -47,32 +36,6 @@ export {
47
36
  type SubscriptionDetails,
48
37
  } from "./presentation/hooks/useSubscriptionDetails";
49
38
 
50
- export {
51
- usePremiumGate,
52
- type UsePremiumGateParams,
53
- type UsePremiumGateResult,
54
- } from "./presentation/hooks/usePremiumGate";
55
-
56
- export {
57
- useFeatureGate,
58
- type UseFeatureGateParams,
59
- type UseFeatureGateResult,
60
- } from "./presentation/hooks/useFeatureGate";
61
-
62
- export {
63
- useUserTier,
64
- type UseUserTierParams,
65
- type UseUserTierResult,
66
- } from "./presentation/hooks/useUserTier";
67
-
68
- export {
69
- useUserTierWithRepository,
70
- type UseUserTierWithRepositoryParams,
71
- type UseUserTierWithRepositoryResult,
72
- type AuthProvider,
73
- } from "./presentation/hooks/useUserTierWithRepository";
74
- */
75
-
76
39
  // Feedback
77
40
  export * from "./presentation/components/feedback/PaywallFeedbackModal";
78
41
  export * from "./presentation/hooks/feedback/usePaywallFeedback";
@@ -136,7 +99,6 @@ export {
136
99
  export {
137
100
  PremiumStatusBadge,
138
101
  type PremiumStatusBadgeProps,
139
- type SubscriptionStatusType,
140
102
  } from "./presentation/components/details/PremiumStatusBadge";
141
103
 
142
104
  // =============================================================================
@@ -6,7 +6,7 @@
6
6
 
7
7
  import React from "react";
8
8
  import { View, Text, StyleSheet, TouchableOpacity } from "react-native";
9
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
9
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
  import {
11
11
  PremiumStatusBadge,
12
12
  type SubscriptionStatusType,
@@ -5,15 +5,15 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, Text, StyleSheet } from "react-native";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
9
-
10
- export type SubscriptionStatusType = "active" | "expired" | "none";
8
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
+ import { SubscriptionStatusType } from "../../../domain/entities/SubscriptionStatus";
11
10
 
12
11
  export interface PremiumStatusBadgeProps {
13
12
  status: SubscriptionStatusType;
14
13
  activeLabel?: string;
15
14
  expiredLabel?: string;
16
15
  noneLabel?: string;
16
+ canceledLabel?: string;
17
17
  }
18
18
 
19
19
  /**
@@ -24,6 +24,7 @@ export const PremiumStatusBadge: React.FC<PremiumStatusBadgeProps> = ({
24
24
  activeLabel = "Active",
25
25
  expiredLabel = "Expired",
26
26
  noneLabel = "Free",
27
+ canceledLabel = "Canceled",
27
28
  }) => {
28
29
  const tokens = useAppDesignTokens();
29
30
 
@@ -31,12 +32,14 @@ export const PremiumStatusBadge: React.FC<PremiumStatusBadgeProps> = ({
31
32
  active: activeLabel,
32
33
  expired: expiredLabel,
33
34
  none: noneLabel,
35
+ canceled: canceledLabel,
34
36
  };
35
37
 
36
38
  const colors: Record<SubscriptionStatusType, string> = {
37
39
  active: tokens.colors.success,
38
40
  expired: tokens.colors.error,
39
41
  none: tokens.colors.textTertiary,
42
+ canceled: tokens.colors.warning,
40
43
  };
41
44
 
42
45
  const backgroundColor = colors[status];
@@ -13,8 +13,8 @@ import {
13
13
  KeyboardAvoidingView,
14
14
  Platform,
15
15
  } from "react-native";
16
- import { AtomicText } from "@umituz/react-native-design-system-atoms";
17
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
16
+ import { AtomicText } from "@umituz/react-native-design-system";
17
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
18
18
  import { useLocalization } from "@umituz/react-native-localization";
19
19
  import { usePaywallFeedback } from "../../hooks/feedback/usePaywallFeedback";
20
20
  import { createPaywallFeedbackStyles } from "./paywallFeedbackStyles";
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { StyleSheet } from "react-native";
7
- import type { DesignTokens } from "@umituz/react-native-design-system-theme";
7
+ import type { DesignTokens } from "@umituz/react-native-design-system";
8
8
 
9
9
  export const createPaywallFeedbackStyles = (
10
10
  tokens: DesignTokens,
@@ -5,8 +5,8 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, StyleSheet, TouchableOpacity } from "react-native";
8
- import { AtomicText } from "@umituz/react-native-design-system-atoms";
9
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { AtomicText } from "@umituz/react-native-design-system";
9
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
  import type { CreditsPackage } from "../../../domain/entities/paywall/CreditsPackage";
11
11
 
12
12
  interface CreditsPackageCardProps {
@@ -5,8 +5,8 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, StyleSheet, ScrollView } from "react-native";
8
- import { AtomicText, AtomicButton } from "@umituz/react-native-design-system-atoms";
9
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { AtomicText, AtomicButton } from "@umituz/react-native-design-system";
9
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
  import { useLocalization } from "@umituz/react-native-localization";
11
11
  import { CreditsPackageCard } from "./CreditsPackageCard";
12
12
  import { PaywallLegalFooter } from "./PaywallLegalFooter";
@@ -5,8 +5,8 @@
5
5
 
6
6
  import React, { useMemo } from "react";
7
7
  import { View, StyleSheet } from "react-native";
8
- import { AtomicText, AtomicIcon } from "@umituz/react-native-design-system-atoms";
9
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { AtomicText, AtomicIcon } from "@umituz/react-native-design-system";
9
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
 
11
11
  interface PaywallFeatureItemProps {
12
12
  icon: string;
@@ -5,8 +5,8 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, TouchableOpacity, StyleSheet } from "react-native";
8
- import { AtomicText, AtomicIcon } from "@umituz/react-native-design-system-atoms";
9
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { AtomicText, AtomicIcon } from "@umituz/react-native-design-system";
9
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
 
11
11
  interface PaywallHeaderProps {
12
12
  title: string;
@@ -5,8 +5,8 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, StyleSheet, TouchableOpacity, Linking } from "react-native";
8
- import { AtomicText } from "@umituz/react-native-design-system-atoms";
9
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { AtomicText } from "@umituz/react-native-design-system";
9
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
 
11
11
  interface PaywallLegalFooterProps {
12
12
  termsText?: string;
@@ -5,7 +5,7 @@
5
5
 
6
6
  import React, { useEffect } from "react";
7
7
  import { View, Modal, StyleSheet, TouchableOpacity, Dimensions } from "react-native";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
9
  import { useLocalization } from "@umituz/react-native-localization";
10
10
  import type { PurchasesPackage } from "react-native-purchases";
11
11
  import { usePaywall } from "../../hooks/usePaywall";
@@ -5,8 +5,8 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, TouchableOpacity, StyleSheet } from "react-native";
8
- import { AtomicText } from "@umituz/react-native-design-system-atoms";
9
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { AtomicText } from "@umituz/react-native-design-system";
9
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
  import type { PaywallTabType } from "../../../domain/entities/paywall/PaywallTab";
11
11
 
12
12
  interface PaywallTabBarProps {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { View, StyleSheet, TouchableOpacity } from "react-native";
3
- import { AtomicButton, AtomicText } from "@umituz/react-native-design-system-atoms";
4
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
3
+ import { AtomicButton, AtomicText } from "@umituz/react-native-design-system";
4
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
5
5
  import { PaywallLegalFooter } from "./PaywallLegalFooter";
6
6
 
7
7
  interface SubscriptionFooterProps {
@@ -5,7 +5,7 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, StyleSheet, ScrollView } from "react-native";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
9
  import type { PurchasesPackage } from "react-native-purchases";
10
10
 
11
11
  import { SubscriptionModalHeader } from "./SubscriptionModalHeader";
@@ -4,8 +4,8 @@
4
4
 
5
5
  import React from "react";
6
6
  import { View, StyleSheet, TouchableOpacity } from "react-native";
7
- import { AtomicText } from "@umituz/react-native-design-system-atoms";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
7
+ import { AtomicText } from "@umituz/react-native-design-system";
8
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
9
 
10
10
  interface SubscriptionModalHeaderProps {
11
11
  title: string;
@@ -13,7 +13,7 @@ import {
13
13
  Platform,
14
14
  ViewStyle,
15
15
  } from "react-native";
16
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
16
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
17
17
 
18
18
  const { height: SCREEN_HEIGHT, width: SCREEN_WIDTH } = Dimensions.get("window");
19
19
 
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { View, StyleSheet, ActivityIndicator } from "react-native";
3
- import { AtomicText } from "@umituz/react-native-design-system-atoms";
4
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
3
+ import { AtomicText } from "@umituz/react-native-design-system";
4
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
5
5
  import type { PurchasesPackage } from "react-native-purchases";
6
6
  import { SubscriptionPlanCard } from "./SubscriptionPlanCard";
7
7
 
@@ -6,8 +6,8 @@
6
6
  import React from "react";
7
7
  import { View, TouchableOpacity, StyleSheet } from "react-native";
8
8
  import type { PurchasesPackage } from "react-native-purchases";
9
- import { AtomicText } from "@umituz/react-native-design-system-atoms";
10
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
9
+ import { AtomicText } from "@umituz/react-native-design-system";
10
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
11
11
  import { formatPrice } from "../../../utils/priceUtils";
12
12
  import { useLocalization } from "@umituz/react-native-localization";
13
13
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  import React, { useMemo } from "react";
7
7
  import { View, StyleSheet, ScrollView } from "react-native";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
9
  import { useLocalization } from "@umituz/react-native-localization";
10
10
  import type { PurchasesPackage } from "react-native-purchases";
11
11
  import { PaywallFeaturesList } from "./PaywallFeaturesList";
@@ -6,7 +6,7 @@
6
6
 
7
7
  import React from "react";
8
8
  import { ScrollView, StyleSheet } from "react-native";
9
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
9
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
  import { SubscriptionHeader } from "./components/SubscriptionHeader";
11
11
  import { CreditsList } from "./components/CreditsList";
12
12
  import { SubscriptionActions } from "./components/SubscriptionActions";
@@ -5,7 +5,7 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, Text, StyleSheet } from "react-native";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
9
 
10
10
  interface CreditItemProps {
11
11
  label: string;
@@ -5,7 +5,7 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, Text, StyleSheet } from "react-native";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
9
  import { CreditItem } from "./CreditItem";
10
10
  import type { CreditInfo } from "../../components/details/PremiumDetailsCard";
11
11
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, Text, StyleSheet, TouchableOpacity } from "react-native";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
9
 
10
10
  interface SubscriptionActionsProps {
11
11
  isPremium: boolean;
@@ -5,7 +5,7 @@
5
5
 
6
6
  import React from "react";
7
7
  import { View, Text, StyleSheet } from "react-native";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system-theme";
8
+ import { useAppDesignTokens } from "@umituz/react-native-design-system";
9
9
  import {
10
10
  PremiumStatusBadge,
11
11
  type SubscriptionStatusType,