@thealteroffice/react-native-adgeist 0.0.3 → 0.0.5

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.
Files changed (38) hide show
  1. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeAdgeistSpec.java +42 -0
  2. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
  3. package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec-generated.cpp +38 -0
  4. package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec.h +31 -0
  5. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI-generated.cpp +45 -0
  6. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI.h +80 -0
  7. package/android/build.gradle +1 -1
  8. package/android/src/main/java/com/adgeist/AdgeistPackage.kt +15 -7
  9. package/android/src/main/java/com/adgeist/implementation/AdgeistModuleImpl.kt +63 -40
  10. package/android/src/newarch/java/com/AdgeistModule.kt +4 -4
  11. package/android/src/oldarch/java/com/AdgeistModule.kt +4 -4
  12. package/ios/Adgeist.mm +26 -9
  13. package/ios/AdgeistImpl.swift +7 -0
  14. package/lib/module/NativeAdgeist.js.map +1 -1
  15. package/lib/module/components/AdgeistProvider.js +29 -0
  16. package/lib/module/components/AdgeistProvider.js.map +1 -0
  17. package/lib/module/components/BannerAd.js +87 -109
  18. package/lib/module/components/BannerAd.js.map +1 -1
  19. package/lib/module/index.js +1 -1
  20. package/lib/module/index.js.map +1 -1
  21. package/lib/typescript/src/NativeAdgeist.d.ts +2 -2
  22. package/lib/typescript/src/NativeAdgeist.d.ts.map +1 -1
  23. package/lib/typescript/src/components/AdgeistProvider.d.ts +18 -0
  24. package/lib/typescript/src/components/AdgeistProvider.d.ts.map +1 -0
  25. package/lib/typescript/src/components/BannerAd.d.ts +0 -1
  26. package/lib/typescript/src/components/BannerAd.d.ts.map +1 -1
  27. package/lib/typescript/src/index.d.ts +1 -1
  28. package/lib/typescript/src/index.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/NativeAdgeist.ts +12 -2
  31. package/src/components/AdgeistProvider.tsx +41 -0
  32. package/src/components/BannerAd.tsx +123 -108
  33. package/src/index.tsx +1 -1
  34. package/lib/module/components/BottomBannerAd.js +0 -150
  35. package/lib/module/components/BottomBannerAd.js.map +0 -1
  36. package/lib/typescript/src/components/BottomBannerAd.d.ts +0 -8
  37. package/lib/typescript/src/components/BottomBannerAd.d.ts.map +0 -1
  38. package/src/components/BottomBannerAd.tsx +0 -185
@@ -7,113 +7,155 @@ import {
7
7
  Text,
8
8
  View,
9
9
  TouchableWithoutFeedback,
10
+ ActivityIndicator,
10
11
  } from 'react-native';
11
12
  import Adgeist from '../NativeAdgeist';
13
+ import { useAdgeistContext } from './AdgeistProvider';
12
14
 
