@adadapted/react-native-sdk 3.1.8 → 3.1.10

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 (40) hide show
  1. package/android/.project +1 -1
  2. package/android/.settings/org.eclipse.buildship.core.prefs +2 -2
  3. package/android/bin/.project +34 -0
  4. package/android/bin/.settings/org.eclipse.buildship.core.prefs +13 -0
  5. package/android/bin/build.gradle +130 -0
  6. package/android/bin/gradle.properties +4 -0
  7. package/android/bin/src/main/AndroidManifest.xml +4 -0
  8. package/android/bin/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkModule.kt +115 -0
  9. package/android/bin/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkPackage.kt +20 -0
  10. package/android/build.gradle +1 -1
  11. package/lib/commonjs/api/adadaptedApiRequests.js +10 -24
  12. package/lib/commonjs/api/adadaptedApiRequests.js.map +1 -1
  13. package/lib/commonjs/api/adadaptedApiRequests.mock.js +11 -21
  14. package/lib/commonjs/api/adadaptedApiRequests.mock.js.map +1 -1
  15. package/lib/commonjs/api/adadaptedApiTypes.js +1 -30
  16. package/lib/commonjs/api/adadaptedApiTypes.js.map +1 -1
  17. package/lib/commonjs/components/AdZone.js +22 -48
  18. package/lib/commonjs/components/AdZone.js.map +1 -1
  19. package/lib/commonjs/index.js +127 -182
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/types.js.map +1 -1
  22. package/lib/commonjs/util.js +4 -2
  23. package/lib/commonjs/util.js.map +1 -1
  24. package/lib/module/api/adadaptedApiRequests.js +9 -8
  25. package/lib/module/api/adadaptedApiRequests.js.map +1 -1
  26. package/lib/module/api/adadaptedApiRequests.mock.js +12 -11
  27. package/lib/module/api/adadaptedApiRequests.mock.js.map +1 -1
  28. package/lib/module/api/adadaptedApiTypes.js +6 -11
  29. package/lib/module/api/adadaptedApiTypes.js.map +1 -1
  30. package/lib/module/components/AdZone.js +21 -36
  31. package/lib/module/components/AdZone.js.map +1 -1
  32. package/lib/module/index.js +130 -159
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/module/types.js.map +1 -1
  35. package/lib/module/util.js +4 -1
  36. package/lib/module/util.js.map +1 -1
  37. package/lib/typescript/src/index.d.ts +8 -0
  38. package/package.json +12 -13
  39. package/src/components/AdZone.tsx +1 -1
  40. package/src/index.tsx +26 -5
@@ -4,25 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AdZone = void 0;
7
-
8
7
  var React = _interopRequireWildcard(require("react"));
9
-
10
8
  var _reactNative = require("react-native");
11
-
12
9
  var adadaptedApiRequests = _interopRequireWildcard(require("../api/adadaptedApiRequests"));
13
-
14
10
  var _adadaptedApiTypes = require("../api/adadaptedApiTypes");
15
-
16
11
  var _reactNativeWebview = require("react-native-webview");
17
-
18
12
  var _util = require("../util");
19
-
20
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
21
-
22
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
15
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
-
26
16
  /**
27
17
  * Creates the AdZone component.
28
18
  */
