@umituz/react-native-subscription 2.12.14 → 2.12.15

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.12.14",
3
+ "version": "2.12.15",
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 React, { useState, useCallback } from "react";
7
- import { View, ScrollView, StyleSheet, TouchableOpacity, ActivityIndicator } from "react-native";
7
+ import { View, ScrollView, StyleSheet, TouchableOpacity, ActivityIndicator, Linking } from "react-native";
8
8
  import { BaseModal, useAppDesignTokens, AtomicText, AtomicIcon } from "@umituz/react-native-design-system";
9
9
  import type { PurchasesPackage } from "react-native-purchases";
10
10
  import { PlanCard } from "./PlanCard";
@@ -80,6 +80,18 @@ export const PaywallModal: React.FC<PaywallModalProps> = React.memo((props) => {
80
80
  }
81
81
  }, [onRestore, isProcessing]);
82
82
 
83
+ const handleLegalUrl = useCallback(async (url: string | undefined) => {
84
+ if (!url) return;
85
+ try {
86
+ const supported = await Linking.canOpenURL(url);
87
+ if (supported) {
88
+ await Linking.openURL(url);
89
+ }
90
+ } catch (error) {
91
+ // Silent fail
92
+ }
93
+ }, []);
94
+
83
95
  const isPurchaseDisabled = showSubscription ? !selectedPlanId : !selectedCreditId;
84
96
 
85
97
  return (
@@ -161,22 +173,26 @@ export const PaywallModal: React.FC<PaywallModalProps> = React.memo((props) => {
161
173
 
162
174
  <View style={styles.footer}>
163
175
  {onRestore && (
164
- <TouchableOpacity onPress={handleRestore} style={styles.restoreButton}>
176
+ <TouchableOpacity
177
+ onPress={handleRestore}
178
+ disabled={isProcessing}
179
+ style={[styles.restoreButton, isProcessing && styles.restoreButtonDisabled]}
180
+ >
165
181
  <AtomicText type="bodySmall" style={[styles.footerLink, { color: tokens.colors.textSecondary }]}>
166
- {translations.restoreButtonText}
182
+ {isProcessing ? translations.processingText : translations.restoreButtonText}
167
183
  </AtomicText>
168
184
  </TouchableOpacity>
169
185
  )}
170
186
  <View style={styles.legalRow}>
171
187
  {legalUrls.termsUrl && (
172
- <TouchableOpacity onPress={() => {}}>
188
+ <TouchableOpacity onPress={() => handleLegalUrl(legalUrls.termsUrl)}>
173
189
  <AtomicText type="bodySmall" style={[styles.footerLink, { color: tokens.colors.textSecondary }]}>
174
190
  {translations.termsOfServiceText}
175
191
  </AtomicText>
176
192
  </TouchableOpacity>
177
193
  )}
178
194
  {legalUrls.privacyUrl && (
179
- <TouchableOpacity onPress={() => {}}>
195
+ <TouchableOpacity onPress={() => handleLegalUrl(legalUrls.privacyUrl)}>
180
196
  <AtomicText type="bodySmall" style={[styles.footerLink, { color: tokens.colors.textSecondary }]}>
181
197
  {translations.privacyText}
182
198
  </AtomicText>
@@ -212,6 +228,7 @@ const styles = StyleSheet.create({
212
228
  ctaText: { fontWeight: "700" },
213
229
  footer: { flexDirection: "column", alignItems: "center", gap: 8 },
214
230
  restoreButton: { marginBottom: 8 },
231
+ restoreButtonDisabled: { opacity: 0.5 },
215
232
  legalRow: { flexDirection: "row", justifyContent: "center", gap: 16 },
216
233
  footerLink: {},
217
234
  });