@umituz/react-native-subscription 2.37.53 → 2.37.55

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.37.53",
3
+ "version": "2.37.55",
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",
@@ -14,10 +14,6 @@ export class PackageHandler {
14
14
  private entitlementId: string
15
15
  ) { }
16
16
 
17
- setService(service: IRevenueCatService): void {
18
- this.service = service;
19
- }
20
-
21
17
  async fetchPackages(): Promise<PurchasesPackage[]> {
22
18
  return fetchPackages(this.service);
23
19
  }
package/src/index.ts CHANGED
@@ -19,11 +19,7 @@ export {
19
19
  isFailure,
20
20
  unwrap,
21
21
  unwrapOr,
22
- map,
23
- flatMap,
24
22
  tryCatch,
25
- tryCatchSync,
26
- combine,
27
23
  } from "./shared/utils/Result";
28
24
  export type { Result, Success, Failure } from "./shared/utils/Result";
29
25
 
@@ -75,16 +71,12 @@ export type {
75
71
 
76
72
  // Utils
77
73
  export * from "./utils/creditMapper";
78
- export * from "./utils/packagePeriodUtils";
79
74
  export * from "./utils/packageTypeDetector";
80
- export * from "./utils/premiumStatusUtils";
81
75
  export * from "./utils/priceUtils";
82
- export * from "./utils/tierUtils";
83
76
  export * from "./utils/types";
84
- export * from "./utils/validation";
85
77
  export * from "./utils/dateUtils";
86
- export * from "./utils/appUtils";
87
- export * from "./shared/utils/dateConverter";
78
+ export { getAppVersion, validatePlatform } from "./utils/appUtils";
79
+ export { toDate, toISOString, toTimestamp, getCurrentISOString } from "./shared/utils/dateConverter";
88
80
 
89
81
  // Credits Query Keys
90
82
  export { creditsQueryKeys } from "./domains/credits/presentation/creditsQueryKeys";
@@ -47,35 +47,3 @@ export function toTimestamp(value: Date | string | number | null | undefined): F
47
47
  export function getCurrentISOString(): string {
48
48
  return new Date().toISOString();
49
49
  }
50
-
51
- export function getCurrentDate(): Date {
52
- return new Date();
53
- }
54
-
55
- export function isBefore(date1: Date | string | null | undefined, date2: Date | string | null | undefined): boolean {
56
- const d1 = toDate(date1);
57
- const d2 = toDate(date2);
58
-
59
- if (!d1 || !d2) return false;
60
- return d1.getTime() < d2.getTime();
61
- }
62
-
63
- export function isAfter(date1: Date | string | null | undefined, date2: Date | string | null | undefined): boolean {
64
- const d1 = toDate(date1);
65
- const d2 = toDate(date2);
66
-
67
- if (!d1 || !d2) return false;
68
- return d1.getTime() > d2.getTime();
69
- }
70
-
71
- export function isInPast(date: Date | string | null | undefined): boolean {
72
- const d = toDate(date);
73
- if (!d) return false;
74
- return d.getTime() < Date.now();
75
- }
76
-
77
- export function isInFuture(date: Date | string | null | undefined): boolean {
78
- const d = toDate(date);
79
- if (!d) return false;
80
- return d.getTime() > Date.now();
81
- }
@@ -1,8 +1,6 @@
1
1
  import { Platform } from "react-native";
2
2
  import Constants from "expo-constants";
3
3
 
4
- export const IS_DEV_MODE = typeof __DEV__ !== "undefined" && __DEV__;
5
-
6
4
  export function getAppVersion(): string {
7
5
  const version = Constants.expoConfig?.version;
8
6
 
@@ -19,7 +17,3 @@ export function validatePlatform(): "ios" | "android" {
19
17
  }
20
18
  return platform;
21
19
  }
22
-
23
- export function isDev(): boolean {
24
- return __DEV__;
25
- }
@@ -1,31 +0,0 @@
1
- import type { PurchasesPackage } from "react-native-purchases";
2
-
3
- export const getPeriodLabel = (period: string | null | undefined): string => {
4
- if (!period) return "";
5
- if (period.includes("Y") || period.includes("year")) return "yearly";
6
- if (period.includes("M") || period.includes("month")) return "monthly";
7
- if (period.includes("W") || period.includes("week")) return "weekly";
8
- if (period.includes("D") || period.includes("day")) return "daily";
9
- return "";
10
- };
11
-
12
- export const isYearlyPackage = (pkg: PurchasesPackage): boolean => {
13
- const period = pkg.product.subscriptionPeriod;
14
- return period?.includes("Y") || period?.includes("year") || false;
15
- };
16
-
17
- export const isMonthlyPackage = (pkg: PurchasesPackage): boolean => {
18
- const period = pkg.product.subscriptionPeriod;
19
- return period?.includes("M") || period?.includes("month") || false;
20
- };
21
-
22
- export const isWeeklyPackage = (pkg: PurchasesPackage): boolean => {
23
- const period = pkg.product.subscriptionPeriod;
24
- return period?.includes("W") || period?.includes("week") || false;
25
- };
26
-
27
- export const findYearlyPackage = (
28
- packages: PurchasesPackage[]
29
- ): PurchasesPackage | undefined => {
30
- return packages.find(isYearlyPackage);
31
- };
@@ -1,21 +0,0 @@
1
- import type { PremiumStatusFetcher } from './types';
2
-
3
- export function getIsPremium(
4
- isAnonymous: boolean,
5
- userId: string | null,
6
- isPremiumOrFetcher: boolean | PremiumStatusFetcher,
7
- ): Promise<boolean> {
8
- if (isAnonymous || userId === null) return Promise.resolve(false);
9
-
10
- if (typeof isPremiumOrFetcher === 'boolean') return Promise.resolve(isPremiumOrFetcher);
11
-
12
- return (async () => {
13
- try {
14
- return await isPremiumOrFetcher.isPremium(userId!);
15
- } catch (error) {
16
- throw new Error(
17
- `Failed to fetch premium status: ${error instanceof Error ? error.message : String(error)}`
18
- );
19
- }
20
- })();
21
- }
@@ -1,34 +0,0 @@
1
- import { USER_TIER, type UserTierInfo } from './types';
2
-
3
- export function getUserTierInfo(
4
- isAnonymous: boolean,
5
- userId: string | null,
6
- isPremium: boolean,
7
- ): UserTierInfo {
8
- if (isAnonymous || userId === null) {
9
- return {
10
- tier: USER_TIER.ANONYMOUS,
11
- isPremium: false,
12
- isAnonymous: true,
13
- isAuthenticated: false,
14
- userId: null,
15
- };
16
- }
17
-
18
- return {
19
- tier: isPremium ? USER_TIER.PREMIUM : USER_TIER.FREEMIUM,
20
- isPremium,
21
- isAnonymous: false,
22
- isAuthenticated: true,
23
- userId,
24
- };
25
- }
26
-
27
- export function checkPremiumAccess(
28
- isAnonymous: boolean,
29
- userId: string | null,
30
- isPremium: boolean,
31
- ): boolean {
32
- if (isAnonymous || userId === null) return false;
33
- return isPremium;
34
- }
@@ -1,17 +0,0 @@
1
- import { USER_TIER, type UserTier, type UserTierInfo } from './types';
2
-
3
- export function isValidUserTier(value: unknown): value is UserTier {
4
- return value === USER_TIER.ANONYMOUS || value === USER_TIER.FREEMIUM || value === USER_TIER.PREMIUM;
5
- }
6
-
7
- export function isUserTierInfo(value: unknown): value is UserTierInfo {
8
- if (typeof value !== 'object' || value === null) return false;
9
- const obj = value as Record<string, unknown>;
10
- return (
11
- isValidUserTier(obj.tier) &&
12
- typeof obj.isPremium === 'boolean' &&
13
- typeof obj.isAnonymous === 'boolean' &&
14
- typeof obj.isAuthenticated === 'boolean' &&
15
- (obj.userId === null || typeof obj.userId === 'string')
16
- );
17
- }