@umituz/react-native-subscription 2.41.5 → 2.41.7
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.41.
|
|
3
|
+
"version": "2.41.7",
|
|
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",
|
|
@@ -8,6 +8,9 @@ import type {
|
|
|
8
8
|
import { detectPackageType } from "../../../utils/packageTypeDetector";
|
|
9
9
|
import { PACKAGE_TYPE, PURCHASE_TYPE, type Platform } from "../../subscription/core/SubscriptionConstants";
|
|
10
10
|
|
|
11
|
+
/** Maximum number of purchase history entries to retain per user */
|
|
12
|
+
const MAX_PURCHASE_HISTORY_SIZE = 10;
|
|
13
|
+
|
|
11
14
|
interface MetadataGeneratorConfig {
|
|
12
15
|
productId: string;
|
|
13
16
|
source: PurchaseSource;
|
|
@@ -44,7 +47,7 @@ export function generatePurchaseMetadata(
|
|
|
44
47
|
timestamp: Timestamp.fromDate(new Date()),
|
|
45
48
|
};
|
|
46
49
|
|
|
47
|
-
const purchaseHistory = [...existingData.purchaseHistory, newMetadata].slice(-
|
|
50
|
+
const purchaseHistory = [...existingData.purchaseHistory, newMetadata].slice(-MAX_PURCHASE_HISTORY_SIZE);
|
|
48
51
|
|
|
49
52
|
return { purchaseType, purchaseHistory };
|
|
50
53
|
}
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
} from "../providers/SubscriptionFlowProvider";
|
|
77
77
|
import { SubscriptionFlowStatus } from "../useSubscriptionFlow";
|
|
78
78
|
|
|
79
|
-
const ManagedSubscriptionFlowInner
|
|
79
|
+
const ManagedSubscriptionFlowInner = React.memo<ManagedSubscriptionFlowProps>(({
|
|
80
80
|
children,
|
|
81
81
|
navigation,
|
|
82
82
|
islocalizationReady,
|
|
@@ -198,7 +198,7 @@ const ManagedSubscriptionFlowInner: React.FC<ManagedSubscriptionFlowProps> = ({
|
|
|
198
198
|
)}
|
|
199
199
|
</>
|
|
200
200
|
);
|
|
201
|
-
};
|
|
201
|
+
});
|
|
202
202
|
|
|
203
203
|
export const ManagedSubscriptionFlow: React.FC<ManagedSubscriptionFlowProps> = (props) => {
|
|
204
204
|
return (
|
|
@@ -64,14 +64,11 @@ const initialState: SubscriptionFlowState = {
|
|
|
64
64
|
export const useSubscriptionFlowStore = createStore<SubscriptionFlowState, SubscriptionFlowActions>({
|
|
65
65
|
name: "subscription-flow-storage",
|
|
66
66
|
initialState,
|
|
67
|
-
persist:
|
|
68
|
-
// Only persist onboarding and paywall status, other states are transient
|
|
69
|
-
partialize: (state) => ({
|
|
70
|
-
isOnboardingComplete: state.isOnboardingComplete,
|
|
71
|
-
paywallShown: state.paywallShown,
|
|
72
|
-
}),
|
|
67
|
+
persist: false,
|
|
73
68
|
onRehydrate: (state) => {
|
|
74
|
-
state.
|
|
69
|
+
if (!state.isInitialized) {
|
|
70
|
+
state.setInitialized(true);
|
|
71
|
+
}
|
|
75
72
|
},
|
|
76
73
|
actions: (set) => ({
|
|
77
74
|
completeOnboarding: async () => {
|