@umituz/react-native-subscription 2.27.67 → 2.27.68

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.67",
3
+ "version": "2.27.68",
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",
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { PurchasesPackage, CustomerInfo } from "react-native-purchases";
7
- import type { IRevenueCatService } from "../../application/ports/IRevenueCatService";
7
+ import type { IRevenueCatService } from "../../../../shared/application/ports/IRevenueCatService";
8
8
  import { getPremiumEntitlement } from "../../domain/types/RevenueCatTypes";
9
9
  import { PurchaseStatusResolver, type PremiumStatus } from "./PurchaseStatusResolver";
10
10
 
@@ -6,7 +6,7 @@
6
6
  import { useState, useCallback } from "react";
7
7
  import type { PurchasesOffering, PurchasesPackage } from "react-native-purchases";
8
8
  import { getRevenueCatService } from '../../infrastructure/services/RevenueCatService';
9
- import type { PurchaseResult, RestoreResult } from '../../application/ports/IRevenueCatService';
9
+ import type { PurchaseResult, RestoreResult } from '../../../../shared/application/ports/IRevenueCatService';
10
10
 
11
11
  export interface UseRevenueCatResult {
12
12
  /** Current offering */
@@ -1,5 +1,5 @@
1
1
  import Purchases, { type PurchasesPackage } from "react-native-purchases";
2
- import type { PurchaseResult } from "../../application/ports/IRevenueCatService";
2
+ import type { PurchaseResult } from "../../../../shared/application/ports/IRevenueCatService";
3
3
  import { RevenueCatPurchaseError, RevenueCatInitializationError } from "../../domain/errors/RevenueCatError";
4
4
  import type { RevenueCatConfig } from "../../domain/value-objects/RevenueCatConfig";
5
5
  import { isUserCancelledError, getErrorMessage } from "../../domain/types/RevenueCatTypes";
@@ -1,5 +1,5 @@
1
1
  import Purchases from "react-native-purchases";
2
- import type { RestoreResult } from "../../application/ports/IRevenueCatService";
2
+ import type { RestoreResult } from "../../../../shared/application/ports/IRevenueCatService";
3
3
  import { RevenueCatRestoreError, RevenueCatInitializationError } from "../../domain/errors/RevenueCatError";
4
4
  import type { RevenueCatConfig } from "../../domain/value-objects/RevenueCatConfig";
5
5
  import { getErrorMessage } from "../../domain/types/RevenueCatTypes";
@@ -1,5 +1,5 @@
1
1
  import Purchases, { LOG_LEVEL, type CustomerInfo, type PurchasesOfferings } from "react-native-purchases";
2
- import type { InitializeResult } from "../../application/ports/IRevenueCatService";
2
+ import type { InitializeResult } from "../../../../shared/application/ports/IRevenueCatService";
3
3
  import type { RevenueCatConfig } from "../../domain/value-objects/RevenueCatConfig";
4
4
  import { resolveApiKey } from "../utils/ApiKeyResolver";
5
5
 
@@ -14,8 +14,8 @@ import type {
14
14
  InitializeResult,
15
15
  PurchaseResult,
16
16
  RestoreResult,
17
- } from "../../application/ports/IRevenueCatService";
18
- import type { RevenueCatConfig } from "../../domain/value-objects/RevenueCatConfig";
17
+ } from "../../../../shared/application/ports/IRevenueCatService";
18
+ import type { RevenueCatConfig } from "../../core/RevenueCatConfig";
19
19
  import { resolveApiKey } from "../utils/ApiKeyResolver";
20
20
  import { initializeSDK } from "./RevenueCatInitializer";
21
21
  import { fetchOfferings } from "./OfferingsFetcher";
@@ -7,6 +7,7 @@ import { PersistentDeviceIdService } from "@umituz/react-native-design-system";
7
7
  import { DeviceTrialRepository } from "../infrastructure/DeviceTrialRepository";
8
8
  import { TrialEligibilityService } from "./TrialEligibilityService";
9
9
  import type { TrialEligibilityResult } from "../core/TrialTypes";
10
+ export type { TrialEligibilityResult };
10
11
 
11
12
  const repository = new DeviceTrialRepository();
12
13
 
package/src/index.ts CHANGED
@@ -2,22 +2,20 @@
2
2
  * React Native Subscription - Public API
3
3
  */
4
4
 
5
- export * from "./domains/wallet";
6
- export * from "./domains/paywall";
7
- export * from "./domains/config";
8
-
9
- // Domain Layer - Constants & Types
10
- export * from "./domain/entities/SubscriptionConstants";
5
+ // Domain Layer - Constants & Types (Now in domains/subscription/core)
6
+ export * from "./domains/subscription/core/SubscriptionConstants";
11
7
  export {
12
8
  createDefaultSubscriptionStatus,
13
9
  isSubscriptionValid,
14
10
  resolveSubscriptionStatus,
15
- } from "./domain/entities/SubscriptionStatus";
16
- export type { SubscriptionStatus, StatusResolverInput } from "./domain/entities/SubscriptionStatus";
17
- export type { SubscriptionConfig } from "./domain/value-objects/SubscriptionConfig";
18
- export type { ISubscriptionRepository } from "./application/ports/ISubscriptionRepository";
11
+ } from "./domains/subscription/core/SubscriptionStatus";
12
+ export type { SubscriptionStatus, StatusResolverInput } from "./domains/subscription/core/SubscriptionStatus";
13
+
14
+ // Application Layer - Ports
15
+ export type { ISubscriptionRepository } from "./shared/application/ports/ISubscriptionRepository";
16
+ export type { IRevenueCatService } from "./shared/application/ports/IRevenueCatService";
19
17
 
