apps-sdk 1.1.69 → 1.1.70
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
|
@@ -18,8 +18,24 @@ class AdaptyOnboarding extends React.Component {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
componentDidMount() {
|
|
21
|
-
const { placementID, lang } = this.props;
|
|
22
|
-
|
|
21
|
+
const { preloadedOnboarding, placementID, lang } = this.props;
|
|
22
|
+
|
|
23
|
+
// If preloaded onboarding is provided, use it immediately (no loading screen!)
|
|
24
|
+
if (preloadedOnboarding) {
|
|
25
|
+
console.log('[ONBOARDING] Using preloaded onboarding data - skipping load');
|
|
26
|
+
this.remoteConfig = preloadedOnboarding.remoteConfig || {};
|
|
27
|
+
|
|
28
|
+
if (this.props.onRemoteConfigLoaded && this.remoteConfig) {
|
|
29
|
+
config.DEBUG_MODE && console.log('Remote config loaded from preload:', this.remoteConfig);
|
|
30
|
+
this.props.onRemoteConfigLoaded(this.remoteConfig);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
this.setState({ onboarding: preloadedOnboarding, isLoading: false });
|
|
34
|
+
} else {
|
|
35
|
+
// Fallback to loading if not preloaded
|
|
36
|
+
console.log('[ONBOARDING] No preloaded data, loading normally');
|
|
37
|
+
this.loadOnboarding(placementID, lang);
|
|
38
|
+
}
|
|
23
39
|
}
|
|
24
40
|
|
|
25
41
|
async componentDidUpdate(prevProps) {
|
|
@@ -27,21 +43,24 @@ class AdaptyOnboarding extends React.Component {
|
|
|
27
43
|
const { placementID, lang } = this.props;
|
|
28
44
|
await this.loadOnboarding(placementID, lang);
|
|
29
45
|
}
|
|
46
|
+
if (!this.props.visible && prevProps.visible) {
|
|
47
|
+
this.handleModalDismiss();
|
|
48
|
+
}
|
|
30
49
|
}
|
|
31
50
|
|
|
32
51
|
loadOnboarding = async (placementID, lang) => {
|
|
33
52
|
try {
|
|
34
53
|
this.setState({ isLoading: true });
|
|
35
54
|
const onboarding = await Adapty.getOnboardingForPlacement(placementID, lang);
|
|
36
|
-
|
|
55
|
+
|
|
37
56
|
if (onboarding) {
|
|
38
57
|
this.remoteConfig = onboarding.remoteConfig || {};
|
|
39
|
-
|
|
58
|
+
|
|
40
59
|
if (this.props.onRemoteConfigLoaded && this.remoteConfig) {
|
|
41
60
|
config.DEBUG_MODE && console.log('Remote config loaded:', this.remoteConfig);
|
|
42
61
|
this.props.onRemoteConfigLoaded(this.remoteConfig);
|
|
43
62
|
}
|
|
44
|
-
|
|
63
|
+
|
|
45
64
|
this.setState({ onboarding, isLoading: false });
|
|
46
65
|
} else {
|
|
47
66
|
console.log('Onboarding not found for placement:', placementID, 'and language:', lang);
|
|
@@ -82,7 +101,7 @@ class AdaptyOnboarding extends React.Component {
|
|
|
82
101
|
|
|
83
102
|
handleModalDismiss = () => {
|
|
84
103
|
config.DEBUG_MODE && console.log('AdaptyOnboarding Modal fully dismissed');
|
|
85
|
-
|
|
104
|
+
|
|
86
105
|
// Reset state after modal is fully dismissed
|
|
87
106
|
this.currentStep = 0;
|
|
88
107
|
this.totalSteps = 0;
|
|
@@ -97,10 +116,10 @@ class AdaptyOnboarding extends React.Component {
|
|
|
97
116
|
if (meta && typeof meta === 'object') {
|
|
98
117
|
this.currentStep = meta.screen_index ?? this.currentStep;
|
|
99
118
|
this.totalSteps = meta.total_screens ?? this.totalSteps;
|
|
100
|
-
|
|
119
|
+
|
|
101
120
|
config.DEBUG_MODE && console.log('State updated AdaptyOnboarding:', {action, meta, currentStep: this.currentStep, totalSteps: this.totalSteps});
|
|
102
121
|
}
|
|
103
|
-
|
|
122
|
+
|
|
104
123
|
if (this.props.onStateUpdated) {
|
|
105
124
|
this.props.onStateUpdated(action, meta, this.remoteConfig);
|
|
106
125
|
}
|
|
@@ -108,16 +127,16 @@ class AdaptyOnboarding extends React.Component {
|
|
|
108
127
|
|
|
109
128
|
handleError = (error) => {
|
|
110
129
|
console.log('Onboarding error:', error);
|
|
111
|
-
|
|
130
|
+
|
|
112
131
|
// Check if it's a WebResource ORB error (common on Android)
|
|
113
132
|
const isORBError = error?.message?.includes('ERR_BLOCKED_BY_ORB');
|
|
114
|
-
|
|
133
|
+
|
|
115
134
|
if (isORBError) {
|
|
116
135
|
config.DEBUG_MODE && console.log('WebResource ORB error detected - non-critical, continuing');
|
|
117
136
|
// Don't propagate ORB errors as they don't break functionality
|
|
118
137
|
return false; // Continue
|
|
119
138
|
}
|
|
120
|
-
|
|
139
|
+
|
|
121
140
|
if (this.props.onError) {
|
|
122
141
|
this.props.onError(error, this.remoteConfig);
|
|
123
142
|
}
|
|
@@ -126,7 +145,7 @@ class AdaptyOnboarding extends React.Component {
|
|
|
126
145
|
|
|
127
146
|
handleAnalytics = (event, data) => {
|
|
128
147
|
config.DEBUG_MODE && console.log('Onboarding analytics AdaptyOnboarding:', event, data);
|
|
129
|
-
|
|
148
|
+
|
|
130
149
|
if (this.props.onAnalytics) {
|
|
131
150
|
this.props.onAnalytics(event, data, this.remoteConfig);
|
|
132
151
|
}
|
|
@@ -134,7 +153,7 @@ class AdaptyOnboarding extends React.Component {
|
|
|
134
153
|
|
|
135
154
|
handlePaywall = (actionId, meta) => {
|
|
136
155
|
config.DEBUG_MODE && console.log('Onboarding paywall AdaptyOnboarding:', actionId, meta);
|
|
137
|
-
|
|
156
|
+
|
|
138
157
|
if (this.props.onPaywall) {
|
|
139
158
|
this.props.onPaywall(actionId, meta, this.remoteConfig);
|
|
140
159
|
}
|
|
@@ -142,7 +161,7 @@ class AdaptyOnboarding extends React.Component {
|
|
|
142
161
|
|
|
143
162
|
handleFinishedLoading = (meta) => {
|
|
144
163
|
config.DEBUG_MODE && console.log('Onboarding finished loading AdaptyOnboarding:', meta);
|
|
145
|
-
|
|
164
|
+
|
|
146
165
|
if (this.props.onFinishedLoading) {
|
|
147
166
|
this.props.onFinishedLoading(meta, this.remoteConfig);
|
|
148
167
|
}
|
|
@@ -177,20 +196,7 @@ class AdaptyOnboarding extends React.Component {
|
|
|
177
196
|
</View>
|
|
178
197
|
);
|
|
179
198
|
|
|
180
|
-
return
|
|
181
|
-
<Modal
|
|
182
|
-
visible={visible}
|
|
183
|
-
animationType="slide"
|
|
184
|
-
presentationStyle="fullScreen"
|
|
185
|
-
onRequestClose={() => {
|
|
186
|
-
config.DEBUG_MODE && console.log('Modal onRequestClose prevented');
|
|
187
|
-
return false;
|
|
188
|
-
}}
|
|
189
|
-
onDismiss={this.handleModalDismiss}
|
|
190
|
-
>
|
|
191
|
-
{content}
|
|
192
|
-
</Modal>
|
|
193
|
-
);
|
|
199
|
+
return content;
|
|
194
200
|
}
|
|
195
201
|
}
|
|
196
202
|
|