@umituz/react-native-subscription 2.27.124 → 2.27.126

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.124",
3
+ "version": "2.27.126",
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",
@@ -1,6 +1,7 @@
1
1
  import type { CreditsConfig } from "../core/Credits";
2
2
  import type { UserCreditsDocumentRead } from "../core/UserCreditsDocument";
3
- import { getAppVersion, validatePlatform } from "../../../utils";
3
+ import { getAppVersion, validatePlatform } from "../../../utils/appUtils";
4
+
4
5
  import type { InitializeCreditsMetadata, InitializationResult } from "../../subscription/application/SubscriptionInitializerTypes";
5
6
  import { runTransaction, type Transaction, type DocumentReference } from "firebase/firestore";
6
7
  import type { Firestore } from "firebase/firestore";
@@ -1,7 +1,8 @@
1
1
  import { Timestamp, serverTimestamp } from "firebase/firestore";
2
2
  import { resolveSubscriptionStatus } from "../../subscription/core/SubscriptionStatus";
3
3
  import { creditAllocationOrchestrator } from "./credit-strategies/CreditAllocationOrchestrator";
4
- import { isPast } from "../../../utils";
4
+ import { isPast } from "../../../utils/dateUtils";
5
+
5
6
  import {
6
7
  CalculateCreditsParams,
7
8
  BuildCreditsDataParams
@@ -9,7 +9,9 @@ import { usePaywallVisibility } from "../../subscription/presentation/usePaywall
9
9
  import { useSubscriptionPackages } from "../../subscription/infrastructure/hooks/useSubscriptionPackages";
10
10
  import { useRevenueCatTrialEligibility } from "../../subscription/infrastructure/hooks/useRevenueCatTrialEligibility";
11
11
  import { createCreditAmountsFromPackages } from "../../../utils/creditMapper";
12
- import { PaywallModal, type TrialEligibilityInfo } from "./PaywallModal";
12
+ import { PaywallModal } from "./PaywallModal";
13
+ import type { TrialEligibilityInfo } from "./PaywallModal.types";
14
+
13
15
  import { usePaywallActions } from "../hooks/usePaywallActions";
14
16
  import { useAuthAwarePurchase } from "../../subscription/presentation/useAuthAwarePurchase";
15
17
  import type { PaywallContainerProps } from "./PaywallContainer.types";
@@ -21,9 +21,14 @@ export const PaywallModal: React.FC<PaywallModalProps> = React.memo((props) => {
21
21
 
22
22
  const handleLegalUrl = useCallback(async (url: string | undefined) => {
23
23
  if (!url) return;
24
- try { if (await Linking.canOpenURL(url)) await Linking.openURL(url); } catch { }
24
+ try {
25
+ if (await Linking.canOpenURL(url)) await Linking.openURL(url);
26
+ } catch (err) {
27
+ console.error("[PaywallModal] Legal link error:", err);
28
+ }
25
29
  }, []);
26
30
 
31
+
27
32
  return (
28
33
  <BaseModal visible={visible} onClose={onClose} contentStyle={styles.modalContent}>
29
34
  <View style={[styles.container, { backgroundColor: tokens.colors.surface }]}>
@@ -7,4 +7,8 @@
7
7
  export * from "./entities/types";
8
8
 
9
9
  // Hooks
10
- export * from "./hooks";
10
+ // Hooks
11
+ export * from "./hooks/useSubscriptionModal";
12
+ export * from "./hooks/usePaywallActions";
13
+ export * from "./hooks/usePaywallTranslations";
14
+
@@ -14,7 +14,8 @@ export class SubscriptionSyncService {
14
14
  try {
15
15
  await this.processor.processPurchase(userId, productId, customerInfo, source);
16
16
  subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.PURCHASE_COMPLETED, { userId, productId });
17
- } catch {
17
+ } catch (err) {
18
+ console.error("[SubscriptionSyncService] purchase error:", err);
18
19
  }
19
20
  }
20
21
 
@@ -22,7 +23,8 @@ export class SubscriptionSyncService {
22
23
  try {
23
24
  await this.processor.processRenewal(userId, productId, newExpirationDate, customerInfo);
24
25
  subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.RENEWAL_DETECTED, { userId, productId });
25
- } catch {
26
+ } catch (err) {
27
+ console.error("[SubscriptionSyncService] renewal error:", err);
26
28
  }
27
29
  }
28
30
 
@@ -37,7 +39,9 @@ export class SubscriptionSyncService {
37
39
  try {
38
40
  await this.processor.processStatusChange(userId, isPremium, productId, expiresAt, willRenew, periodType);
39
41
  subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.PREMIUM_STATUS_CHANGED, { userId, isPremium });
40
- } catch {
42
+ } catch (err) {
43
+ console.error("[SubscriptionSyncService] status change error:", err);
41
44
  }
42
45
  }
43
46
  }
47
+
@@ -3,7 +3,8 @@
3
3
  * Validation and helper functions for SubscriptionManager
4
4
  */
5
5
 
6
- import type { SubscriptionManagerConfig } from "./SubscriptionManager";
6
+ import type { SubscriptionManagerConfig } from "./SubscriptionManager.types";
7
+
7
8
  import type { IRevenueCatService } from "../../../../shared/application/ports/IRevenueCatService";
8
9
  import { SubscriptionInternalState } from "./SubscriptionInternalState";
9
10
 