13
- interface Creative {
14
- fileUrl: string;
15
- title: string;
16
- description: string;
17
- ctaUrl?: string;
15
+ interface AdData {
16
+ id: string;
17
+ bidId: string;
18
+ cur: string;
19
+ seatBid: SeatBid[];
18
20
  }
19
21
 
20
- interface AdData {
21
- _id: string;
22
- creative: Creative;
22
+ interface SeatBid {
23
+ bidId: string;
24
+ bid: Bid[];
25
+ }
26
+
27
+ interface Bid {
28
+ id: string;
29
+ impId: string;
30
+ price: number;
31
+ ext: BidExtension;
23
32
  }
24
33
 
34
+ interface BidExtension {
35
+ creativeUrl: string;
36
+ ctaUrl: string;
37
+ creativeTitle: string;
38
+ creativeDescription: string;
39
+ creativeBrandName?: string;
40
+ }
25
41
  interface AdBannerTypes {
26
- dataPublisherId: string;
27
42
  dataAdSlot: string;
28
43
  width: number;
29
44
  height: number;
30
45
  }
31
46
 
32
- export const BannerAd: React.FC<AdBannerTypes> = ({
33
- dataPublisherId,
34
- dataAdSlot,
35
- width,
36
- height,
37
- }) => {
47
+ export const BannerAd: React.FC<AdBannerTypes> = ({ dataAdSlot }) => {
38
48
  const [adData, setAdData] = useState<AdData | null>(null);
49
+ const [isLoading, setIsLoading] = useState(false);
50
+ const { publisherId, apiKey, domain, isTestEnvironment } =
51
+ useAdgeistContext();
52
+
53
+ const creativeData = adData?.seatBid?.[0]?.bid?.[0]?.ext as BidExtension;
39
54
 
40
55
  useEffect(() => {
41
56
  (async () => {
42
57
  try {
58
+ setIsLoading(true);
43
59
  const response: Object = await Adgeist.fetchCreative(
60
+ apiKey,
61
+ domain,
44
62
  dataAdSlot,
45
- dataPublisherId
63
+ publisherId,
64
+ isTestEnvironment
46
65
  );
66
+
47
67
  const creative: { data: AdData } = response as { data: AdData };
48
68
  setAdData(creative.data);
69
+ setIsLoading(false);
49
70
 
50
- await Adgeist.sendCreativeAnalytic(
51
- creative.data._id,
52
- dataAdSlot,
53
- dataPublisherId,
54
- 'impression'
55
- );
71
+ if (creative.data.seatBid.length > 0) {
72
+ await Adgeist.sendCreativeAnalytic(
73
+ creative.data.seatBid?.[0]?.bid?.[0]?.id || '',
74
+ dataAdSlot,
75
+ publisherId,
76
+ 'IMPRESSION',
77
+ domain,
78
+ apiKey,
79
+ creative.data.id,
80
+ isTestEnvironment
81
+ );
82
+ }
56
83
  } catch (error) {
57
84
  console.error('Ad load failed:', error);
58
85
  }
59
86
  })();
60
- }, [dataPublisherId, dataAdSlot]);
87
+ }, [publisherId, dataAdSlot, apiKey, domain, isTestEnvironment]);
61
88
 
62
89
  const handleClick = async () => {
63
- if (adData?.creative?.ctaUrl) {
90
+ if (adData && adData?.seatBid.length > 0) {
64
91
  await Adgeist.sendCreativeAnalytic(
65
- adData._id,
92
+ adData?.seatBid?.[0]?.bid?.[0]?.id || '',
66
93
  dataAdSlot,
67
- dataPublisherId,
68
- 'click'
94
+ publisherId,
95
+ 'CLICK',
96
+ domain,
97
+ apiKey,
98
+ adData.id,
99
+ isTestEnvironment
69
100
  );
70
- Linking.openURL(adData.creative.ctaUrl).catch((err) =>
101
+ Linking.openURL(creativeData.ctaUrl).catch((err) =>
71
102
  console.error('Failed to open URL:', err)
72
103
  );
73
104
  }
74
105
  };
75
106
 
76
- if (!adData?.creative?.fileUrl) return null;
107
+ if (isLoading) {
108
+ return (
109
+ <View style={styles.loadingOverlayContainer}>
110
+ <ActivityIndicator size="large" color="#63AA75" />
111
+ </View>
112
+ );
113
+ }
114
+
115
+ if (!creativeData?.creativeUrl) return null;
77
116
 
78
117
  return (
79
118
  <TouchableWithoutFeedback accessible accessibilityLabel="Ad Banner">
80
- <View style={styles.container}>
119
+ <View style={styles.adContainer}>
81
120
  <Image
82
- style={[styles.creative, { width, height }]}
83
- source={{ uri: adData.creative.fileUrl }}
121
+ style={[styles.creative, { width: '100%', height: 300 }]}
122
+ source={{ uri: creativeData.creativeUrl }}
84
123
  />
85
- <View style={styles.options}>
86
- <Text style={styles.option}>x</Text>
87
- <Text style={styles.option}>i</Text>
88
- </View>
89
124
  <View style={styles.adContent}>
90
- <Image
91
- style={styles.logo}
92
- source={{ uri: adData.creative.fileUrl }}
93
- />
94
- <View style={styles.textContainer}>
95
- <View style={styles.titleRow}>
96
- <Text style={styles.adBadge}>AD</Text>
97
- <Text style={styles.title} numberOfLines={1} ellipsizeMode="tail">
98
- {adData.creative.title}
99
- </Text>
100
- </View>
125
+ <View style={styles.contentContainer}>
126
+ <Text style={styles.title} numberOfLines={1} ellipsizeMode="tail">
127
+ {creativeData.creativeTitle}
128
+ </Text>
129
+
101
130
  <Text
102
131
  style={styles.description}
103
132
  numberOfLines={1}
104
133
  ellipsizeMode="tail"
105
134
  >
106
- {adData.creative.description}
135
+ {creativeData.creativeDescription}
136
+ </Text>
137
+
138
+ <Text
139
+ style={styles.brandName}
140
+ numberOfLines={1}
141
+ ellipsizeMode="tail"
142
+ >
143
+ {creativeData?.creativeBrandName || 'Brand Name'}
107
144
  </Text>
108
145
  </View>
109
146
  <TouchableWithoutFeedback
110
- onPress={handleClick}
147
+ onPress={() => {
148
+ handleClick();
149
+ }}
111
150
  accessible
112
151
  accessibilityLabel="Visit Site Button"
113
152
  >
114
- <View style={styles.button}>
115
- <Text style={styles.buttonText}>Visit Site</Text>
116
- </View>
153
+ <Image
154
+ style={[styles.linkButton]}
155
+ source={{
156
+ uri: 'https://d2cfeg6k9cklz9.cloudfront.net/onboarding-icons/Button.png',
157
+ }}
158
+ />
117
159
  </TouchableWithoutFeedback>
118
160
  </View>
119
161
  </View>
@@ -122,81 +164,54 @@ export const BannerAd: React.FC<AdBannerTypes> = ({
122
164
  };
123
165
 
124
166
  const styles = StyleSheet.create({
125
- container: {
167
+ adContainer: {
168
+ width: Dimensions.get('window').width,
126
169
  backgroundColor: 'white',
127
- borderRadius: 10,
128
- },
129
- creative: {
130
- resizeMode: 'contain',
131
- borderTopLeftRadius: 10,
132
- borderTopRightRadius: 10,
170
+ borderRadius: 5,
133
171
  },
134
- options: {
135
- flexDirection: 'row',
136
- gap: 2,
137
- position: 'absolute',
138
- top: 5,
139
- left: 5,
172
+ loadingOverlayContainer: {
173
+ width: '100%',
174
+ height: 375,
175
+ alignItems: 'center',
176
+ justifyContent: 'center',
140
177
  },
141
- option: {
142
- color: 'green',
143
- backgroundColor: '#00000022',
144
- width: 20,
145
- height: 20,
146
- textAlign: 'center',
178
+ creative: {
179
+ resizeMode: 'cover',
180
+ borderTopLeftRadius: 5,
181
+ borderTopRightRadius: 5,
147
182
  },
148
183
  adContent: {
149
184
  width: '100%',
150
185
  backgroundColor: 'white',
151
186
  flexDirection: 'row',
152
187
  justifyContent: 'space-between',
153
- paddingHorizontal: 10,
154
188
  paddingVertical: 10,
189
+ paddingHorizontal: 20,
155
190
  alignItems: 'center',
156
- borderBottomLeftRadius: 10,
157
- borderBottomRightRadius: 10,
158
- borderTopColor: '#00000022',
159
- borderTopWidth: 1,
160
- },
161
- logo: {
162
- width: 35,
163
- height: 35,
164
- resizeMode: 'contain',
165
- borderRadius: 2,
166
- },
167
- textContainer: {
168
- width: Dimensions.get('window').width - 150,
169
- },
170
- titleRow: {
171
- flexDirection: 'row',
172
- alignItems: 'center',
173
- gap: 5,
174
- width: Dimensions.get('window').width - 200,
191
+ borderBottomLeftRadius: 5,
192
+ borderBottomRightRadius: 5,
175
193
  },
176
- adBadge: {
177
- color: 'white',
178
- backgroundColor: 'green',
179
- width: 40,
180
- borderRadius: 4,
181
- textAlign: 'center',
194
+ contentContainer: {
195
+ width: Dimensions.get('window').width - 100,
182
196
  },
183
197
  title: {
184
198
  color: 'black',
199
+ fontSize: 18,
200
+ fontWeight: 'bold',
185
201
  },
186
202
  description: {
187
203
  color: 'black',
204
+ fontSize: 16,
188
205
  },
189
- button: {
190
- paddingHorizontal: 10,
191
- paddingVertical: 5,
192
- borderWidth: 1,
193
- borderColor: 'green',
194
- borderRadius: 5,
195
- alignItems: 'center',
196
- justifyContent: 'center',
197
- height: 40,
206
+ brandName: {
207
+ color: 'black',
208
+ fontSize: 16,
209
+ opacity: 0.6,
210
+ marginTop: 5,
211
+ fontWeight: 'semibold',
198
212
  },
199
- buttonText: {
200
- color: 'green',
213
+ linkButton: {
214
+ width: 40,
215
+ height: 40,
201
216
  },
202
217
  });
package/src/index.tsx CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from './components/BannerAd';
2
- export * from './components/BottomBannerAd';
2
+ export * from './components/AdgeistProvider';
@@ -1,150 +0,0 @@
1
- "use strict";
2
-
3
- import React, { useEffect, useState } from 'react';
4
- import { Dimensions, Image, Linking, StyleSheet, Text, View, TouchableOpacity, TouchableWithoutFeedback } from 'react-native';
5
- import Adgeist from "../NativeAdgeist.js";
6
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
- export const BottomBannerAd = ({
8
- dataPublisherId,
9
- dataAdSlot
10
- }) => {
11
- const [adData, setAdData] = useState(null);
12
- useEffect(() => {
13
- (async () => {
14
- try {
15
- const response = await Adgeist.fetchCreative(dataAdSlot, dataPublisherId);
16
- const creative = response;
17
- setAdData(creative.data);
18
- await Adgeist.sendCreativeAnalytic(creative.data._id, dataAdSlot, dataPublisherId, 'impression');
19
- } catch (error) {
20
- console.error('Ad load failed:', error);
21
- }
22
- })();
23
- }, [dataPublisherId, dataAdSlot]);
24
- const handleClick = async () => {
25
- if (adData?.creative?.ctaUrl) {
26
- await Adgeist.sendCreativeAnalytic(adData._id, dataAdSlot, dataPublisherId, 'click');
27
- Linking.openURL(adData.creative.ctaUrl).catch(err => console.error('Failed to open URL:', err));
28
- }
29
- };
30
- if (!adData?.creative?.fileUrl) return null;
31
- return /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
32
- style: styles.container,
33
- onPress: handleClick,
34
- accessible: true,
35
- accessibilityLabel: "Ad Banner",
36
- children: /*#__PURE__*/_jsxs(View, {
37
- style: styles.adContent,
38
- children: [/*#__PURE__*/_jsx(Image, {
39
- style: styles.logo,
40
- source: {
41
- uri: adData.creative.fileUrl
42
- }
43
- }), /*#__PURE__*/_jsxs(View, {
44
- style: styles.textContainer,
45
- children: [/*#__PURE__*/_jsxs(View, {
46
- style: styles.titleRow,
47
- children: [/*#__PURE__*/_jsx(Text, {
48
- style: styles.adBadge,
49
- children: "AD"
50
- }), /*#__PURE__*/_jsx(Text, {
51
- style: styles.title,
52
- numberOfLines: 1,
53
- ellipsizeMode: "tail",
54
- children: adData.creative.title
55
- })]
56
- }), /*#__PURE__*/_jsx(Text, {
57
- style: styles.description,
58
- numberOfLines: 1,
59
- ellipsizeMode: "tail",
60
- children: adData.creative.description
61
- })]
62
- }), /*#__PURE__*/_jsx(TouchableOpacity, {
63
- style: styles.button,
64
- onPress: handleClick,
65
- accessible: true,
66
- accessibilityLabel: "Visit Site Button",
67
- children: /*#__PURE__*/_jsx(Text, {
68
- style: styles.buttonText,
69
- children: "Visit Site"
70
- })
71
- })]
72
- })
73
- });
74
- };
75
- const styles = StyleSheet.create({
76
- container: {
77
- backgroundColor: 'white',
78
- borderRadius: 10
79
- },
80
- creative: {
81
- resizeMode: 'contain',
82
- borderTopLeftRadius: 10,
83
- borderTopRightRadius: 10
84
- },
85
- options: {
86
- flexDirection: 'row',
87
- gap: 2,
88
- position: 'absolute',
89
- top: 5,
90
- left: 5
91
- },
92
- option: {
93
- color: 'green',
94
- backgroundColor: '#00000022',
95
- width: 20,
96
- height: 20,
97
- textAlign: 'center'
98
- },
99
- adContent: {
100
- width: '100%',
101
- backgroundColor: 'white',
102
- flexDirection: 'row',
103
- justifyContent: 'space-between',
104
- paddingHorizontal: 10,
105
- paddingVertical: 10,
106
- alignItems: 'center'
107
- },
108
- logo: {
109
- width: 35,
110
- height: 35,
111
- resizeMode: 'contain',
112
- borderRadius: 2
113
- },
114
- textContainer: {
115
- width: Dimensions.get('window').width - 150
116
- },
117
- titleRow: {
118
- flexDirection: 'row',
119
- alignItems: 'center',
120
- gap: 5,
121
- width: Dimensions.get('window').width - 200
122
- },
123
- adBadge: {
124
- color: 'white',
125
- backgroundColor: 'green',
126
- width: 40,
127
- borderRadius: 4,
128
- textAlign: 'center'
129
- },
130
- title: {
131
- color: 'black'
132
- },
133
- description: {
134
- color: 'black'
135
- },
136
- button: {
137
- paddingHorizontal: 10,
138
- paddingVertical: 5,
139
- borderWidth: 1,
140
- borderColor: 'green',
141
- borderRadius: 5,
142
- alignItems: 'center',
143
- justifyContent: 'center',
144
- height: 40
145
- },
146
- buttonText: {
147
- color: 'green'
148
- }
149
- });
150
- //# sourceMappingURL=BottomBannerAd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useEffect","useState","Dimensions","Image","Linking","StyleSheet","Text","View","TouchableOpacity","TouchableWithoutFeedback","Adgeist","jsx","_jsx","jsxs","_jsxs","BottomBannerAd","dataPublisherId","dataAdSlot","adData","setAdData","response","fetchCreative","creative","data","sendCreativeAnalytic","_id","error","console","handleClick","ctaUrl","openURL","catch","err","fileUrl","style","styles","container","onPress","accessible","accessibilityLabel","children","adContent","logo","source","uri","textContainer","titleRow","adBadge","title","numberOfLines","ellipsizeMode","description","button","buttonText","create","backgroundColor","borderRadius","resizeMode","borderTopLeftRadius","borderTopRightRadius","options","flexDirection","gap","position","top","left","option","color","width","height","textAlign","justifyContent","paddingHorizontal","paddingVertical","alignItems","get","borderWidth","borderColor"],"sourceRoot":"../../../src","sources":["components/BottomBannerAd.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SACEC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,UAAU,EACVC,IAAI,EACJC,IAAI,EACJC,gBAAgB,EAChBC,wBAAwB,QACnB,cAAc;AACrB,OAAOC,OAAO,MAAM,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAmBvC,OAAO,MAAMC,cAAuC,GAAGA,CAAC;EACtDC,eAAe;EACfC;AACF,CAAC,KAAK;EACJ,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGlB,QAAQ,CAAgB,IAAI,CAAC;EAEzDD,SAAS,CAAC,MAAM;IACd,CAAC,YAAY;MACX,IAAI;QACF,MAAMoB,QAAgB,GAAG,MAAMV,OAAO,CAACW,aAAa,CAClDJ,UAAU,EACVD,eACF,CAAC;QACD,MAAMM,QAA0B,GAAGF,QAA4B;QAC/DD,SAAS,CAACG,QAAQ,CAACC,IAAI,CAAC;QACxB,MAAMb,OAAO,CAACc,oBAAoB,CAChCF,QAAQ,CAACC,IAAI,CAACE,GAAG,EACjBR,UAAU,EACVD,eAAe,EACf,YACF,CAAC;MACH,CAAC,CAAC,OAAOU,KAAK,EAAE;QACdC,OAAO,CAACD,KAAK,CAAC,iBAAiB,EAAEA,KAAK,CAAC;MACzC;IACF,CAAC,EAAE,CAAC;EACN,CAAC,EAAE,CAACV,eAAe,EAAEC,UAAU,CAAC,CAAC;EAEjC,MAAMW,WAAW,GAAG,MAAAA,CAAA,KAAY;IAC9B,IAAIV,MAAM,EAAEI,QAAQ,EAAEO,MAAM,EAAE;MAC5B,MAAMnB,OAAO,CAACc,oBAAoB,CAChCN,MAAM,CAACO,GAAG,EACVR,UAAU,EACVD,eAAe,EACf,OACF,CAAC;M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EAChB,CAAC;EACDX,aAAa,EAAE;IACbuB,KAAK,EAAElE,UAAU,CAACyE,GAAG,CAAC,QAAQ,CAAC,CAACP,KAAK,GAAG;EAC1C,CAAC;EACDtB,QAAQ,EAAE;IACRe,aAAa,EAAE,KAAK;IACpBa,UAAU,EAAE,QAAQ;IACpBZ,GAAG,EAAE,CAAC;IACNM,KAAK,EAAElE,UAAU,CAACyE,GAAG,CAAC,QAAQ,CAAC,CAACP,KAAK,GAAG;EAC1C,CAAC;EACDrB,OAAO,EAAE;IACPoB,KAAK,EAAE,OAAO;IACdZ,eAAe,EAAE,OAAO;IACxBa,KAAK,EAAE,EAAE;IACTZ,YAAY,EAAE,CAAC;IACfc,SAAS,EAAE;EACb,CAAC;EACDtB,KAAK,EAAE;IACLmB,KAAK,EAAE;EACT,CAAC;EACDhB,WAAW,EAAE;IACXgB,KAAK,EAAE;EACT,CAAC;EACDf,MAAM,EAAE;IACNoB,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,CAAC;IAClBG,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBrB,YAAY,EAAE,CAAC;IACfkB,UAAU,EAAE,QAAQ;IACpBH,cAAc,EAAE,QAAQ;IACxBF,MAAM,EAAE;EACV,CAAC;EACDhB,UAAU,EAAE;IACVc,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface AdBannerTypes {
3
- dataPublisherId: string;
4
- dataAdSlot: string;
5
- }
6
- export declare const BottomBannerAd: React.FC<AdBannerTypes>;
7
- export {};
8
- //# sourceMappingURL=BottomBannerAd.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BottomBannerAd.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomBannerAd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAyBnD,UAAU,aAAa;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA8ElD,CAAC"}
@@ -1,185 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import {
3
- Dimensions,
4
- Image,
5
- Linking,
6
- StyleSheet,
7
- Text,
8
- View,
9
- TouchableOpacity,
10
- TouchableWithoutFeedback,
11
- } from 'react-native';
12
- import Adgeist from '../NativeAdgeist';
13
-
14
- interface Creative {
15
- fileUrl: string;
16
- title: string;
17
- description: string;
18
- ctaUrl?: string;
19
- }
20
-
21
- interface AdData {
22
- _id: string;
23
- creative: Creative;
24
- }
25
-
26
- interface AdBannerTypes {
27
- dataPublisherId: string;
28
- dataAdSlot: string;
29
- }
30
-
31
- export const BottomBannerAd: React.FC<AdBannerTypes> = ({
32
- dataPublisherId,
33
- dataAdSlot,
34
- }) => {
35
- const [adData, setAdData] = useState<AdData | null>(null);
36
-
37
- useEffect(() => {
38
- (async () => {
39
- try {
40
- const response: Object = await Adgeist.fetchCreative(
41
- dataAdSlot,
42
- dataPublisherId
43
- );
44
- const creative: { data: AdData } = response as { data: AdData };
45
- setAdData(creative.data);
46
- await Adgeist.sendCreativeAnalytic(
47
- creative.data._id,
48
- dataAdSlot,
49
- dataPublisherId,
50
- 'impression'
51
- );
52
- } catch (error) {
53
- console.error('Ad load failed:', error);
54
- }
55
- })();
56
- }, [dataPublisherId, dataAdSlot]);
57
-
58
- const handleClick = async () => {
59
- if (adData?.creative?.ctaUrl) {
60
- await Adgeist.sendCreativeAnalytic(
61
- adData._id,
62
- dataAdSlot,
63
- dataPublisherId,
64
- 'click'
65
- );
66
- Linking.openURL(adData.creative.ctaUrl).catch((err) =>
67
- console.error('Failed to open URL:', err)
68
- );
69
- }
70
- };
71
-
72
- if (!adData?.creative?.fileUrl) return null;
73
-
74
- return (
75
- <TouchableWithoutFeedback
76
- style={styles.container}
77
- onPress={handleClick}
78
- accessible
79
- accessibilityLabel="Ad Banner"
80
- >
81
- <View style={styles.adContent}>
82
- <Image style={styles.logo} source={{ uri: adData.creative.fileUrl }} />
83
- <View style={styles.textContainer}>
84
- <View style={styles.titleRow}>
85
- <Text style={styles.adBadge}>AD</Text>
86
- <Text style={styles.title} numberOfLines={1} ellipsizeMode="tail">
87
- {adData.creative.title}
88
- </Text>
89
- </View>
90
- <Text
91
- style={styles.description}
92
- numberOfLines={1}
93
- ellipsizeMode="tail"
94
- >
95
- {adData.creative.description}
96
- </Text>
97
- </View>
98
- <TouchableOpacity
99
- style={styles.button}
100
- onPress={handleClick}
101
- accessible
102
- accessibilityLabel="Visit Site Button"
103
- >
104
- <Text style={styles.buttonText}>Visit Site</Text>
105
- </TouchableOpacity>
106
- </View>
107
- </TouchableWithoutFeedback>
108
- );
109
- };
110
-
111
- const styles = StyleSheet.create({
112
- container: {
113
- backgroundColor: 'white',
114
- borderRadius: 10,
115
- },
116
- creative: {
117
- resizeMode: 'contain',
118
- borderTopLeftRadius: 10,
119
- borderTopRightRadius: 10,
120
- },
121
- options: {
122
- flexDirection: 'row',
123
- gap: 2,
124
- position: 'absolute',
125
- top: 5,
126
- left: 5,
127
- },
128
- option: {
129
- color: 'green',
130
- backgroundColor: '#00000022',
131
- width: 20,
132
- height: 20,
133
- textAlign: 'center',
134
- },
135
- adContent: {
136
- width: '100%',
137
- backgroundColor: 'white',
138
- flexDirection: 'row',
139
- justifyContent: 'space-between',
140
- paddingHorizontal: 10,
141
- paddingVertical: 10,
142
- alignItems: 'center',
143
- },
144
- logo: {
145
- width: 35,
146
- height: 35,
147
- resizeMode: 'contain',
148
- borderRadius: 2,
149
- },
150
- textContainer: {
151
- width: Dimensions.get('window').width - 150,
152
- },
153
- titleRow: {
154
- flexDirection: 'row',
155
- alignItems: 'center',
156
- gap: 5,
157
- width: Dimensions.get('window').width - 200,
158
- },
159
- adBadge: {
160
- color: 'white',
161
- backgroundColor: 'green',
162
- width: 40,
163
- borderRadius: 4,
164
- textAlign: 'center',
165
- },
166
- title: {
167
- color: 'black',
168
- },
169
- description: {
170
- color: 'black',
171
- },
172
- button: {
173
- paddingHorizontal: 10,
174
- paddingVertical: 5,
175
- borderWidth: 1,
176
- borderColor: 'green',
177
- borderRadius: 5,
178
- alignItems: 'center',
179
- justifyContent: 'center',
180
- height: 40,
181
- },
182
- buttonText: {
183
- color: 'green',
184
- },
185
- });