@umituz/react-native-subscription 3.1.1 → 3.1.2

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": "3.1.1",
3
+ "version": "3.1.2",
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",
@@ -144,7 +144,7 @@ export const PaywallScreen: React.FC<PaywallScreenProps> = React.memo((props) =>
144
144
  tokens={tokens}
145
145
  translations={translations}
146
146
  heroImage={heroImage}
147
- selectedPlanId={selectedPlanId}
147
+ selectedPlanId={selectedPlanId ?? undefined}
148
148
  bestValueIdentifier={bestValueIdentifier}
149
149
  creditAmounts={creditAmounts}
150
150
  creditsLabel={creditsLabel}
@@ -154,7 +154,7 @@ export const PaywallScreen: React.FC<PaywallScreenProps> = React.memo((props) =>
154
154
  }, [tokens, translations, heroImage, selectedPlanId, bestValueIdentifier, creditAmounts, creditsLabel, setSelectedPlanId]);
155
155
 
156
156
  // Performance Optimization: getItemLayout for FlatList
157
- const getItemLayout = useCallback((_data: ArrayLike<PaywallListItem> | null, index: number) => {
157
+ const getItemLayout = useCallback((_data: ArrayLike<PaywallListItem> | null | undefined, index: number) => {
158
158
  return calculatePaywallItemLayout(flatData, index);
159
159
  }, [flatData]);
160
160
 
@@ -9,7 +9,7 @@ export class UserIdResolver {
9
9
  async resolveCreditsUserId(revenueCatUserId: string | null | undefined): Promise<string> {
10
10
  // Try revenueCatUserId first
11
11
  const trimmed = revenueCatUserId?.trim();
12
- if (this.isValidUserId(trimmed)) {
12
+ if (trimmed && this.isValidUserId(trimmed)) {
13
13
  return trimmed;
14
14
  }
15
15
 
@@ -69,8 +69,8 @@ export function updateLiveRefs(
69
69
  const { creditBalance, hasSubscription, onShowPaywall, requiredCredits, isCreditsLoaded } = params;
70
70
 
71
71
  state.creditBalanceRef.current = creditBalance;
72
- state.hasSubscriptionRef.current = hasSubscription;
72
+ state.hasSubscriptionRef.current = hasSubscription ?? false;
73
73
  state.onShowPaywallRef.current = onShowPaywall;
74
- state.requiredCreditsRef.current = requiredCredits;
74
+ state.requiredCreditsRef.current = requiredCredits ?? 0;
75
75
  state.isCreditsLoadedRef.current = isCreditsLoaded;
76
76
  }