@umituz/react-native-subscription 2.12.15 โ†’ 2.12.16

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.15",
3
+ "version": "2.12.16",
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",
package/src/index.ts CHANGED
@@ -120,6 +120,8 @@ export {
120
120
  type SubscriptionDetailTranslations,
121
121
  } from "./presentation/screens/SubscriptionDetailScreen";
122
122
 
123
+ export { type DevTestActions } from "./presentation/screens/components/DevTestSection";
124
+
123
125
 
124
126
  // =============================================================================
125
127
  // UTILS - Date & Price
@@ -5,11 +5,12 @@
5
5
  */
6
6
 
7
7
  import React from "react";
8
- import { ScrollView, StyleSheet } from "react-native";
8
+ import { View, ScrollView, StyleSheet } from "react-native";
9
9
  import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
  import { SubscriptionHeader } from "./components/SubscriptionHeader";
11
11
  import { CreditsList } from "./components/CreditsList";
12
12
  import { SubscriptionActions } from "./components/SubscriptionActions";
13
+ import { DevTestSection, type DevTestActions } from "./components/DevTestSection";
13
14
  import type { SubscriptionStatusType } from "../components/details/PremiumStatusBadge";
14
15
  import type { CreditInfo } from "../components/details/PremiumDetailsCard";
15
16
 
@@ -41,6 +42,10 @@ export interface SubscriptionDetailConfig {
41
42
  translations: SubscriptionDetailTranslations;
42
43
  onManageSubscription?: () => void;
43
44
  onUpgrade?: () => void;
45
+ devTools?: {
46
+ actions: DevTestActions;
47
+ title?: string;
48
+ };
44
49
  }
45
50
 
46
51
  export interface SubscriptionDetailScreenProps {
@@ -54,39 +59,48 @@ export const SubscriptionDetailScreen: React.FC<
54
59
  const showCredits = config.credits && config.credits.length > 0;
55
60
 
56
61
  return (
57
- <ScrollView
58
- style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}
59
- contentContainerStyle={styles.content}
60
- >
61
- <SubscriptionHeader
62
- statusType={config.statusType}
63
- isPremium={config.isPremium}
64
- isLifetime={config.isLifetime}
65
- expirationDate={config.expirationDate}
66
- purchaseDate={config.purchaseDate}
67
- daysRemaining={config.daysRemaining}
68
- translations={config.translations}
69
- />
62
+ <View style={{ flex: 1 }}>
63
+ <ScrollView
64
+ style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}
65
+ contentContainerStyle={styles.content}
66
+ >
67
+ <SubscriptionHeader
68
+ statusType={config.statusType}
69
+ isPremium={config.isPremium}
70
+ isLifetime={config.isLifetime}
71
+ expirationDate={config.expirationDate}
72
+ purchaseDate={config.purchaseDate}
73
+ daysRemaining={config.daysRemaining}
74
+ translations={config.translations}
75
+ />
76
+
77
+ {showCredits && (
78
+ <CreditsList
79
+ credits={config.credits!}
80
+ title={
81
+ config.translations.usageTitle || config.translations.creditsTitle
82
+ }
83
+ description={config.translations.creditsResetInfo}
84
+ remainingLabel={config.translations.remainingLabel}
85
+ />
86
+ )}
70
87
 
71
- {showCredits && (
72
- <CreditsList
73
- credits={config.credits!}
74
- title={
75
- config.translations.usageTitle || config.translations.creditsTitle
76
- }
77
- description={config.translations.creditsResetInfo}
78
- remainingLabel={config.translations.remainingLabel}
88
+ <SubscriptionActions
89
+ isPremium={config.isPremium}
90
+ manageButtonLabel={config.translations.manageButton}
91
+ upgradeButtonLabel={config.translations.upgradeButton}
92
+ onManage={config.onManageSubscription}
93
+ onUpgrade={config.onUpgrade}
79
94
  />
80
- )}
95
+ </ScrollView>
81
96
 
82
- <SubscriptionActions
83
- isPremium={config.isPremium}
84
- manageButtonLabel={config.translations.manageButton}
85
- upgradeButtonLabel={config.translations.upgradeButton}
86
- onManage={config.onManageSubscription}
87
- onUpgrade={config.onUpgrade}
88
- />
89
- </ScrollView>
97
+ {config.devTools && (
98
+ <DevTestSection
99
+ actions={config.devTools.actions}
100
+ title={config.devTools.title}
101
+ />
102
+ )}
103
+ </View>
90
104
  );
