@umituz/react-native-subscription 2.41.2 → 2.41.4
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.4",
|
|
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",
|
|
@@ -130,18 +130,34 @@ const ManagedSubscriptionFlowInner: React.FC<ManagedSubscriptionFlowProps> = ({
|
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
// 1. Loading /
|
|
133
|
+
// 1. Loading / Initialization View
|
|
134
134
|
if (status === SubscriptionFlowStatus.INITIALIZING || !islocalizationReady) {
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
);
|
|
135
|
+
if (__DEV__) {
|
|
136
|
+
console.log('[ManagedSubscriptionFlow] ⏳ Rendering Initialization state', {
|
|
137
|
+
status,
|
|
138
|
+
islocalizationReady,
|
|
139
|
+
hasSplashConfig: !!splash,
|
|
140
|
+
isSplashComplete
|
|
141
|
+
});
|
|
143
142
|
}
|
|
144
|
-
|
|
143
|
+
|
|
144
|
+
// Even if no splash config provided, we should show a basic splash to avoid white screen
|
|
145
|
+
return (
|
|
146
|
+
<SplashScreen
|
|
147
|
+
appName={splash?.appName || "Loading..."}
|
|
148
|
+
tagline={splash?.tagline || "Please wait while we set things up"}
|
|
149
|
+
colors={tokens.colors}
|
|
150
|
+
/>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (__DEV__) {
|
|
155
|
+
console.log('[ManagedSubscriptionFlow] 🔄 Rendering Main state', {
|
|
156
|
+
status,
|
|
157
|
+
isSplashComplete,
|
|
158
|
+
islocalizationReady,
|
|
159
|
+
showFeedback: flowState.showFeedback
|
|
160
|
+
});
|
|
145
161
|
}
|
|
146
162
|
|
|
147
163
|
// 2. Onboarding View
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { createContext, useContext, useEffect } from "react";
|
|
2
2
|
import { useSubscriptionFlowStore, SubscriptionFlowStatus } from "../useSubscriptionFlow";
|
|
3
|
+
import { initializationState } from "../../infrastructure/state/initializationState";
|
|
3
4
|
|
|
4
5
|
interface SubscriptionFlowContextType {
|
|
5
6
|
status: SubscriptionFlowStatus;
|
|
@@ -10,8 +11,39 @@ const SubscriptionFlowContext = createContext<SubscriptionFlowContextType | unde
|
|
|
10
11
|
export const SubscriptionFlowProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
|
11
12
|
const store = useSubscriptionFlowStore();
|
|
12
13
|
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
// 1. Listen to background initialization state
|
|
16
|
+
const unsubscribe = initializationState.subscribe(() => {
|
|
17
|
+
const { initialized } = initializationState.getSnapshot();
|
|
18
|
+
if (__DEV__) {
|
|
19
|
+
console.log('[SubscriptionFlowProvider] 🔄 Initialization state updated:', { initialized });
|
|
20
|
+
}
|
|
21
|
+
if (initialized && !store.isInitialized) {
|
|
22
|
+
store.setInitialized(true);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Check initial state
|
|
27
|
+
const { initialized } = initializationState.getSnapshot();
|
|
28
|
+
if (initialized && !store.isInitialized) {
|
|
29
|
+
if (__DEV__) console.log('[SubscriptionFlowProvider] ✅ Already initialized on mount');
|
|
30
|
+
store.setInitialized(true);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return () => unsubscribe();
|
|
34
|
+
}, [store.isInitialized, store.setInitialized]);
|
|
35
|
+
|
|
13
36
|
useEffect(() => {
|
|
14
37
|
// This effect manages the overall flow status transition
|
|
38
|
+
if (__DEV__) {
|
|
39
|
+
console.log('[SubscriptionFlowProvider] 🧠 Calculating Status Transition', {
|
|
40
|
+
isInitialized: store.isInitialized,
|
|
41
|
+
isOnboardingComplete: store.isOnboardingComplete,
|
|
42
|
+
showPostOnboardingPaywall: store.showPostOnboardingPaywall,
|
|
43
|
+
currentStatus: store.status
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
15
47
|
if (!store.isInitialized) {
|
|
16
48
|
store.setStatus(SubscriptionFlowStatus.INITIALIZING);
|
|
17
49
|
return;
|
|
@@ -27,6 +59,7 @@ export const SubscriptionFlowProvider: React.FC<{ children: React.ReactNode }> =
|
|
|
27
59
|
return;
|
|
28
60
|
}
|
|
29
61
|
|
|
62
|
+
if (__DEV__) console.log('[SubscriptionFlowProvider] 🏆 Flow is READY');
|
|
30
63
|
store.setStatus(SubscriptionFlowStatus.READY);
|
|
31
64
|
}, [
|
|
32
65
|
store.isInitialized,
|