@umituz/react-native-subscription 2.2.42 → 2.2.44

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.2.42",
3
+ "version": "2.2.44",
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",
@@ -18,12 +18,12 @@ export interface ISubscriptionService {
18
18
  userId: string,
19
19
  productId: string,
20
20
  expiresAt: string | null
21
- ): Promise<void>;
21
+ ): Promise<SubscriptionStatus>;
22
22
 
23
23
  /**
24
24
  * Deactivate a subscription
25
25
  */
26
- deactivateSubscription(userId: string): Promise<void>;
26
+ deactivateSubscription(userId: string): Promise<SubscriptionStatus>;
27
27
 
28
28
  /**
29
29
  * Check if user has premium access
@@ -32,3 +32,23 @@ export class SubscriptionError extends Error {
32
32
  return new SubscriptionError(message, 'NETWORK_ERROR');
33
33
  }
34
34
  }
35
+
36
+ export class SubscriptionRepositoryError extends Error {
37
+ public readonly code: string;
38
+
39
+ constructor(message: string, code: string = 'REPOSITORY_ERROR') {
40
+ super(message);
41
+ this.name = 'SubscriptionRepositoryError';
42
+ this.code = code;
43
+ }
44
+ }
45
+
46
+ export class SubscriptionValidationError extends Error {
47
+ public readonly code: string;
48
+
49
+ constructor(message: string, code: string = 'VALIDATION_ERROR') {
50
+ super(message);
51
+ this.name = 'SubscriptionValidationError';
52
+ this.code = code;
53
+ }
54
+ }
@@ -60,6 +60,12 @@ export class SubscriptionService implements ISubscriptionService {
60
60
  }
61
61
  }
62
62
 
63
+ // Alias for ISubscriptionService interface compliance
64
+ async getStatus(userId: string): Promise<SubscriptionStatus | null> {
65
+ const status = await this.getSubscriptionStatus(userId);
66
+ return status.isPremium ? status : null;
67
+ }
68
+
63
69
  async isPremium(userId: string): Promise<boolean> {
64
70
  const status = await this.getSubscriptionStatus(userId);
65
71
  return this.repository.isSubscriptionValid(status);