@adadapted/react-native-sdk 3.4.0 → 3.5.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 (48) hide show
  1. package/lib/commonjs/api/adadaptedApiRequests.js +9 -9
  2. package/lib/commonjs/api/adadaptedApiRequests.js.map +1 -1
  3. package/lib/commonjs/api/adadaptedApiTypes.js.map +1 -1
  4. package/lib/commonjs/componentTypes/AdZone.js +11 -0
  5. package/lib/commonjs/componentTypes/AdZone.js.map +1 -0
  6. package/lib/commonjs/componentTypes/Device.js +22 -0
  7. package/lib/commonjs/componentTypes/Device.js.map +1 -0
  8. package/lib/commonjs/componentTypes/Environment.js +34 -0
  9. package/lib/commonjs/componentTypes/Environment.js.map +1 -0
  10. package/lib/commonjs/components/AdZone.js +11 -15
  11. package/lib/commonjs/components/AdZone.js.map +1 -1
  12. package/lib/commonjs/index.js +96 -116
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/module/api/adadaptedApiRequests.js +9 -9
  15. package/lib/module/api/adadaptedApiRequests.js.map +1 -1
  16. package/lib/module/api/adadaptedApiTypes.js.map +1 -1
  17. package/lib/module/componentTypes/AdZone.js +7 -0
  18. package/lib/module/componentTypes/AdZone.js.map +1 -0
  19. package/lib/module/componentTypes/Device.js +18 -0
  20. package/lib/module/componentTypes/Device.js.map +1 -0
  21. package/lib/module/componentTypes/Environment.js +30 -0
  22. package/lib/module/componentTypes/Environment.js.map +1 -0
  23. package/lib/module/components/AdZone.js +11 -15
  24. package/lib/module/components/AdZone.js.map +1 -1
  25. package/lib/module/index.js +92 -122
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/typescript/src/api/adadaptedApiRequests.d.ts +10 -9
  28. package/lib/typescript/src/api/adadaptedApiRequests.d.ts.map +1 -1
  29. package/lib/typescript/src/api/adadaptedApiTypes.d.ts +11 -4
  30. package/lib/typescript/src/api/adadaptedApiTypes.d.ts.map +1 -1
  31. package/lib/typescript/src/componentTypes/AdZone.d.ts +95 -0
  32. package/lib/typescript/src/componentTypes/AdZone.d.ts.map +1 -0
  33. package/lib/typescript/src/componentTypes/Device.d.ts +80 -0
  34. package/lib/typescript/src/componentTypes/Device.d.ts.map +1 -0
  35. package/lib/typescript/src/componentTypes/Environment.d.ts +57 -0
  36. package/lib/typescript/src/componentTypes/Environment.d.ts.map +1 -0
  37. package/lib/typescript/src/components/AdZone.d.ts +2 -55
  38. package/lib/typescript/src/components/AdZone.d.ts.map +1 -1
  39. package/lib/typescript/src/index.d.ts +38 -142
  40. package/lib/typescript/src/index.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/src/api/adadaptedApiRequests.ts +25 -24
  43. package/src/api/adadaptedApiTypes.ts +11 -5
  44. package/src/componentTypes/AdZone.ts +97 -0
  45. package/src/componentTypes/Device.ts +79 -0
  46. package/src/componentTypes/Environment.ts +58 -0
  47. package/src/components/AdZone.tsx +33 -111
  48. package/src/index.tsx +152 -250
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
- AdZoneDetailedListItemInfo,
15
+ DetailedListItem,
16
16
  KeywordIntercepts,
17
17
  KeywordSearchTerm,
18
18
  ListManagerEvent,
@@ -29,74 +29,8 @@ import { AdZone } from "./components/AdZone";
29
29
  import { safeInvoke } from "./util";
30
30
  import packageJson from "../package.json";
31
31
  import base64 from "react-native-base64";
