@kontextso/sdk-react-native 2.3.1 → 2.4.1

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/dist/index.js CHANGED
@@ -107,7 +107,7 @@ var sendMessage = (webViewRef, type, code, data) => {
107
107
  }));
108
108
  `);
109
109
  };
110
- var Format = ({ code, messageId, wrapper, ...otherParams }) => {
110
+ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
111
111
  const context = (0, import_react2.useContext)(import_sdk_react.AdsContext);
112
112
  const bid = (0, import_sdk_react.useBid)({ code, messageId });
113
113
  const [height, setHeight] = (0, import_react2.useState)(0);
@@ -126,6 +126,7 @@ var Format = ({ code, messageId, wrapper, ...otherParams }) => {
126
126
  const modalInitTimeoutRef = (0, import_react2.useRef)(null);
127
127
  const isModalInitRef = (0, import_react2.useRef)(false);
128
128
  const { height: windowHeight, width: windowWidth } = (0, import_react_native.useWindowDimensions)();
129
+ const isAdViewVisible = showIframe && iframeLoaded;
129
130
  const reset = () => {
130
131
  setHeight(0);
131
132
  setShowIframe(false);
@@ -229,6 +230,10 @@ var Format = ({ code, messageId, wrapper, ...otherParams }) => {
229
230
  }
230
231
  }, message.data.timeout ?? 5e3);
231
232
  break;
233
+ case "event-iframe":
234
+ onEvent?.(message.data);
235
+ context?.onAdEventInternal(message.data);
236
+ break;
232
237
  }
233
238
  },
234
239
  {
@@ -277,6 +282,10 @@ var Format = ({ code, messageId, wrapper, ...otherParams }) => {
277
282
  }
278
283
  context?.onAdClickInternal(message.data);
279
284
  break;
285
+ case "event-iframe":
286
+ onEvent?.(message.data);
287
+ context?.onAdEventInternal(message.data);
288
+ break;
280
289
  }
281
290
  },
282
291
  {
@@ -318,93 +327,93 @@ var Format = ({ code, messageId, wrapper, ...otherParams }) => {
318
327
  });
319
328
  };
320
329
  (0, import_react2.useEffect)(() => {
330
+ if (!isAdViewVisible) return;
321
331
  const interval = setInterval(() => {
322
332
  checkIfInViewport();
323
333
  }, 250);
324
334
  return () => clearInterval(interval);
325
- }, []);
335
+ }, [isAdViewVisible]);
326
336
  if (!context || !bid || !iframeUrl || context.isDisabled) {
327
337
  return null;
328
338
  }
329
- const getWidth = () => {
330
- if (showIframe && iframeLoaded) {
331
- return "100%";
339
+ const inlineContent = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
340
+ frame_webview_default,
341
+ {
342
+ ref: webViewRef,
343
+ iframeUrl,
344
+ onMessage,
345
+ style: {
346
+ height,
347
+ width: "100%",
348
+ backgroundColor: "transparent",
349
+ borderWidth: 0,
350
+ ...iframeStyles
351
+ },
352
+ onError: () => {
353
+ debug("iframe-error");
354
+ reset();
355
+ },
356
+ onLoad: () => {
357
+ debug("iframe-load");
358
+ }
332
359
  }
333
- return 0;
334
- };
335
- const getHeight = () => {
336
- if (showIframe && iframeLoaded) {
337
- return height;
360
+ );
361
+ const interstitialContent = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
362
+ import_react_native.Modal,
363
+ {
364
+ visible: modalOpen,
365
+ transparent: true,
366
+ onRequestClose: resetModal,
367
+ animationType: "slide",
368
+ statusBarTranslucent: true,
369
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
370
+ import_react_native.View,
371
+ {
372
+ style: {
373
+ flex: 1,
374
+ // Don't show the modal until the modal page is loaded and sends 'init-component-iframe' message back to SDK
375
+ ...modalShown ? { opacity: 1, pointerEvents: "auto" } : { opacity: 0, pointerEvents: "none" }
376
+ },
377
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
378
+ frame_webview_default,
379
+ {
380
+ ref: modalWebViewRef,
381
+ iframeUrl: modalUrl,
382
+ onMessage: onModalMessage,
383
+ style: {
384
+ backgroundColor: "transparent",
385
+ height: "100%",
386
+ width: "100%",
387
+ borderWidth: 0
388
+ },
389
+ onError: () => {
390
+ debug("modal-error");
391
+ resetModal();
392
+ },
393
+ onLoad: () => {
394
+ debug("modal-load");
395
+ setModalLoaded(true);
396
+ }
397
+ }
398
+ )
399
+ }
400
+ )
338
401
  }
339
- return 0;
340
- };
341
- const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
402
+ );
403
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
342
404
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
343
- import_react_native.Modal,
405
+ import_react_native.View,
344
406
  {
345
- visible: modalOpen,
346
- transparent: true,
347
- onRequestClose: resetModal,
348
- animationType: "slide",
349
- statusBarTranslucent: true,
350
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
351
- import_react_native.View,
352
- {
353
- style: {
354
- flex: 1,
355
- // Don't show the modal until the modal page is loaded and sends 'init-component-iframe' message back to SDK
356
- ...modalShown ? { opacity: 1, pointerEvents: "auto" } : { opacity: 0, pointerEvents: "none" }
357
- },
358
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
359
- frame_webview_default,
360
- {
361
- ref: modalWebViewRef,
362
- iframeUrl: modalUrl,
363
- onMessage: onModalMessage,
364
- style: {
365
- backgroundColor: "transparent",
366
- height: "100%",
367
- width: "100%",
368
- borderWidth: 0
369
- },
370
- onError: () => {
371
- debug("modal-error");
372
- resetModal();
373
- },
374
- onLoad: () => {
375
- debug("modal-load");
376
- setModalLoaded(true);
377
- }
378
- }
379
- )
380
- }
381
- )
382
- }
383
- ),
384
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native.View, { style: containerStyles, ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
385
- frame_webview_default,
386
- {
387
- ref: webViewRef,
388
- iframeUrl,
389
- onMessage,
390
- style: {
391
- height: getHeight(),
392
- width: getWidth(),
393
- backgroundColor: "transparent",
394
- borderWidth: 0,
395
- ...iframeStyles
396
- },
397
- onError: () => {
398
- debug("iframe-error");
399
- reset();
407
+ style: isAdViewVisible ? containerStyles : {
408
+ height: 0,
409
+ overflow: "hidden"
400
410
  },
401
- onLoad: () => {
402
- debug("iframe-load");
403
- }
411
+ ref: containerRef,
412
+ children: wrapper ? wrapper(inlineContent) : inlineContent
404
413
  }
405
- ) })
414
+ ),
415
+ interstitialContent
406
416
  ] });
407
- return wrapper ? wrapper(content) : content;
408
417
  };
409
418
  var FormatWithErrorBoundary = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sdk_react.ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Format, { ...props }) });
410
419
  var Format_default = FormatWithErrorBoundary;
@@ -426,7 +435,7 @@ var import_react_native2 = require("react-native");
426
435
  var NativeRNKontext_default = import_react_native2.TurboModuleRegistry.getEnforcing("RNKontext");
427
436
 
428
437
  // package.json
429
- var version = "2.3.1-rc.2";
438
+ var version = "2.4.1";
430
439
 
431
440
  // src/context/AdsProvider.tsx
432
441
  var import_jsx_runtime4 = require("react/jsx-runtime");
@@ -472,7 +481,7 @@ var getDevice = async () => {
472
481
  // outputType: Not available without native module
473
482
  },
474
483
  network: {
475
- // carrier: await DeviceInfo.getCarrier(),
484
+ // carrier: await DeviceInfo.getCarrier(), not supported in react-native-device-info v10.0.0
476
485
  userAgent: await import_react_native_device_info.default.getUserAgent()
477
486
  // detail: Requires @react-native-community/netinfo
478
487
  // type: Requires @react-native-community/netinfo
@@ -503,6 +512,7 @@ var getDevice = async () => {
503
512
  };
504
513
  var getApp = async () => ({
505
514
  bundleId: import_react_native_device_info.default.getBundleId(),
515
+ // not supported in react-native-device-info v10.0.0
506
516
  // firstInstallTime: await DeviceInfo.getFirstInstallTime(),
507
517
  // lastUpdateTime: await DeviceInfo.getLastUpdateTime(),
508
518
  // startTime: await DeviceInfo.getStartupTime(),
package/dist/index.mjs CHANGED
@@ -76,7 +76,7 @@ var sendMessage = (webViewRef, type, code, data) => {
76
76
  }));
77
77
  `);
