@upeex/ads-sdk 1.1.25 → 1.1.29
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/dist/index.js +45 -38
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -93,6 +93,8 @@ function AdBanner({ client, slot, baseUrl = 'https://app.upeex.com.br/ad', theme
|
|
|
93
93
|
const [modalVisible, setModalVisible] = useState(false);
|
|
94
94
|
const [canClose, setCanClose] = useState(false);
|
|
95
95
|
const progressAnim = useRef(new Animated.Value(0)).current;
|
|
96
|
+
// Ensures the popup is shown only once — refreshes update the ad silently
|
|
97
|
+
const hasShownPopup = useRef(false);
|
|
96
98
|
const log = (...args) => {
|
|
97
99
|
if (debug)
|
|
98
100
|
console.log('[UPEEX ADS]', ...args);
|
|
@@ -135,7 +137,8 @@ function AdBanner({ client, slot, baseUrl = 'https://app.upeex.com.br/ad', theme
|
|
|
135
137
|
}
|
|
136
138
|
setAd(data);
|
|
137
139
|
setError(null);
|
|
138
|
-
if (isPopup) {
|
|
140
|
+
if (isPopup && !hasShownPopup.current) {
|
|
141
|
+
hasShownPopup.current = true;
|
|
139
142
|
setModalVisible(true);
|
|
140
143
|
}
|
|
141
144
|
if (data.refresh && data.refresh > 0) {
|
|
@@ -172,16 +175,16 @@ function AdBanner({ client, slot, baseUrl = 'https://app.upeex.com.br/ad', theme
|
|
|
172
175
|
}
|
|
173
176
|
};
|
|
174
177
|
if (isPopup) {
|
|
175
|
-
return (jsx(Modal, { transparent: true, animationType: "fade", visible: true, onRequestClose: () => { }, children:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
178
|
+
return (jsx(Modal, { transparent: true, animationType: "fade", visible: true, onRequestClose: () => { }, children: jsx(View, { style: styles.modalBackground, children: jsxs(View, { style: styles.imageWrapper, children: [jsx(View, { style: styles.progressBarContainer, children: jsx(AnimatedView, { style: [
|
|
179
|
+
styles.progressBar,
|
|
180
|
+
{
|
|
181
|
+
width: progressAnim.interpolate({
|
|
182
|
+
inputRange: [0, 1],
|
|
183
|
+
outputRange: ['0%', '100%'],
|
|
184
|
+
}),
|
|
185
|
+
backgroundColor: '#fff',
|
|
186
|
+
},
|
|
187
|
+
] }) }), !canClose && (jsx(View, { style: styles.spinnerOverlay, children: jsx(ActivityIndicator, { size: "small", color: "#fff" }) })), canClose && (jsx(TouchableOpacity, { style: styles.closeButton, onPress: () => { }, children: jsx(Text, { style: styles.closeButtonText, children: "X" }) })), jsx(TouchableOpacity, { activeOpacity: 1, onPress: handleFallbackPress, children: jsx(Image, { source: { uri: fallbackImage }, style: styles.popupImage, resizeMode: "contain" }) })] }) }) }));
|
|
185
188
|
}
|
|
186
189
|
// Banner fallback
|
|
187
190
|
return (jsx(TouchableOpacity, { activeOpacity: 0.9, style: [styles.container, theme === 'dark' && styles.dark, style], onPress: handleFallbackPress, children: jsx(Image, { source: { uri: fallbackImage }, style: { width: 320, height: 50, resizeMode: 'contain' } }) }));
|
|
@@ -206,16 +209,16 @@ function AdBanner({ client, slot, baseUrl = 'https://app.upeex.com.br/ad', theme
|
|
|
206
209
|
};
|
|
207
210
|
// ─── POPUP ─────────────────────────────────────────────────────────────────
|
|
208
211
|
if (isPopup) {
|
|
209
|
-
return (jsx(Modal, { transparent: true, animationType: "fade", visible: modalVisible, onRequestClose: () => canClose && setModalVisible(false), children:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
212
|
+
return (jsx(Modal, { transparent: true, animationType: "fade", visible: modalVisible, onRequestClose: () => canClose && setModalVisible(false), children: jsx(View, { style: styles.modalBackground, children: jsxs(View, { style: styles.imageWrapper, children: [jsx(View, { style: styles.progressBarContainer, children: jsx(AnimatedView, { style: [
|
|
213
|
+
styles.progressBar,
|
|
214
|
+
{
|
|
215
|
+
width: progressAnim.interpolate({
|
|
216
|
+
inputRange: [0, 1],
|
|
217
|
+
outputRange: ['0%', '100%'],
|
|
218
|
+
}),
|
|
219
|
+
backgroundColor: '#fff',
|
|
220
|
+
},
|
|
221
|
+
] }) }), !canClose && (jsx(View, { style: styles.spinnerOverlay, children: jsx(ActivityIndicator, { size: "small", color: "#fff" }) })), canClose && (jsx(TouchableOpacity, { style: styles.closeButton, onPress: () => setModalVisible(false), children: jsx(Text, { style: styles.closeButtonText, children: "X" }) })), jsx(TouchableOpacity, { activeOpacity: 1, onPress: handlePress, children: jsx(Image, { source: { uri: ad.image }, style: styles.popupImage, resizeMode: "contain" }) })] }) }) }));
|
|
219
222
|
}
|
|
220
223
|
// ─── BANNER ────────────────────────────────────────────────────────────────
|
|
221
224
|
return (jsx(TouchableOpacity, { activeOpacity: 0.9, style: [styles.container, theme === 'dark' && styles.dark, style], onPress: handlePress, children: jsx(Image, { source: { uri: ad.image }, style: {
|
|
@@ -255,32 +258,33 @@ const styles = StyleSheet.create({
|
|
|
255
258
|
justifyContent: 'center',
|
|
256
259
|
alignItems: 'center',
|
|
257
260
|
},
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
// Wrapper that groups image + progress bar + close button together
|
|
262
|
+
imageWrapper: {
|
|
263
|
+
position: 'relative',
|
|
264
|
+
width: screenWidth * 0.88,
|
|
265
|
+
aspectRatio: 1,
|
|
266
|
+
maxWidth: 420,
|
|
267
|
+
},
|
|
268
|
+
popupImage: {
|
|
260
269
|
width: '100%',
|
|
261
270
|
height: '100%',
|
|
262
|
-
|
|
263
|
-
alignItems: 'center',
|
|
264
|
-
},
|
|
265
|
-
fullScreenImage: {
|
|
266
|
-
width: '90%',
|
|
267
|
-
height: '90%',
|
|
271
|
+
borderRadius: 8,
|
|
268
272
|
},
|
|
269
273
|
closeButton: {
|
|
270
274
|
position: 'absolute',
|
|
271
|
-
top:
|
|
272
|
-
right:
|
|
273
|
-
backgroundColor: 'rgba(0,0,0,0.
|
|
274
|
-
width:
|
|
275
|
-
height:
|
|
276
|
-
borderRadius:
|
|
275
|
+
top: 8,
|
|
276
|
+
right: 8,
|
|
277
|
+
backgroundColor: 'rgba(0,0,0,0.65)',
|
|
278
|
+
width: 32,
|
|
279
|
+
height: 32,
|
|
280
|
+
borderRadius: 16,
|
|
277
281
|
justifyContent: 'center',
|
|
278
282
|
alignItems: 'center',
|
|
279
283
|
zIndex: 999,
|
|
280
284
|
},
|
|
281
285
|
closeButtonText: {
|
|
282
286
|
color: '#fff',
|
|
283
|
-
fontSize:
|
|
287
|
+
fontSize: 15,
|
|
284
288
|
fontWeight: 'bold',
|
|
285
289
|
},
|
|
286
290
|
progressBarContainer: {
|
|
@@ -290,15 +294,18 @@ const styles = StyleSheet.create({
|
|
|
290
294
|
width: '100%',
|
|
291
295
|
height: 5,
|
|
292
296
|
backgroundColor: 'rgba(255,255,255,0.3)',
|
|
297
|
+
borderTopLeftRadius: 8,
|
|
298
|
+
borderTopRightRadius: 8,
|
|
293
299
|
zIndex: 1000,
|
|
294
300
|
},
|
|
295
301
|
progressBar: {
|
|
296
302
|
height: '100%',
|
|
303
|
+
borderTopLeftRadius: 8,
|
|
297
304
|
},
|
|
298
305
|
spinnerOverlay: {
|
|
299
306
|
position: 'absolute',
|
|
300
|
-
top:
|
|
301
|
-
right:
|
|
307
|
+
top: 10,
|
|
308
|
+
right: 10,
|
|
302
309
|
zIndex: 1000,
|
|
303
310
|
},
|
|
304
311
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upeex/ads-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.29",
|
|
4
4
|
"description": "Upeex Ads SDK for React Native and universal apps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -39,4 +39,4 @@
|
|
|
39
39
|
"react": "18.2.0",
|
|
40
40
|
"react-native": "0.73.0"
|
|
41
41
|
}
|
|
42
|
-
}
|
|
42
|
+
}
|