32
-
33
- /**
34
- * Enum representing possible device operating systems.
35
- */
36
- export enum DeviceOS {
37
- /**
38
- * Represents the Android operating system.
39
- */
40
- ANDROID = "android",
41
- /**
42
- * Represents the iOS operating system.
43
- */
44
- IOS = "ios",
45
- }
46
-
47
- /**
48
- * Enum defining the different API environments.
49
- */
50
- export enum ApiEnv {
51
- /**
52
- * The production API environment.
53
- */
54
- Prod = "https://ads.adadapted.com",
55
- /**
56
- * The development API environment.
57
- */
58
- Dev = "https://sandbox.adadapted.com",
59
- /**
60
- * Used only for unit testing/mock data.
61
- */
62
- Mock = "MOCK_DATA",
63
- }
64
-
65
- /**
66
- * Enum defining the different API environments for List Manager.
67
- */
68
- export enum ListManagerApiEnv {
69
- /**
70
- * The production API environment.
71
- */
72
- Prod = "https://ec.adadapted.com",
73
- /**
74
- * The development API environment.
75
- */
76
- Dev = "https://sandec.adadapted.com",
77
- /**
78
- * Used only for unit testing/mocking data.
79
- */
80
- Mock = "MOCK_DATA",
81
- }
82
-
83
- /**
84
- * Enum defining the different API environments for the Payload Server.
85
- */
86
- export enum PayloadApiEnv {
87
- /**
88
- * The production API environment.
89
- */
90
- Prod = "https://payload.adadapted.com",
91
- /**
92
- * The development API environment.
93
- */
94
- Dev = "https://sandpayload.adadapted.com",
95
- /**
96
- * Used only for unit testing/mocking data.
97
- */
98
- Mock = "MOCK_DATA",
99
- }
32
+ import { DeviceTypes } from "./componentTypes/Device";
33
+ import { EnvironmentTypes } from "./componentTypes/Environment";
100
34
 
101
35
  /**
102
36
  * Interface defining inputs to the {@link Sdk.initialize: AdadaptedReactNativeSdk} method.
@@ -110,7 +44,7 @@ export interface InitializeProps {
110
44
  * The API environment.
111
45
  * If undefined, defaults to production.
112
46
  */
113
- apiEnv?: ApiEnv;
47
+ apiEnv?: EnvironmentTypes.ApiEnv;
114
48
  /**
115
49
  * Optional custom advertiserId to replace IDFA - ios only.
116
50
  */
@@ -131,81 +65,19 @@ export interface InitializeProps {
131
65
  onAdZonesRefreshed?(): void;
132
66
  /**
133
67
  * Callback that gets triggered when an "add to list" item/items are clicked.
134
- * @param detail - details about the list items to add to cart.
68
+ * @param items - The array of items to "add to list".
135
69
  */
136
- onAddToListTriggered?(detail: AdZoneDetailedListItemInfo): void;
70
+ onAddToListTriggered?(items: DetailedListItem[]): void;
137
71
  /**
138
72
  * Callback that gets triggered when an "add to list"
139
73
  * occurs by means of an "out of app" data payload.
140
- * @param detail - Details about payloads clients must go through.
74
+ * @param payloads - All payloads the client must go through.
141
75
  */
142
76
  onOutOfAppPayloadAvailable?(payloads: OutOfAppDataPayload[]): void;
143
77
  /**
144
- * Ad zones that contain off-screen ads.
78
+ * Ad zone ids that contain off-screen ads.
145
79
  */
146
- offScreenAdZone?: [number];
147
- }
148
-
149
- /**
150
- * Interface defining properties of a user's Device.
151
- */
152
- export interface DeviceInfo {
153
- /**
154
- * The unique device ID.
155
- */
156
- udid: string;
157
- /**
158
- * The device name.
159
- */
160
- deviceName: string;
161
- /**
162
- * The operating system name.
163
- */
164
- systemName: string;
165
- /**
166
- * The operating system version.
167
- */
168
- systemVersion: string;
169
- /**
170
- * The device model.
171
- */
172
- deviceModel: string;
173
- /**
174
- * The device screen width.
175
- */
176
- deviceWidth: string;
177
- /**
178
- * The device screen height.
179
- */
180
- deviceHeight: string;
181
- /**
182
- * The device screen density.
183
- */
184
- deviceScreenDensity: string;
185
- /**
186
- * The current device local.
187
- */
188
- deviceLocale: string;
189
- /**
190
- * The device carrier name.
191
- */
192
- deviceCarrier: string;
193
- /**
194
- * The bundle ID.
195
- */
196
- bundleId: string;
197
- /**
198
- * The bundle version.
199
- */
200
- bundleVersion: string;
201
- /**
202
- * The current device timezone.
203
- */
204
- deviceTimezone: string;
205
- /**
206
- * If true, ad tracking is enabled for the device.
207
- */
208
- isAdTrackingEnabled: boolean;
80
+ offScreenAdZoneIds?: [number];
209
81
  }