91
105
  };
92
106
 
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Dev Test Section
3
+ * Developer testing tools for subscription renewals
4
+ * Only visible in __DEV__ mode
5
+ */
6
+
7
+ import React from "react";
8
+ import { View, TouchableOpacity, StyleSheet } from "react-native";
9
+ import { AtomicText, useAppDesignTokens } from "@umituz/react-native-design-system";
10
+
11
+ export interface DevTestActions {
12
+ onTestRenewal: () => Promise<void>;
13
+ onCheckCredits: () => void;
14
+ onTestDuplicate: () => Promise<void>;
15
+ }
16
+
17
+ export interface DevTestSectionProps {
18
+ actions: DevTestActions;
19
+ title?: string;
20
+ }
21
+
22
+ export const DevTestSection: React.FC<DevTestSectionProps> = ({
23
+ actions,
24
+ title = "๐Ÿงช Developer Testing",
25
+ }) => {
26
+ const tokens = useAppDesignTokens();
27
+
28
+ if (!__DEV__) {
29
+ return null;
30
+ }
31
+
32
+ return (
33
+ <View
34
+ style={[
35
+ styles.container,
36
+ {
37
+ backgroundColor: tokens.colors.surfaceSecondary,
38
+ borderTopColor: tokens.colors.border,
39
+ },
40
+ ]}
41
+ >
42
+ <AtomicText
43
+ type="titleMedium"
44
+ style={[styles.title, { color: tokens.colors.textPrimary }]}
45
+ >
46
+ {title}
47
+ </AtomicText>
48
+
49
+ <TouchableOpacity
50
+ style={[styles.button, { backgroundColor: tokens.colors.primary }]}
51
+ onPress={actions.onTestRenewal}
52
+ >
53
+ <AtomicText
54
+ type="bodyMedium"
55
+ style={[styles.buttonText, { color: tokens.colors.onPrimary }]}
56
+ >
57
+ โšก Test Auto-Renewal (Add Credits)
58
+ </AtomicText>
59
+ </TouchableOpacity>
60
+
61
+ <TouchableOpacity
62
+ style={[
63
+ styles.button,
64
+ {
65
+ backgroundColor: tokens.colors.surfaceSecondary,
66
+ borderWidth: 1,
67
+ borderColor: tokens.colors.border,
68
+ },
69
+ ]}
70
+ onPress={actions.onCheckCredits}
71
+ >
72
+ <AtomicText
73
+ type="bodyMedium"
74
+ style={[styles.buttonText, { color: tokens.colors.textPrimary }]}
75
+ >
76
+ ๐Ÿ“Š Check Current Credits
77
+ </AtomicText>
78
+ </TouchableOpacity>
79
+
80
+ <TouchableOpacity
81
+ style={[
82
+ styles.button,
83
+ {
84
+ backgroundColor: tokens.colors.surfaceSecondary,
85
+ borderWidth: 1,
86
+ borderColor: tokens.colors.border,
87
+ },
88
+ ]}
89
+ onPress={actions.onTestDuplicate}
90
+ >
91
+ <AtomicText
92
+ type="bodyMedium"
93
+ style={[styles.buttonText, { color: tokens.colors.textPrimary }]}
94
+ >
95
+ ๐Ÿ”’ Test Duplicate Protection
96
+ </AtomicText>
97
+ </TouchableOpacity>
98
+ </View>
99
+ );
100
+ };
101
+
102
+ const styles = StyleSheet.create({
103
+ container: {
104
+ padding: 16,
105
+ gap: 12,
106
+ borderTopWidth: 1,
107
+ },
108
+ title: {
109
+ fontWeight: "600",
110
+ marginBottom: 4,
111
+ },
112
+ button: {
113
+ paddingVertical: 12,
114
+ paddingHorizontal: 16,
115
+ borderRadius: 8,
116
+ alignItems: "center",
117
+ },
118
+ buttonText: {
119
+ fontWeight: "500",
120
+ },
121
+ });