@umituz/react-native-subscription 2.27.31 → 2.27.33

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.31",
3
+ "version": "2.27.33",
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",
@@ -60,7 +60,6 @@
60
60
  "@umituz/react-native-auth": "^3.6.14",
61
61
  "@umituz/react-native-design-system": "^2.9.35",
62
62
  "@umituz/react-native-firebase": "*",
63
- "@umituz/react-native-localization": "^3.6.0",
64
63
  "eslint": "^9.39.2",
65
64
  "eslint-plugin-react": "^7.37.5",
66
65
  "eslint-plugin-react-hooks": "^7.0.1",
@@ -85,9 +84,7 @@
85
84
  "expo-video": "~3.0.15",
86
85
  "expo-web-browser": "~15.0.10",
87
86
  "firebase": "^11.0.0",
88
- "i18next": "^25.7.3",
89
87
  "react": "19.1.0",
90
- "react-i18next": "^16.5.1",
91
88
  "react-native": "0.81.5",
92
89
  "react-native-gesture-handler": "^2.30.0",
93
90
  "react-native-purchases": "^7.0.0",
@@ -1,13 +1,6 @@
1
- /**
2
- * Paywall Feedback Modal
3
- * Collects user feedback when declining paywall
4
- */
5
-
6
1
  import React, { useMemo } from "react";
7
2
  import { View, TouchableOpacity, TextInput } from "react-native";
8
- import { AtomicText, BaseModal } from "@umituz/react-native-design-system";
9
- import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
- import { useLocalization } from "@umituz/react-native-localization";
3
+ import { AtomicText, BaseModal, useAppDesignTokens } from "@umituz/react-native-design-system";
11
4
  import { usePaywallFeedback } from "../../hooks/feedback/usePaywallFeedback";
12
5
  import { createPaywallFeedbackStyles } from "./paywallFeedbackStyles";
13
6
 
@@ -19,26 +12,33 @@ const FEEDBACK_OPTION_IDS = [
19
12
  "other",
20
13
  ] as const;
21
14
 
15
+ export interface PaywallFeedbackTranslations {
16
+ title: string;
17
+ subtitle: string;
18
+ submit: string;
19
+ otherPlaceholder: string;
20
+ reasons: {
21
+ too_expensive: string;
22
+ no_need: string;
23
+ trying_out: string;
24
+ technical_issues: string;
25
+ other: string;
26
+ };
27
+ }
28
+
22
29
  export interface PaywallFeedbackModalProps {
30
+ translations: PaywallFeedbackTranslations;
23
31
  visible: boolean;
24
32
  onClose: () => void;
25
33
  onSubmit: (reason: string) => void;
26
- title?: string;
27
- subtitle?: string;
28
- submitText?: string;
29
- otherPlaceholder?: string;
30
34
  }
31
35
 
32
36
  export const PaywallFeedbackModal: React.FC<PaywallFeedbackModalProps> = React.memo(({
37
+ translations,
33
38
  visible,
34
39
  onClose,
35
40
  onSubmit,
36
- title,
37
- subtitle,
38
- submitText,
39
- otherPlaceholder,
40
41
  }) => {
41
- const { t } = useLocalization();
42
42
  const tokens = useAppDesignTokens();
43
43
 
44
44
  const {
@@ -47,7 +47,7 @@ export const PaywallFeedbackModal: React.FC<PaywallFeedbackModalProps> = React.m
47
47
  setOtherText,
48
48
  selectReason,
49
49
  handleSubmit,
50
- handleSkip, // BaseModal's onClose will handle skipping
50
+ handleSkip,
51
51
  canSubmit,
52
52
  } = usePaywallFeedback({ onSubmit, onClose });
53
53
 
@@ -56,18 +56,12 @@ export const PaywallFeedbackModal: React.FC<PaywallFeedbackModalProps> = React.m
56
56
  [tokens, canSubmit],
57
57
  );
58
58
 
59
- const displayTitle = title || t("paywall.feedback.title");
60
- const displaySubtitle = subtitle || t("paywall.feedback.subtitle");
61
- const displaySubmitText = submitText || t("paywall.feedback.submit");
62
- const displayOtherPlaceholder = otherPlaceholder || t("paywall.feedback.otherPlaceholder");
63
-
64
- // BaseModal from design system handles animations, safe areas, keyboard avoiding, and overlay backdrop
65
59
  return (
66
60
  <BaseModal
67
61
  visible={visible}
68
62
  onClose={handleSkip}
69
- title={displayTitle}
70
- subtitle={displaySubtitle}
63
+ title={translations.title}
64
+ subtitle={translations.subtitle}
71
65
  >
72
66
  <View style={{ paddingHorizontal: tokens.spacing.md, paddingBottom: tokens.spacing.lg }}>
73
67
  <View style={[styles.optionsContainer, { backgroundColor: 'transparent', padding: 0 }]}>
@@ -75,7 +69,7 @@ export const PaywallFeedbackModal: React.FC<PaywallFeedbackModalProps> = React.m
75
69
  const isSelected = selectedReason === optionId;
76
70
  const isOther = optionId === "other";
77
71
  const showInput = isSelected && isOther;
78
- const displayText = t(`paywall.feedback.reasons.${optionId}`);
72
+ const displayText = translations.reasons[optionId];
79
73
 
80
74
  // Dynamic styles for the container
81
75
  const containerStyle = {
@@ -135,7 +129,7 @@ export const PaywallFeedbackModal: React.FC<PaywallFeedbackModalProps> = React.m
135
129
  padding: tokens.spacing.sm,
136
130
  }
137
131
  ]}
