@adadapted/react-native-sdk 3.2.0 → 3.4.0

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 (72) hide show
  1. package/android/.project +1 -1
  2. package/android/.settings/org.eclipse.buildship.core.prefs +2 -2
  3. package/android/bin/build.gradle +13 -11
  4. package/android/bin/gradle.properties +4 -4
  5. package/android/build.gradle +19 -81
  6. package/android/gradle.properties +4 -4
  7. package/android/src/main/AndroidManifest.xml +1 -3
  8. package/android/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkModule.kt +39 -54
  9. package/ios/AdadaptedReactNativeSdk.m +1 -1
  10. package/lib/commonjs/api/adadaptedApiRequests.js +3 -3
  11. package/lib/commonjs/api/adadaptedApiRequests.js.map +1 -1
  12. package/lib/commonjs/api/adadaptedApiRequests.mock.js +25 -8
  13. package/lib/commonjs/api/adadaptedApiRequests.mock.js.map +1 -1
  14. package/lib/commonjs/api/adadaptedApiTypes.js +68 -28
  15. package/lib/commonjs/api/adadaptedApiTypes.js.map +1 -1
  16. package/lib/commonjs/components/AdZone.js +101 -67
  17. package/lib/commonjs/components/AdZone.js.map +1 -1
  18. package/lib/commonjs/components/ReportAdButton.js +40 -0
  19. package/lib/commonjs/components/ReportAdButton.js.map +1 -0
  20. package/lib/commonjs/images/ReportIcon.png +0 -0
  21. package/lib/commonjs/index.js +139 -93
  22. package/lib/commonjs/index.js.map +1 -1
  23. package/lib/commonjs/package.json +1 -0
  24. package/lib/commonjs/types.js +4 -0
  25. package/lib/commonjs/types.js.map +1 -1
  26. package/lib/commonjs/util.js +14 -4
  27. package/lib/commonjs/util.js.map +1 -1
  28. package/lib/module/api/adadaptedApiRequests.js +2 -0
  29. package/lib/module/api/adadaptedApiRequests.js.map +1 -1
  30. package/lib/module/api/adadaptedApiRequests.mock.js +27 -9
  31. package/lib/module/api/adadaptedApiRequests.mock.js.map +1 -1
  32. package/lib/module/api/adadaptedApiTypes.js +85 -24
  33. package/lib/module/api/adadaptedApiTypes.js.map +1 -1
  34. package/lib/module/components/AdZone.js +90 -61
  35. package/lib/module/components/AdZone.js.map +1 -1
  36. package/lib/module/components/ReportAdButton.js +34 -0
  37. package/lib/module/components/ReportAdButton.js.map +1 -0
  38. package/lib/module/images/ReportIcon.png +0 -0
  39. package/lib/module/index.js +142 -89
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/package.json +1 -0
  42. package/lib/module/types.js +2 -0
  43. package/lib/module/types.js.map +1 -1
  44. package/lib/module/util.js +16 -4
  45. package/lib/module/util.js.map +1 -1
  46. package/lib/typescript/src/api/adadaptedApiRequests.d.ts +1 -0
  47. package/lib/typescript/src/api/adadaptedApiRequests.d.ts.map +1 -0
  48. package/lib/typescript/src/api/adadaptedApiRequests.mock.d.ts +1 -0
  49. package/lib/typescript/src/api/adadaptedApiRequests.mock.d.ts.map +1 -0
  50. package/lib/typescript/src/api/adadaptedApiTypes.d.ts +5 -0
  51. package/lib/typescript/src/api/adadaptedApiTypes.d.ts.map +1 -0
  52. package/lib/typescript/src/components/AdZone.d.ts +11 -6
  53. package/lib/typescript/src/components/AdZone.d.ts.map +1 -0
  54. package/lib/typescript/src/components/ReportAdButton.d.ts +19 -0
  55. package/lib/typescript/src/components/ReportAdButton.d.ts.map +1 -0
  56. package/lib/typescript/src/index.d.ts +33 -17
  57. package/lib/typescript/src/index.d.ts.map +1 -0
  58. package/lib/typescript/src/types.d.ts +3 -2
  59. package/lib/typescript/src/types.d.ts.map +1 -0
  60. package/lib/typescript/src/util.d.ts +13 -0
  61. package/lib/typescript/src/util.d.ts.map +1 -0
  62. package/package.json +151 -155
  63. package/src/api/adadaptedApiRequests.mock.ts +25 -9
  64. package/src/api/adadaptedApiTypes.ts +5 -0
  65. package/src/components/AdZone.tsx +94 -46
  66. package/src/components/ReportAdButton.tsx +46 -0
  67. package/src/images/ReportIcon.png +0 -0
  68. package/src/index.tsx +146 -69
  69. package/src/util.ts +13 -0
  70. package/lib/typescript/example/index.d.ts +0 -1
  71. package/lib/typescript/example/src/App.d.ts +0 -9
  72. package/lib/typescript/jest.setup.d.ts +0 -5
