@kontextso/sdk-react-native 3.0.7-rc.2 → 3.0.7-rc.3
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 +119 -439
- package/dist/index.mjs +119 -442
- package/package.json +1 -1
- package/src/formats/Format.tsx +120 -455
package/dist/index.js
CHANGED
|
@@ -56,47 +56,10 @@ function handleIframeMessage(handler, opts) {
|
|
|
56
56
|
|
|
57
57
|
// src/formats/Format.tsx
|
|
58
58
|
var import_sdk_react = require("@kontextso/sdk-react");
|
|
59
|
-
var import_react2 = require("react");
|
|
60
|
-
var import_react_native = require("react-native");
|
|
61
|
-
|
|
62
|
-
// src/frame-webview.tsx
|
|
63
59
|
var import_react = require("react");
|
|
60
|
+
var import_react_native = require("react-native");
|
|
64
61
|
var import_react_native_webview = require("react-native-webview");
|
|
65
62
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
66
|
-
var FrameWebView = (0, import_react.forwardRef)(
|
|
67
|
-
({ iframeUrl, onMessage, style, onError, onLoad }, forwardedRef) => {
|
|
68
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
-
import_react_native_webview.WebView,
|
|
70
|
-
{
|
|
71
|
-
ref: forwardedRef,
|
|
72
|
-
source: {
|
|
73
|
-
uri: iframeUrl
|
|
74
|
-
},
|
|
75
|
-
onMessage,
|
|
76
|
-
style,
|
|
77
|
-
allowsInlineMediaPlayback: true,
|
|
78
|
-
mediaPlaybackRequiresUserAction: false,
|
|
79
|
-
javaScriptEnabled: true,
|
|
80
|
-
domStorageEnabled: true,
|
|
81
|
-
allowsFullscreenVideo: false,
|
|
82
|
-
injectedJavaScript: `
|
|
83
|
-
window.addEventListener("message", function(event) {
|
|
84
|
-
if (window.ReactNativeWebView && event.data) {
|
|
85
|
-
// ReactNativeWebView.postMessage only supports string data
|
|
86
|
-
window.ReactNativeWebView.postMessage(JSON.stringify(event.data));
|
|
87
|
-
}
|
|
88
|
-
}, false);
|
|
89
|
-
`,
|
|
90
|
-
onError,
|
|
91
|
-
onLoad
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
var frame_webview_default = FrameWebView;
|
|
97
|
-
|
|
98
|
-
// src/formats/Format.tsx
|
|
99
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
100
63
|
var sendMessage = (webViewRef, type, code, data) => {
|
|
101
64
|
const message = makeIframeMessage(type, {
|
|
102
65
|
data,
|
|
@@ -108,68 +71,24 @@ var sendMessage = (webViewRef, type, code, data) => {
|
|
|
108
71
|
}));
|
|
109
72
|
`);
|
|
110
73
|
};
|
|
111
|
-
var
|
|
112
|
-
|
|
74
|
+
var getUrl = (code, messageId, bidId) => {
|
|
75
|
+
const context = (0, import_react.useContext)(import_sdk_react.AdsContext);
|
|
76
|
+
if (!context || !bidId) {
|
|
113
77
|
return null;
|
|
114
78
|
}
|
|
115
|
-
|
|
79
|
+
const adServerUrl = context?.adServerUrl;
|
|
80
|
+
const params = new URLSearchParams({
|
|
81
|
+
code,
|
|
82
|
+
messageId,
|
|
83
|
+
sdk: "sdk-react-native"
|
|
84
|
+
});
|
|
85
|
+
return `${adServerUrl}/api/frame/${bidId}?${params}`;
|
|
116
86
|
};
|
|
117
87
|
var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
118
|
-
const context = (0,
|
|
88
|
+
const context = (0, import_react.useContext)(import_sdk_react.AdsContext);
|
|
119
89
|
const bid = (0, import_sdk_react.useBid)({ code, messageId });
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
const iframeUrl = (0, import_sdk_react.useIframeUrl)(bid, code, messageId, "sdk-react-native", otherParams.theme, cachedContent);
|
|
123
|
-
const modalUrl = iframeUrl.replace("/api/frame/", "/api/modal/");
|
|
124
|
-
const [showIframe, setShowIframe] = (0, import_react2.useState)(false);
|
|
125
|
-
const [iframeLoaded, setIframeLoaded] = (0, import_react2.useState)(false);
|
|
126
|
-
const [modalOpen, setModalOpen] = (0, import_react2.useState)(false);
|
|
127
|
-
const [modalShown, setModalShown] = (0, import_react2.useState)(false);
|
|
128
|
-
const [modalLoaded, setModalLoaded] = (0, import_react2.useState)(false);
|
|
129
|
-
const [containerStyles, setContainerStyles] = (0, import_react2.useState)({});
|
|
130
|
-
const [iframeStyles, setIframeStyles] = (0, import_react2.useState)({});
|
|
131
|
-
const containerRef = (0, import_react2.useRef)(null);
|
|
132
|
-
const webViewRef = (0, import_react2.useRef)(null);
|
|
133
|
-
const modalWebViewRef = (0, import_react2.useRef)(null);
|
|
134
|
-
const modalInitTimeoutRef = (0, import_react2.useRef)(null);
|
|
135
|
-
const isModalInitRef = (0, import_react2.useRef)(false);
|
|
136
|
-
const { height: windowHeight, width: windowWidth } = (0, import_react_native.useWindowDimensions)();
|
|
137
|
-
const keyboardHeightRef = (0, import_react2.useRef)(0);
|
|
138
|
-
const isAdViewVisible = showIframe && iframeLoaded;
|
|
139
|
-
const reset = () => {
|
|
140
|
-
setHeight(0);
|
|
141
|
-
setShowIframe(false);
|
|
142
|
-
setContainerStyles({});
|
|
143
|
-
setIframeStyles({});
|
|
144
|
-
setIframeLoaded(false);
|
|
145
|
-
resetModal();
|
|
146
|
-
context?.resetAll();
|
|
147
|
-
context?.captureError(new Error("Processing iframe error"));
|
|
148
|
-
};
|
|
149
|
-
const resetModal = () => {
|
|
150
|
-
debugModal("Format:resetModal", {
|
|
151
|
-
params: {
|
|
152
|
-
messageId,
|
|
153
|
-
code,
|
|
154
|
-
otherParams
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
if (modalInitTimeoutRef.current) {
|
|
158
|
-
debugModal("Format:resetModalTimeout", {
|
|
159
|
-
params: {
|
|
160
|
-
messageId,
|
|
161
|
-
code,
|
|
162
|
-
otherParams
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
clearTimeout(modalInitTimeoutRef.current);
|
|
166
|
-
modalInitTimeoutRef.current = null;
|
|
167
|
-
}
|
|
168
|
-
isModalInitRef.current = false;
|
|
169
|
-
setModalOpen(false);
|
|
170
|
-
setModalLoaded(false);
|
|
171
|
-
setModalShown(false);
|
|
172
|
-
};
|
|
90
|
+
const iframeUrl = getUrl(code, messageId, bid?.bidId);
|
|
91
|
+
const webViewRef = (0, import_react.useRef)(null);
|
|
173
92
|
const debug = (name, data = {}) => {
|
|
174
93
|
context?.onDebugEventInternal?.(name, {
|
|
175
94
|
code,
|
|
@@ -177,24 +96,6 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
177
96
|
otherParams,
|
|
178
97
|
bid,
|
|
179
98
|
iframeUrl,
|
|
180
|
-
iframeLoaded,
|
|
181
|
-
showIframe,
|
|
182
|
-
height,
|
|
183
|
-
containerStyles,
|
|
184
|
-
iframeStyles,
|
|
185
|
-
...data
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
const debugModal = (name, data = {}) => {
|
|
189
|
-
context?.onDebugEventInternal?.(name, {
|
|
190
|
-
code,
|
|
191
|
-
messageId,
|
|
192
|
-
otherParams,
|
|
193
|
-
bid,
|
|
194
|
-
modalUrl,
|
|
195
|
-
modalOpen,
|
|
196
|
-
modalShown,
|
|
197
|
-
modalLoaded,
|
|
198
99
|
...data
|
|
199
100
|
});
|
|
200
101
|
};
|
|
@@ -216,7 +117,6 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
216
117
|
(message) => {
|
|
217
118
|
switch (message.type) {
|
|
218
119
|
case "init-iframe":
|
|
219
|
-
setIframeLoaded(true);
|
|
220
120
|
debug("Format:iframePostMessage", {
|
|
221
121
|
params: {
|
|
222
122
|
code,
|
|
@@ -233,46 +133,6 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
233
133
|
messageId
|
|
234
134
|
});
|
|
235
135
|
break;
|
|
236
|
-
case "error-iframe":
|
|
237
|
-
reset();
|
|
238
|
-
break;
|
|
239
|
-
case "resize-iframe":
|
|
240
|
-
setHeight(message.data.height);
|
|
241
|
-
break;
|
|
242
|
-
case "click-iframe":
|
|
243
|
-
if (message.data.url) {
|
|
244
|
-
import_react_native.Linking.openURL(`${context?.adServerUrl}${message.data.url}`).catch(
|
|
245
|
-
(err) => console.error("error opening url", err)
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
context?.onAdClickInternal(message.data);
|
|
249
|
-
break;
|
|
250
|
-
case "view-iframe":
|
|
251
|
-
context?.onAdViewInternal(message.data);
|
|
252
|
-
break;
|
|
253
|
-
case "ad-done-iframe":
|
|
254
|
-
if (bid?.bidId && message.data.cachedContent) {
|
|
255
|
-
context?.cachedContentRef?.current?.set(bid.bidId, message.data.cachedContent);
|
|
256
|
-
}
|
|
257
|
-
break;
|
|
258
|
-
case "show-iframe":
|
|
259
|
-
setShowIframe(true);
|
|
260
|
-
break;
|
|
261
|
-
case "hide-iframe":
|
|
262
|
-
setShowIframe(false);
|
|
263
|
-
break;
|
|
264
|
-
case "set-styles-iframe":
|
|
265
|
-
setContainerStyles(message.data.containerStyles);
|
|
266
|
-
setIframeStyles(message.data.iframeStyles);
|
|
267
|
-
break;
|
|
268
|
-
case "open-component-iframe":
|
|
269
|
-
setModalOpen(true);
|
|
270
|
-
modalInitTimeoutRef.current = setTimeout(() => {
|
|
271
|
-
if (!isModalInitRef.current) {
|
|
272
|
-
resetModal();
|
|
273
|
-
}
|
|
274
|
-
}, message.data.timeout ?? 5e3);
|
|
275
|
-
break;
|
|
276
136
|
case "event-iframe":
|
|
277
137
|
onEvent?.(message.data);
|
|
278
138
|
context?.onAdEventInternal(message.data);
|
|
@@ -290,197 +150,8 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
290
150
|
error: e
|
|
291
151
|
});
|
|
292
152
|
console.error("error parsing message from webview", e);
|
|
293
|
-
reset();
|
|
294
153
|
}
|
|
295
154
|
};
|
|
296
|
-
const onModalMessage = (event) => {
|
|
297
|
-
try {
|
|
298
|
-
const data = JSON.parse(event.nativeEvent.data);
|
|
299
|
-
debugModal("Format:modalIframeMessage", {
|
|
300
|
-
params: { data, messageId, code, otherParams },
|
|
301
|
-
message: data
|
|
302
|
-
});
|
|
303
|
-
const messageHandler = handleIframeMessage(
|
|
304
|
-
(message) => {
|
|
305
|
-
switch (message.type) {
|
|
306
|
-
case "close-component-iframe":
|
|
307
|
-
resetModal();
|
|
308
|
-
break;
|
|
309
|
-
case "init-component-iframe":
|
|
310
|
-
isModalInitRef.current = true;
|
|
311
|
-
if (modalInitTimeoutRef.current) {
|
|
312
|
-
clearTimeout(modalInitTimeoutRef.current);
|
|
313
|
-
modalInitTimeoutRef.current = null;
|
|
314
|
-
}
|
|
315
|
-
setModalShown(true);
|
|
316
|
-
break;
|
|
317
|
-
case "error-component-iframe":
|
|
318
|
-
case "error-iframe":
|
|
319
|
-
resetModal();
|
|
320
|
-
context?.captureError(new Error("Processing modal iframe error"));
|
|
321
|
-
break;
|
|
322
|
-
case "click-iframe":
|
|
323
|
-
if (message.data.url) {
|
|
324
|
-
import_react_native.Linking.openURL(`${context?.adServerUrl}${message.data.url}`).catch(
|
|
325
|
-
(err) => console.error("error opening url", err)
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
context?.onAdClickInternal(message.data);
|
|
329
|
-
break;
|
|
330
|
-
case "event-iframe":
|
|
331
|
-
onEvent?.(message.data);
|
|
332
|
-
context?.onAdEventInternal(message.data);
|
|
333
|
-
break;
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
code,
|
|
338
|
-
component: "modal"
|
|
339
|
-
}
|
|
340
|
-
);
|
|
341
|
-
messageHandler({ data });
|
|
342
|
-
} catch (e) {
|
|
343
|
-
debugModal("Format:modalIframeMessageError", {
|
|
344
|
-
params: { error: e, messageId, code, otherParams },
|
|
345
|
-
error: e
|
|
346
|
-
});
|
|
347
|
-
console.error("error parsing message from webview", e);
|
|
348
|
-
resetModal();
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
const paramsString = (0, import_sdk_react.convertParamsToString)(otherParams);
|
|
352
|
-
(0, import_react2.useEffect)(() => {
|
|
353
|
-
if (!iframeLoaded || !context?.adServerUrl || !bid || !webViewRef.current) {
|
|
354
|
-
debug("Format:iframePostMessageNotLoaded", {
|
|
355
|
-
params: {
|
|
356
|
-
messageId,
|
|
357
|
-
iframeLoaded,
|
|
358
|
-
contextAdServerUrl: context?.adServerUrl,
|
|
359
|
-
bid,
|
|
360
|
-
code,
|
|
361
|
-
otherParams
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
debug("Format:iframePostMessage", {
|
|
367
|
-
params: {
|
|
368
|
-
messageId,
|
|
369
|
-
otherParams,
|
|
370
|
-
code
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
sendMessage(webViewRef, "update-iframe", code, {
|
|
374
|
-
data: { otherParams },
|
|
375
|
-
code
|
|
376
|
-
});
|
|
377
|
-
}, [paramsString, iframeLoaded, context?.adServerUrl, bid, code]);
|
|
378
|
-
const checkIfInViewport = () => {
|
|
379
|
-
if (!containerRef.current) {
|
|
380
|
-
debug("Format:checkIfInViewportNoContainer", {
|
|
381
|
-
params: {
|
|
382
|
-
messageId,
|
|
383
|
-
code,
|
|
384
|
-
otherParams
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
debug("Format:checkIfInViewportMeasure", {
|
|
390
|
-
params: {
|
|
391
|
-
windowWidth,
|
|
392
|
-
windowHeight,
|
|
393
|
-
messageId,
|
|
394
|
-
code,
|
|
395
|
-
otherParams
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
containerRef.current.measureInWindow((containerX, containerY, containerWidth, containerHeight) => {
|
|
399
|
-
sendMessage(webViewRef, "update-dimensions-iframe", code, {
|
|
400
|
-
windowWidth,
|
|
401
|
-
windowHeight,
|
|
402
|
-
containerWidth,
|
|
403
|
-
containerHeight,
|
|
404
|
-
containerX,
|
|
405
|
-
containerY,
|
|
406
|
-
keyboardHeight: keyboardHeightRef.current
|
|
407
|
-
});
|
|
408
|
-
debug("Format:checkIfInViewportMeasureSend", {
|
|
409
|
-
params: {
|
|
410
|
-
messageId,
|
|
411
|
-
code,
|
|
412
|
-
otherParams,
|
|
413
|
-
windowWidth,
|
|
414
|
-
windowHeight,
|
|
415
|
-
containerWidth,
|
|
416
|
-
containerHeight,
|
|
417
|
-
containerX,
|
|
418
|
-
containerY,
|
|
419
|
-
keyboardHeight: keyboardHeightRef.current
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
});
|
|
423
|
-
};
|
|
424
|
-
(0, import_react2.useEffect)(() => {
|
|
425
|
-
if (!isAdViewVisible) {
|
|
426
|
-
debug("Format:checkIfInViewportNotVisible", {
|
|
427
|
-
params: {
|
|
428
|
-
messageId,
|
|
429
|
-
code,
|
|
430
|
-
otherParams
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
const interval = setInterval(() => {
|
|
436
|
-
checkIfInViewport();
|
|
437
|
-
}, 250);
|
|
438
|
-
return () => {
|
|
439
|
-
clearInterval(interval);
|
|
440
|
-
debug("Format:checkIfInViewportCleanup", {
|
|
441
|
-
params: {
|
|
442
|
-
messageId,
|
|
443
|
-
code,
|
|
444
|
-
otherParams
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
};
|
|
448
|
-
}, [isAdViewVisible]);
|
|
449
|
-
(0, import_react2.useEffect)(() => {
|
|
450
|
-
const showSubscription = import_react_native.Keyboard.addListener("keyboardDidShow", (e) => {
|
|
451
|
-
debug("Format:keyboardDidShow", {
|
|
452
|
-
params: {
|
|
453
|
-
keyboardHeight: e?.endCoordinates?.height ?? 0,
|
|
454
|
-
messageId,
|
|
455
|
-
code,
|
|
456
|
-
otherParams
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
keyboardHeightRef.current = e?.endCoordinates?.height ?? 0;
|
|
460
|
-
});
|
|
461
|
-
const hideSubscription = import_react_native.Keyboard.addListener("keyboardDidHide", () => {
|
|
462
|
-
debug("Format:keyboardDidHide", {
|
|
463
|
-
params: {
|
|
464
|
-
messageId,
|
|
465
|
-
code,
|
|
466
|
-
otherParams
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
keyboardHeightRef.current = 0;
|
|
470
|
-
});
|
|
471
|
-
return () => {
|
|
472
|
-
showSubscription.remove();
|
|
473
|
-
hideSubscription.remove();
|
|
474
|
-
keyboardHeightRef.current = 0;
|
|
475
|
-
debug("Format:keyboardEffectCleanup", {
|
|
476
|
-
params: {
|
|
477
|
-
messageId,
|
|
478
|
-
code,
|
|
479
|
-
otherParams
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
};
|
|
483
|
-
}, []);
|
|
484
155
|
if (!context || !bid || !iframeUrl) {
|
|
485
156
|
debug("Format:noContextOrBidOrIframeUrl", {
|
|
486
157
|
params: {
|
|
@@ -494,116 +165,125 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
494
165
|
});
|
|
495
166
|
return null;
|
|
496
167
|
}
|
|
497
|
-
|
|
498
|
-
|
|
168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
169
|
+
import_react_native.View,
|
|
499
170
|
{
|
|
500
|
-
ref: webViewRef,
|
|
501
|
-
iframeUrl,
|
|
502
|
-
onMessage,
|
|
503
171
|
style: {
|
|
504
|
-
height,
|
|
172
|
+
height: 300,
|
|
505
173
|
width: "100%",
|
|
506
174
|
backgroundColor: "transparent",
|
|
507
|
-
borderWidth: 0
|
|
508
|
-
...iframeStyles
|
|
509
|
-
},
|
|
510
|
-
onError: () => {
|
|
511
|
-
debug("Format:iframeError", {
|
|
512
|
-
params: {
|
|
513
|
-
messageId,
|
|
514
|
-
code,
|
|
515
|
-
otherParams
|
|
516
|
-
}
|
|
517
|
-
});
|
|
518
|
-
reset();
|
|
175
|
+
borderWidth: 0
|
|
519
176
|
},
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
params: {
|
|
523
|
-
messageId,
|
|
524
|
-
code,
|
|
525
|
-
otherParams
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
);
|
|
531
|
-
const interstitialContent = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
532
|
-
import_react_native.Modal,
|
|
533
|
-
{
|
|
534
|
-
visible: modalOpen,
|
|
535
|
-
transparent: true,
|
|
536
|
-
onRequestClose: resetModal,
|
|
537
|
-
animationType: "slide",
|
|
538
|
-
statusBarTranslucent: true,
|
|
539
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
540
|
-
import_react_native.View,
|
|
177
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
178
|
+
import_react_native_webview.WebView,
|
|
541
179
|
{
|
|
180
|
+
ref: webViewRef,
|
|
181
|
+
source: {
|
|
182
|
+
uri: iframeUrl
|
|
183
|
+
},
|
|
184
|
+
onMessage,
|
|
542
185
|
style: {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
186
|
+
height: 300,
|
|
187
|
+
width: "100%",
|
|
188
|
+
backgroundColor: "transparent",
|
|
189
|
+
borderWidth: 0
|
|
546
190
|
},
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
borderWidth: 0
|
|
558
|
-
},
|
|
559
|
-
onError: () => {
|
|
560
|
-
debug("Format:modalError", {
|
|
561
|
-
params: {
|
|
562
|
-
messageId,
|
|
563
|
-
code,
|
|
564
|
-
otherParams
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
resetModal();
|
|
568
|
-
},
|
|
569
|
-
onLoad: () => {
|
|
570
|
-
debug("Format:modalLoad", {
|
|
571
|
-
params: {
|
|
572
|
-
messageId,
|
|
573
|
-
code,
|
|
574
|
-
otherParams
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
setModalLoaded(true);
|
|
578
|
-
}
|
|
191
|
+
allowsInlineMediaPlayback: true,
|
|
192
|
+
mediaPlaybackRequiresUserAction: false,
|
|
193
|
+
javaScriptEnabled: true,
|
|
194
|
+
domStorageEnabled: true,
|
|
195
|
+
allowsFullscreenVideo: false,
|
|
196
|
+
injectedJavaScript: `
|
|
197
|
+
window.addEventListener("message", function(event) {
|
|
198
|
+
if (window.ReactNativeWebView && event.data) {
|
|
199
|
+
// ReactNativeWebView.postMessage only supports string data
|
|
200
|
+
window.ReactNativeWebView.postMessage(JSON.stringify(event.data));
|
|
579
201
|
}
|
|
580
|
-
)
|
|
202
|
+
}, false);
|
|
203
|
+
`,
|
|
204
|
+
onLoadStart: () => {
|
|
205
|
+
debug("Format:iframeLoadStart", {
|
|
206
|
+
params: {
|
|
207
|
+
messageId,
|
|
208
|
+
code,
|
|
209
|
+
otherParams
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
onError: () => {
|
|
214
|
+
debug("Format:iframeError", {
|
|
215
|
+
params: {
|
|
216
|
+
messageId,
|
|
217
|
+
code,
|
|
218
|
+
otherParams
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
onLoad: () => {
|
|
223
|
+
debug("Format:iframeLoad", {
|
|
224
|
+
params: {
|
|
225
|
+
messageId,
|
|
226
|
+
code,
|
|
227
|
+
otherParams
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
onLoadProgress: () => {
|
|
232
|
+
debug("Format:iframeLoadProgress", {
|
|
233
|
+
params: {
|
|
234
|
+
messageId,
|
|
235
|
+
code,
|
|
236
|
+
otherParams
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
onHttpError: () => {
|
|
241
|
+
debug("Format:iframeHttpError", {
|
|
242
|
+
params: {
|
|
243
|
+
messageId,
|
|
244
|
+
code,
|
|
245
|
+
otherParams
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
onRenderProcessGone: () => {
|
|
250
|
+
debug("Format:iframeRenderProcessGone", {
|
|
251
|
+
params: {
|
|
252
|
+
messageId,
|
|
253
|
+
code,
|
|
254
|
+
otherParams
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
},
|
|
258
|
+
onNavigationStateChange: () => {
|
|
259
|
+
debug("Format:iframeNavigationStateChange", {
|
|
260
|
+
params: {
|
|
261
|
+
messageId,
|
|
262
|
+
code,
|
|
263
|
+
otherParams
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
onContentProcessDidTerminate: () => {
|
|
268
|
+
debug("Format:iframeContentProcessDidTerminate", {
|
|
269
|
+
params: {
|
|
270
|
+
messageId,
|
|
271
|
+
code,
|
|
272
|
+
otherParams
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
581
276
|
}
|
|
582
277
|
)
|
|
583
278
|
}
|
|
584
279
|
);
|
|
585
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
586
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
587
|
-
import_react_native.View,
|
|
588
|
-
{
|
|
589
|
-
style: isAdViewVisible ? containerStyles : {
|
|
590
|
-
height: 0,
|
|
591
|
-
overflow: "hidden"
|
|
592
|
-
},
|
|
593
|
-
ref: containerRef,
|
|
594
|
-
children: wrapper ? wrapper(inlineContent) : inlineContent
|
|
595
|
-
}
|
|
596
|
-
),
|
|
597
|
-
interstitialContent
|
|
598
|
-
] });
|
|
599
280
|
};
|
|
600
|
-
var
|
|
601
|
-
var Format_default = FormatWithErrorBoundary;
|
|
281
|
+
var Format_default = Format;
|
|
602
282
|
|
|
603
283
|
// src/formats/InlineAd.tsx
|
|
604
|
-
var
|
|
284
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
605
285
|
var InlineAd = ({ code, messageId, wrapper, ...props }) => {
|
|
606
|
-
return /* @__PURE__ */ (0,
|
|
286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Format_default, { code, messageId, wrapper, ...props });
|
|
607
287
|
};
|
|
608
288
|
var InlineAd_default = InlineAd;
|
|
609
289
|
|
|
@@ -614,14 +294,14 @@ var import_react_native3 = require("react-native");
|
|
|
614
294
|
var import_react_native_device_info = __toESM(require("react-native-device-info"));
|
|
615
295
|
|
|
616
296
|
// package.json
|
|
617
|
-
var version = "3.0.7-rc.
|
|
297
|
+
var version = "3.0.7-rc.3";
|
|
618
298
|
|
|
619
299
|
// src/NativeRNKontext.ts
|
|
620
300
|
var import_react_native2 = require("react-native");
|
|
621
301
|
var NativeRNKontext_default = import_react_native2.TurboModuleRegistry.getEnforcing("RNKontext");
|
|
622
302
|
|
|
623
303
|
// src/context/AdsProvider.tsx
|
|
624
|
-
var
|
|
304
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
625
305
|
ErrorUtils.setGlobalHandler((error, isFatal) => {
|
|
626
306
|
if (!isFatal) {
|
|
627
307
|
import_sdk_react2.log.warn(error);
|
|
@@ -715,7 +395,7 @@ var getSdk = async () => ({
|
|
|
715
395
|
version
|
|
716
396
|
});
|
|
717
397
|
var AdsProvider = (props) => {
|
|
718
|
-
return /* @__PURE__ */ (0,
|
|
398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sdk_react2.AdsProviderInternal, { ...props, getDevice, getSdk, getApp });
|
|
719
399
|
};
|
|
720
400
|
// Annotate the CommonJS export names for ESM import in node:
|
|
721
401
|
0 && (module.exports = {
|