20
- // Result Pattern (Functional Error Handling)
18
+ // Result Pattern (Now in shared/utils)
21
19
  export {
22
20
  success,
23
21
  failure,
@@ -30,39 +28,29 @@ export {
30
28
  tryCatch,
31
29
  tryCatchSync,
32
30
  combine,
33
- } from "./domain/value-objects/Result";
34
- export type { Result, Success, Failure } from "./domain/value-objects/Result";
31
+ } from "./shared/utils/Result";
32
+ export type { Result, Success, Failure } from "./shared/utils/Result";
35
33
 
36
- // Infrastructure Layer
37
- export { SubscriptionService, initializeSubscriptionService } from "./infrastructure/services/SubscriptionService";
38
- export {
39
- submitFeedback,
40
- submitPaywallFeedback,
41
- submitSettingsFeedback,
42
- type FeedbackData,
43
- type FeedbackSubmitResult,
44
- } from "./infrastructure/services/FeedbackService";
45
- export { initializeSubscription, type SubscriptionInitConfig, type CreditPackageConfig } from "./infrastructure/services/SubscriptionInitializer";
46
- export {
34
+ // Infrastructure Layer (Services & Repositories)
35
+ export { initializeSubscription, type SubscriptionInitConfig, type CreditPackageConfig } from "./domains/subscription/application/SubscriptionInitializer";
36
+ export {
47
37
  getDeviceId,
48
38
  checkTrialEligibility,
49
39
  recordTrialStart,
50
40
  recordTrialEnd,
51
41
  recordTrialConversion,
52
- TRIAL_CONFIG,
53
- type DeviceTrialRecord,
54
- type TrialEligibilityResult,
55
- } from "./infrastructure/services/TrialService";
56
- export { CreditsRepository, createCreditsRepository } from "./infrastructure/repositories/CreditsRepository";
57
- export { configureCreditsRepository, getCreditsRepository, getCreditsConfig, resetCreditsRepository, isCreditsRepositoryConfigured } from "./infrastructure/repositories/CreditsRepositoryProvider";
58
- export {
59
- getSavedPurchase,
60
- clearSavedPurchase,
61
- configureAuthProvider,
62
- type PurchaseAuthProvider,
63
- } from "./presentation/hooks/useAuthAwarePurchase";
42
+ type TrialEligibilityResult
43
+ } from "./domains/trial/application/TrialService";
44
+
45
+ export { CreditsRepository } from "./domains/credits/infrastructure/CreditsRepository";
46
+ export {
47
+ configureCreditsRepository,
48
+ getCreditsRepository,
49
+ getCreditsConfig,
50
+ isCreditsRepositoryConfigured
51
+ } from "./domains/credits/infrastructure/CreditsRepositoryProvider";
64
52
 
65
- // Presentation Layer - Hooks
53
+ // Presentation Layer - Hooks (Point to the bridge)
66
54
  export * from "./presentation/hooks";
67
55
 
68
56
  // Presentation Layer - Components
@@ -70,12 +58,7 @@ export * from "./presentation/components/details/PremiumDetailsCard";
70
58
  export * from "./presentation/components/details/PremiumStatusBadge";
71
59
  export * from "./presentation/components/sections/SubscriptionSection";
72
60
  export * from "./presentation/components/feedback/PaywallFeedbackModal";
73
- export * from "./presentation/components/overlay";
74
61
  export * from "./presentation/screens/SubscriptionDetailScreen";
75
- export * from "./presentation/types/SubscriptionDetailTypes";
76
-
77
- // Presentation Layer - Stores
78
- export * from "./presentation/stores";
79
62
 
80
63
  export type {
81
64
  CreditType,
@@ -83,27 +66,13 @@ export type {
83
66
  CreditsConfig,
84
67
  CreditsResult,
85
68
  DeductCreditsResult,
86
- CreditAllocation,
87
- PackageAllocationMap,
88
- } from "./domain/entities/Credits";
89
- export { DEFAULT_CREDITS_CONFIG } from "./domain/entities/Credits";
90
- export { InsufficientCreditsError } from "./domain/errors/InsufficientCreditsError";
69
+ } from "./domains/credits/core/Credits";
70
+
71
+ export { DEFAULT_CREDITS_CONFIG } from "./domains/credits/core/Credits";
91
72
 
92
73
  // Utils
93
74
  export * from "./utils";
94
75
 
95
- // RevenueCat
96
- export * from "./revenuecat";
97
-
98
- // App Service Helpers (for configureAppServices)
99
- export {
100
- createCreditService,
101
- createPaywallService,
102
- type CreditServiceConfig,
103
- type ICreditService,
104
- type IPaywallService,
105
- } from "./infrastructure/services/app-service-helpers";
106
-
107
76
  // Init Module Factory