@@ -1,19 +1,29 @@
1
+ "use strict";
2
+
1
3
  /**
2
4
  * Component for creating an {@link AdZone}.
3
5
  * @module
4
6
  */
5
- import * as React from "react";
7
+ import React, { useEffect, useState } from "react";
6
8
  import { DeviceEventEmitter, Linking, StyleSheet, View } from "react-native";
7
9
  import * as adadaptedApiRequests from "../api/adadaptedApiRequests";
8
10
  import { AdActionType, ReportedEventType } from "../api/adadaptedApiTypes";
9
11
  import { WebView } from "react-native-webview";
10
12
  import { safeInvoke } from "../util";
11
- import { useEffect, useState } from "react";
13
+ import { ReportAdButton } from "./ReportAdButton";
12
14
 
13
15
  /**
14
16
  * Props interface for {@link AdZone}.
15
17
  */
16
18
 
19
+ /**
20
+ * Interface for tracking "touch" coordinates.
21
+ */
22
+
23
+ /**
24
+ * Defines the style typing for the component.
25
+ */
26
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
17
27
  /**
18
28
  * Timer used for cycling through ads in the zone
19
29
  * based on the ad "refresh time" for each ad.
@@ -25,14 +35,11 @@ let cycleAdTimer;
25
35
  * @param props - properties passed to AdZone.
26
36
  * @returns an AdZone JSX Element.
27
37
  */