138
- placeholder={displayOtherPlaceholder}
132
+ placeholder={translations.otherPlaceholder}
139
133
  placeholderTextColor={tokens.colors.textTertiary}
140
134
  multiline
141
135
  maxLength={200}
@@ -157,7 +151,7 @@ export const PaywallFeedbackModal: React.FC<PaywallFeedbackModalProps> = React.m
157
151
  activeOpacity={0.8}
158
152
  >
159
153
  <AtomicText type="labelLarge" style={styles.submitText}>
160
- {displaySubmitText}
154
+ {translations.submit}
161
155
  </AtomicText>
162
156
  </TouchableOpacity>
163
157
  </View>
@@ -48,9 +48,6 @@ export interface UsePaywallVisibilityResult {
48
48
  }
49
49
 
50
50
  export function usePaywallVisibility(): UsePaywallVisibilityResult {
51
- if (typeof __DEV__ !== 'undefined' && __DEV__) {
52
- console.log('[usePaywallVisibility] Hook called');
53
- }
54
51
  const state = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
55
52
 
56
53
  const setShowPaywall = useCallback((visible: boolean, source?: PurchaseSource) => {
@@ -33,9 +33,6 @@ export interface UsePremiumResult {
33
33
  }
34
34
 
35
35
  export const usePremium = (): UsePremiumResult => {
36
- if (typeof __DEV__ !== 'undefined' && __DEV__) {
37
- console.log('[usePremium] Hook called');
38
- }
39
36
  const { isPremium: subscriptionActive, isLoading: statusLoading } = useSubscriptionStatus();
40
37
  const { credits, isLoading: creditsLoading } = useCredits();
41
38
 
@@ -30,7 +30,16 @@ export class PackageHandler {
30
30
  }
31
31
 
32
32
  async fetchPackages(): Promise<PurchasesPackage[]> {
33
+ if (__DEV__) {
34
+ console.log('[DEBUG PackageHandler] fetchPackages called', {
35
+ hasService: !!this.service,
36
+ isInitialized: this.service?.isInitialized(),
37
+ });
38
+ }
33
39
  if (!this.service?.isInitialized()) {
40
+ if (__DEV__) {
41
+ console.log('[DEBUG PackageHandler] Service not initialized, returning empty');
42
+ }
34
43
  return [];
35
44
  }
36
45
 
@@ -95,6 +95,13 @@ class SubscriptionManagerImpl {
95
95
  }
96
96
 
97
97
  async getPackages(): Promise<PurchasesPackage[]> {
98
+ if (__DEV__) {
99
+ console.log('[DEBUG SubscriptionManager] getPackages called', {
100
+ isConfigured: this.isConfigured(),
101
+ isInitialized: this.isInitialized(),
102
+ hasServiceInstance: !!this.serviceInstance,
103
+ });
104
+ }
98
105
  this.ensureConfigured();
99
106
  if (!this.serviceInstance) {
100
107
  this.serviceInstance = getRevenueCatService();
@@ -57,11 +57,22 @@ function buildSuccessResult(
57
57
  return { success: true, offering: offerings.current, hasPremium };
58
58
  }
59
59
 
60
+ declare const __DEV__: boolean;
61
+
60
62
  export async function initializeSDK(
61
63
  deps: InitializerDeps,
62
64
  userId: string,
63
65
  apiKey?: string
64
66
  ): Promise<InitializeResult> {
67
+ if (__DEV__) {
68
+ console.log('[DEBUG RevenueCatInitializer] initializeSDK called', {
69
+ userId,
70
+ hasApiKey: !!apiKey,
71
+ isInitialized: deps.isInitialized(),
72
+ currentUserId: deps.getCurrentUserId(),
73
+ isPurchasesConfigured,
74
+ });
75
+ }
65
76
  // Case 1: Already initialized with the same user ID
66
77
  if (deps.isInitialized() && deps.getCurrentUserId() === userId) {
67
78
  try {
@@ -122,6 +133,9 @@ export async function initializeSDK(
122
133
  try {
123
134
  configureLogHandler();
124
135
 
136
+ if (__DEV__) {
137
+ console.log('[DEBUG RevenueCatInitializer] Configuring Purchases SDK with userId:', userId);
138
+ }
125
139
  await Purchases.configure({
126
140
  apiKey: key,
127
141
  appUserID: userId,
@@ -130,11 +144,21 @@ export async function initializeSDK(
130
144
  deps.setInitialized(true);
131
145
  deps.setCurrentUserId(userId);
132
146
 
147
+ if (__DEV__) {
148
+ console.log('[DEBUG RevenueCatInitializer] Purchases configured, fetching customer info and offerings...');
149
+ }
133
150
  const [customerInfo, offerings] = await Promise.all([
134
151
  Purchases.getCustomerInfo(),
135
152
  Purchases.getOfferings(),
136
153
  ]);
137
154
 
155
+ if (__DEV__) {
156
+ console.log('[DEBUG RevenueCatInitializer] Init complete', {
157
+ hasOfferings: !!offerings.current,
158
+ offeringsIdentifier: offerings.current?.identifier,
159
+ packagesCount: offerings.current?.availablePackages?.length ?? 0,
160
+ });
161
+ }
138
162
  return buildSuccessResult(deps, customerInfo, offerings);
139
163
  } catch (error) {
140
164
  getErrorMessage(error, "RevenueCat init failed");