78
78
  };
79
- var Format = ({ code, messageId, wrapper, ...otherParams }) => {
79
+ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
80
80
  const context = useContext(AdsContext);
81
81
  const bid = useBid({ code, messageId });
82
82
  const [height, setHeight] = useState(0);
@@ -95,6 +95,7 @@ var Format = ({ code, messageId, wrapper, ...otherParams }) => {
95
95
  const modalInitTimeoutRef = useRef(null);
96
96
  const isModalInitRef = useRef(false);
97
97
  const { height: windowHeight, width: windowWidth } = useWindowDimensions();
98
+ const isAdViewVisible = showIframe && iframeLoaded;
98
99
  const reset = () => {
99
100
  setHeight(0);
100
101
  setShowIframe(false);
@@ -198,6 +199,10 @@ var Format = ({ code, messageId, wrapper, ...otherParams }) => {
198
199
  }
199
200
  }, message.data.timeout ?? 5e3);
200
201
  break;
202
+ case "event-iframe":
203
+ onEvent?.(message.data);
204
+ context?.onAdEventInternal(message.data);
205
+ break;
201
206
  }
202
207
  },
203
208
  {
@@ -246,6 +251,10 @@ var Format = ({ code, messageId, wrapper, ...otherParams }) => {
246
251
  }
247
252
  context?.onAdClickInternal(message.data);
248
253
  break;
254
+ case "event-iframe":
255
+ onEvent?.(message.data);
256
+ context?.onAdEventInternal(message.data);
257
+ break;
249
258
  }