28
- export function AdZone(props) {
29
- // Generates a random number between 0 and (number of available ads - 1).
30
- const startingAdIndex = Math.floor(Math.random() * props.adZoneData.ads.length);
31
-
38
+ export const AdZone = props => {
32
39
  /**
33
40
  * Tracks the current ad index being shown.
34
41
  */
35
- const [adIndexShown, setAdIndexShown] = useState(startingAdIndex);
42
+ const [adIndexShown, setAdIndexShown] = useState(Math.floor(Math.random() * props.adZoneData.ads.length));
36
43
  /**
37
44
  * Tracks the coordinates when the user started touching the Ad View.
38
45
  */
@@ -40,12 +47,13 @@ export function AdZone(props) {
40
47
  x: 0,
41
48
  y: 0
42
49
  });
50
+
43
51
  /**
44
52
  * Track ad visibility (for off-screen ads).
45
53
  */
46
- const [isAdVisible, setIsAdVisibile] = useState(props.defaultToInvisibleAdZone ? false : true);
54
+ const [isAdZoneVisible, setIsAdVisibile] = useState(props.isAdZoneVisible);
47
55
 
48
- // - Define all useEffect triggers.
56
+ // Setup device listeners.
49
57
  useEffect(() => {
50
58
  DeviceEventEmitter.addListener("visibility-event", event => {
51
59
  setIsAdVisibile(event);
@@ -55,21 +63,25 @@ export function AdZone(props) {
55
63
  });
56
64
  return () => {
57
65
  clearTimeout(cycleAdTimer);
58
- DeviceEventEmitter.removeAllListeners("visibility-event");
59
66
  DeviceEventEmitter.removeAllListeners("acknowledge");
60
67
  };
68
+ // eslint-disable-next-line react-hooks/exhaustive-deps
61
69
  }, []);
70
+
71
+ // Send impression on ad cycle.
62
72
  useEffect(() => {
63
73
  startAdTimer();
64
- if (isAdVisible) {
74
+ if (isAdZoneVisible) {
65
75
  sendAdImpression();
66
76
  }
77
+ // eslint-disable-next-line react-hooks/exhaustive-deps
67
78
  }, [adIndexShown]);
68
79
  useEffect(() => {
69
- if (isAdVisible) {
80
+ if (props.offScreenAdZone && isAdZoneVisible && props.adZoneData && props.adZoneData.ads && props.adZoneData.ads.length > adIndexShown && !props.adZoneData.ads[adIndexShown].impression_tracked) {
70
81
  sendAdImpression();
71
82
  }
72
- }, [isAdVisible]);
83
+ // eslint-disable-next-line react-hooks/exhaustive-deps
84
+ }, [isAdZoneVisible]);
73
85
 
74
86
  /**
75
87
  * Generates all component related styles.
@@ -84,6 +96,11 @@ export function AdZone(props) {
84
96
  webView: {
85
97
  width: "100%",
86
98
  height: "100%"
99
+ },
100
+ reportAd: {
101
+ position: "absolute",
102
+ top: 10,
103
+ right: 10
87
104
  }
88
105
  });
89
106
  }
@@ -91,12 +108,11 @@ export function AdZone(props) {
91
108
  // Generate the styles each render in case the ad is updated with
92
109
  // new settings that need to be reflected in the styles of the view.
93
110
  const styles = generateStyles();
94
- const currentAd = props.adZoneData.ads[adIndexShown] || undefined;
95
111
  const finalMainViewStyle = styles.mainView;
96
- if (!currentAd || !currentAd.creative_url) {
112
+ if (!props.adZoneData.ads[adIndexShown] || !props.adZoneData.ads[adIndexShown].creative_url) {
97
113
  // If there is no ad to display, make the view take up no space.
98
- finalMainViewStyle.width = "0";
99
- finalMainViewStyle.height = "0";
114
+ finalMainViewStyle.width = 0;
115
+ finalMainViewStyle.height = 0;
100
116
  }
101
117
 
102
118
  /**
@@ -121,11 +137,13 @@ export function AdZone(props) {
121
137
  function acknowledge(itemName) {
122
138
  if (props.adZoneData.ads) {
123
139
  props.adZoneData.ads.forEach(ad => {
124
- ad.payload.detailed_list_items.forEach(item => {
125
- if (item.product_title === itemName) {
126
- triggerReportAdEvent(ad, ReportedEventType.INTERACTION);
127
- }
128
- });
140
+ if (ad.action_type === "c") {
141
+ ad.payload.detailed_list_items.forEach(item => {
142
+ if (item.product_title === itemName) {
143
+ triggerReportAdEvent(ad, ReportedEventType.INTERACTION);
144
+ }
145
+ });
146
+ }
129
147
  });
130
148
  }
131
149
  }
@@ -160,9 +178,11 @@ export function AdZone(props) {
160
178
  */
161
179
  function startAdTimer() {
162
180
  clearTimeout(cycleAdTimer);
163
- if (props.adZoneData.ads.length > 0) {
181
+ if (props.adZoneData.ads.length > 0 && props.adZoneData.ads[adIndexShown]) {
164
182
  const refreshTime = props.adZoneData.ads[adIndexShown].refresh_time * 1000;
165
183
  cycleAdTimer = setTimeout(cycleDisplayedAd, refreshTime);
184
+ } else {
185
+ cycleAdTimer = setTimeout(cycleDisplayedAd, 30000);
166
186
  }
167
187
  }
168
188
 
@@ -170,19 +190,23 @@ export function AdZone(props) {
170
190
  * Cycles to the next ad to display in the current available sequence of ads.
171
191
  */
172
192
  function cycleDisplayedAd() {
173
- // Start by determining the next ad index to display.
174
193
  let nextAdIndex = 0;
194
+
195
+ // Start by determining the next ad index to display.
175
196
  const lastAd = props.adZoneData.ads[adIndexShown];
176
197
  if (adIndexShown < props.adZoneData.ads.length - 1) {
177
198
  nextAdIndex = adIndexShown + 1;
178
- }
179
- if (nextAdIndex !== adIndexShown && lastAd.impression_tracked) {
180
- // Reset ad impression tracking status.
181
- lastAd.impression_tracked = false;
182
199
  } else {
200
+ nextAdIndex = 0;
201
+ }
202
+ if (!lastAd.impression_tracked && !isAdZoneVisible) {
183
203
  // Send invisible ad impression if ad was not visible before end of timer cycle.
184
204
  triggerReportAdEvent(lastAd, ReportedEventType.INVISIBLE_IMPRESSION);
185
205
  }
206
+ if (lastAd.impression_tracked) {
207
+ // Reset ad impression tracking status.
208
+ lastAd.impression_tracked = false;
209
+ }
186
210
  setAdIndexShown(nextAdIndex);
187
211
  }
188
212
 
@@ -191,47 +215,52 @@ export function AdZone(props) {
191
215
  */
192
216
  function sendAdImpression() {
193
217
  const ad = props.adZoneData.ads[adIndexShown];
194
-
195
- // Trigger an impression event for the ad.
196
- if (!ad.impression_tracked) {
218
+ if (ad.impression_tracked === undefined || !ad.impression_tracked) {
197
219
  triggerReportAdEvent(ad, ReportedEventType.IMPRESSION);
198
220
  ad.impression_tracked = true;
199
221
  }
200
222
  }
201
223
 
202
224
  // Returned JSX.
203
- return /*#__PURE__*/React.createElement(View, {
204
- style: finalMainViewStyle
205
- }, currentAd && currentAd.creative_url ? /*#__PURE__*/React.createElement(WebView, {
206
- source: {
207
- uri: currentAd.creative_url
208
- },
209
- androidLayerType: "hardware",
210
- automaticallyAdjustContentInsets: false,
211
- style: styles.webView,
212
- onTouchStart: e => {
213
- setTouchStartCoords({
214
- x: e.nativeEvent.pageX,
215
- y: e.nativeEvent.pageY
216
- });
217
- },
218
- onTouchEnd: e => {
219
- if (touchStartCoords) {
220
- const touchEndCoords = {
225
+ return /*#__PURE__*/_jsxs(View, {
226
+ style: finalMainViewStyle,
227
+ children: [props.adZoneData.ads[adIndexShown] && props.adZoneData.ads[adIndexShown].creative_url ? /*#__PURE__*/_jsx(WebView, {
228
+ source: {
229
+ uri: props.adZoneData.ads[adIndexShown].creative_url
230
+ },
231
+ androidLayerType: "hardware",
232
+ automaticallyAdjustContentInsets: false,
233
+ style: styles.webView,
234
+ onTouchStart: e => {
235
+ setTouchStartCoords({
221
236
  x: e.nativeEvent.pageX,
222
237
  y: e.nativeEvent.pageY
223
- };
224
- if (Math.abs(touchStartCoords.x - touchEndCoords.x) < props.xyDragDistanceAllowed && Math.abs(touchStartCoords.y - touchEndCoords.y) < props.xyDragDistanceAllowed) {
225
- onAdZoneSelected(currentAd);
226
- }
227
-
228
- // Make sure to reset the start coords
229
- setTouchStartCoords({
230
- x: 0,
231
- y: 0
232
238
  });
239
+ },
240
+ onTouchEnd: e => {
241
+ if (touchStartCoords) {
242
+ const touchEndCoords = {
243
+ x: e.nativeEvent.pageX,
244
+ y: e.nativeEvent.pageY
245
+ };
246
+ if (Math.abs(touchStartCoords.x - touchEndCoords.x) < props.xyDragDistanceAllowed && Math.abs(touchStartCoords.y - touchEndCoords.y) < props.xyDragDistanceAllowed) {
247
+ onAdZoneSelected(props.adZoneData.ads[adIndexShown]);
248
+ }
249
+
250
+ // Make sure to reset the start coords
251
+ setTouchStartCoords({
252
+ x: 0,
253
+ y: 0
254
+ });
255
+ }
233
256
  }
234
- }
235
- }) : undefined);
236
- }
257
+ }) : undefined, /*#__PURE__*/_jsx(View, {
258
+ style: styles.reportAd,
259
+ children: props.adZoneData && props.adZoneData.ads[adIndexShown] ? /*#__PURE__*/_jsx(ReportAdButton, {
260
+ adId: props.adZoneData.ads[adIndexShown].ad_id,
261
+ udid: props.udid
262
+ }) : /*#__PURE__*/_jsx(_Fragment, {})
263
+ })]
264
+ });
265
+ };
237
266
  //# sourceMappingURL=AdZone.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","DeviceEventEmitter","Linking","StyleSheet","View","adadaptedApiRequests","AdActionType","ReportedEventType","WebView","safeInvoke","useEffect","useState","cycleAdTimer","AdZone","props","startingAdIndex","Math","floor","random","adZoneData","ads","length","adIndexShown","setAdIndexShown","touchStartCoords","setTouchStartCoords","x","y","isAdVisible","setIsAdVisibile","defaultToInvisibleAdZone","addListener","event","itemName","acknowledge","clearTimeout","removeAllListeners","startAdTimer","sendAdImpression","generateStyles","create","mainView","width","height","webView","styles","currentAd","undefined","finalMainViewStyle","creative_url","onAdZoneSelected","currentlyDisplayedAd","action_type","EXTERNAL","action_path","openURL","then","CONTENT","payload","detailed_list_items","onAddToListTriggered","cycleDisplayedAd","forEach","ad","item","product_title","triggerReportAdEvent","INTERACTION","eventType","currentTs","round","Date","getTime","reportAdEvent","app_id","appId","session_id","sessionId","udid","events","ad_id","impression_id","event_type","created_at","deviceOs","apiEnv","refreshTime","refresh_time","setTimeout","nextAdIndex","lastAd","impression_tracked","INVISIBLE_IMPRESSION","IMPRESSION","uri","e","nativeEvent","pageX","pageY","touchEndCoords","abs","xyDragDistanceAllowed"],"sources":["AdZone.tsx"],"sourcesContent":["/**\n * Component for creating an {@link AdZone}.\n * @module\n */\nimport * as React from \"react\";\nimport {\n DeviceEventEmitter,\n Linking,\n StyleSheet,\n View,\n ViewStyle,\n} from \"react-native\";\nimport * as adadaptedApiRequests from \"../api/adadaptedApiRequests\";\nimport {\n Ad,\n AdActionType,\n DetailedListItem,\n ReportedEventType,\n Zone,\n} from \"../api/adadaptedApiTypes\";\nimport { WebView } from \"react-native-webview\";\nimport { ApiEnv, DeviceOS } from \"../index\";\nimport { safeInvoke } from \"../util\";\nimport { useEffect, useState } from \"react\";\n\n/**\n * Props interface for {@link AdZone}.\n */\ninterface Props {\n /**\n * The app ID.\n */\n appId: string;\n /**\n * The session ID.\n */\n sessionId: string;\n /**\n * The UDID.\n */\n udid: string;\n /**\n * The touch sensitivity of the Ad Zone in both the X and Y directions.\n * This is used to determine the click/press sensitivity when the\n * Ad Zone is being touched by the user as a regular touch or while\n * scrolling the view. If the amount of touch \"drag\" distance in either\n * X or Y direction is less than this value, we will treat the action as\n * a click/press on the Ad Zone.\n */\n xyDragDistanceAllowed: number;\n /**\n * The device OS used for API requests.\n */\n deviceOs: DeviceOS;\n /**\n * The API environment to use when making an API request.\n */\n apiEnv: ApiEnv;\n /**\n * The ad zone data.\n */\n adZoneData: Zone;\n /**\n * Callback that gets triggered when an \"add to list\" item/items are clicked.\n * @param items - The array of items to \"add to list\".\n */\n onAddToListTriggered?(items: DetailedListItem[]): void;\n /**\n * Track the ad zone visibility in parent component.\n */\n isAdZoneVisible?: boolean;\n /**\n * Set default ad zone visibility to false.\n */\n defaultToInvisibleAdZone?: boolean;\n}\n\n/**\n * Interface for tracking \"touch\" coordinates.\n */\ninterface TouchCoordinates {\n /**\n * The X coordinate for the touch.\n */\n x: number;\n /**\n * The Y coordinate for the touch.\n */\n y: number;\n}\n\n/**\n * Defines the style typing for the component.\n */\ninterface StyleDef {\n /**\n * Styles for the main View element.\n */\n mainView: ViewStyle;\n /**\n * Styles for the WebView element.\n */\n webView: ViewStyle;\n}\n/**\n * Timer used for cycling through ads in the zone\n * based on the ad \"refresh time\" for each ad.\n */\nlet cycleAdTimer: ReturnType<typeof setTimeout> | undefined;\n\n/**\n * Creates the AdZone component.\n * @param props - properties passed to AdZone.\n * @returns an AdZone JSX Element.\n */\nexport function AdZone(props: Props): JSX.Element {\n // Generates a random number between 0 and (number of available ads - 1).\n const startingAdIndex = Math.floor(\n Math.random() * props.adZoneData.ads.length\n );\n\n /**\n * Tracks the current ad index being shown.\n */\n const [adIndexShown, setAdIndexShown] = useState(startingAdIndex);\n /**\n * Tracks the coordinates when the user started touching the Ad View.\n */\n const [touchStartCoords, setTouchStartCoords] = useState({ x: 0, y: 0 });\n /**\n * Track ad visibility (for off-screen ads).\n */\n const [isAdVisible, setIsAdVisibile] = useState(\n props.defaultToInvisibleAdZone ? false : true\n );\n\n // - Define all useEffect triggers.\n useEffect(() => {\n DeviceEventEmitter.addListener(\"visibility-event\", (event) => {\n setIsAdVisibile(event);\n });\n DeviceEventEmitter.addListener(\"acknowledge\", (itemName) => {\n acknowledge(itemName);\n });\n return () => {\n clearTimeout(cycleAdTimer);\n DeviceEventEmitter.removeAllListeners(\"visibility-event\");\n DeviceEventEmitter.removeAllListeners(\"acknowledge\");\n };\n }, []);\n\n useEffect(() => {\n startAdTimer();\n if (isAdVisible) {\n sendAdImpression();\n }\n }, [adIndexShown]);\n\n useEffect(() => {\n if (isAdVisible) {\n sendAdImpression();\n }\n }, [isAdVisible]);\n\n /**\n * Generates all component related styles.\n * @returns the styles needed for the component.\n */\n function generateStyles(): StyleDef {\n return StyleSheet.create({\n mainView: {\n width: \"100%\",\n height: \"100%\",\n },\n webView: {\n width: \"100%\",\n height: \"100%\",\n },\n });\n }\n\n // Generate the styles each render in case the ad is updated with\n // new settings that need to be reflected in the styles of the view.\n const styles = generateStyles();\n const currentAd: Ad | undefined =\n props.adZoneData.ads[adIndexShown] || undefined;\n const finalMainViewStyle = styles.mainView;\n\n if (!currentAd || !currentAd.creative_url) {\n // If there is no ad to display, make the view take up no space.\n finalMainViewStyle.width = \"0\";\n finalMainViewStyle.height = \"0\";\n }\n\n /**\n * Triggers when the user selects the ad zone.\n * @param currentlyDisplayedAd - The ad currently displayed.\n */\n function onAdZoneSelected(currentlyDisplayedAd: Ad): void {\n // Determine the \"action type\" and perform that specific action.\n if (\n currentlyDisplayedAd.action_type === AdActionType.EXTERNAL &&\n currentlyDisplayedAd.action_path\n ) {\n // Action Type: EXTERNAL\n Linking.openURL(currentlyDisplayedAd.action_path).then();\n } else if (\n currentlyDisplayedAd.action_type === AdActionType.CONTENT &&\n currentlyDisplayedAd.payload &&\n currentlyDisplayedAd.payload.detailed_list_items\n ) {\n safeInvoke(\n props.onAddToListTriggered,\n currentlyDisplayedAd.payload.detailed_list_items\n );\n }\n\n cycleDisplayedAd();\n }\n\n /**\n * Call to acknowledge ATL item(s) added to user list.\n * @param itemName - Detailed list item title from ad that was clicked.\n */\n function acknowledge(itemName: string): void {\n if (props.adZoneData.ads) {\n props.adZoneData.ads.forEach((ad) => {\n ad.payload.detailed_list_items.forEach((item) => {\n if (item.product_title === itemName) {\n triggerReportAdEvent(ad, ReportedEventType.INTERACTION);\n }\n });\n });\n }\n }\n\n /**\n * Triggered when we need to report an ad event to the API.\n * @param ad - The ad to send an event for.\n * @param eventType - The event type for the reported event.\n */\n function triggerReportAdEvent(ad: Ad, eventType: ReportedEventType): void {\n // The event timestamp has to be sent as a unix timestamp.\n const currentTs = Math.round(new Date().getTime() / 1000);\n\n // Log the taken action/event with the API.\n adadaptedApiRequests\n .reportAdEvent(\n {\n app_id: props.appId,\n session_id: props.sessionId,\n udid: props.udid,\n events: [\n {\n ad_id: ad.ad_id,\n impression_id: ad.impression_id,\n event_type: eventType,\n created_at: currentTs,\n },\n ],\n },\n props.deviceOs,\n props.apiEnv\n )\n .then(() => {\n // Do nothing with the response for now...\n });\n }\n\n /**\n * Generates a new timer for cycling to the next ad.\n */\n function startAdTimer(): void {\n clearTimeout(cycleAdTimer);\n\n if (props.adZoneData.ads.length > 0) {\n const refreshTime: number =\n props.adZoneData.ads[adIndexShown].refresh_time * 1000;\n cycleAdTimer = setTimeout(cycleDisplayedAd, refreshTime);\n }\n }\n\n /**\n * Cycles to the next ad to display in the current available sequence of ads.\n */\n function cycleDisplayedAd(): void {\n // Start by determining the next ad index to display.\n let nextAdIndex = 0;\n const lastAd = props.adZoneData.ads[adIndexShown];\n\n if (adIndexShown < props.adZoneData.ads.length - 1) {\n nextAdIndex = adIndexShown + 1;\n }\n\n if (nextAdIndex !== adIndexShown && lastAd.impression_tracked) {\n // Reset ad impression tracking status.\n lastAd.impression_tracked = false;\n } else {\n // Send invisible ad impression if ad was not visible before end of timer cycle.\n triggerReportAdEvent(\n lastAd,\n ReportedEventType.INVISIBLE_IMPRESSION\n );\n }\n\n setAdIndexShown(nextAdIndex);\n }\n\n /**\n * Send ad tracking impression.\n */\n function sendAdImpression(): void {\n const ad = props.adZoneData.ads[adIndexShown];\n\n // Trigger an impression event for the ad.\n if (!ad.impression_tracked) {\n triggerReportAdEvent(ad, ReportedEventType.IMPRESSION);\n ad.impression_tracked = true;\n }\n }\n\n // Returned JSX.\n return (\n <View style={finalMainViewStyle}>\n {currentAd && currentAd.creative_url ? (\n <WebView\n source={{\n uri: currentAd.creative_url,\n }}\n androidLayerType=\"hardware\"\n automaticallyAdjustContentInsets={false}\n style={styles.webView}\n onTouchStart={(e) => {\n setTouchStartCoords({\n x: e.nativeEvent.pageX,\n y: e.nativeEvent.pageY,\n });\n }}\n onTouchEnd={(e) => {\n if (touchStartCoords) {\n const touchEndCoords: TouchCoordinates = {\n x: e.nativeEvent.pageX,\n y: e.nativeEvent.pageY,\n };\n\n if (\n Math.abs(\n touchStartCoords.x - touchEndCoords.x\n ) < props.xyDragDistanceAllowed &&\n Math.abs(\n touchStartCoords.y - touchEndCoords.y\n ) < props.xyDragDistanceAllowed\n ) {\n onAdZoneSelected(currentAd);\n }\n\n // Make sure to reset the start coords\n setTouchStartCoords({ x: 0, y: 0 });\n }\n }}\n />\n ) : undefined}\n </View>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACIC,kBAAkB,EAClBC,OAAO,EACPC,UAAU,EACVC,IAAI,QAED,cAAc;AACrB,OAAO,KAAKC,oBAAoB,MAAM,6BAA6B;AACnE,SAEIC,YAAY,EAEZC,iBAAiB,QAEd,0BAA0B;AACjC,SAASC,OAAO,QAAQ,sBAAsB;AAE9C,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;;AAE3C;AACA;AACA;;AA6EA;AACA;AACA;AACA;AACA,IAAIC,YAAuD;;AAE3D;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,MAAM,CAACC,KAAY,EAAe;EAC9C;EACA,MAAMC,eAAe,GAAGC,IAAI,CAACC,KAAK,CAC9BD,IAAI,CAACE,MAAM,EAAE,GAAGJ,KAAK,CAACK,UAAU,CAACC,GAAG,CAACC,MAAM,CAC9C;;EAED;AACJ;AACA;EACI,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGZ,QAAQ,CAACI,eAA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E,CAAC,CAACC,WAAW,CAACC,KAAK;UACtBtE,CAAC,EAAEoE,CAAC,CAACC,WAAW,CAACE;QACrB,CAAC;QAED,IACIlF,IAAI,CAACoF,GAAG,CACJ5E,gBAAgB,CAACE,CAAC,GAAGyE,cAAc,CAACzE,CAAC,CACxC,GAAGZ,KAAK,CAACuF,qBAAqB,IAC/BrF,IAAI,CAACoF,GAAG,CACJ5E,gBAAgB,CAACG,CAAC,GAAGwE,cAAc,CAACxE,CAAC,CACxC,GAAGb,KAAK,CAACuF,qBAAqB,EACjC;UACEnD,gBAAgB,CAACJ,SAAS,CAAC;QAC/B;;QAEA;QACArB,mBAAmB,CAAC;UAAEC,CAAC,EAAE,CAAC;UAAEC,CAAC,EAAE;QAAE,CAAC,CAAC;MACvC;IACJ;EAAE,EACJ,GACFoB,SAAS,CACV;AAEf"}
1
+ {"version":3,"names":["React","useEffect","useState","DeviceEventEmitter","Linking","StyleSheet","View","adadaptedApiRequests","AdActionType","ReportedEventType","WebView","safeInvoke","ReportAdButton","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","cycleAdTimer","AdZone","props","adIndexShown","setAdIndexShown","Math","floor","random","adZoneData","ads","length","touchStartCoords","setTouchStartCoords","x","y","isAdZoneVisible","setIsAdVisibile","addListener","event","itemName","acknowledge","clearTimeout","removeAllListeners","startAdTimer","sendAdImpression","offScreenAdZone","impression_tracked","generateStyles","create","mainView","width","height","webView","reportAd","position","top","right","styles","finalMainViewStyle","creative_url","onAdZoneSelected","currentlyDisplayedAd","action_type","EXTERNAL","action_path","openURL","then","CONTENT","payload","detailed_list_items","onAddToListTriggered","cycleDisplayedAd","forEach","ad","item","product_title","triggerReportAdEvent","INTERACTION","eventType","currentTs","round","Date","getTime","reportAdEvent","app_id","appId","session_id","sessionId","udid","events","ad_id","impression_id","event_type","created_at","deviceOs","apiEnv","refreshTime","refresh_time","setTimeout","nextAdIndex","lastAd","INVISIBLE_IMPRESSION","undefined","IMPRESSION","style","children","source","uri","androidLayerType","automaticallyAdjustContentInsets","onTouchStart","e","nativeEvent","pageX","pageY","onTouchEnd","touchEndCoords","abs","xyDragDistanceAllowed","adId"],"sourceRoot":"../../../src","sources":["components/AdZone.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SACIC,kBAAkB,EAClBC,OAAO,EACPC,UAAU,EACVC,IAAI,QAED,cAAc;AACrB,OAAO,KAAKC,oBAAoB,MAAM,6BAA6B;AACnE,SAEIC,YAAY,EAEZC,iBAAiB,QAEd,0BAA0B;AACjC,SAASC,OAAO,QAAQ,sBAAsB;AAE9C,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,cAAc,QAAQ,kBAAkB;;AAEjD;AACA;AACA;;AAkDA;AACA;AACA;;AAYA;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAiBA;AACA;AACA;AACA;AACA,IAAIC,YAAuD;;AAE3D;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,GAAIC,KAAY,IAAyB;EACxD;AACJ;AACA;EACI,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGrB,QAAQ,CAC5CsB,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAGL,KAAK,CAACM,UAAU,CAACC,GAAG,CAACC,MAAM,CAC1D,CAAC;EACD;AACJ;AACA;EACI,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG7B,QAAQ,CAAmB;IACvE8B,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE;EACP,CAAC,CAAC;;EAEF;AACJ;AACA;EACI,MAAM,CAACC,eAAe,EAAEC,eAAe,CAAC,GAAGjC,QAAQ,CAACmB,KAAK,CAACa,eAAe,CAAC;;EAE1E;EACAjC,SAAS,CAAC,MAAM;IACZE,kBAAkB,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gBACnDR,IAAA,CAACF,cAAc;QACX0G,IAAI,EAAEjG,KAAK,CAACM,UAAU,CAACC,GAAG,CAACN,YAAY,CAAC,CAACmE,KAAM;QAC/CF,IAAI,EAAElE,KAAK,CAACkE;MAAK,CACpB,CAAC,gBAEFzE,IAAA,CAAAE,SAAA,IAAI;IACP,CACC,CAAC;EAAA,CACL,CAAC;AAEf,CAAC","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ import React, { useEffect } from "react";
4
+ import { Image, Linking, StyleSheet, TouchableOpacity } from "react-native";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ /**
7
+ * Creates the ReportAdButton component.
8
+ * @param props The component's props.
9
+ * @returns a reportSdButton JSX Element.
10
+ */
11
+ export function ReportAdButton(props) {
12
+ const reportAdUrlBase = new URL("https://feedback.add-it.io/");
13
+ const styles = StyleSheet.create({
14
+ buttonStyle: {
15
+ width: 14,
16
+ height: 14
17
+ }
18
+ });
19
+ useEffect(() => {
20
+ reportAdUrlBase.searchParams.append("aid", props.adId);
21
+ reportAdUrlBase.searchParams.append("uid", props.udid);
22
+ // eslint-disable-next-line react-hooks/exhaustive-deps
23
+ }, [props]);
24
+ return /*#__PURE__*/_jsx(TouchableOpacity, {
25
+ style: styles.buttonStyle,
26
+ onPress: () => {
27
+ Linking.openURL(reportAdUrlBase.toString());
28
+ },
29
+ children: /*#__PURE__*/_jsx(Image, {
30
+ source: require("../images/ReportIcon.png")
31
+ })
32
+ });
33
+ }
34
+ //# sourceMappingURL=ReportAdButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","Image","Linking","StyleSheet","TouchableOpacity","jsx","_jsx","ReportAdButton","props","reportAdUrlBase","URL","styles","create","buttonStyle","width","height","searchParams","append","adId","udid","style","onPress","openURL","toString","children","source","require"],"sourceRoot":"../../../src","sources":["components/ReportAdButton.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,KAAK,EAAEC,OAAO,EAAEC,UAAU,EAAEC,gBAAgB,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAa5E;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,KAAY,EAAqB;EAC5D,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAC,6BAA6B,CAAC;EAE9D,MAAMC,MAAM,GAAGR,UAAU,CAACS,MAAM,CAAC;IAC7BC,WAAW,EAAE;MACTC,KAAK,EAAE,EAAE;MACTC,MAAM,EAAE;IACZ;EACJ,CAAC,CAAC;EAEFf,SAAS,CAAC,MAAM;IACZS,eAAe,CAACO,YAAY,CAACC,MAAM,CAAC,KAAK,EAAET,KAAK,CAACU,IAAI,CAAC;IACtDT,eAAe,CAACO,YAAY,CAACC,MAAM,CAAC,KAAK,EAAET,KAAK,CAACW,IAAI,CAAC;IACtD;EACJ,CAAC,EAAE,CAACX,KAAK,CAAC,CAAC;EAEX,oBACIF,IAAA,CAACF,gBAAgB;IACbgB,KAAK,EAAET,MAAM,CAACE,WAAY;IAC1BQ,OAAO,EAAEA,CAAA,KAAM;MACXnB,OAAO,CAACoB,OAAO,CAACb,eAAe,CAACc,QAAQ,CAAC,CAAC,CAAC;IAC/C,CAAE;IAAAC,QAAA,eAEFlB,IAAA,CAACL,KAAK;MAACwB,MAAM,EAAEC,OAAO,CAAC,0BAA0B;IAAE,CAAE;EAAC,CACxC,CAAC;AAE3B","ignoreList":[]}
Binary file