@umituz/react-native-subscription 2.12.43 → 2.12.45
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.
|
|
3
|
+
"version": "2.12.45",
|
|
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",
|
|
@@ -33,9 +33,11 @@ export const PremiumDetailsCard: React.FC<PremiumDetailsCardProps> = ({
|
|
|
33
33
|
<View style={[styles.card, { backgroundColor: tokens.colors.surface }]}>
|
|
34
34
|
{(isPremium || showCredits) && (
|
|
35
35
|
<View style={styles.header}>
|
|
36
|
-
<
|
|
37
|
-
{
|
|
38
|
-
|
|
36
|
+
<View style={styles.headerTitleContainer}>
|
|
37
|
+
<AtomicText type="titleLarge" style={{ color: tokens.colors.textPrimary }}>
|
|
38
|
+
{translations.title}
|
|
39
|
+
</AtomicText>
|
|
40
|
+
</View>
|
|
39
41
|
<PremiumStatusBadge
|
|
40
42
|
status={statusType}
|
|
41
43
|
activeLabel={translations.statusActive}
|
|
@@ -154,6 +156,10 @@ const styles = StyleSheet.create({
|
|
|
154
156
|
justifyContent: "space-between",
|
|
155
157
|
alignItems: "center",
|
|
156
158
|
},
|
|
159
|
+
headerTitleContainer: {
|
|
160
|
+
flex: 1,
|
|
161
|
+
marginRight: 12,
|
|
162
|
+
},
|
|
157
163
|
freeUserHeader: {
|
|
158
164
|
marginBottom: 4,
|
|
159
165
|
},
|
|
@@ -51,9 +51,11 @@ export const SubscriptionHeader: React.FC<SubscriptionHeaderProps> = ({
|
|
|
51
51
|
return (
|
|
52
52
|
<View style={[styles.container, { backgroundColor: tokens.colors.surface }]}>
|
|
53
53
|
<View style={styles.header}>
|
|
54
|
-
<
|
|
55
|
-
{
|
|
56
|
-
|
|
54
|
+
<View style={styles.titleContainer}>
|
|
55
|
+
<AtomicText type="headlineSmall" style={[styles.title, { color: tokens.colors.textPrimary }]}>
|
|
56
|
+
{translations.title}
|
|
57
|
+
</AtomicText>
|
|
58
|
+
</View>
|
|
57
59
|
<PremiumStatusBadge
|
|
58
60
|
status={statusType}
|
|
59
61
|
activeLabel={translations.statusActive}
|
|
@@ -136,6 +138,10 @@ const styles = StyleSheet.create({
|
|
|
136
138
|
justifyContent: "space-between",
|
|
137
139
|
alignItems: "center",
|
|
138
140
|
},
|
|
141
|
+
titleContainer: {
|
|
142
|
+
flex: 1,
|
|
143
|
+
marginRight: 12,
|
|
144
|
+
},
|
|
139
145
|
title: {
|
|
140
146
|
fontWeight: "700",
|
|
141
147
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import {
|
|
6
6
|
isSubscriptionExpired,
|
|
7
7
|
getDaysUntilExpiration,
|
|
8
|
-
} from '../
|
|
8
|
+
} from '../dateValidationUtils';
|
|
9
9
|
|
|
10
10
|
describe('Date Validation Utils', () => {
|
|
11
11
|
describe('isSubscriptionExpired', () => {
|
|
@@ -22,7 +22,7 @@ describe('Date Validation Utils', () => {
|
|
|
22
22
|
customerId: null,
|
|
23
23
|
syncedAt: null,
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
expect(isSubscriptionExpired(status)).toBe(true);
|
|
27
27
|
});
|
|
28
28
|
|
|
@@ -35,14 +35,14 @@ describe('Date Validation Utils', () => {
|
|
|
35
35
|
customerId: 'customer123',
|
|
36
36
|
syncedAt: '2024-01-01T00:00:00.000Z',
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
expect(isSubscriptionExpired(status)).toBe(false);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
it('should return false for future expiration', () => {
|
|
43
43
|
const futureDate = new Date();
|
|
44
44
|
futureDate.setDate(futureDate.getDate() + 30);
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
const status = {
|
|
47
47
|
isPremium: true,
|
|
48
48
|
expiresAt: futureDate.toISOString(),
|
|
@@ -51,14 +51,14 @@ describe('Date Validation Utils', () => {
|
|
|
51
51
|
customerId: 'customer123',
|
|
52
52
|
syncedAt: '2024-01-01T00:00:00.000Z',
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
expect(isSubscriptionExpired(status)).toBe(false);
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
it('should return true for past expiration', () => {
|
|
59
59
|
const pastDate = new Date();
|
|
60
60
|
pastDate.setDate(pastDate.getDate() - 1);
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
const status = {
|
|
63
63
|
isPremium: true,
|
|
64
64
|
expiresAt: pastDate.toISOString(),
|
|
@@ -67,7 +67,7 @@ describe('Date Validation Utils', () => {
|
|
|
67
67
|
customerId: 'customer123',
|
|
68
68
|
syncedAt: '2024-01-01T00:00:00.000Z',
|
|
69
69
|
};
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
const result = getDaysUntilExpiration(status);
|
|
72
72
|
expect(result === 0 || result === -0).toBe(true);
|
|
73
73
|
});
|
|
@@ -87,14 +87,14 @@ describe('Date Validation Utils', () => {
|
|
|
87
87
|
customerId: 'customer123',
|
|
88
88
|
syncedAt: '2024-01-01T00:00:00.000Z',
|
|
89
89
|
};
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
expect(getDaysUntilExpiration(status)).toBeNull();
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
it('should return positive days for future expiration', () => {
|
|
95
95
|
const futureDate = new Date();
|
|
96
96
|
futureDate.setDate(futureDate.getDate() + 5);
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
const status = {
|
|
99
99
|
isPremium: true,
|
|
100
100
|
expiresAt: futureDate.toISOString(),
|
|
@@ -103,14 +103,14 @@ describe('Date Validation Utils', () => {
|
|
|
103
103
|
customerId: 'customer123',
|
|
104
104
|
syncedAt: '2024-01-01T00:00:00.000Z',
|
|
105
105
|
};
|
|
106
|
-
|
|
106
|
+
|
|
107
107
|
expect(getDaysUntilExpiration(status)).toBe(5);
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
it('should return 0 for past expiration', () => {
|
|
111
111
|
const pastDate = new Date();
|
|
112
112
|
pastDate.setDate(pastDate.getDate() - 5);
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
const status = {
|
|
115
115
|
isPremium: true,
|
|
116
116
|
expiresAt: pastDate.toISOString(),
|
|
@@ -119,14 +119,14 @@ describe('Date Validation Utils', () => {
|
|
|
119
119
|
customerId: 'customer123',
|
|
120
120
|
syncedAt: '2024-01-01T00:00:00.000Z',
|
|
121
121
|
};
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
expect(getDaysUntilExpiration(status)).toBe(0);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
it('should return 0 for today expiration', () => {
|
|
127
127
|
const today = new Date();
|
|
128
128
|
today.setHours(0, 0, 0, 0); // Start of today
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
const status = {
|
|
131
131
|
isPremium: true,
|
|
132
132
|
expiresAt: today.toISOString(),
|
|
@@ -135,7 +135,7 @@ describe('Date Validation Utils', () => {
|
|
|
135
135
|
customerId: 'customer123',
|
|
136
136
|
syncedAt: '2024-01-01T00:00:00.000Z',
|
|
137
137
|
};
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
expect(getDaysUntilExpiration(status)).toBe(0);
|
|
140
140
|
});
|
|
141
141
|
});
|