@@ -36,59 +26,54 @@ class AdZone extends React.Component {
36
26
  * @inheritDoc
37
27
  */
38
28
  constructor(props, context) {
39
- super(props, context); // Generates a random number between 0 and (number of available ads - 1).
29
+ super(props, context);
40
30
 
31
+ // Generates a random number between 0 and (number of available ads - 1).
41
32
  _defineProperty(this, "cycleAdTimer", void 0);
42
-
43
33
  const startingAdIndex = Math.floor(Math.random() * this.props.adZoneData.ads.length);
44
34
  this.state = {
45
35
  adIndexShown: startingAdIndex,
46
36
  touchStartCoords: undefined
47
37
  };
48
38
  }
39
+
49
40
  /**
50
41
  * @inheritDoc
51
42
  */
52
-
53
-
54
43
  componentDidMount() {
55
44
  this.initializeAd();
56
45
  }
46
+
57
47
  /**
58
48
  * @inheritDoc
59
49
  */
60
-
61
-
62
50
  componentWillUnmount() {
63
51
  if (this.cycleAdTimer) {
64
52
  clearTimeout(this.cycleAdTimer);
65
53
  }
66
54
  }
55
+
67
56
  /**
68
57
  * @inheritDoc
69
58
  */
70
-
71
-
72
59
  render() {
73
60
  // Generate the styles each render in case the ad is updated with
74
61
  // new settings that need to be reflected in the styles of the view.
75
62
  const styles = this.generateStyles();
76
63
  const currentAd = this.props.adZoneData.ads[this.state.adIndexShown] || undefined;
77
64
  const finalMainViewStyle = styles.mainView;
78
-
79
65
  if (!currentAd || !currentAd.creative_url) {
80
66
  // If there is no ad to display, make the view take up no space.
81
67
  finalMainViewStyle.width = 0;
82
68
  finalMainViewStyle.height = 0;
83
69
  }
84
-
85
70
  return /*#__PURE__*/React.createElement(_reactNative.View, {
86
71
  style: finalMainViewStyle
87
72
  }, currentAd && currentAd.creative_url ? /*#__PURE__*/React.createElement(_reactNativeWebview.WebView, {
88
73
  source: {
89
74
  uri: currentAd.creative_url
90
75
  },
91
- androidHardwareAccelerationDisabled: true,
76
+ androidLayerType: "hardware",
92
77
  automaticallyAdjustContentInsets: false,
93
78
  style: styles.webView,
94
79
  onTouchStart: e => {
@@ -105,12 +90,11 @@ class AdZone extends React.Component {
105
90
  x: e.nativeEvent.pageX,
106
91
  y: e.nativeEvent.pageY
107
92
  };
108
-
109
93
  if (Math.abs(this.state.touchStartCoords.x - touchEndCoords.x) < this.props.xyDragDistanceAllowed && Math.abs(this.state.touchStartCoords.y - touchEndCoords.y) < this.props.xyDragDistanceAllowed) {
110
94
  this.onAdZoneSelected(currentAd);
111
- } // Make sure to reset the start coords
112
-
95
+ }
113
96
 
97
+ // Make sure to reset the start coords
114
98
  this.setState({
115
99
  touchStartCoords: undefined
116
100
  });
@@ -118,12 +102,11 @@ class AdZone extends React.Component {
118
102
  }
119
103
  }) : undefined);
120
104
  }
105
+
121
106
  /**
122
107
  * Triggers when the user selects the ad zone.
123
108
  * @param currentAd - The ad currently displayed.
124
109
  */
125
-
126
-
127
110
  onAdZoneSelected(currentAd) {
128
111
  // Determine the "action type" and perform that specific action.
129
112
  if (currentAd.action_type === _adadaptedApiTypes.AdActionType.EXTERNAL && currentAd.action_path) {
@@ -132,26 +115,23 @@ class AdZone extends React.Component {
132
115
  } else if (currentAd.action_type === _adadaptedApiTypes.AdActionType.CONTENT && currentAd.payload && currentAd.payload.detailed_list_items) {
133
116
  (0, _util.safeInvoke)(this.props.onAddToListTriggered, currentAd.payload.detailed_list_items);
134
117
  }
135
-
136
118
  this.triggerReportAdEvent(currentAd, _adadaptedApiTypes.ReportedEventType.INTERACTION);
137
-
138
119
  if (this.cycleAdTimer) {
139
120
  clearTimeout(this.cycleAdTimer);
140
121
  }
141
-
142
122
  this.cycleDisplayedAd();
143
123
  }
124
+
144
125
  /**
145
126
  * Triggered when we need to report an ad event to the API.
146
127
  * @param currentAd - The ad to send an event for.
147
128
  * @param eventType - The event type for the reported event.
148
129
  */
149
-
150
-
151
130
  triggerReportAdEvent(currentAd, eventType) {
152
131
  // The event timestamp has to be sent as a unix timestamp.
153
- const currentTs = Math.round(new Date().getTime() / 1000); // Log the taken action/event with the API.
132
+ const currentTs = Math.round(new Date().getTime() / 1000);
154
133
 
134
+ // Log the taken action/event with the API.
155
135
  adadaptedApiRequests.reportAdEvent({
156
136
  app_id: this.props.appId,
157
137
  session_id: this.props.sessionId,
@@ -162,16 +142,16 @@ class AdZone extends React.Component {
162
142
  event_type: eventType,
163
143
  created_at: currentTs
164
144
  }]
165
- }, this.props.deviceOs, this.props.apiEnv).then(() => {// Do nothing with the response for now...
145
+ }, this.props.deviceOs, this.props.apiEnv).then(() => {
146
+ // Do nothing with the response for now...
166
147
  });
167
148
  }
149
+
168
150
  /**
169
151
  * Generates a new timer for cycling to the next ad.
170
152
  * @param timerLength - The length of time(in milliseconds) to initialize
171
153
  * the timer with.
172
154
  */
173
-
174
-
175
155
  createAdTimer(timerLength) {
176
156
  if (this.props.adZoneData.ads.length > 0) {
177
157
  this.cycleAdTimer = setTimeout(() => {
@@ -179,42 +159,38 @@ class AdZone extends React.Component {
179
159
  }, timerLength);
180
160
  }
181
161
  }
162
+
182
163
  /**
183
164
  * Cycles to the next ad to display in the current available sequence of ads.
184
165
  */
185
-
186
-
187
166
  cycleDisplayedAd() {
188
167
  // Start by determining the next ad index to display.
189
168
  let nextAdIndex = 0;
190
-
191
169
  if (this.state.adIndexShown < this.props.adZoneData.ads.length - 1) {
192
170
  nextAdIndex = this.state.adIndexShown + 1;
193
171
  }
194
-
195
172
  this.setState({
196
173
  adIndexShown: nextAdIndex
197
174
  }, () => {
198
175
  this.initializeAd();
199
176
  });
200
177
  }
178
+
201
179
  /**
202
180
  * Performs all ad initialization tasks when a new ad is being displayed.
203
181
  */
204
-
205
-
206
182
  initializeAd() {
207
183
  // Create the new timer based on the new ad index.
208
- this.createAdTimer(this.props.adZoneData.ads[this.state.adIndexShown].refresh_time * 1000); // Trigger an impression event for the ad.
184
+ this.createAdTimer(this.props.adZoneData.ads[this.state.adIndexShown].refresh_time * 1000);
209
185
 
186
+ // Trigger an impression event for the ad.
210
187
  this.triggerReportAdEvent(this.props.adZoneData.ads[this.state.adIndexShown], _adadaptedApiTypes.ReportedEventType.IMPRESSION);
211
188
  }
189
+
212
190
  /**
213
191
  * Generates all component related styles.
214
192
  * @returns the styles needed for the component.
215
193
  */
216
-
217
-
218
194
  generateStyles() {
219
195
  return _reactNative.StyleSheet.create({
220
196
  mainView: {
@@ -227,8 +203,6 @@ class AdZone extends React.Component {
227
203
  }
228
204
  });
229
205
  }
230
-
231
206
  }
232
-
233
207
  exports.AdZone = AdZone;
234
208
  //# sourceMappingURL=AdZone.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["AdZone.tsx"],"names":["AdZone","React","Component","constructor","props","context","startingAdIndex","Math","floor","random","adZoneData","ads","length","state","adIndexShown","touchStartCoords","undefined","componentDidMount","initializeAd","componentWillUnmount","cycleAdTimer","clearTimeout","render","styles","generateStyles","currentAd","finalMainViewStyle","mainView","creative_url","width","height","uri","webView","e","setState","x","nativeEvent","pageX","y","pageY","touchEndCoords","abs","xyDragDistanceAllowed","onAdZoneSelected","action_type","AdActionType","EXTERNAL","action_path","Linking","openURL","then","CONTENT","payload","detailed_list_items","onAddToListTriggered","triggerReportAdEvent","ReportedEventType","INTERACTION","cycleDisplayedAd","eventType","currentTs","round","Date","getTime","adadaptedApiRequests","reportAdEvent","app_id","appId","session_id","sessionId","udid","events","ad_id","impression_id","event_type","created_at","deviceOs","apiEnv","createAdTimer","timerLength","setTimeout","nextAdIndex","refresh_time","IMPRESSION","StyleSheet","create"],"mappings":";;;;;;;AAIA;;AACA;;AACA;;AACA;;AAOA;;AAEA;;;;;;;;AAwFA;AACA;AACA;AACO,MAAMA,MAAN,SAAqBC,KAAK,CAACC,SAA3B,CAAmD;AACtD;AACJ;AACA;AACA;;AAGI;AACJ;AACA;AACIC,EAAAA,WAAW,CAACC,KAAD,EAAeC,OAAf,EAA8B;AACrC,UAAMD,KAAN,EAAaC,OAAb,EADqC,CAGrC;;AAHqC;;AAIrC,UAAMC,eAAe,GAAGC,IAAI,CAACC,KAAL,CACpBD,IAAI,CAACE,MAAL,KAAgB,KAAKL,KAAL,CAAWM,UAAX,CAAsBC,GAAtB,CAA0BC,MADtB,CAAxB;AAIA,SAAKC,KAAL,GAAa;AACTC,MAAAA,YAAY,EAAER,eADL;AAETS,MAAAA,gBAAgB,EAAEC;AAFT,KAAb;AAIH;AAED;AACJ;AACA;;;AACWC,EAAAA,iBAAP,GAAiC;AAC7B,SAAKC,YAAL;AACH;AAED;AACJ;AACA;;;AACWC,EAAAA,oBAAP,GAAoC;AAChC,QAAI,KAAKC,YAAT,EAAuB;AACnBC,MAAAA,YAAY,CAAC,KAAKD,YAAN,CAAZ;AACH;AACJ;AAED;AACJ;AACA;;;AACWE,EAAAA,MAAP,GAA6B;AACzB;AACA;AACA,UAAMC,MAAM,GAAG,KAAKC,cAAL,EAAf;AACA,UAAMC,SAAyB,GAC3B,KAAKrB,KAAL,CAAWM,UAAX,CAAsBC,GAAtB,CAA0B,KAAKE,KAAL,CAAWC,YAArC,KAAsDE,SAD1D;AAEA,UAAMU,kBAAkB,GAAGH,MAAM,CAACI,QAAlC;;AAEA,QAAI,CAACF,SAAD,IAAc,CAACA,SAAS,CAACG,YAA7B,EAA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GAAtB,CAA0B,KAAKE,KAAL,CAAWC,YAArC,CADJ,EAEI0C,qCAAkB2B,UAFtB;AAIH;AAED;AACJ;AACA;AACA;;;AACY3D,EAAAA,cAAR,GAAmC;AAC/B,WAAO4D,wBAAWC,MAAX,CAAkB;AACrB1D,MAAAA,QAAQ,EAAE;AACNE,QAAAA,KAAK,EAAE,MADD;AAENC,QAAAA,MAAM,EAAE;AAFF,OADW;AAKrBE,MAAAA,OAAO,EAAE;AACLH,QAAAA,KAAK,EAAE,MADF;AAELC,QAAAA,MAAM,EAAE;AAFH;AALY,KAAlB,CAAP;AAUH;;AA/OqD","sourcesContent":["/**\n * Component for creating an {@link AdZone}.\n * @module\n */\nimport * as React from \"react\";\nimport { Linking, StyleSheet, View, ViewStyle } 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\";\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\n/**\n * State interface for {@link AdZone}.\n */\ninterface State {\n /**\n * Tracks the current ad index being shown.\n */\n adIndexShown: number;\n /**\n * Tracks the coordinates when the user started touching the Ad View.\n */\n touchStartCoords: TouchCoordinates | undefined;\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/**\n * Creates the AdZone component.\n */\nexport class AdZone extends React.Component<Props, State> {\n /**\n * Timer used for cycling through ads in the zone\n * based on the ad \"refresh time\" for each ad.\n */\n private cycleAdTimer: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * @inheritDoc\n */\n constructor(props: Props, context?: any) {\n super(props, context);\n\n // Generates a random number between 0 and (number of available ads - 1).\n const startingAdIndex = Math.floor(\n Math.random() * this.props.adZoneData.ads.length\n );\n\n this.state = {\n adIndexShown: startingAdIndex,\n touchStartCoords: undefined,\n };\n }\n\n /**\n * @inheritDoc\n */\n public componentDidMount(): void {\n this.initializeAd();\n }\n\n /**\n * @inheritDoc\n */\n public componentWillUnmount(): void {\n if (this.cycleAdTimer) {\n clearTimeout(this.cycleAdTimer);\n }\n }\n\n /**\n * @inheritDoc\n */\n public render(): JSX.Element {\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 = this.generateStyles();\n const currentAd: Ad | undefined =\n this.props.adZoneData.ads[this.state.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 return (\n <View style={finalMainViewStyle}>\n {currentAd && currentAd.creative_url ? (\n <WebView\n source={{\n uri: currentAd.creative_url,\n }}\n androidHardwareAccelerationDisabled={true}\n automaticallyAdjustContentInsets={false}\n style={styles.webView}\n onTouchStart={(e) => {\n this.setState({\n touchStartCoords: {\n x: e.nativeEvent.pageX,\n y: e.nativeEvent.pageY,\n },\n });\n }}\n onTouchEnd={(e) => {\n if (this.state.touchStartCoords) {\n const touchEndCoords: TouchCoordinates = {\n x: e.nativeEvent.pageX,\n y: e.nativeEvent.pageY,\n };\n\n if (\n Math.abs(\n this.state.touchStartCoords.x -\n touchEndCoords.x\n ) < this.props.xyDragDistanceAllowed &&\n Math.abs(\n this.state.touchStartCoords.y -\n touchEndCoords.y\n ) < this.props.xyDragDistanceAllowed\n ) {\n this.onAdZoneSelected(currentAd);\n }\n\n // Make sure to reset the start coords\n this.setState({\n touchStartCoords: undefined,\n });\n }\n }}\n />\n ) : undefined}\n </View>\n );\n }\n\n /**\n * Triggers when the user selects the ad zone.\n * @param currentAd - The ad currently displayed.\n */\n private onAdZoneSelected(currentAd: Ad): void {\n // Determine the \"action type\" and perform that specific action.\n if (\n currentAd.action_type === AdActionType.EXTERNAL &&\n currentAd.action_path\n ) {\n // Action Type: EXTERNAL\n Linking.openURL(currentAd.action_path).then();\n } else if (\n currentAd.action_type === AdActionType.CONTENT &&\n currentAd.payload &&\n currentAd.payload.detailed_list_items\n ) {\n safeInvoke(\n this.props.onAddToListTriggered,\n currentAd.payload.detailed_list_items\n );\n }\n\n this.triggerReportAdEvent(currentAd, ReportedEventType.INTERACTION);\n if (this.cycleAdTimer) {\n clearTimeout(this.cycleAdTimer);\n }\n this.cycleDisplayedAd();\n }\n\n /**\n * Triggered when we need to report an ad event to the API.\n * @param currentAd - The ad to send an event for.\n * @param eventType - The event type for the reported event.\n */\n private triggerReportAdEvent(\n currentAd: Ad,\n eventType: ReportedEventType\n ): 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: this.props.appId,\n session_id: this.props.sessionId,\n udid: this.props.udid,\n events: [\n {\n ad_id: currentAd.ad_id,\n impression_id: currentAd.impression_id,\n event_type: eventType,\n created_at: currentTs,\n },\n ],\n },\n this.props.deviceOs,\n this.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 * @param timerLength - The length of time(in milliseconds) to initialize\n * the timer with.\n */\n private createAdTimer(timerLength: number): void {\n if (this.props.adZoneData.ads.length > 0) {\n this.cycleAdTimer = setTimeout(() => {\n this.cycleDisplayedAd();\n }, timerLength);\n }\n }\n\n /**\n * Cycles to the next ad to display in the current available sequence of ads.\n */\n private cycleDisplayedAd(): void {\n // Start by determining the next ad index to display.\n let nextAdIndex = 0;\n\n if (this.state.adIndexShown < this.props.adZoneData.ads.length - 1) {\n nextAdIndex = this.state.adIndexShown + 1;\n }\n\n this.setState(\n {\n adIndexShown: nextAdIndex,\n },\n () => {\n this.initializeAd();\n }\n );\n }\n\n /**\n * Performs all ad initialization tasks when a new ad is being displayed.\n */\n private initializeAd(): void {\n // Create the new timer based on the new ad index.\n this.createAdTimer(\n this.props.adZoneData.ads[this.state.adIndexShown].refresh_time *\n 1000\n );\n\n // Trigger an impression event for the ad.\n this.triggerReportAdEvent(\n this.props.adZoneData.ads[this.state.adIndexShown],\n ReportedEventType.IMPRESSION\n );\n }\n\n /**\n * Generates all component related styles.\n * @returns the styles needed for the component.\n */\n private 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"]}
1
+ {"version":3,"names":["AdZone","React","Component","constructor","props","context","startingAdIndex","Math","floor","random","adZoneData","ads","length","state","adIndexShown","touchStartCoords","undefined","componentDidMount","initializeAd","componentWillUnmount","cycleAdTimer","clearTimeout","render","styles","generateStyles","currentAd","finalMainViewStyle","mainView","creative_url","width","height","uri","webView","e","setState","x","nativeEvent","pageX","y","pageY","touchEndCoords","abs","xyDragDistanceAllowed","onAdZoneSelected","action_type","AdActionType","EXTERNAL","action_path","Linking","openURL","then","CONTENT","payload","detailed_list_items","safeInvoke","onAddToListTriggered","triggerReportAdEvent","ReportedEventType","INTERACTION","cycleDisplayedAd","eventType","currentTs","round","Date","getTime","adadaptedApiRequests","reportAdEvent","app_id","appId","session_id","sessionId","udid","events","ad_id","impression_id","event_type","created_at","deviceOs","apiEnv","createAdTimer","timerLength","setTimeout","nextAdIndex","refresh_time","IMPRESSION","StyleSheet","create"],"sources":["AdZone.tsx"],"sourcesContent":["/**\n * Component for creating an {@link AdZone}.\n * @module\n */\nimport * as React from \"react\";\nimport { Linking, StyleSheet, View, ViewStyle } 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\";\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\n/**\n * State interface for {@link AdZone}.\n */\ninterface State {\n /**\n * Tracks the current ad index being shown.\n */\n adIndexShown: number;\n /**\n * Tracks the coordinates when the user started touching the Ad View.\n */\n touchStartCoords: TouchCoordinates | undefined;\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/**\n * Creates the AdZone component.\n */\nexport class AdZone extends React.Component<Props, State> {\n /**\n * Timer used for cycling through ads in the zone\n * based on the ad \"refresh time\" for each ad.\n */\n private cycleAdTimer: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * @inheritDoc\n */\n constructor(props: Props, context?: any) {\n super(props, context);\n\n // Generates a random number between 0 and (number of available ads - 1).\n const startingAdIndex = Math.floor(\n Math.random() * this.props.adZoneData.ads.length\n );\n\n this.state = {\n adIndexShown: startingAdIndex,\n touchStartCoords: undefined,\n };\n }\n\n /**\n * @inheritDoc\n */\n public componentDidMount(): void {\n this.initializeAd();\n }\n\n /**\n * @inheritDoc\n */\n public componentWillUnmount(): void {\n if (this.cycleAdTimer) {\n clearTimeout(this.cycleAdTimer);\n }\n }\n\n /**\n * @inheritDoc\n */\n public render(): JSX.Element {\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 = this.generateStyles();\n const currentAd: Ad | undefined =\n this.props.adZoneData.ads[this.state.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 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 this.setState({\n touchStartCoords: {\n x: e.nativeEvent.pageX,\n y: e.nativeEvent.pageY,\n },\n });\n }}\n onTouchEnd={(e) => {\n if (this.state.touchStartCoords) {\n const touchEndCoords: TouchCoordinates = {\n x: e.nativeEvent.pageX,\n y: e.nativeEvent.pageY,\n };\n\n if (\n Math.abs(\n this.state.touchStartCoords.x -\n touchEndCoords.x\n ) < this.props.xyDragDistanceAllowed &&\n Math.abs(\n this.state.touchStartCoords.y -\n touchEndCoords.y\n ) < this.props.xyDragDistanceAllowed\n ) {\n this.onAdZoneSelected(currentAd);\n }\n\n // Make sure to reset the start coords\n this.setState({\n touchStartCoords: undefined,\n });\n }\n }}\n />\n ) : undefined}\n </View>\n );\n }\n\n /**\n * Triggers when the user selects the ad zone.\n * @param currentAd - The ad currently displayed.\n */\n private onAdZoneSelected(currentAd: Ad): void {\n // Determine the \"action type\" and perform that specific action.\n if (\n currentAd.action_type === AdActionType.EXTERNAL &&\n currentAd.action_path\n ) {\n // Action Type: EXTERNAL\n Linking.openURL(currentAd.action_path).then();\n } else if (\n currentAd.action_type === AdActionType.CONTENT &&\n currentAd.payload &&\n currentAd.payload.detailed_list_items\n ) {\n safeInvoke(\n this.props.onAddToListTriggered,\n currentAd.payload.detailed_list_items\n );\n }\n\n this.triggerReportAdEvent(currentAd, ReportedEventType.INTERACTION);\n if (this.cycleAdTimer) {\n clearTimeout(this.cycleAdTimer);\n }\n this.cycleDisplayedAd();\n }\n\n /**\n * Triggered when we need to report an ad event to the API.\n * @param currentAd - The ad to send an event for.\n * @param eventType - The event type for the reported event.\n */\n private triggerReportAdEvent(\n currentAd: Ad,\n eventType: ReportedEventType\n ): 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: this.props.appId,\n session_id: this.props.sessionId,\n udid: this.props.udid,\n events: [\n {\n ad_id: currentAd.ad_id,\n impression_id: currentAd.impression_id,\n event_type: eventType,\n created_at: currentTs,\n },\n ],\n },\n this.props.deviceOs,\n this.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 * @param timerLength - The length of time(in milliseconds) to initialize\n * the timer with.\n */\n private createAdTimer(timerLength: number): void {\n if (this.props.adZoneData.ads.length > 0) {\n this.cycleAdTimer = setTimeout(() => {\n this.cycleDisplayedAd();\n }, timerLength);\n }\n }\n\n /**\n * Cycles to the next ad to display in the current available sequence of ads.\n */\n private cycleDisplayedAd(): void {\n // Start by determining the next ad index to display.\n let nextAdIndex = 0;\n\n if (this.state.adIndexShown < this.props.adZoneData.ads.length - 1) {\n nextAdIndex = this.state.adIndexShown + 1;\n }\n\n this.setState(\n {\n adIndexShown: nextAdIndex,\n },\n () => {\n this.initializeAd();\n }\n );\n }\n\n /**\n * Performs all ad initialization tasks when a new ad is being displayed.\n */\n private initializeAd(): void {\n // Create the new timer based on the new ad index.\n this.createAdTimer(\n this.props.adZoneData.ads[this.state.adIndexShown].refresh_time *\n 1000\n );\n\n // Trigger an impression event for the ad.\n this.triggerReportAdEvent(\n this.props.adZoneData.ads[this.state.adIndexShown],\n ReportedEventType.IMPRESSION\n );\n }\n\n /**\n * Generates all component related styles.\n * @returns the styles needed for the component.\n */\n private 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"],"mappings":";;;;;;AAIA;AACA;AACA;AACA;AAOA;AAEA;AAAqC;AAAA;AAAA;AAwFrC;AACA;AACA;AACO,MAAMA,MAAM,SAASC,KAAK,CAACC,SAAS,CAAe;EACtD;AACJ;AACA;AACA;;EAGI;AACJ;AACA;EACIC,WAAW,CAACC,KAAY,EAAEC,OAAa,EAAE;IACrC,KAAK,CAACD,KAA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