108
77
  export {
109
78
  createSubscriptionInitModule,
@@ -1,5 +1,5 @@
1
1
  import type { InitModule } from '@umituz/react-native-design-system';
2
- import { initializeSubscription, type SubscriptionInitConfig } from '../infrastructure/services/SubscriptionInitializer';
2
+ import { initializeSubscription, type SubscriptionInitConfig } from '../domains/subscription/application/SubscriptionInitializer';
3
3
 
4
4
  export interface SubscriptionInitModuleConfig extends Omit<SubscriptionInitConfig, 'apiKey'> {
5
5
  getApiKey: () => string | undefined;
@@ -9,9 +9,7 @@ import { useAppDesignTokens, AtomicText } from "@umituz/react-native-design-syst
9
9
  import {
10
10
  SUBSCRIPTION_STATUS,
11
11
  type SubscriptionStatusType
12
- } from "../../../domain/entities/SubscriptionConstants";
13
-
14
- export type { SubscriptionStatusType };
12
+ } from "../../../domains/subscription/core/SubscriptionConstants";
15
13
 
16
14
  export interface PremiumStatusBadgeProps {
17
15
  status: SubscriptionStatusType;
@@ -8,7 +8,7 @@ import { useAuth } from "@umituz/react-native-auth";
8
8
  import {
9
9
  submitPaywallFeedback,
10
10
  submitSettingsFeedback,
11
- } from "../../../infrastructure/services/FeedbackService";
11
+ } from "../../../shared/application/FeedbackService";
12
12
 
13
13
  export interface UsePaywallFeedbackSubmitOptions {
14
14
  onSuccess?: () => void;
@@ -0,0 +1,32 @@
1
+ import type {
2
+ PurchasesOffering,
3
+ PurchasesPackage,
4
+ CustomerInfo,
5
+ } from "react-native-purchases";
6
+
7
+ export interface InitializeResult {
8
+ success: boolean;
9
+ offering: PurchasesOffering | null;
10
+ isPremium: boolean;
11
+ }
12
+
13
+ export interface PurchaseResult {
14
+ success: boolean;
15
+ productId: string | null;
16
+ }
17
+
18
+ export interface RestoreResult {
19
+ success: boolean;
20
+ productId: string | null;
21
+ }
22
+
23
+ export interface IRevenueCatService {
24
+ initialize(userId: string, apiKey?: string): Promise<InitializeResult>;
25
+ fetchOfferings(): Promise<PurchasesOffering | null>;
26
+ purchasePackage(pkg: PurchasesPackage, userId: string): Promise<PurchaseResult>;
27
+ restorePurchases(userId: string): Promise<RestoreResult>;
28
+ isInitialized(): boolean;
29
+ getCurrentUserId(): string | null;
30
+ getCustomerInfo(): Promise<CustomerInfo | null>;
31
+ reset(): Promise<void>;
32
+ }
@@ -1,54 +0,0 @@
1
- # Domain Layer
2
-
3
- Abonelik sisteminin temel domain logic'ini, entity'lerini ve value object'lerini içeren katman.
4
-
5
- ## Location
6
-
7
- `src/domain/`
8
-
9
- ## Strategy
10
-
11
- Temel iş kavramlarını, iş kurallarını ve domain logic'ini encapsulate eden katman. Framework-agnostic ve tamamen iş mantığına odaklı.
12
-
13
- ## Restrictions
14
-
15
- ### REQUIRED
16
-
17
- - MUST be framework-agnostic (no React, React Native dependencies)
18
- - MUST encapsulate business rules within entities
19
- - MUST validate all invariants on entity creation
20
- - MUST use immutable objects
21
- - MUST implement type guards for type safety
22
- - MUST define domain-specific error types
23
-
24
- ### PROHIBITED
25
-
26
- - MUST NOT contain any framework or UI code
27
- - MUST NOT have direct dependencies on infrastructure
28
- - MUST NOT expose mutable state
29
- - MUST NOT use generic error types
30
-
31
- ### CRITICAL
32
-
33
- - Keep entities pure and framework-independent
34
- - Validate all business rules on entity creation
35
- - Make all objects immutable
36
- - Encapsulate business logic within entities
37
- - Use strong typing throughout
38
-
39
- ## AI Agent Guidelines
40
-
41
- When working with domain layer:
42
- 1. Immutable Objects - entity'leri immutable olarak tasarlayın
43
- 2. Validation - entity creation'da validation yapın
44
- 3. Encapsulation - business logic'i entity içinde tutun
45
- 4. Type Safety - strong typing kullanın
46
- 5. Domain Events - önemli domain olaylarını event olarak yayınlayın
47
- 6. Error Handling - domain-specific hatalar tanımlayın
48
-
49
- ## Related Documentation
50
-
51
- - [Domain Entities](./entities/README.md)
52
- - [Value Objects](./value-objects/README.md)
53
- - [Domain Errors](./errors/README.md)
54
- - [Application Layer](../application/README.md)