210
82
 
211
83
  /**
@@ -241,19 +113,19 @@ export class AdadaptedReactNativeSdk {
241
113
  /**
242
114
  * The API environment to use when making API calls.
243
115
  */
244
- private apiEnv: ApiEnv;
116
+ private apiEnv: EnvironmentTypes.ApiEnv;
245
117
  /**
246
118
  * The API environment to use when making API calls for List Manager.
247
119
  */
248
- private listManagerApiEnv: ListManagerApiEnv;
120
+ private listManagerApiEnv: EnvironmentTypes.ListManagerApiEnv;
249
121
  /**
250
122
  * The API environment to use when making API calls for the Payload server.
251
123
  */
252
- private payloadApiEnv: PayloadApiEnv;
124
+ private payloadApiEnv: EnvironmentTypes.PayloadApiEnv;
253
125
  /**
254
126
  * The device operating system.
255
127
  */
256
- private deviceOs: DeviceOS | undefined;
128
+ private deviceOs: DeviceTypes.DeviceOS | undefined;
257
129
  /**
258
130
  * The session ID used for the API to properly identify a user.
259
131
  */
@@ -261,7 +133,7 @@ export class AdadaptedReactNativeSdk {
261
133
  /**
262
134
  * All device data gathered when "initialize" is called.
263
135
  */
264
- private deviceInfo: DeviceInfo | undefined;
136
+ private deviceInfo: DeviceTypes.DeviceInfo | undefined;
265
137
  /**
266
138
  * All current Session/Ad info.
267
139
  * This info can be refreshed based on the set interval.
@@ -275,6 +147,10 @@ export class AdadaptedReactNativeSdk {
275
147
  * The available off-screen ad zones.
276
148
  */
277
149
  private offScreenAdZones: AdZoneInfo[] = [];
150
+ /**
151
+ * The zone ids of the availible off-screen ad zones.
152
+ */
153
+ private offScreenAdZoneIds: number[] = [];
278
154
  /**
279
155
  * The touch sensitivity of the Ad Zone in both the X and Y directions.
280
156
  * This is used to determine the click/press sensitivity when the
@@ -309,11 +185,11 @@ export class AdadaptedReactNativeSdk {
309
185
  /**
310
186
  * If provided, triggers when an "add to list" item is
311
187
  * clicked in an ad zone.
312
- * @param detail - The array of items to "add to list".
188
+ * @param items - The array of items to "add to list".
313
189
  * @param isExternalPayload - If true, the items are from an external payload.
314
190
  */
315
191
  private onAddToListTriggered: (
316
- detail: AdZoneDetailedListItemInfo,
192
+ items: DetailedListItem[],
317
193
  isExternalPayload?: boolean
318
194
  ) => void | undefined;
319
195
  /**
@@ -333,9 +209,19 @@ export class AdadaptedReactNativeSdk {
333
209
  */
334
210
  private AppStateOnEventListener: EmitterSubscription | undefined;
335
211
  /**
336
- * Ad zones that contain off-screen ads.
212
+ * The current adzone visibility status.
337
213
  */
338
- private offScreenAdZone: [number] | undefined;
214
+ private isAdZoneVisible: boolean = true;
215
+ /**
216
+ * The ad context object.
217
+ */
218
+ private adContext:
219
+ | {
220
+ contextIds: string[];
221
+ zoneIds: string[];
222
+ }
223
+ | undefined;
224
+
339
225
  /**
340
226
  * Gets the Session ID.
341
227
  * @returns the Session ID.
@@ -348,7 +234,7 @@ export class AdadaptedReactNativeSdk {
348
234
  * Gets the Device Info object.
349
235
  * @returns the Device Info object.
350
236
  */
351
- public getDeviceInfo(): DeviceInfo | undefined {
237
+ public getDeviceInfo(): DeviceTypes.DeviceInfo | undefined {
352
238
  return this.deviceInfo;
353
239
  }
354
240
 
@@ -368,13 +254,35 @@ export class AdadaptedReactNativeSdk {
368
254
  return this.offScreenAdZones;
369
255
  }
370
256
 
257
+ /**
258
+ * Sets an ad context to replace an ad zone's ads with contextual ads for recipes.
259
+ * @param adContext - Object containing the contextual term and the associted ad zone.
260
+ * @param adContext.contextIds - An array of contextual ad ids.
261
+ * @param adContext.zoneIds - An array of zone ids for applying contextual ads.
262
+ */
263
+ public setAdContext(adContext: {
264
+ contextIds: string[];
265
+ zoneIds: string[];
266
+ }): void {
267
+ this.adContext = adContext;
268
+ this.onRefreshAdZones(true);
269
+ }
270
+
271
+ /**
272
+ * Clear the contextual ads from ad zones to return standard ads to the ad zones.
273
+ */
274
+ public clearAdContext(): void {
275
+ this.adContext = undefined;
276
+ this.onRefreshAdZones(true);
277
+ }
278
+
371
279
  /**
372
280
  * @inheritDoc
373
281
  */
374
282
  constructor() {
375
- this.apiEnv = ApiEnv.Prod;
376
- this.listManagerApiEnv = ListManagerApiEnv.Prod;
377
- this.payloadApiEnv = PayloadApiEnv.Prod;
283
+ this.apiEnv = EnvironmentTypes.ApiEnv.Prod;
284
+ this.listManagerApiEnv = EnvironmentTypes.ListManagerApiEnv.Prod;
285
+ this.payloadApiEnv = EnvironmentTypes.PayloadApiEnv.Prod;
378
286
  this.onAdZonesRefreshed = () => {
379
287
  // Defaulting to empty method.
380
288
  };
@@ -406,106 +314,87 @@ export class AdadaptedReactNativeSdk {
406
314
  });
407
315
  }
408
316
 
317
+ private adZoneTemplate(
318
+ adZones: { [key: number]: Zone },
319
+ zoneId: string,
320
+ offScreenAdZone: boolean
321
+ ): AdZoneInfo {
322
+ return {
323
+ zoneId: adZones[Number(zoneId)].id,
324
+ adZone: (
325
+ <AdZone
326
+ key={zoneId}
327
+ appId={this.appId}
328
+ sessionId={this.sessionId!}
329
+ udid={this.deviceInfo!.udid}
330
+ deviceOs={this.deviceOs!}
331
+ apiEnv={this.apiEnv}
332
+ xyDragDistanceAllowed={
333
+ this.xyAdZoneDragDistanceAllowed || 25
334
+ }
335
+ adZoneData={adZones[Number(zoneId)]}
336
+ onAddToListTriggered={(items) => {
337
+ safeInvoke(this.onAddToListTriggered, items);
338
+ }}
339
+ isAdZoneVisible={this.isAdZoneVisible}
340
+ offScreenAdZone={offScreenAdZone ? true : false}
341
+ isContextualAd={this.adContext ? true : false}
342
+ />
343
+ ),
344
+ };
345
+ }
346
+
409
347
  /**
410
348
  * Creates all Ad Zone Info objects based on provided Ad Zones.
411
349
  * @param adZones - The object of available zones.
350
+ * @param offScreenAdZone - True if an ad zone first renders out of view.
412
351
  * @returns the array of Ad Zone Info objects.
413
352
  */
414
- private generateAdZones(adZones: { [key: number]: Zone }): AdZoneInfo[] {
353
+ private generateAdZones(
354
+ adZones: { [key: number]: Zone },
355
+ offScreenAdZone: boolean = false
356
+ ): AdZoneInfo[] {
415
357
  const adZoneInfoList: AdZoneInfo[] = [];
416
-
417
- for (const adZoneId in adZones) {
418
- if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {
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
- ),
443
- });
358
+ const offScreenAdZoneList: AdZoneInfo[] = [];
359
+
360
+ if (offScreenAdZone) {
361
+ for (const adZoneId in adZones) {
362
+ if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {
363
+ if (this.offScreenAdZoneIds.includes(Number(adZoneId))) {
364
+ offScreenAdZoneList.push(
365
+ this.adZoneTemplate(adZones, adZoneId, true)
366
+ );
367
+ }
368
+ }
444
369
  }
445
- }
446
- return adZoneInfoList;
447
- }
448
-
449
- /**
450
- * Creates all off-screen Ad Zone Info objects based on provided off-screen Ad Zones.
451
- * @param adZones - The object of available zones.
452
- * @returns the array of off-screen Ad Zone Info objects.
453
- */
454
- private generateOffScreenAdZones(adZones: {
455
- [key: number]: Zone;
456
- }): AdZoneInfo[] {
457
- const adZoneInfoList: AdZoneInfo[] = [];
458
-
459
- for (const adZoneId in adZones) {
460
- if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {
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
- });
370
+ } else {
371
+ for (const adZoneId in adZones) {
372
+ if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {
373
+ adZoneInfoList.push(
374
+ this.adZoneTemplate(adZones, adZoneId, false)
375
+ );
491
376
  }
492
377
  }
493
378
  }
494
- return adZoneInfoList;
379
+
380
+ return offScreenAdZone ? offScreenAdZoneList : adZoneInfoList;
495
381
  }