@@ -118,6 +118,10 @@ export {
118
118
  // Screens
119
119
  export {
120
120
  WalletScreen,
121
- type WalletScreenProps,
122
- type WalletScreenTranslations,
123
121
  } from "./presentation/screens/WalletScreen";
122
+
123
+ export type {
124
+ WalletScreenProps,
125
+ WalletScreenTranslations,
126
+ } from "./presentation/screens/WalletScreen.types";
127
+
@@ -5,7 +5,8 @@
5
5
  * Set once at app init, used by WalletScreen automatically.
6
6
  */
7
7
 
8
- import type { WalletScreenTranslations } from "../../presentation/screens/WalletScreen";
8
+ import type { WalletScreenTranslations } from "../../presentation/screens/WalletScreen.types";
9
+
9
10
 
10
11
  export interface WalletConfiguration {
11
12
  translations: WalletScreenTranslations;
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  // Domain Layer - Constants & Types (Now in domains/subscription/core)
6
+ // Domain Layer - Constants & Types
6
7
  export * from "./domains/subscription/core/SubscriptionConstants";
7
8
  export {
8
9
  createDefaultSubscriptionStatus,
@@ -11,6 +12,9 @@ export {
11
12
  } from "./domains/subscription/core/SubscriptionStatus";
12
13
  export type { SubscriptionStatus, StatusResolverInput } from "./domains/subscription/core/SubscriptionStatus";
13
14
 
15
+
16
+
17
+
14
18
  // Application Layer - Ports
15
19
  export type { ISubscriptionRepository } from "./shared/application/ports/ISubscriptionRepository";
16
20
  export type { IRevenueCatService } from "./shared/application/ports/IRevenueCatService";
@@ -51,7 +55,17 @@ export {
51
55
  } from "./domains/credits/infrastructure/CreditsRepositoryManager";
52
56
 
53
57
  // Presentation Layer - Hooks (Point to the bridge)
54
- export * from "./presentation/hooks";
58
+ // Presentation Layer - Hooks
59
+ export { useAuthAwarePurchase } from "./domains/subscription/presentation/useAuthAwarePurchase";
60
+ export { useCredits } from "./domains/credits/presentation/useCredits";
61
+ export { useDeductCredit } from "./domains/credits/presentation/useDeductCredit";
62
+ export { useFeatureGate } from "./domains/subscription/presentation/useFeatureGate";
63
+ export { usePaywallVisibility } from "./domains/subscription/presentation/usePaywallVisibility";
64
+ export { usePremium } from "./domains/subscription/presentation/usePremium";
65
+ export { useSubscriptionStatus } from "./domains/subscription/presentation/useSubscriptionStatus";
66
+ export * from "./presentation/hooks/feedback/usePaywallFeedback";
67
+ export * from "./presentation/hooks/feedback/useFeedbackSubmit";
68
+
55
69
 
56
70
  // Presentation Layer - Components
57
71
  export * from "./domains/subscription/presentation/components/details/PremiumDetailsCard";
@@ -71,7 +85,18 @@ export type {
71
85
 
72
86
 
73
87
  // Utils
74
- export * from "./utils";
88
+ // Utils
89
+ export * from "./utils/creditMapper";
90
+ export * from "./utils/packagePeriodUtils";
91
+ export * from "./utils/packageTypeDetector";
92
+ export * from "./utils/premiumStatusUtils";
93
+ export * from "./utils/priceUtils";
94
+ export * from "./utils/tierUtils";
95
+ export * from "./utils/types";
96
+ export * from "./utils/validation";
97
+ export * from "./utils/dateUtils";
98
+ export * from "./utils/appUtils";
99
+
75
100
 
76
101
  // Init Module Factory
77
102
  export {
@@ -8,7 +8,8 @@ import Constants from "expo-constants";
8
8
  * Gets the current app version from Expo constants
9
9
  */
10
10
  export function getAppVersion(): string {
11
- const version = Constants.expoConfig?.version ?? Constants.manifest2?.extra?.expoClient?.version;
11
+ const version = Constants.expoConfig?.version;
12
+
12
13
  if (!version) {
13
14
  throw new Error("appVersion is required in expoConfig");
14
15
  }
@@ -1,11 +0,0 @@
1
- /**
2
- * Paywall Hooks Index
3
- */
4
-
5
- export { useSubscriptionModal } from './useSubscriptionModal';
6
- export { usePaywallActions } from './usePaywallActions';
7
- export {
8
- usePaywallTranslations,
9
- type UsePaywallTranslationsParams,
10
- type UsePaywallTranslationsResult,
11
- } from './usePaywallTranslations';
@@ -1,5 +0,0 @@
1
- /**
2
- * Overlay Components
3
- */
4
-
5
- export { PurchaseLoadingOverlay, type PurchaseLoadingOverlayProps } from "./PurchaseLoadingOverlay";
@@ -1,9 +0,0 @@
1
- export * from "../../domains/subscription/presentation/useAuthAwarePurchase";
2
- export * from "../../domains/credits/presentation/useCredits";
3
- export * from "../../domains/credits/presentation/useDeductCredit";
4
- export * from "../../domains/subscription/presentation/useFeatureGate";
5
- export * from "../../domains/subscription/presentation/usePaywallVisibility";
6
- export * from "../../domains/subscription/presentation/usePremium";
7
- export * from "../../domains/subscription/presentation/useSubscriptionStatus";
8
- export * from "./feedback/usePaywallFeedback";
9
- export * from "./feedback/useFeedbackSubmit";
@@ -1,11 +0,0 @@
1
-
2
- export * from "./creditMapper";
3
- export * from "./packagePeriodUtils";
4
- export * from "./packageTypeDetector";
5
- export * from "./premiumStatusUtils";
6
- export * from "./priceUtils";
7
- export * from "./tierUtils";
8
- export * from "./types";
9
- export * from "./validation";
10
- export * from "./dateUtils";
11
- export * from "./appUtils";