@umituz/react-native-subscription 2.12.13 → 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.13",
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 (
@@ -160,27 +172,33 @@ export const PaywallModal: React.FC<PaywallModalProps> = React.memo((props) => {
160
172
  </TouchableOpacity>
161
173
 
162
174
  <View style={styles.footer}>
163
- {legalUrls.termsUrl && (
164
- <TouchableOpacity onPress={() => {}}>
165
- <AtomicText type="bodySmall" style={[styles.footerLink, { color: tokens.colors.textSecondary }]}>
166
- {translations.termsOfServiceText}
167
- </AtomicText>
168
- </TouchableOpacity>
169
- )}
170
175
  {onRestore && (
171
- <TouchableOpacity onPress={handleRestore}>
176
+ <TouchableOpacity
177
+ onPress={handleRestore}
178
+ disabled={isProcessing}
179
+ style={[styles.restoreButton, isProcessing && styles.restoreButtonDisabled]}
180
+ >
172
181
  <AtomicText type="bodySmall" style={[styles.footerLink, { color: tokens.colors.textSecondary }]}>
173
- {translations.restoreButtonText}
174
- </AtomicText>
175
- </TouchableOpacity>
176
- )}
177
- {legalUrls.privacyUrl && (
178
- <TouchableOpacity onPress={() => {}}>
179
- <AtomicText type="bodySmall" style={[styles.footerLink, { color: tokens.colors.textSecondary }]}>
180
- {translations.privacyText}
182
+ {isProcessing ? translations.processingText : translations.restoreButtonText}
181
183
  </AtomicText>
182
184
  </TouchableOpacity>
183
185
  )}
186
+ <View style={styles.legalRow}>
187
+ {legalUrls.termsUrl && (
188
+ <TouchableOpacity onPress={() => handleLegalUrl(legalUrls.termsUrl)}>
189
+ <AtomicText type="bodySmall" style={[styles.footerLink, { color: tokens.colors.textSecondary }]}>
190
+ {translations.termsOfServiceText}
191
+ </AtomicText>
192
+ </TouchableOpacity>
193
+ )}
194
+ {legalUrls.privacyUrl && (
195
+ <TouchableOpacity onPress={() => handleLegalUrl(legalUrls.privacyUrl)}>
196
+ <AtomicText type="bodySmall" style={[styles.footerLink, { color: tokens.colors.textSecondary }]}>
197
+ {translations.privacyText}
198
+ </AtomicText>
199
+ </TouchableOpacity>
200
+ )}
201
+ </View>
184
202
  </View>
185
203
  </ScrollView>
186
204
  </View>
@@ -208,6 +226,9 @@ const styles = StyleSheet.create({
208
226
  cta: { borderRadius: 12, paddingVertical: 14, alignItems: "center", marginBottom: 12 },
209
227
  ctaDisabled: { opacity: 0.5 },
210
228
  ctaText: { fontWeight: "700" },
211
- footer: { flexDirection: "row", justifyContent: "center", gap: 16, flexWrap: "wrap" },
229
+ footer: { flexDirection: "column", alignItems: "center", gap: 8 },
230
+ restoreButton: { marginBottom: 8 },
231
+ restoreButtonDisabled: { opacity: 0.5 },
232
+ legalRow: { flexDirection: "row", justifyContent: "center", gap: 16 },
212
233
  footerLink: {},
213
234
  });