250
259
  },
251
260
  {
@@ -287,93 +296,93 @@ var Format = ({ code, messageId, wrapper, ...otherParams }) => {
287
296
  });
288
297
  };
289
298
  useEffect(() => {
299
+ if (!isAdViewVisible) return;
290
300
  const interval = setInterval(() => {
291
301
  checkIfInViewport();
292
302
  }, 250);
293
303
  return () => clearInterval(interval);
294
- }, []);
304
+ }, [isAdViewVisible]);
295
305
  if (!context || !bid || !iframeUrl || context.isDisabled) {
296
306
  return null;
297
307
  }
298
- const getWidth = () => {
299
- if (showIframe && iframeLoaded) {
300
- return "100%";
308
+ const inlineContent = /* @__PURE__ */ jsx2(
309
+ frame_webview_default,
310
+ {
311
+ ref: webViewRef,
312
+ iframeUrl,
313
+ onMessage,
314
+ style: {
315
+ height,
316
+ width: "100%",
317
+ backgroundColor: "transparent",
318
+ borderWidth: 0,
319
+ ...iframeStyles
320
+ },
321
+ onError: () => {
322
+ debug("iframe-error");
323
+ reset();
324
+ },
325
+ onLoad: () => {
326
+ debug("iframe-load");
327
+ }
301
328
  }
302
- return 0;
303
- };
304
- const getHeight = () => {
305
- if (showIframe && iframeLoaded) {
306
- return height;
329
+ );
330
+ const interstitialContent = /* @__PURE__ */ jsx2(
331
+ Modal,
332
+ {
333
+ visible: modalOpen,
334
+ transparent: true,
335
+ onRequestClose: resetModal,
336
+ animationType: "slide",
337
+ statusBarTranslucent: true,
338
+ children: /* @__PURE__ */ jsx2(
339
+ View,
340
+ {
341
+ style: {
342
+ flex: 1,
343
+ // Don't show the modal until the modal page is loaded and sends 'init-component-iframe' message back to SDK
344
+ ...modalShown ? { opacity: 1, pointerEvents: "auto" } : { opacity: 0, pointerEvents: "none" }
345
+ },
346
+ children: /* @__PURE__ */ jsx2(
347
+ frame_webview_default,
348
+ {
349
+ ref: modalWebViewRef,
350
+ iframeUrl: modalUrl,
351
+ onMessage: onModalMessage,
352
+ style: {
353
+ backgroundColor: "transparent",
354
+ height: "100%",
355
+ width: "100%",
356
+ borderWidth: 0
357
+ },
358
+ onError: () => {
359
+ debug("modal-error");
360
+ resetModal();
361
+ },
362
+ onLoad: () => {
363
+ debug("modal-load");
364
+ setModalLoaded(true);
365
+ }
366
+ }
367
+ )
368
+ }
369
+ )
307
370
  }
308
- return 0;
309
- };
310
- const content = /* @__PURE__ */ jsxs(Fragment, { children: [
371
+ );
372
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
311
373
  /* @__PURE__ */ jsx2(
312
- Modal,
374
+ View,
313
375
  {
314
- visible: modalOpen,
315
- transparent: true,
316
- onRequestClose: resetModal,
317
- animationType: "slide",
318
- statusBarTranslucent: true,
319
- children: /* @__PURE__ */ jsx2(
320
- View,
321
- {
322
- style: {
323
- flex: 1,
324
- // Don't show the modal until the modal page is loaded and sends 'init-component-iframe' message back to SDK
325
- ...modalShown ? { opacity: 1, pointerEvents: "auto" } : { opacity: 0, pointerEvents: "none" }
326
- },
327
- children: /* @__PURE__ */ jsx2(
328
- frame_webview_default,
329
- {
330
- ref: modalWebViewRef,
331
- iframeUrl: modalUrl,
332
- onMessage: onModalMessage,
333
- style: {
334
- backgroundColor: "transparent",
335
- height: "100%",
336
- width: "100%",
337
- borderWidth: 0
338
- },
339
- onError: () => {
340
- debug("modal-error");
341
- resetModal();
342
- },
343
- onLoad: () => {
344
- debug("modal-load");
345
- setModalLoaded(true);
346
- }
347
- }
348
- )
349
- }
350
- )
351
- }
352
- ),
353
- /* @__PURE__ */ jsx2(View, { style: containerStyles, ref: containerRef, children: /* @__PURE__ */ jsx2(
354
- frame_webview_default,
355
- {
356
- ref: webViewRef,
357
- iframeUrl,
358
- onMessage,
359
- style: {
360
- height: getHeight(),
361
- width: getWidth(),
362
- backgroundColor: "transparent",
363
- borderWidth: 0,
364
- ...iframeStyles
365
- },
366
- onError: () => {
367
- debug("iframe-error");
368
- reset();
376
+ style: isAdViewVisible ? containerStyles : {
377
+ height: 0,
378
+ overflow: "hidden"
369
379
  },
370
- onLoad: () => {
371
- debug("iframe-load");
372
- }
380
+ ref: containerRef,
381
+ children: wrapper ? wrapper(inlineContent) : inlineContent
373
382
  }
374
- ) })
383
+ ),
384
+ interstitialContent
375
385
  ] });
376
- return wrapper ? wrapper(content) : content;
377
386
  };
378
387
  var FormatWithErrorBoundary = (props) => /* @__PURE__ */ jsx2(ErrorBoundary, { children: /* @__PURE__ */ jsx2(Format, { ...props }) });
379
388
  var Format_default = FormatWithErrorBoundary;
@@ -395,7 +404,7 @@ import { TurboModuleRegistry } from "react-native";
395
404
  var NativeRNKontext_default = TurboModuleRegistry.getEnforcing("RNKontext");
396
405
 
397
406
  // package.json
398
- var version = "2.3.1-rc.2";
407
+ var version = "2.4.1";
399
408
 
400
409
  // src/context/AdsProvider.tsx
401
410
  import { jsx as jsx4 } from "react/jsx-runtime";
@@ -441,7 +450,7 @@ var getDevice = async () => {
441
450
  // outputType: Not available without native module
442
451
  },
443
452
  network: {
444
- // carrier: await DeviceInfo.getCarrier(),
453
+ // carrier: await DeviceInfo.getCarrier(), not supported in react-native-device-info v10.0.0
445
454
  userAgent: await DeviceInfo.getUserAgent()
446
455
  // detail: Requires @react-native-community/netinfo
447
456
  // type: Requires @react-native-community/netinfo
@@ -472,6 +481,7 @@ var getDevice = async () => {
472
481
  };
473
482
  var getApp = async () => ({
474
483
  bundleId: DeviceInfo.getBundleId(),
484
+ // not supported in react-native-device-info v10.0.0
475
485
  // firstInstallTime: await DeviceInfo.getFirstInstallTime(),
476
486
  // lastUpdateTime: await DeviceInfo.getLastUpdateTime(),
477
487
  // startTime: await DeviceInfo.getStartupTime(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontextso/sdk-react-native",
3
- "version": "2.3.1",
3
+ "version": "2.4.1",
4
4
  "description": "Kontext SDK for React Native",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -55,7 +55,7 @@
55
55
  "react-native-webview": "^13.10.0"
56
56
  },
57
57
  "dependencies": {
58
- "@kontextso/sdk-react": "^2.0.1"
58
+ "@kontextso/sdk-react": "^2.1.0"
59
59
  },
60
60
  "files": [
61
61
  "dist/*",
@@ -50,7 +50,7 @@ const getDevice = async (): Promise<DeviceConfig> => {
50
50
  // outputType: Not available without native module
51
51
  },
52
52
  network: {
53
- // carrier: await DeviceInfo.getCarrier(),
53
+ // carrier: await DeviceInfo.getCarrier(), not supported in react-native-device-info v10.0.0
54
54
  userAgent: await DeviceInfo.getUserAgent(),
55
55
  // detail: Requires @react-native-community/netinfo
56
56
  // type: Requires @react-native-community/netinfo
@@ -83,9 +83,12 @@ const getDevice = async (): Promise<DeviceConfig> => {
83
83
 
84
84
  const getApp = async (): Promise<AppConfig> => ({
85
85
  bundleId: DeviceInfo.getBundleId(),
86
+
87
+ // not supported in react-native-device-info v10.0.0
86
88
  // firstInstallTime: await DeviceInfo.getFirstInstallTime(),
87
89
  // lastUpdateTime: await DeviceInfo.getLastUpdateTime(),
88
90
  // startTime: await DeviceInfo.getStartupTime(),
91
+
89
92
  version: DeviceInfo.getVersion(),
90
93
  })
91
94
 
@@ -36,7 +36,7 @@ const sendMessage = (
36
36
  `)
37
37
  }
38
38
 
39
- const Format = ({ code, messageId, wrapper, ...otherParams }: FormatProps) => {
39
+ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatProps) => {
40
40
  const context = useContext(AdsContext)
41
41
 
42
42
  const bid = useBid({ code, messageId })
@@ -63,6 +63,8 @@ const Format = ({ code, messageId, wrapper, ...otherParams }: FormatProps) => {
63
63
 
64
64
  const { height: windowHeight, width: windowWidth } = useWindowDimensions()
65
65
 
66
+ const isAdViewVisible = showIframe && iframeLoaded
67
+
66
68
  const reset = () => {
67
69
  setHeight(0)
68
70
  setShowIframe(false)
@@ -183,6 +185,11 @@ const Format = ({ code, messageId, wrapper, ...otherParams }: FormatProps) => {
183
185
  }
184
186
  }, message.data.timeout ?? 5000)
185
187
  break
188
+
189
+ case 'event-iframe':
190
+ onEvent?.(message.data)
191
+ context?.onAdEventInternal(message.data)
192
+ break
186
193
  }
187
194
  },
188
195
  {
@@ -240,6 +247,11 @@ const Format = ({ code, messageId, wrapper, ...otherParams }: FormatProps) => {
240
247
  }
241
248
  context?.onAdClickInternal(message.data)
242
249
  break
250
+
251
+ case 'event-iframe':
252
+ onEvent?.(message.data)
253
+ context?.onAdEventInternal(message.data)
254
+ break
243
255
  }
244
256
  },
245
257
  {
@@ -287,94 +299,98 @@ const Format = ({ code, messageId, wrapper, ...otherParams }: FormatProps) => {
287
299
  }
288
300
 
289
301
  useEffect(() => {
302
+ if (!isAdViewVisible) return
303
+
290
304
  const interval = setInterval(() => {
291
305
  checkIfInViewport()
292
306
  }, 250)
293
307
 
294
308
  return () => clearInterval(interval)
295
- }, [])
309
+ }, [isAdViewVisible])
296
310
 
297
311
  if (!context || !bid || !iframeUrl || context.isDisabled) {
298
312
  return null
299
313
  }
300
314
 
301
- const getWidth = () => {
302
- if (showIframe && iframeLoaded) {
303
- return '100%'
304
- }
305
- return 0
306
- }
307
-
308
- const getHeight = () => {
309
- if (showIframe && iframeLoaded) {
310
- return height
311
- }
312
- return 0
313
- }
315
+ const inlineContent = (
316
+ <FrameWebView
317
+ ref={webViewRef}
318
+ iframeUrl={iframeUrl}
319
+ onMessage={onMessage}
320
+ style={{
321
+ height,
322
+ width: '100%',
323
+ backgroundColor: 'transparent',
324
+ borderWidth: 0,
325
+ ...iframeStyles,
326
+ }}
327
+ onError={() => {
328
+ debug('iframe-error')
329
+ reset()
330
+ }}
331
+ onLoad={() => {
332
+ debug('iframe-load')
333
+ }}
334
+ />
335
+ )
314
336
 
315
- const content = (
316
- <>
317
- <Modal
318
- visible={modalOpen}
319
- transparent={true}
320
- onRequestClose={resetModal}
321
- animationType="slide"
322
- statusBarTranslucent={true}
337
+ const interstitialContent = (
338
+ <Modal
339
+ visible={modalOpen}
340
+ transparent={true}
341
+ onRequestClose={resetModal}
342
+ animationType="slide"
343
+ statusBarTranslucent={true}
344
+ >
345
+ <View
346
+ style={{
347
+ flex: 1,
348
+ // Don't show the modal until the modal page is loaded and sends 'init-component-iframe' message back to SDK
349
+ ...(modalShown ? { opacity: 1, pointerEvents: 'auto' } : { opacity: 0, pointerEvents: 'none' }),
350
+ }}
323
351
  >
324
- <View
325
- style={{
326
- flex: 1,
327
- // Don't show the modal until the modal page is loaded and sends 'init-component-iframe' message back to SDK
328
- ...(modalShown ? { opacity: 1, pointerEvents: 'auto' } : { opacity: 0, pointerEvents: 'none' }),
329
- }}
330
- >
331
- <FrameWebView
332
- ref={modalWebViewRef}
333
- iframeUrl={modalUrl}
334
- onMessage={onModalMessage}
335
- style={{
336
- backgroundColor: 'transparent',
337
- height: '100%',
338
- width: '100%',
339
- borderWidth: 0,
340
- }}
341
- onError={() => {
342
- debug('modal-error')
343
- resetModal()
344
- }}
345
- onLoad={() => {
346
- debug('modal-load')
347
- setModalLoaded(true)
348
- }}
349
- />
350
- </View>
351
- </Modal>
352
-
353
- <View style={containerStyles} ref={containerRef}>
354
352
  <FrameWebView
355
- ref={webViewRef}
356
- iframeUrl={iframeUrl}
357
- onMessage={onMessage}
353
+ ref={modalWebViewRef}
354
+ iframeUrl={modalUrl}
355
+ onMessage={onModalMessage}
358
356
  style={{
359
- height: getHeight(),
360
- width: getWidth(),
361
357
  backgroundColor: 'transparent',
358
+ height: '100%',
359
+ width: '100%',
362
360
  borderWidth: 0,
363
- ...iframeStyles,
364
361
  }}
365
362
  onError={() => {
366
- debug('iframe-error')
367
- reset()
363
+ debug('modal-error')
364
+ resetModal()
368
365
  }}
369
366
  onLoad={() => {
370
- debug('iframe-load')
367
+ debug('modal-load')
368
+ setModalLoaded(true)
371
369
  }}
372
370
  />
373
371
  </View>
374
- </>
372
+ </Modal>
375
373
  )
376
374
 
377
- return wrapper ? wrapper(content) : content
375
+ return (
376
+ <>
377
+ <View
378
+ style={
379
+ isAdViewVisible
380
+ ? containerStyles
381
+ : {
382
+ height: 0,
383
+ overflow: 'hidden',
384
+ }
385
+ }
386
+ ref={containerRef}
387
+ >
388
+ {wrapper ? wrapper(inlineContent) : inlineContent}
389
+ </View>
390
+
391
+ {interstitialContent}
392
+ </>
393
+ )
378
394
  }
379
395
 
380
396
  const FormatWithErrorBoundary = (props: FormatProps) => (
@@ -1,5 +1,5 @@
1
1
  import Format from './Format'
2
- import { type FormatProps } from '@kontextso/sdk-react'
2
+ import type { FormatProps } from '@kontextso/sdk-react'
3
3
 
4
4
  const InlineAd = ({ code, messageId, wrapper, ...props }: FormatProps) => {
5
5
  return <Format code={code} messageId={messageId} wrapper={wrapper} {...props} />