@adadapted/react-native-sdk 3.3.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.
- package/android/bin/build.gradle +9 -8
- package/android/bin/gradle.properties +1 -1
- package/android/build.gradle +17 -80
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkModule.kt +39 -54
- package/ios/AdadaptedReactNativeSdk.m +1 -1
- package/lib/commonjs/api/adadaptedApiRequests.js +3 -3
- package/lib/commonjs/api/adadaptedApiRequests.js.map +1 -1
- package/lib/commonjs/api/adadaptedApiRequests.mock.js.map +1 -1
- package/lib/commonjs/api/adadaptedApiTypes.js +5 -10
- package/lib/commonjs/api/adadaptedApiTypes.js.map +1 -1
- package/lib/commonjs/components/AdZone.js +68 -73
- package/lib/commonjs/components/AdZone.js.map +1 -1
- package/lib/commonjs/components/ReportAdButton.js +9 -7
- package/lib/commonjs/components/ReportAdButton.js.map +1 -1
- package/lib/commonjs/index.js +63 -67
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/util.js +1 -4
- package/lib/commonjs/util.js.map +1 -1
- package/lib/module/api/adadaptedApiRequests.js +2 -0
- package/lib/module/api/adadaptedApiRequests.js.map +1 -1
- package/lib/module/api/adadaptedApiRequests.mock.js +2 -0
- package/lib/module/api/adadaptedApiRequests.mock.js.map +1 -1
- package/lib/module/api/adadaptedApiTypes.js +16 -0
- package/lib/module/api/adadaptedApiTypes.js.map +1 -1
- package/lib/module/components/AdZone.js +62 -68
- package/lib/module/components/AdZone.js.map +1 -1
- package/lib/module/components/ReportAdButton.js +9 -5
- package/lib/module/components/ReportAdButton.js.map +1 -1
- package/lib/module/index.js +58 -56
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/util.js +5 -5
- package/lib/module/util.js.map +1 -1
- package/lib/typescript/src/api/adadaptedApiTypes.d.ts +4 -0
- package/lib/typescript/src/api/adadaptedApiTypes.d.ts.map +1 -1
- package/lib/typescript/src/components/AdZone.d.ts +7 -3
- package/lib/typescript/src/components/AdZone.d.ts.map +1 -1
- package/lib/typescript/src/components/ReportAdButton.d.ts +2 -2
- package/lib/typescript/src/components/ReportAdButton.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +11 -12
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +10 -14
- package/src/api/adadaptedApiTypes.ts +5 -0
- package/src/components/AdZone.tsx +58 -42
- package/src/components/ReportAdButton.tsx +1 -1
- package/src/index.tsx +87 -76
- package/lib/typescript/example/index.d.ts +0 -2
- package/lib/typescript/example/index.d.ts.map +0 -1
- package/lib/typescript/example/src/App.d.ts +0 -29
- package/lib/typescript/example/src/App.d.ts.map +0 -1
- package/lib/typescript/example/src/OffScreenAdZone.d.ts +0 -38
- package/lib/typescript/example/src/OffScreenAdZone.d.ts.map +0 -1
- package/lib/typescript/example/src/StandardAdZone.d.ts +0 -38
- package/lib/typescript/example/src/StandardAdZone.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -2
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/jest.setup.d.ts +0 -6
- package/lib/typescript/jest.setup.d.ts.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Component for creating an {@link AdZone}.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import React, { useEffect, useState } from "react";
|
|
6
6
|
import {
|
|
7
7
|
DeviceEventEmitter,
|
|
8
8
|
Linking,
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
import { WebView } from "react-native-webview";
|
|
22
22
|
import { ApiEnv, DeviceOS } from "../index";
|
|
23
23
|
import { safeInvoke } from "../util";
|
|
24
|
-
import { useEffect, useState } from "react";
|
|
25
24
|
import { ReportAdButton } from "./ReportAdButton";
|
|
26
25
|
|
|
27
26
|
/**
|
|
@@ -67,7 +66,7 @@ interface Props {
|
|
|
67
66
|
*/
|
|
68
67
|
onAddToListTriggered?(items: DetailedListItem[]): void;
|
|
69
68
|
/**
|
|
70
|
-
*
|
|
69
|
+
* An ad zone that is not visible on screen for the initial render.
|
|
71
70
|
*/
|
|
72
71
|
offScreenAdZone: boolean;
|
|
73
72
|
/**
|
|
@@ -118,24 +117,25 @@ let cycleAdTimer: ReturnType<typeof setTimeout> | undefined;
|
|
|
118
117
|
* @param props - properties passed to AdZone.
|
|
119
118
|
* @returns an AdZone JSX Element.
|
|
120
119
|
*/
|
|
121
|
-
export
|
|
122
|
-
// Generates a random number between 0 and (number of available ads - 1).
|
|
123
|
-
const startingAdIndex = Math.floor(
|
|
124
|
-
Math.random() * props.adZoneData.ads.length
|
|
125
|
-
);
|
|
126
|
-
|
|
120
|
+
export const AdZone = (props: Props): React.ReactElement => {
|
|
127
121
|
/**
|
|
128
122
|
* Tracks the current ad index being shown.
|
|
129
123
|
*/
|
|
130
|
-
const [adIndexShown, setAdIndexShown] = useState(
|
|
124
|
+
const [adIndexShown, setAdIndexShown] = useState(
|
|
125
|
+
Math.floor(Math.random() * props.adZoneData.ads.length)
|
|
126
|
+
);
|
|
131
127
|
/**
|
|
132
128
|
* Tracks the coordinates when the user started touching the Ad View.
|
|
133
129
|
*/
|
|
134
|
-
const [touchStartCoords, setTouchStartCoords] = useState({
|
|
130
|
+
const [touchStartCoords, setTouchStartCoords] = useState<TouchCoordinates>({
|
|
131
|
+
x: 0,
|
|
132
|
+
y: 0,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
135
|
/**
|
|
136
136
|
* Track ad visibility (for off-screen ads).
|
|
137
137
|
*/
|
|
138
|
-
const [
|
|
138
|
+
const [isAdZoneVisible, setIsAdVisibile] = useState(props.isAdZoneVisible);
|
|
139
139
|
|
|
140
140
|
// Setup device listeners.
|
|
141
141
|
useEffect(() => {
|
|
@@ -147,15 +147,8 @@ export function AdZone(props: Props): JSX.Element {
|
|
|
147
147
|
acknowledge(itemName);
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
if (props.offScreenAdZone && isAdVisible) {
|
|
151
|
-
sendAdImpression();
|
|
152
|
-
} else if (!props.offScreenAdZone) {
|
|
153
|
-
sendAdImpression();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
150
|
return () => {
|
|
157
151
|
clearTimeout(cycleAdTimer);
|
|
158
|
-
DeviceEventEmitter.removeAllListeners("visibility-event");
|
|
159
152
|
DeviceEventEmitter.removeAllListeners("acknowledge");
|
|
160
153
|
};
|
|
161
154
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -164,23 +157,25 @@ export function AdZone(props: Props): JSX.Element {
|
|
|
164
157
|
// Send impression on ad cycle.
|
|
165
158
|
useEffect(() => {
|
|
166
159
|
startAdTimer();
|
|
167
|
-
if (
|
|
168
|
-
sendAdImpression();
|
|
169
|
-
} else if (!props.offScreenAdZone) {
|
|
160
|
+
if (isAdZoneVisible) {
|
|
170
161
|
sendAdImpression();
|
|
171
162
|
}
|
|
172
163
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
173
164
|
}, [adIndexShown]);
|
|
174
165
|
|
|
175
|
-
// Send impression based on visibility change. (for off-screen ads)
|
|
176
166
|
useEffect(() => {
|
|
177
|
-
if (
|
|
178
|
-
|
|
179
|
-
|
|
167
|
+
if (
|
|
168
|
+
props.offScreenAdZone &&
|
|
169
|
+
isAdZoneVisible &&
|
|
170
|
+
props.adZoneData &&
|
|
171
|
+
props.adZoneData.ads &&
|
|
172
|
+
props.adZoneData.ads.length > adIndexShown &&
|
|
173
|
+
!props.adZoneData.ads[adIndexShown].impression_tracked
|
|
174
|
+
) {
|
|
180
175
|
sendAdImpression();
|
|
181
176
|
}
|
|
182
177
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
183
|
-
}, [
|
|
178
|
+
}, [isAdZoneVisible]);
|
|
184
179
|
|
|
185
180
|
/**
|
|
186
181
|
* Generates all component related styles.
|
|
@@ -207,11 +202,12 @@ export function AdZone(props: Props): JSX.Element {
|
|
|
207
202
|
// Generate the styles each render in case the ad is updated with
|
|
208
203
|
// new settings that need to be reflected in the styles of the view.
|
|
209
204
|
const styles = generateStyles();
|
|
210
|
-
const currentAd: Ad | undefined =
|
|
211
|
-
props.adZoneData.ads[adIndexShown] || undefined;
|
|
212
205
|
const finalMainViewStyle = styles.mainView;
|
|
213
206
|
|
|
214
|
-
if (
|
|
207
|
+
if (
|
|
208
|
+
!props.adZoneData.ads[adIndexShown] ||
|
|
209
|
+
!props.adZoneData.ads[adIndexShown].creative_url
|
|
210
|
+
) {
|
|
215
211
|
// If there is no ad to display, make the view take up no space.
|
|
216
212
|
finalMainViewStyle.width = 0;
|
|
217
213
|
finalMainViewStyle.height = 0;
|
|
@@ -303,10 +299,15 @@ export function AdZone(props: Props): JSX.Element {
|
|
|
303
299
|
function startAdTimer(): void {
|
|
304
300
|
clearTimeout(cycleAdTimer);
|
|
305
301
|
|
|
306
|
-
if (
|
|
302
|
+
if (
|
|
303
|
+
props.adZoneData.ads.length > 0 &&
|
|
304
|
+
props.adZoneData.ads[adIndexShown]
|
|
305
|
+
) {
|
|
307
306
|
const refreshTime: number =
|
|
308
307
|
props.adZoneData.ads[adIndexShown].refresh_time * 1000;
|
|
309
308
|
cycleAdTimer = setTimeout(cycleDisplayedAd, refreshTime);
|
|
309
|
+
} else {
|
|
310
|
+
cycleAdTimer = setTimeout(cycleDisplayedAd, 30000);
|
|
310
311
|
}
|
|
311
312
|
}
|
|
312
313
|
|
|
@@ -314,18 +315,18 @@ export function AdZone(props: Props): JSX.Element {
|
|
|
314
315
|
* Cycles to the next ad to display in the current available sequence of ads.
|
|
315
316
|
*/
|
|
316
317
|
function cycleDisplayedAd(): void {
|
|
317
|
-
// Start by determining the next ad index to display.
|
|
318
318
|
let nextAdIndex = 0;
|
|
319
|
+
|
|
320
|
+
// Start by determining the next ad index to display.
|
|
319
321
|
const lastAd = props.adZoneData.ads[adIndexShown];
|
|
320
322
|
|
|
321
323
|
if (adIndexShown < props.adZoneData.ads.length - 1) {
|
|
322
324
|
nextAdIndex = adIndexShown + 1;
|
|
325
|
+
} else {
|
|
326
|
+
nextAdIndex = 0;
|
|
323
327
|
}
|
|
324
328
|
|
|
325
|
-
if (
|
|
326
|
-
// Reset ad impression tracking status.
|
|
327
|
-
lastAd.impression_tracked = false;
|
|
328
|
-
} else {
|
|
329
|
+
if (!lastAd.impression_tracked && !isAdZoneVisible) {
|
|
329
330
|
// Send invisible ad impression if ad was not visible before end of timer cycle.
|
|
330
331
|
triggerReportAdEvent(
|
|
331
332
|
lastAd,
|
|
@@ -333,6 +334,11 @@ export function AdZone(props: Props): JSX.Element {
|
|
|
333
334
|
);
|
|
334
335
|
}
|
|
335
336
|
|
|
337
|
+
if (lastAd.impression_tracked) {
|
|
338
|
+
// Reset ad impression tracking status.
|
|
339
|
+
lastAd.impression_tracked = false;
|
|
340
|
+
}
|
|
341
|
+
|
|
336
342
|
setAdIndexShown(nextAdIndex);
|
|
337
343
|
}
|
|
338
344
|
|
|
@@ -342,7 +348,7 @@ export function AdZone(props: Props): JSX.Element {
|
|
|
342
348
|
function sendAdImpression(): void {
|
|
343
349
|
const ad = props.adZoneData.ads[adIndexShown];
|
|
344
350
|
|
|
345
|
-
if (!ad.impression_tracked) {
|
|
351
|
+
if (ad.impression_tracked === undefined || !ad.impression_tracked) {
|
|
346
352
|
triggerReportAdEvent(ad, ReportedEventType.IMPRESSION);
|
|
347
353
|
ad.impression_tracked = true;
|
|
348
354
|
}
|
|
@@ -351,10 +357,11 @@ export function AdZone(props: Props): JSX.Element {
|
|
|
351
357
|
// Returned JSX.
|
|
352
358
|
return (
|
|
353
359
|
<View style={finalMainViewStyle}>
|
|
354
|
-
{
|
|
360
|
+
{props.adZoneData.ads[adIndexShown] &&
|
|
361
|
+
props.adZoneData.ads[adIndexShown].creative_url ? (
|
|
355
362
|
<WebView
|
|
356
363
|
source={{
|
|
357
|
-
uri:
|
|
364
|
+
uri: props.adZoneData.ads[adIndexShown].creative_url,
|
|
358
365
|
}}
|
|
359
366
|
androidLayerType="hardware"
|
|
360
367
|
automaticallyAdjustContentInsets={false}
|
|
@@ -380,7 +387,9 @@ export function AdZone(props: Props): JSX.Element {
|
|
|
380
387
|
touchStartCoords.y - touchEndCoords.y
|
|
381
388
|
) < props.xyDragDistanceAllowed
|
|
382
389
|
) {
|
|
383
|
-
onAdZoneSelected(
|
|
390
|
+
onAdZoneSelected(
|
|
391
|
+
props.adZoneData.ads[adIndexShown]
|
|
392
|
+
);
|
|
384
393
|
}
|
|
385
394
|
|
|
386
395
|
// Make sure to reset the start coords
|
|
@@ -390,8 +399,15 @@ export function AdZone(props: Props): JSX.Element {
|
|
|
390
399
|
/>
|
|
391
400
|
) : undefined}
|
|
392
401
|
<View style={styles.reportAd}>
|
|
393
|
-
|
|
402
|
+
{props.adZoneData && props.adZoneData.ads[adIndexShown] ? (
|
|
403
|
+
<ReportAdButton
|
|
404
|
+
adId={props.adZoneData.ads[adIndexShown].ad_id}
|
|
405
|
+
udid={props.udid}
|
|
406
|
+
/>
|
|
407
|
+
) : (
|
|
408
|
+
<></>
|
|
409
|
+
)}
|
|
394
410
|
</View>
|
|
395
411
|
</View>
|
|
396
412
|
);
|
|
397
|
-
}
|
|
413
|
+
};
|
|
@@ -17,7 +17,7 @@ interface Props {
|
|
|
17
17
|
* @param props The component's props.
|
|
18
18
|
* @returns a reportSdButton JSX Element.
|
|
19
19
|
*/
|
|
20
|
-
export function ReportAdButton(props: Props): JSX.Element {
|
|
20
|
+
export function ReportAdButton(props: Props): React.JSX.Element {
|
|
21
21
|
const reportAdUrlBase = new URL("https://feedback.add-it.io/");
|
|
22
22
|
|
|
23
23
|
const styles = StyleSheet.create({
|
package/src/index.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import * as adadaptedApiRequests from "./api/adadaptedApiRequests";
|
|
13
13
|
import {
|
|
14
14
|
AdSession,
|
|
15
|
-
|
|
15
|
+
AdZoneDetailedListItemInfo,
|
|
16
16
|
KeywordIntercepts,
|
|
17
17
|
KeywordSearchTerm,
|
|
18
18
|
ListManagerEvent,
|
|
@@ -131,13 +131,13 @@ export interface InitializeProps {
|
|
|
131
131
|
onAdZonesRefreshed?(): void;
|
|
132
132
|
/**
|
|
133
133
|
* Callback that gets triggered when an "add to list" item/items are clicked.
|
|
134
|
-
* @param
|
|
134
|
+
* @param detail - details about the list items to add to cart.
|
|
135
135
|
*/
|
|
136
|
-
onAddToListTriggered?(
|
|
136
|
+
onAddToListTriggered?(detail: AdZoneDetailedListItemInfo): void;
|
|
137
137
|
/**
|
|
138
138
|
* Callback that gets triggered when an "add to list"
|
|
139
139
|
* occurs by means of an "out of app" data payload.
|
|
140
|
-
* @param
|
|
140
|
+
* @param detail - Details about payloads clients must go through.
|
|
141
141
|
*/
|
|
142
142
|
onOutOfAppPayloadAvailable?(payloads: OutOfAppDataPayload[]): void;
|
|
143
143
|
/**
|
|
@@ -219,7 +219,7 @@ export interface AdZoneInfo {
|
|
|
219
219
|
/**
|
|
220
220
|
* The ad zone component.
|
|
221
221
|
*/
|
|
222
|
-
adZone: JSX.Element;
|
|
222
|
+
adZone: React.JSX.Element;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
/**
|
|
@@ -309,11 +309,11 @@ export class AdadaptedReactNativeSdk {
|
|
|
309
309
|
/**
|
|
310
310
|
* If provided, triggers when an "add to list" item is
|
|
311
311
|
* clicked in an ad zone.
|
|
312
|
-
* @param
|
|
312
|
+
* @param detail - The array of items to "add to list".
|
|
313
313
|
* @param isExternalPayload - If true, the items are from an external payload.
|
|
314
314
|
*/
|
|
315
315
|
private onAddToListTriggered: (
|
|
316
|
-
|
|
316
|
+
detail: AdZoneDetailedListItemInfo,
|
|
317
317
|
isExternalPayload?: boolean
|
|
318
318
|
) => void | undefined;
|
|
319
319
|
/**
|
|
@@ -333,11 +333,7 @@ export class AdadaptedReactNativeSdk {
|
|
|
333
333
|
*/
|
|
334
334
|
private AppStateOnEventListener: EmitterSubscription | undefined;
|
|
335
335
|
/**
|
|
336
|
-
*
|
|
337
|
-
*/
|
|
338
|
-
private isAdZoneVisible: boolean = true;
|
|
339
|
-
/**
|
|
340
|
-
* Ad zones that contain off-screen ads..
|
|
336
|
+
* Ad zones that contain off-screen ads.
|
|
341
337
|
*/
|
|
342
338
|
private offScreenAdZone: [number] | undefined;
|
|
343
339
|
/**
|
|
@@ -420,34 +416,30 @@ export class AdadaptedReactNativeSdk {
|
|
|
420
416
|
|
|
421
417
|
for (const adZoneId in adZones) {
|
|
422
418
|
if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
/>
|
|
448
|
-
),
|
|
449
|
-
});
|
|
450
|
-
}
|
|
419
|
+
adZoneInfoList.push({
|
|
420
|
+
zoneId: adZones[adZoneId].id,
|
|
421
|
+
adZone: (
|
|
422
|
+
<AdZone
|
|
423
|
+
key={adZoneId}
|
|
424
|
+
appId={this.appId}
|
|
425
|
+
sessionId={this.sessionId!}
|
|
426
|
+
udid={this.deviceInfo!.udid}
|
|
427
|
+
deviceOs={this.deviceOs!}
|
|
428
|
+
apiEnv={this.apiEnv}
|
|
429
|
+
xyDragDistanceAllowed={
|
|
430
|
+
this.xyAdZoneDragDistanceAllowed || 25
|
|
431
|
+
}
|
|
432
|
+
adZoneData={adZones[adZoneId]}
|
|
433
|
+
onAddToListTriggered={(details) => {
|
|
434
|
+
safeInvoke(this.onAddToListTriggered, {
|
|
435
|
+
zoneId: adZoneId,
|
|
436
|
+
items: details,
|
|
437
|
+
});
|
|
438
|
+
}}
|
|
439
|
+
isAdZoneVisible={true}
|
|
440
|
+
offScreenAdZone={false}
|
|
441
|
+
/>
|
|
442
|
+
),
|
|
451
443
|
});
|
|
452
444
|
}
|
|
453
445
|
}
|
|
@@ -466,35 +458,37 @@ export class AdadaptedReactNativeSdk {
|
|
|
466
458
|
|
|
467
459
|
for (const adZoneId in adZones) {
|
|
468
460
|
if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
461
|
+
if (
|
|
462
|
+
this.offScreenAdZone &&
|
|
463
|
+
this.offScreenAdZone.length > 0 &&
|
|
464
|
+
this.offScreenAdZone.includes(Number(adZoneId))
|
|
465
|
+
) {
|
|
466
|
+
adZoneInfoList.push({
|
|
467
|
+
zoneId: adZones[adZoneId].id,
|
|
468
|
+
adZone: (
|
|
469
|
+
<AdZone
|
|
470
|
+
key={adZoneId}
|
|
471
|
+
appId={this.appId}
|
|
472
|
+
sessionId={this.sessionId!}
|
|
473
|
+
udid={this.deviceInfo!.udid}
|
|
474
|
+
deviceOs={this.deviceOs!}
|
|
475
|
+
apiEnv={this.apiEnv}
|
|
476
|
+
xyDragDistanceAllowed={
|
|
477
|
+
this.xyAdZoneDragDistanceAllowed || 25
|
|
478
|
+
}
|
|
479
|
+
adZoneData={adZones[adZoneId]}
|
|
480
|
+
onAddToListTriggered={(items) => {
|
|
481
|
+
safeInvoke(this.onAddToListTriggered, {
|
|
482
|
+
zoneId: adZoneId,
|
|
483
|
+
items,
|
|
484
|
+
});
|
|
485
|
+
}}
|
|
486
|
+
isAdZoneVisible={false}
|
|
487
|
+
offScreenAdZone={true}
|
|
488
|
+
/>
|
|
489
|
+
),
|
|
490
|
+
});
|
|
491
|
+
}
|
|
498
492
|
}
|
|
499
493
|
}
|
|
500
494
|
return adZoneInfoList;
|
|
@@ -734,7 +728,6 @@ export class AdadaptedReactNativeSdk {
|
|
|
734
728
|
* @param isVisible - Ad Zone visibility tracking.
|
|
735
729
|
*/
|
|
736
730
|
public onAdZoneVisibilityChanged(isVisible: boolean): void {
|
|
737
|
-
this.isAdZoneVisible = isVisible;
|
|
738
731
|
DeviceEventEmitter.emit("visibility-event", isVisible);
|
|
739
732
|
}
|
|
740
733
|
|
|
@@ -924,8 +917,14 @@ export class AdadaptedReactNativeSdk {
|
|
|
924
917
|
|
|
925
918
|
this.keywordInterceptSearchValue = searchTerm;
|
|
926
919
|
|
|
927
|
-
if (!this.deviceInfo
|
|
928
|
-
console.error(
|
|
920
|
+
if (!this.deviceInfo) {
|
|
921
|
+
console.error(
|
|
922
|
+
"AdAdapted SDK has not been initialized with device info."
|
|
923
|
+
);
|
|
924
|
+
} else if (!this.sessionId) {
|
|
925
|
+
console.error(
|
|
926
|
+
"AdAdapted SDK has not been initialized with session id."
|
|
927
|
+
);
|
|
929
928
|
} else if (!this.keywordIntercepts) {
|
|
930
929
|
console.error("No available keyword intercepts.");
|
|
931
930
|
} else if (
|
|
@@ -1017,8 +1016,14 @@ export class AdadaptedReactNativeSdk {
|
|
|
1017
1016
|
public reportKeywordInterceptTermSelected(termId: string): void {
|
|
1018
1017
|
const termObj = this.getKeywordInterceptTerm(termId);
|
|
1019
1018
|
|
|
1020
|
-
if (!this.deviceInfo
|
|
1021
|
-
console.error(
|
|
1019
|
+
if (!this.deviceInfo) {
|
|
1020
|
+
console.error(
|
|
1021
|
+
"AdAdapted SDK has not been initialized with device info."
|
|
1022
|
+
);
|
|
1023
|
+
} else if (!this.sessionId) {
|
|
1024
|
+
console.error(
|
|
1025
|
+
"AdAdapted SDK has not been initialized with session id."
|
|
1026
|
+
);
|
|
1022
1027
|
} else if (!this.keywordIntercepts) {
|
|
1023
1028
|
console.error("No available keyword intercepts.");
|
|
1024
1029
|
} else if (!termId || !termObj) {
|
|
@@ -1070,8 +1075,14 @@ export class AdadaptedReactNativeSdk {
|
|
|
1070
1075
|
}
|
|
1071
1076
|
}
|
|
1072
1077
|
|
|
1073
|
-
if (!this.deviceInfo
|
|
1074
|
-
console.error(
|
|
1078
|
+
if (!this.deviceInfo) {
|
|
1079
|
+
console.error(
|
|
1080
|
+
"AdAdapted SDK has not been initialized with device info."
|
|
1081
|
+
);
|
|
1082
|
+
} else if (!this.sessionId) {
|
|
1083
|
+
console.error(
|
|
1084
|
+
"AdAdapted SDK has not been initialized with session id."
|
|
1085
|
+
);
|
|
1075
1086
|
} else if (!this.keywordIntercepts) {
|
|
1076
1087
|
console.error("No available keyword intercepts.");
|
|
1077
1088
|
} else if (!termIds || termIds.length === 0 || termObjs.length === 0) {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../example/index.tsx"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test app component for testing the
|
|
3
|
-
* {@link AdadaptedReactNativeSdk} package/module.
|
|
4
|
-
*/
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { KeywordSearchResult } from "../../src/index";
|
|
7
|
-
/**
|
|
8
|
-
* Interfaced used to pass in an item to the {@link StandardAdZonePage.selectItem} method.
|
|
9
|
-
* Only one of the two properties should be provided.
|
|
10
|
-
*/
|
|
11
|
-
export interface SelectedItem {
|
|
12
|
-
/**
|
|
13
|
-
* The object containing a keyword search item.
|
|
14
|
-
*/
|
|
15
|
-
item?: KeywordSearchResult;
|
|
16
|
-
/**
|
|
17
|
-
* A standard product name.
|
|
18
|
-
*/
|
|
19
|
-
itemName?: string;
|
|
20
|
-
}
|
|
21
|
-
export type RootStackParamList = {
|
|
22
|
-
StandardAdZone: undefined;
|
|
23
|
-
OffScreenAdZone: undefined;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Creates the main component for the App.
|
|
27
|
-
*/
|
|
28
|
-
export declare const App: () => React.JSX.Element;
|
|
29
|
-
//# sourceMappingURL=App.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../example/src/App.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAIH,mBAAmB,EACtB,MAAM,iBAAiB,CAAC;AAMzB;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC7B,cAAc,EAAE,SAAS,CAAC;IAC1B,eAAe,EAAE,SAAS,CAAC;CAC9B,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,GAAG,yBAyIf,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test app component for testing the
|
|
3
|
-
* {@link AdadaptedReactNativeSdk} package/module.
|
|
4
|
-
*/
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { AdadaptedReactNativeSdk, AdZoneInfo } from "../../src/index";
|
|
7
|
-
import { SelectedItem } from "./App";
|
|
8
|
-
/**
|
|
9
|
-
* Props interface for {@link StandardAdZonePage}.
|
|
10
|
-
*/
|
|
11
|
-
interface OffScreenAdZonePageProps {
|
|
12
|
-
/**
|
|
13
|
-
* The adadapted sdk instance.
|
|
14
|
-
*/
|
|
15
|
-
aaSdk: AdadaptedReactNativeSdk;
|
|
16
|
-
/**
|
|
17
|
-
* The current session's id.
|
|
18
|
-
*/
|
|
19
|
-
sessionId: string | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* The ad zones' data.
|
|
22
|
-
*/
|
|
23
|
-
adZoneInfoList: AdZoneInfo[] | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* The selected list items array.
|
|
26
|
-
*/
|
|
27
|
-
selectedItemList: string[];
|
|
28
|
-
/**
|
|
29
|
-
* Adds selected item to grocery list;
|
|
30
|
-
*/
|
|
31
|
-
selectItem(item: SelectedItem): void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates an off screen example component.
|
|
35
|
-
*/
|
|
36
|
-
export declare const OffScreenAdZonePage: (props: OffScreenAdZonePageProps) => React.JSX.Element;
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=OffScreenAdZone.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OffScreenAdZone.d.ts","sourceRoot":"","sources":["../../../../example/src/OffScreenAdZone.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAiB,MAAM,OAAO,CAAC;AAWtC,OAAO,EACH,uBAAuB,EACvB,UAAU,EAEb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAsB,YAAY,EAAE,MAAM,OAAO,CAAC;AASzD;;GAEG;AACH,UAAU,wBAAwB;IAC9B;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;IAC/B;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;OAEG;IACH,cAAc,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;IACzC;;OAEG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;CACxC;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,UAAW,wBAAwB,sBAiNlE,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test app component for testing the
|
|
3
|
-
* {@link AdadaptedReactNativeSdk} package/module.
|
|
4
|
-
*/
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { AdadaptedReactNativeSdk, AdZoneInfo } from "../../src/index";
|
|
7
|
-
import { SelectedItem } from "./App";
|
|
8
|
-
/**
|
|
9
|
-
* Props interface for {@link StandardAdZonePage}.
|
|
10
|
-
*/
|
|
11
|
-
interface StandardAdZonePageProps {
|
|
12
|
-
/**
|
|
13
|
-
* The adadapted sdk instance.
|
|
14
|
-
*/
|
|
15
|
-
aaSdk: AdadaptedReactNativeSdk;
|
|
16
|
-
/**
|
|
17
|
-
* The current session's id.
|
|
18
|
-
*/
|
|
19
|
-
sessionId: string | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* The ad zones' data.
|
|
22
|
-
*/
|
|
23
|
-
adZoneInfoList: AdZoneInfo[] | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* The selected list items array.
|
|
26
|
-
*/
|
|
27
|
-
selectedItemList: string[];
|
|
28
|
-
/**
|
|
29
|
-
* Adds selected item to grocery list;
|
|
30
|
-
*/
|
|
31
|
-
selectItem(item: SelectedItem): void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates a standard ad zone exmple component.
|
|
35
|
-
*/
|
|
36
|
-
export declare const StandardAdZonePage: (props: StandardAdZonePageProps) => React.JSX.Element;
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=StandardAdZone.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StandardAdZone.d.ts","sourceRoot":"","sources":["../../../../example/src/StandardAdZone.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAiB,MAAM,OAAO,CAAC;AAYtC,OAAO,EACH,uBAAuB,EACvB,UAAU,EAEb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAsB,YAAY,EAAE,MAAM,OAAO,CAAC;AASzD;;GAEG;AACH,UAAU,uBAAuB;IAC7B;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;IAC/B;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;OAEG;IACH,cAAc,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;IACzC;;OAEG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;CACxC;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,UAAW,uBAAuB,sBA+LhE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../jest.setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,2BAA2B,CAAC"}
|