496
382
 
497
383
  /**
498
384
  * Triggered when session data is initialized or refreshed. Creates
499
385
  * a timer based on the session data refresh value.
386
+ * @param immediateRefresh - If true the ad zones are refreshed bypassing the timer.
500
387
  */
501
- private onRefreshAdZones(): void {
388
+ private onRefreshAdZones(immediateRefresh: boolean = false): void {
502
389
  // Get the amount of time we will wait until a refresh occurs.
503
390
  // We are setting a minimum refresh time of 5 minutes, so if a
504
391
  // value provided by the API is lower, we don't refresh too often.
505
- const timerMs =
506
- this.sessionInfo!.polling_interval_ms >= 300000
507
- ? this.sessionInfo!.polling_interval_ms
508
- : 300000;
392
+ // If there are contextual ads, we refresh immediately to reload the ad zone.
393
+ const timerMs = immediateRefresh
394
+ ? 0
395
+ : this.sessionInfo!.polling_interval_ms >= 300000
396
+ ? this.sessionInfo!.polling_interval_ms
397
+ : 300000;
509
398
 
510
399
  this.refreshAdZonesTimer = setTimeout(() => {
511
400
  adadaptedApiRequests
@@ -514,16 +403,23 @@ export class AdadaptedReactNativeSdk {
514
403
  aid: this.appId,
515
404
  sid: this.sessionId!,
516
405
  uid: this.deviceInfo!.udid,
406
+ sdkVersion: packageJson.version,
407
+ adContext: this.adContext,
517
408
  },
518
409
  this.deviceOs!,
519
410
  this.apiEnv
520
411
  )
521
412
  .then((response) => {
522
413
  this.sessionInfo = response.data;
414
+
415
+ if (this.offScreenAdZones.length > 0) {
416
+ this.offScreenAdZones = this.generateAdZones(
417
+ response.data.zones,
418
+ true
419
+ );
420
+ }
421
+
523
422
  this.adZones = this.generateAdZones(response.data.zones);
524
- this.offScreenAdZones = this.generateOffScreenAdZones(
525
- response.data.zones
526
- );
527
423
 
528
424
  // Call the user defined callback indicating
529
425
  // the session data has been refreshed.
@@ -753,19 +649,20 @@ export class AdadaptedReactNativeSdk {
753
649
  if (props.apiEnv) {
754
650
  this.apiEnv = props.apiEnv;
755
651
  } else {
756
- this.apiEnv = ApiEnv.Prod;
652
+ this.apiEnv = EnvironmentTypes.ApiEnv.Prod;
757
653
  }
758
654
 
759
655
  // Base the List Manager API environment off what
760
656
  // the user provides for the props.apiEnv value.
761
657
  if (props.apiEnv) {
762
- if (props.apiEnv === ApiEnv.Prod) {
763
- this.listManagerApiEnv = ListManagerApiEnv.Prod;
658
+ if (props.apiEnv === EnvironmentTypes.ApiEnv.Prod) {
659
+ this.listManagerApiEnv =
660
+ EnvironmentTypes.ListManagerApiEnv.Prod;
764
661
  } else {
765
- this.listManagerApiEnv = ListManagerApiEnv.Dev;
662
+ this.listManagerApiEnv = EnvironmentTypes.ListManagerApiEnv.Dev;
766
663
  }
767
664
  } else {
768
- this.listManagerApiEnv = ListManagerApiEnv.Prod;
665
+ this.listManagerApiEnv = EnvironmentTypes.ListManagerApiEnv.Prod;
769
666
  }
770
667
 
771
668
  // The ad zone touch drag sensitivity setting.
@@ -792,21 +689,22 @@ export class AdadaptedReactNativeSdk {
792
689
  }
793
690
 
794
691
  // If provided set any off-screen ad zones.
795
- if (props.offScreenAdZone) {
796
- this.offScreenAdZone = props.offScreenAdZone;
692
+ if ((props.offScreenAdZoneIds ?? []).length > 0) {
693
+ this.offScreenAdZoneIds = props.offScreenAdZoneIds ?? [];
797
694
  }
798
695
 
799
696
  return new Promise<void>((resolve, reject) => {
800
697
  this.getDeviceInformation()
801
698
  .then((deviceInfoObj) => {
802
- const deviceInfo = JSON.parse(deviceInfoObj) as DeviceInfo;
699
+ const deviceInfo = JSON.parse(
700
+ deviceInfoObj
701
+ ) as DeviceTypes.DeviceInfo;
803
702
  this.deviceInfo = deviceInfo;
804
- this.deviceOs =
805
- deviceInfo.systemName === "ios"
806
- ? DeviceOS.IOS
807
- : DeviceOS.ANDROID;
703
+ this.deviceOs = deviceInfo.systemName.includes("ios")
704
+ ? DeviceTypes.DeviceOS.IOS
705
+ : DeviceTypes.DeviceOS.ANDROID;
808
706
  // Pass custom advertiserId - ios only
809
- if (Platform.OS === "ios") {
707
+ if (Platform.OS.includes("ios")) {
810
708
  if (!(props.advertiserId === undefined)) {
811
709
  deviceInfo.udid = props.advertiserId;
812
710
  }
@@ -848,13 +746,17 @@ export class AdadaptedReactNativeSdk {
848
746
  );
849
747
  this.sessionId = response.data.session_id;
850
748
  this.sessionInfo = response.data;
749
+
851
750
  this.adZones = this.generateAdZones(
852
751
  response.data.zones
853
752
  );
854
- this.offScreenAdZones =
855
- this.generateOffScreenAdZones(
856
- response.data.zones
753
+
754
+ if ((props.offScreenAdZoneIds ?? []).length > 0) {
755
+ this.offScreenAdZones = this.generateAdZones(
756
+ response.data.zones,
757
+ true
857
758
  );
759
+ }
858
760
 
859
761
  // Start the session data refresh timer.
860
762
  this.onRefreshAdZones();