@thealteroffice/react-native-adgeist 0.0.31-beta → 0.0.33-beta
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/Adgeist.podspec +1 -1
- package/README.md +10 -47
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/adgeist/components/HTML5AdViewManagerImpl.kt +4 -0
- package/android/src/main/java/com/adgeist/modules/AdgeistImpl.kt +11 -25
- package/android/src/main/java/com/adgeist/utils/CreativeExtensions.kt +0 -46
- package/android/src/newarch/java/com/Adgeist.kt +17 -63
- package/android/src/oldarch/java/com/Adgeist.kt +17 -64
- package/ios/Adgeist.mm +0 -4
- package/ios/AdgeistImpl.swift +17 -68
- package/lib/module/constants.js +1 -1
- package/lib/module/constants.js.map +1 -1
- package/lib/module/env.js +5 -0
- package/lib/module/env.js.map +1 -0
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/providers/AdgeistProvider.js +3 -2
- package/lib/module/providers/AdgeistProvider.js.map +1 -1
- package/lib/module/specs/NativeAdgeist.js.map +1 -1
- package/lib/typescript/src/constants.d.ts +1 -1
- package/lib/typescript/src/constants.d.ts.map +1 -1
- package/lib/typescript/src/env.d.ts +3 -0
- package/lib/typescript/src/env.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +0 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/providers/AdgeistProvider.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeAdgeist.d.ts +0 -1
- package/lib/typescript/src/specs/NativeAdgeist.d.ts.map +1 -1
- package/package.json +6 -4
- package/src/constants.ts +1 -1
- package/src/env.ts +3 -0
- package/src/index.tsx +0 -4
- package/src/providers/AdgeistProvider.tsx +3 -2
- package/src/specs/NativeAdgeist.ts +0 -2
- package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeAdgeistSpec.java +0 -88
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/HTML5AdNativeComponentManagerDelegate.java +0 -55
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/HTML5AdNativeComponentManagerInterface.java +0 -24
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -36
- package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec-generated.cpp +0 -104
- package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec.h +0 -31
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/ComponentDescriptors.cpp +0 -22
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/ComponentDescriptors.h +0 -24
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/EventEmitters.cpp +0 -60
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/EventEmitters.h +0 -49
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/Props.cpp +0 -28
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/Props.h +0 -69
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI-generated.cpp +0 -150
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI.h +0 -179
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/ShadowNodes.cpp +0 -17
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/ShadowNodes.h +0 -32
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/States.cpp +0 -16
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/States.h +0 -29
- package/android/libs/adgeistkit-beta-release.aar +0 -0
- package/lib/module/components/deprecated/BannerAdView.js +0 -375
- package/lib/module/components/deprecated/BannerAdView.js.map +0 -1
- package/lib/module/types/CPMAdResponse.js +0 -2
- package/lib/module/types/CPMAdResponse.js.map +0 -1
- package/lib/module/utmtracker/index.js +0 -25
- package/lib/module/utmtracker/index.js.map +0 -1
- package/lib/typescript/src/components/deprecated/BannerAdView.d.ts +0 -17
- package/lib/typescript/src/components/deprecated/BannerAdView.d.ts.map +0 -1
- package/lib/typescript/src/types/CPMAdResponse.d.ts +0 -29
- package/lib/typescript/src/types/CPMAdResponse.d.ts.map +0 -1
- package/lib/typescript/src/utmtracker/index.d.ts +0 -6
- package/lib/typescript/src/utmtracker/index.d.ts.map +0 -1
- package/src/components/deprecated/BannerAdView.tsx +0 -527
- package/src/types/CPMAdResponse.ts +0 -31
- package/src/utmtracker/index.ts +0 -26
|
@@ -1,527 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState, useRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Image,
|
|
4
|
-
Linking,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
Text,
|
|
7
|
-
View,
|
|
8
|
-
TouchableWithoutFeedback,
|
|
9
|
-
ActivityIndicator,
|
|
10
|
-
Dimensions,
|
|
11
|
-
} from 'react-native';
|
|
12
|
-
import Video from 'react-native-video';
|
|
13
|
-
import Adgeist from '../../specs/NativeAdgeist';
|
|
14
|
-
import { useAdgeistContext } from '../../providers/AdgeistProvider';
|
|
15
|
-
import { normalizeUrl } from '../../utilities';
|
|
16
|
-
import type { FIXEDADRESPONSE } from '../../types/FixedAdResponse';
|
|
17
|
-
import type { CPMADRESPONSE } from '../../types/CPMAdResponse';
|
|
18
|
-
|
|
19
|
-
interface AdBannerProps {
|
|
20
|
-
dataAdSlot: string;
|
|
21
|
-
dataSlotType?: 'banner' | 'video';
|
|
22
|
-
dataBuyType?: 'FIXED' | 'CPM';
|
|
23
|
-
width?: number;
|
|
24
|
-
height?: number;
|
|
25
|
-
isResponsive?: boolean;
|
|
26
|
-
responsiveType?: 'SQUARE' | 'VERTICAL' | 'WIDE';
|
|
27
|
-
onAdLoadError?: (error: Error) => void;
|
|
28
|
-
onAdLoadSuccess?: (adData: FIXEDADRESPONSE | CPMADRESPONSE) => void;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const BannerAd: React.FC<AdBannerProps> = ({
|
|
32
|
-
dataAdSlot,
|
|
33
|
-
dataSlotType = 'banner',
|
|
34
|
-
dataBuyType = 'FIXED',
|
|
35
|
-
width = 0,
|
|
36
|
-
height = 0,
|
|
37
|
-
isResponsive = false,
|
|
38
|
-
onAdLoadError,
|
|
39
|
-
onAdLoadSuccess,
|
|
40
|
-
}) => {
|
|
41
|
-
const [adData, setAdData] = useState<FIXEDADRESPONSE | CPMADRESPONSE | null>(
|
|
42
|
-
null
|
|
43
|
-
);
|
|
44
|
-
const [isMuted, setIsMuted] = useState<boolean>(true);
|
|
45
|
-
const [error, setError] = useState<Error | null>(null);
|
|
46
|
-
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
47
|
-
const [hasImpression, setHasImpression] = useState<boolean>(false);
|
|
48
|
-
const [hasView, setHasView] = useState<boolean>(false);
|
|
49
|
-
const [isPaused, setIsPaused] = useState<boolean>(true);
|
|
50
|
-
const [isManuallyControlled, setIsManuallyControlled] =
|
|
51
|
-
useState<boolean>(false);
|
|
52
|
-
const renderStartTime = useRef(Date.now());
|
|
53
|
-
const adRef = useRef<View>(null);
|
|
54
|
-
const visibilityStartTime = useRef<number | null>(null);
|
|
55
|
-
const timeToVisible = useRef<number | null>(null);
|
|
56
|
-
const viewTime = useRef<number>(0);
|
|
57
|
-
const lastCheckTime = useRef<number>(Date.now());
|
|
58
|
-
const currentVisibilityRatio = useRef<number>(0);
|
|
59
|
-
const videoRef = useRef<any>(null);
|
|
60
|
-
|
|
61
|
-
const { isInitialized, isTestEnvironment } = useAdgeistContext();
|
|
62
|
-
|
|
63
|
-
let creativeBrandName;
|
|
64
|
-
let creativeUrl;
|
|
65
|
-
let creativeTitle;
|
|
66
|
-
let creativeDescription;
|
|
67
|
-
let ctaUrl;
|
|
68
|
-
let bidMeta = '';
|
|
69
|
-
|
|
70
|
-
let bidId;
|
|
71
|
-
let campaignId;
|
|
72
|
-
let adSpaceId = dataAdSlot;
|
|
73
|
-
|
|
74
|
-
if (dataBuyType === 'FIXED') {
|
|
75
|
-
creativeTitle = (adData as FIXEDADRESPONSE)?.creatives?.[0]?.title;
|
|
76
|
-
creativeDescription = (adData as FIXEDADRESPONSE)?.creatives?.[0]
|
|
77
|
-
?.description;
|
|
78
|
-
creativeBrandName = (adData as FIXEDADRESPONSE)?.advertiser?.name;
|
|
79
|
-
creativeUrl = (adData as FIXEDADRESPONSE)?.creatives?.[0]?.fileUrl;
|
|
80
|
-
ctaUrl = (adData as FIXEDADRESPONSE)?.creatives?.[0]?.ctaUrl;
|
|
81
|
-
bidMeta = (adData as FIXEDADRESPONSE)?.metaData;
|
|
82
|
-
|
|
83
|
-
bidId = (adData as FIXEDADRESPONSE)?.id;
|
|
84
|
-
campaignId = (adData as FIXEDADRESPONSE)?.campaignId;
|
|
85
|
-
} else {
|
|
86
|
-
let cpmData = (adData as CPMADRESPONSE)?.data;
|
|
87
|
-
let creativeData = cpmData?.seatBid?.[0]?.bid?.[0]?.ext;
|
|
88
|
-
|
|
89
|
-
creativeTitle = creativeData?.creativeTitle;
|
|
90
|
-
creativeDescription = creativeData?.creativeDescription;
|
|
91
|
-
creativeBrandName = undefined; // Not available in CPM response
|
|
92
|
-
creativeUrl = creativeData?.creativeUrl;
|
|
93
|
-
ctaUrl = creativeData?.ctaUrl;
|
|
94
|
-
|
|
95
|
-
bidId = cpmData?.id;
|
|
96
|
-
campaignId = cpmData?.seatBid?.[0]?.bid?.[0]?.id;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const fetchAd = useCallback(async () => {
|
|
100
|
-
if (!isInitialized) return;
|
|
101
|
-
|
|
102
|
-
try {
|
|
103
|
-
setIsLoading(true);
|
|
104
|
-
setError(null);
|
|
105
|
-
setHasImpression(false);
|
|
106
|
-
setHasView(false);
|
|
107
|
-
|
|
108
|
-
const response = await Adgeist.fetchCreative(
|
|
109
|
-
dataAdSlot,
|
|
110
|
-
dataBuyType,
|
|
111
|
-
isTestEnvironment
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
const creative: { data: FIXEDADRESPONSE | CPMADRESPONSE } = response as {
|
|
115
|
-
data: FIXEDADRESPONSE | CPMADRESPONSE;
|
|
116
|
-
};
|
|
117
|
-
setAdData(creative.data);
|
|
118
|
-
onAdLoadSuccess?.(creative.data);
|
|
119
|
-
} catch (err) {
|
|
120
|
-
const error = err instanceof Error ? err : new Error('Ad load failed');
|
|
121
|
-
setError(error);
|
|
122
|
-
setHasImpression(false);
|
|
123
|
-
setHasView(false);
|
|
124
|
-
onAdLoadError?.(error);
|
|
125
|
-
} finally {
|
|
126
|
-
setIsLoading(false);
|
|
127
|
-
}
|
|
128
|
-
}, [
|
|
129
|
-
isInitialized,
|
|
130
|
-
dataBuyType,
|
|
131
|
-
dataAdSlot,
|
|
132
|
-
isTestEnvironment,
|
|
133
|
-
onAdLoadError,
|
|
134
|
-
onAdLoadSuccess,
|
|
135
|
-
]);
|
|
136
|
-
|
|
137
|
-
const trackImpressionOnMediaLoad = useCallback(async () => {
|
|
138
|
-
if (hasImpression || !bidId || !campaignId) return;
|
|
139
|
-
|
|
140
|
-
try {
|
|
141
|
-
const renderTime = Date.now() - renderStartTime.current;
|
|
142
|
-
|
|
143
|
-
await Adgeist.trackImpression(
|
|
144
|
-
campaignId,
|
|
145
|
-
adSpaceId,
|
|
146
|
-
bidId,
|
|
147
|
-
bidMeta,
|
|
148
|
-
dataBuyType,
|
|
149
|
-
isTestEnvironment,
|
|
150
|
-
renderTime
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
setHasImpression(true);
|
|
154
|
-
} catch (err) {
|
|
155
|
-
console.error('Failed to track impression:', err);
|
|
156
|
-
}
|
|
157
|
-
}, [
|
|
158
|
-
hasImpression,
|
|
159
|
-
bidId,
|
|
160
|
-
campaignId,
|
|
161
|
-
adSpaceId,
|
|
162
|
-
dataBuyType,
|
|
163
|
-
bidMeta,
|
|
164
|
-
isTestEnvironment,
|
|
165
|
-
]);
|
|
166
|
-
|
|
167
|
-
const trackView = useCallback(async () => {
|
|
168
|
-
if (hasView || !hasImpression || !bidId || !campaignId) return;
|
|
169
|
-
|
|
170
|
-
try {
|
|
171
|
-
const currentViewTime = viewTime.current;
|
|
172
|
-
const currentTimeToVisible = timeToVisible.current || 0;
|
|
173
|
-
const visibility = currentVisibilityRatio.current;
|
|
174
|
-
|
|
175
|
-
if (
|
|
176
|
-
currentViewTime >= (dataSlotType === 'video' ? 2000 : 1000) &&
|
|
177
|
-
visibility >= 0.5 &&
|
|
178
|
-
timeToVisible.current !== null
|
|
179
|
-
) {
|
|
180
|
-
await Adgeist.trackView(
|
|
181
|
-
campaignId,
|
|
182
|
-
adSpaceId,
|
|
183
|
-
bidId,
|
|
184
|
-
bidMeta,
|
|
185
|
-
dataBuyType,
|
|
186
|
-
isTestEnvironment,
|
|
187
|
-
currentViewTime,
|
|
188
|
-
visibility,
|
|
189
|
-
0,
|
|
190
|
-
currentTimeToVisible
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
setHasView(true);
|
|
194
|
-
}
|
|
195
|
-
} catch (err) {
|
|
196
|
-
console.error('Failed to track view:', err);
|
|
197
|
-
}
|
|
198
|
-
}, [
|
|
199
|
-
hasView,
|
|
200
|
-
hasImpression,
|
|
201
|
-
bidId,
|
|
202
|
-
campaignId,
|
|
203
|
-
adSpaceId,
|
|
204
|
-
dataBuyType,
|
|
205
|
-
bidMeta,
|
|
206
|
-
isTestEnvironment,
|
|
207
|
-
dataSlotType,
|
|
208
|
-
]);
|
|
209
|
-
|
|
210
|
-
const togglePlayPause = useCallback(() => {
|
|
211
|
-
setIsManuallyControlled(true);
|
|
212
|
-
setIsPaused((prev) => !prev);
|
|
213
|
-
}, []);
|
|
214
|
-
|
|
215
|
-
const checkVisibility = useCallback(() => {
|
|
216
|
-
if (!adRef.current || !hasImpression) return;
|
|
217
|
-
|
|
218
|
-
adRef.current.measure((_x, _y, _width, height, _pageX, pageY) => {
|
|
219
|
-
const window = Dimensions.get('window');
|
|
220
|
-
const windowHeight = window.height;
|
|
221
|
-
|
|
222
|
-
const adTop = pageY;
|
|
223
|
-
const adBottom = pageY + height;
|
|
224
|
-
const windowTop = 0;
|
|
225
|
-
const windowBottom = windowHeight;
|
|
226
|
-
|
|
227
|
-
const visibleTop = Math.max(adTop, windowTop);
|
|
228
|
-
const visibleBottom = Math.min(adBottom, windowBottom);
|
|
229
|
-
const visibleHeight = Math.max(0, visibleBottom - visibleTop);
|
|
230
|
-
const visibilityRatio = height > 0 ? visibleHeight / height : 0;
|
|
231
|
-
currentVisibilityRatio.current = visibilityRatio;
|
|
232
|
-
|
|
233
|
-
const currentTime = Date.now();
|
|
234
|
-
const deltaTime = currentTime - lastCheckTime.current;
|
|
235
|
-
lastCheckTime.current = currentTime;
|
|
236
|
-
|
|
237
|
-
if (visibilityRatio >= 0.5 && timeToVisible.current === null) {
|
|
238
|
-
timeToVisible.current = currentTime - renderStartTime.current;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
if (visibilityRatio >= 0.5) {
|
|
242
|
-
viewTime.current += deltaTime;
|
|
243
|
-
if (!visibilityStartTime.current) {
|
|
244
|
-
visibilityStartTime.current = currentTime;
|
|
245
|
-
}
|
|
246
|
-
if (dataSlotType === 'video' && isPaused && !isManuallyControlled) {
|
|
247
|
-
setIsPaused(false);
|
|
248
|
-
}
|
|
249
|
-
} else {
|
|
250
|
-
visibilityStartTime.current = null;
|
|
251
|
-
if (dataSlotType === 'video' && !isPaused) {
|
|
252
|
-
setIsPaused(true);
|
|
253
|
-
setIsManuallyControlled(false);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (
|
|
258
|
-
!hasView &&
|
|
259
|
-
viewTime.current >= (dataSlotType === 'video' ? 2000 : 1000) &&
|
|
260
|
-
visibilityRatio >= 0.5
|
|
261
|
-
) {
|
|
262
|
-
trackView();
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
}, [
|
|
266
|
-
hasImpression,
|
|
267
|
-
trackView,
|
|
268
|
-
dataSlotType,
|
|
269
|
-
isPaused,
|
|
270
|
-
hasView,
|
|
271
|
-
isManuallyControlled,
|
|
272
|
-
]);
|
|
273
|
-
|
|
274
|
-
const handleClick = useCallback(async () => {
|
|
275
|
-
if (
|
|
276
|
-
!adData ||
|
|
277
|
-
(dataBuyType == 'CPM' &&
|
|
278
|
-
!(adData as CPMADRESPONSE).data?.seatBid?.length) ||
|
|
279
|
-
!bidId ||
|
|
280
|
-
!campaignId
|
|
281
|
-
)
|
|
282
|
-
return;
|
|
283
|
-
|
|
284
|
-
try {
|
|
285
|
-
Adgeist.trackClick(
|
|
286
|
-
campaignId,
|
|
287
|
-
adSpaceId,
|
|
288
|
-
bidId,
|
|
289
|
-
bidMeta,
|
|
290
|
-
dataBuyType,
|
|
291
|
-
isTestEnvironment
|
|
292
|
-
);
|
|
293
|
-
|
|
294
|
-
await Linking.openURL(normalizeUrl(ctaUrl as string));
|
|
295
|
-
} catch (err) {
|
|
296
|
-
console.error('Failed to handle ad click:', err);
|
|
297
|
-
}
|
|
298
|
-
}, [
|
|
299
|
-
adData,
|
|
300
|
-
bidId,
|
|
301
|
-
campaignId,
|
|
302
|
-
adSpaceId,
|
|
303
|
-
bidMeta,
|
|
304
|
-
dataBuyType,
|
|
305
|
-
isTestEnvironment,
|
|
306
|
-
ctaUrl,
|
|
307
|
-
]);
|
|
308
|
-
|
|
309
|
-
useEffect(() => {
|
|
310
|
-
renderStartTime.current = Date.now();
|
|
311
|
-
lastCheckTime.current = Date.now();
|
|
312
|
-
fetchAd();
|
|
313
|
-
}, [fetchAd]);
|
|
314
|
-
|
|
315
|
-
useEffect(() => {
|
|
316
|
-
if (!hasImpression) return;
|
|
317
|
-
|
|
318
|
-
if (dataSlotType === 'banner' && hasView) return;
|
|
319
|
-
|
|
320
|
-
const intervalId = setInterval(checkVisibility, 200);
|
|
321
|
-
|
|
322
|
-
return () => {
|
|
323
|
-
clearInterval(intervalId);
|
|
324
|
-
};
|
|
325
|
-
}, [hasImpression, checkVisibility, dataSlotType, hasView]);
|
|
326
|
-
|
|
327
|
-
if (isLoading) {
|
|
328
|
-
return (
|
|
329
|
-
<View
|
|
330
|
-
style={[
|
|
331
|
-
styles.loadingOverlayContainer,
|
|
332
|
-
!isResponsive && { width: width, height: height },
|
|
333
|
-
]}
|
|
334
|
-
>
|
|
335
|
-
<ActivityIndicator size="large" color="#63AA75" />
|
|
336
|
-
</View>
|
|
337
|
-
);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
if (creativeUrl || error) return null;
|
|
341
|
-
|
|
342
|
-
return (
|
|
343
|
-
<TouchableWithoutFeedback
|
|
344
|
-
accessible
|
|
345
|
-
accessibilityLabel="Ad Banner"
|
|
346
|
-
style={{ width: '100%', height: '100%' }}
|
|
347
|
-
>
|
|
348
|
-
<View
|
|
349
|
-
ref={adRef}
|
|
350
|
-
style={[
|
|
351
|
-
styles.adContainer,
|
|
352
|
-
!isResponsive && { width: width, height: height },
|
|
353
|
-
]}
|
|
354
|
-
>
|
|
355
|
-
{dataSlotType === 'banner' ? (
|
|
356
|
-
<TouchableWithoutFeedback onPress={handleClick}>
|
|
357
|
-
<Image
|
|
358
|
-
style={styles.creative}
|
|
359
|
-
source={{ uri: creativeUrl }}
|
|
360
|
-
accessibilityLabel="Ad Creative"
|
|
361
|
-
resizeMode="contain"
|
|
362
|
-
onLoad={trackImpressionOnMediaLoad}
|
|
363
|
-
onError={(e) => {
|
|
364
|
-
console.error('Image load error:', e.nativeEvent.error);
|
|
365
|
-
setError(new Error('Failed to load ad image'));
|
|
366
|
-
}}
|
|
367
|
-
/>
|
|
368
|
-
</TouchableWithoutFeedback>
|
|
369
|
-
) : (
|
|
370
|
-
<View style={styles.videoCreative}>
|
|
371
|
-
<TouchableWithoutFeedback onPress={handleClick}>
|
|
372
|
-
<Video
|
|
373
|
-
ref={videoRef}
|
|
374
|
-
source={{ uri: creativeUrl }}
|
|
375
|
-
resizeMode="contain"
|
|
376
|
-
style={{ width: '100%', height: '100%' }}
|
|
377
|
-
repeat={true}
|
|
378
|
-
muted={isMuted}
|
|
379
|
-
paused={isPaused}
|
|
380
|
-
onLoad={trackImpressionOnMediaLoad}
|
|
381
|
-
onError={() => {
|
|
382
|
-
setError(new Error('Failed to load ad video'));
|
|
383
|
-
}}
|
|
384
|
-
/>
|
|
385
|
-
</TouchableWithoutFeedback>
|
|
386
|
-
<View style={styles.videoControls}>
|
|
387
|
-
<TouchableWithoutFeedback onPress={togglePlayPause}>
|
|
388
|
-
<Image
|
|
389
|
-
style={styles.playPauseIcon}
|
|
390
|
-
source={{
|
|
391
|
-
uri: isPaused
|
|
392
|
-
? 'https://d2cfeg6k9cklz9.cloudfront.net/ad-icons/Play.png'
|
|
393
|
-
: 'https://d2cfeg6k9cklz9.cloudfront.net/ad-icons/Pause.png',
|
|
394
|
-
}}
|
|
395
|
-
accessibilityLabel={
|
|
396
|
-
isPaused ? 'Paused video' : 'Playing video'
|
|
397
|
-
}
|
|
398
|
-
/>
|
|
399
|
-
</TouchableWithoutFeedback>
|
|
400
|
-
<TouchableWithoutFeedback onPress={() => setIsMuted(!isMuted)}>
|
|
401
|
-
<Image
|
|
402
|
-
style={styles.soundIcon}
|
|
403
|
-
source={{
|
|
404
|
-
uri: isMuted
|
|
405
|
-
? 'https://d2cfeg6k9cklz9.cloudfront.net/ad-icons/Muted.png'
|
|
406
|
-
: 'https://d2cfeg6k9cklz9.cloudfront.net/ad-icons/Unmuted.png',
|
|
407
|
-
}}
|
|
408
|
-
accessibilityLabel={isMuted ? 'Unmute video' : 'Mute video'}
|
|
409
|
-
/>
|
|
410
|
-
</TouchableWithoutFeedback>
|
|
411
|
-
</View>
|
|
412
|
-
</View>
|
|
413
|
-
)}
|
|
414
|
-
|
|
415
|
-
<View style={styles.adContent}>
|
|
416
|
-
<View style={styles.contentContainer}>
|
|
417
|
-
<Text style={styles.title} numberOfLines={1} ellipsizeMode="tail">
|
|
418
|
-
{creativeTitle}
|
|
419
|
-
</Text>
|
|
420
|
-
<Text
|
|
421
|
-
style={styles.description}
|
|
422
|
-
numberOfLines={1}
|
|
423
|
-
ellipsizeMode="tail"
|
|
424
|
-
>
|
|
425
|
-
{creativeDescription}
|
|
426
|
-
</Text>
|
|
427
|
-
{creativeBrandName && (
|
|
428
|
-
<Text
|
|
429
|
-
style={styles.brandName}
|
|
430
|
-
numberOfLines={1}
|
|
431
|
-
ellipsizeMode="tail"
|
|
432
|
-
>
|
|
433
|
-
{creativeBrandName || 'The Brand Name'}
|
|
434
|
-
</Text>
|
|
435
|
-
)}
|
|
436
|
-
</View>
|
|
437
|
-
<TouchableWithoutFeedback onPress={handleClick}>
|
|
438
|
-
<Image
|
|
439
|
-
style={styles.linkButton}
|
|
440
|
-
source={{
|
|
441
|
-
uri: 'https://d2cfeg6k9cklz9.cloudfront.net/ad-icons/Button.png',
|
|
442
|
-
}}
|
|
443
|
-
accessibilityLabel="Visit Advertiser Site"
|
|
444
|
-
/>
|
|
445
|
-
</TouchableWithoutFeedback>
|
|
446
|
-
</View>
|
|
447
|
-
</View>
|
|
448
|
-
</TouchableWithoutFeedback>
|
|
449
|
-
);
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
const styles = StyleSheet.create({
|
|
453
|
-
adContainer: {
|
|
454
|
-
backgroundColor: '#FFFFFF',
|
|
455
|
-
borderRadius: 5,
|
|
456
|
-
},
|
|
457
|
-
loadingOverlayContainer: {
|
|
458
|
-
alignItems: 'center',
|
|
459
|
-
justifyContent: 'center',
|
|
460
|
-
},
|
|
461
|
-
creative: {
|
|
462
|
-
resizeMode: 'contain',
|
|
463
|
-
borderTopLeftRadius: 5,
|
|
464
|
-
backgroundColor: '#FFFFFF',
|
|
465
|
-
borderTopRightRadius: 5,
|
|
466
|
-
width: '100%',
|
|
467
|
-
height: '70%',
|
|
468
|
-
},
|
|
469
|
-
videoCreative: {
|
|
470
|
-
position: 'relative',
|
|
471
|
-
width: '100%',
|
|
472
|
-
height: '70%',
|
|
473
|
-
},
|
|
474
|
-
videoControls: {},
|
|
475
|
-
playPauseIcon: {
|
|
476
|
-
position: 'absolute',
|
|
477
|
-
bottom: 8,
|
|
478
|
-
left: 10,
|
|
479
|
-
width: 30,
|
|
480
|
-
height: 30,
|
|
481
|
-
},
|
|
482
|
-
soundIcon: {
|
|
483
|
-
position: 'absolute',
|
|
484
|
-
bottom: 10,
|
|
485
|
-
right: 10,
|
|
486
|
-
width: 30,
|
|
487
|
-
height: 30,
|
|
488
|
-
},
|
|
489
|
-
adContent: {
|
|
490
|
-
width: '100%',
|
|
491
|
-
height: '30%',
|
|
492
|
-
backgroundColor: '#FFFFFF',
|
|
493
|
-
flexDirection: 'row',
|
|
494
|
-
justifyContent: 'space-between',
|
|
495
|
-
paddingVertical: 10,
|
|
496
|
-
paddingRight: 10,
|
|
497
|
-
paddingLeft: 20,
|
|
498
|
-
alignItems: 'center',
|
|
499
|
-
borderBottomLeftRadius: 5,
|
|
500
|
-
borderBottomRightRadius: 5,
|
|
501
|
-
},
|
|
502
|
-
contentContainer: {
|
|
503
|
-
flex: 1,
|
|
504
|
-
marginRight: 10,
|
|
505
|
-
},
|
|
506
|
-
title: {
|
|
507
|
-
color: '#1A1A1A',
|
|
508
|
-
fontSize: 16,
|
|
509
|
-
fontWeight: '600',
|
|
510
|
-
},
|
|
511
|
-
description: {
|
|
512
|
-
color: '#4A4A4A',
|
|
513
|
-
fontSize: 15,
|
|
514
|
-
marginBottom: 4,
|
|
515
|
-
},
|
|
516
|
-
brandName: {
|
|
517
|
-
color: '#6B7280',
|
|
518
|
-
fontSize: 14,
|
|
519
|
-
textTransform: 'capitalize',
|
|
520
|
-
opacity: 0.8,
|
|
521
|
-
},
|
|
522
|
-
linkButton: {
|
|
523
|
-
width: 80,
|
|
524
|
-
height: 40,
|
|
525
|
-
objectFit: 'contain',
|
|
526
|
-
},
|
|
527
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export interface CPMADRESPONSE {
|
|
2
|
-
success: boolean;
|
|
3
|
-
message: string;
|
|
4
|
-
data?: BidResponseData;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
interface BidResponseData {
|
|
8
|
-
id: string;
|
|
9
|
-
seatBid: SeatBid[];
|
|
10
|
-
bidId: string;
|
|
11
|
-
cur: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface SeatBid {
|
|
15
|
-
bidId: string;
|
|
16
|
-
bid: Bid[];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface Bid {
|
|
20
|
-
id: string;
|
|
21
|
-
impId: string;
|
|
22
|
-
price: number;
|
|
23
|
-
ext: BidExtension;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface BidExtension {
|
|
27
|
-
creativeUrl: string;
|
|
28
|
-
ctaUrl: string;
|
|
29
|
-
creativeTitle: string;
|
|
30
|
-
creativeDescription: string;
|
|
31
|
-
}
|
package/src/utmtracker/index.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import Adgeist from '../specs/NativeAdgeist';
|
|
2
|
-
|
|
3
|
-
class AdgeistError extends Error {
|
|
4
|
-
code?: string;
|
|
5
|
-
|
|
6
|
-
constructor(message: string, code?: string) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = 'AdgeistError';
|
|
9
|
-
this.code = code;
|
|
10
|
-
Object.setPrototypeOf(this, AdgeistError.prototype);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @param uri - string
|
|
16
|
-
* @throws AdgeistError if the operation fails
|
|
17
|
-
*/
|
|
18
|
-
export const trackConversionsWithDeepLinks = (uri: string): void => {
|
|
19
|
-
try {
|
|
20
|
-
Adgeist.trackDeeplinkUtm(uri);
|
|
21
|
-
} catch (error: unknown) {
|
|
22
|
-
const err =
|
|
23
|
-
error instanceof Error ? error : new Error('Failed to set user details');
|
|
24
|
-
throw new AdgeistError(err.message);
|
|
25
|
-
}
|
|
26
|
-
};
|