@kontextso/sdk-react-native 3.0.7-rc.1 → 3.0.7-rc.2
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 +112 -22
- package/dist/index.mjs +112 -22
- package/package.json +1 -1
- package/src/formats/Format.tsx +107 -17
package/dist/index.js
CHANGED
|
@@ -147,9 +147,21 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
147
147
|
context?.captureError(new Error("Processing iframe error"));
|
|
148
148
|
};
|
|
149
149
|
const resetModal = () => {
|
|
150
|
-
debugModal("Format:resetModal"
|
|
150
|
+
debugModal("Format:resetModal", {
|
|
151
|
+
params: {
|
|
152
|
+
messageId,
|
|
153
|
+
code,
|
|
154
|
+
otherParams
|
|
155
|
+
}
|
|
156
|
+
});
|
|
151
157
|
if (modalInitTimeoutRef.current) {
|
|
152
|
-
debugModal("Format:resetModalTimeout"
|
|
158
|
+
debugModal("Format:resetModalTimeout", {
|
|
159
|
+
params: {
|
|
160
|
+
messageId,
|
|
161
|
+
code,
|
|
162
|
+
otherParams
|
|
163
|
+
}
|
|
164
|
+
});
|
|
153
165
|
clearTimeout(modalInitTimeoutRef.current);
|
|
154
166
|
modalInitTimeoutRef.current = null;
|
|
155
167
|
}
|
|
@@ -186,13 +198,19 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
186
198
|
...data
|
|
187
199
|
});
|
|
188
200
|
};
|
|
189
|
-
debug("Format:updateState"
|
|
201
|
+
debug("Format:updateState", {
|
|
202
|
+
params: {
|
|
203
|
+
messageId,
|
|
204
|
+
code,
|
|
205
|
+
otherParams
|
|
206
|
+
}
|
|
207
|
+
});
|
|
190
208
|
const onMessage = (event) => {
|
|
191
209
|
try {
|
|
192
210
|
const data = JSON.parse(event.nativeEvent.data);
|
|
193
211
|
debug("Format:iframeMessage", {
|
|
194
212
|
message: data,
|
|
195
|
-
params: { data }
|
|
213
|
+
params: { data, messageId, code, otherParams }
|
|
196
214
|
});
|
|
197
215
|
const messageHandler = handleIframeMessage(
|
|
198
216
|
(message) => {
|
|
@@ -201,6 +219,7 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
201
219
|
setIframeLoaded(true);
|
|
202
220
|
debug("Format:iframePostMessage", {
|
|
203
221
|
params: {
|
|
222
|
+
code,
|
|
204
223
|
messages: context?.messages,
|
|
205
224
|
sdk: "sdk-react-native",
|
|
206
225
|
otherParams,
|
|
@@ -267,7 +286,7 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
267
286
|
messageHandler({ data });
|
|
268
287
|
} catch (e) {
|
|
269
288
|
debug("Format:iframeMessageError", {
|
|
270
|
-
params: { error: e },
|
|
289
|
+
params: { error: e, messageId, code, otherParams },
|
|
271
290
|
error: e
|
|
272
291
|
});
|
|
273
292
|
console.error("error parsing message from webview", e);
|
|
@@ -278,7 +297,7 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
278
297
|
try {
|
|
279
298
|
const data = JSON.parse(event.nativeEvent.data);
|
|
280
299
|
debugModal("Format:modalIframeMessage", {
|
|
281
|
-
params: { data },
|
|
300
|
+
params: { data, messageId, code, otherParams },
|
|
282
301
|
message: data
|
|
283
302
|
});
|
|
284
303
|
const messageHandler = handleIframeMessage(
|
|
@@ -322,7 +341,7 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
322
341
|
messageHandler({ data });
|
|
323
342
|
} catch (e) {
|
|
324
343
|
debugModal("Format:modalIframeMessageError", {
|
|
325
|
-
params: { error: e },
|
|
344
|
+
params: { error: e, messageId, code, otherParams },
|
|
326
345
|
error: e
|
|
327
346
|
});
|
|
328
347
|
console.error("error parsing message from webview", e);
|
|
@@ -334,16 +353,21 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
334
353
|
if (!iframeLoaded || !context?.adServerUrl || !bid || !webViewRef.current) {
|
|
335
354
|
debug("Format:iframePostMessageNotLoaded", {
|
|
336
355
|
params: {
|
|
356
|
+
messageId,
|
|
337
357
|
iframeLoaded,
|
|
338
358
|
contextAdServerUrl: context?.adServerUrl,
|
|
339
|
-
bid
|
|
359
|
+
bid,
|
|
360
|
+
code,
|
|
361
|
+
otherParams
|
|
340
362
|
}
|
|
341
363
|
});
|
|
342
364
|
return;
|
|
343
365
|
}
|
|
344
366
|
debug("Format:iframePostMessage", {
|
|
345
367
|
params: {
|
|
346
|
-
|
|
368
|
+
messageId,
|
|
369
|
+
otherParams,
|
|
370
|
+
code
|
|
347
371
|
}
|
|
348
372
|
});
|
|
349
373
|
sendMessage(webViewRef, "update-iframe", code, {
|
|
@@ -353,13 +377,22 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
353
377
|
}, [paramsString, iframeLoaded, context?.adServerUrl, bid, code]);
|
|
354
378
|
const checkIfInViewport = () => {
|
|
355
379
|
if (!containerRef.current) {
|
|
356
|
-
debug("Format:checkIfInViewportNoContainer"
|
|
380
|
+
debug("Format:checkIfInViewportNoContainer", {
|
|
381
|
+
params: {
|
|
382
|
+
messageId,
|
|
383
|
+
code,
|
|
384
|
+
otherParams
|
|
385
|
+
}
|
|
386
|
+
});
|
|
357
387
|
return;
|
|
358
388
|
}
|
|
359
389
|
debug("Format:checkIfInViewportMeasure", {
|
|
360
390
|
params: {
|
|
361
391
|
windowWidth,
|
|
362
|
-
windowHeight
|
|
392
|
+
windowHeight,
|
|
393
|
+
messageId,
|
|
394
|
+
code,
|
|
395
|
+
otherParams
|
|
363
396
|
}
|
|
364
397
|
});
|
|
365
398
|
containerRef.current.measureInWindow((containerX, containerY, containerWidth, containerHeight) => {
|
|
@@ -374,6 +407,9 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
374
407
|
});
|
|
375
408
|
debug("Format:checkIfInViewportMeasureSend", {
|
|
376
409
|
params: {
|
|
410
|
+
messageId,
|
|
411
|
+
code,
|
|
412
|
+
otherParams,
|
|
377
413
|
windowWidth,
|
|
378
414
|
windowHeight,
|
|
379
415
|
containerWidth,
|
|
@@ -387,7 +423,13 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
387
423
|
};
|
|
388
424
|
(0, import_react2.useEffect)(() => {
|
|
389
425
|
if (!isAdViewVisible) {
|
|
390
|
-
debug("Format:checkIfInViewportNotVisible"
|
|
426
|
+
debug("Format:checkIfInViewportNotVisible", {
|
|
427
|
+
params: {
|
|
428
|
+
messageId,
|
|
429
|
+
code,
|
|
430
|
+
otherParams
|
|
431
|
+
}
|
|
432
|
+
});
|
|
391
433
|
return;
|
|
392
434
|
}
|
|
393
435
|
const interval = setInterval(() => {
|
|
@@ -395,27 +437,48 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
395
437
|
}, 250);
|
|
396
438
|
return () => {
|
|
397
439
|
clearInterval(interval);
|
|
398
|
-
debug("Format:checkIfInViewportCleanup"
|
|
440
|
+
debug("Format:checkIfInViewportCleanup", {
|
|
441
|
+
params: {
|
|
442
|
+
messageId,
|
|
443
|
+
code,
|
|
444
|
+
otherParams
|
|
445
|
+
}
|
|
446
|
+
});
|
|
399
447
|
};
|
|
400
448
|
}, [isAdViewVisible]);
|
|
401
449
|
(0, import_react2.useEffect)(() => {
|
|
402
450
|
const showSubscription = import_react_native.Keyboard.addListener("keyboardDidShow", (e) => {
|
|
403
451
|
debug("Format:keyboardDidShow", {
|
|
404
452
|
params: {
|
|
405
|
-
keyboardHeight: e?.endCoordinates?.height ?? 0
|
|
453
|
+
keyboardHeight: e?.endCoordinates?.height ?? 0,
|
|
454
|
+
messageId,
|
|
455
|
+
code,
|
|
456
|
+
otherParams
|
|
406
457
|
}
|
|
407
458
|
});
|
|
408
459
|
keyboardHeightRef.current = e?.endCoordinates?.height ?? 0;
|
|
409
460
|
});
|
|
410
461
|
const hideSubscription = import_react_native.Keyboard.addListener("keyboardDidHide", () => {
|
|
411
|
-
debug("Format:keyboardDidHide"
|
|
462
|
+
debug("Format:keyboardDidHide", {
|
|
463
|
+
params: {
|
|
464
|
+
messageId,
|
|
465
|
+
code,
|
|
466
|
+
otherParams
|
|
467
|
+
}
|
|
468
|
+
});
|
|
412
469
|
keyboardHeightRef.current = 0;
|
|
413
470
|
});
|
|
414
471
|
return () => {
|
|
415
472
|
showSubscription.remove();
|
|
416
473
|
hideSubscription.remove();
|
|
417
474
|
keyboardHeightRef.current = 0;
|
|
418
|
-
debug("Format:keyboardEffectCleanup"
|
|
475
|
+
debug("Format:keyboardEffectCleanup", {
|
|
476
|
+
params: {
|
|
477
|
+
messageId,
|
|
478
|
+
code,
|
|
479
|
+
otherParams
|
|
480
|
+
}
|
|
481
|
+
});
|
|
419
482
|
};
|
|
420
483
|
}, []);
|
|
421
484
|
if (!context || !bid || !iframeUrl) {
|
|
@@ -423,7 +486,10 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
423
486
|
params: {
|
|
424
487
|
context,
|
|
425
488
|
bid,
|
|
426
|
-
iframeUrl
|
|
489
|
+
iframeUrl,
|
|
490
|
+
messageId,
|
|
491
|
+
code,
|
|
492
|
+
otherParams
|
|
427
493
|
}
|
|
428
494
|
});
|
|
429
495
|
return null;
|
|
@@ -442,11 +508,23 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
442
508
|
...iframeStyles
|
|
443
509
|
},
|
|
444
510
|
onError: () => {
|
|
445
|
-
debug("Format:iframeError"
|
|
511
|
+
debug("Format:iframeError", {
|
|
512
|
+
params: {
|
|
513
|
+
messageId,
|
|
514
|
+
code,
|
|
515
|
+
otherParams
|
|
516
|
+
}
|
|
517
|
+
});
|
|
446
518
|
reset();
|
|
447
519
|
},
|
|
448
520
|
onLoad: () => {
|
|
449
|
-
debug("Format:iframeLoad"
|
|
521
|
+
debug("Format:iframeLoad", {
|
|
522
|
+
params: {
|
|
523
|
+
messageId,
|
|
524
|
+
code,
|
|
525
|
+
otherParams
|
|
526
|
+
}
|
|
527
|
+
});
|
|
450
528
|
}
|
|
451
529
|
}
|
|
452
530
|
);
|
|
@@ -479,11 +557,23 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
479
557
|
borderWidth: 0
|
|
480
558
|
},
|
|
481
559
|
onError: () => {
|
|
482
|
-
debug("Format:modalError"
|
|
560
|
+
debug("Format:modalError", {
|
|
561
|
+
params: {
|
|
562
|
+
messageId,
|
|
563
|
+
code,
|
|
564
|
+
otherParams
|
|
565
|
+
}
|
|
566
|
+
});
|
|
483
567
|
resetModal();
|
|
484
568
|
},
|
|
485
569
|
onLoad: () => {
|
|
486
|
-
debug("Format:modalLoad"
|
|
570
|
+
debug("Format:modalLoad", {
|
|
571
|
+
params: {
|
|
572
|
+
messageId,
|
|
573
|
+
code,
|
|
574
|
+
otherParams
|
|
575
|
+
}
|
|
576
|
+
});
|
|
487
577
|
setModalLoaded(true);
|
|
488
578
|
}
|
|
489
579
|
}
|
|
@@ -524,7 +614,7 @@ var import_react_native3 = require("react-native");
|
|
|
524
614
|
var import_react_native_device_info = __toESM(require("react-native-device-info"));
|
|
525
615
|
|
|
526
616
|
// package.json
|
|
527
|
-
var version = "3.0.7-rc.
|
|
617
|
+
var version = "3.0.7-rc.2";
|
|
528
618
|
|
|
529
619
|
// src/NativeRNKontext.ts
|
|
530
620
|
var import_react_native2 = require("react-native");
|
package/dist/index.mjs
CHANGED
|
@@ -116,9 +116,21 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
116
116
|
context?.captureError(new Error("Processing iframe error"));
|
|
117
117
|
};
|
|
118
118
|
const resetModal = () => {
|
|
119
|
-
debugModal("Format:resetModal"
|
|
119
|
+
debugModal("Format:resetModal", {
|
|
120
|
+
params: {
|
|
121
|
+
messageId,
|
|
122
|
+
code,
|
|
123
|
+
otherParams
|
|
124
|
+
}
|
|
125
|
+
});
|
|
120
126
|
if (modalInitTimeoutRef.current) {
|
|
121
|
-
debugModal("Format:resetModalTimeout"
|
|
127
|
+
debugModal("Format:resetModalTimeout", {
|
|
128
|
+
params: {
|
|
129
|
+
messageId,
|
|
130
|
+
code,
|
|
131
|
+
otherParams
|
|
132
|
+
}
|
|
133
|
+
});
|
|
122
134
|
clearTimeout(modalInitTimeoutRef.current);
|
|
123
135
|
modalInitTimeoutRef.current = null;
|
|
124
136
|
}
|
|
@@ -155,13 +167,19 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
155
167
|
...data
|
|
156
168
|
});
|
|
157
169
|
};
|
|
158
|
-
debug("Format:updateState"
|
|
170
|
+
debug("Format:updateState", {
|
|
171
|
+
params: {
|
|
172
|
+
messageId,
|
|
173
|
+
code,
|
|
174
|
+
otherParams
|
|
175
|
+
}
|
|
176
|
+
});
|
|
159
177
|
const onMessage = (event) => {
|
|
160
178
|
try {
|
|
161
179
|
const data = JSON.parse(event.nativeEvent.data);
|
|
162
180
|
debug("Format:iframeMessage", {
|
|
163
181
|
message: data,
|
|
164
|
-
params: { data }
|
|
182
|
+
params: { data, messageId, code, otherParams }
|
|
165
183
|
});
|
|
166
184
|
const messageHandler = handleIframeMessage(
|
|
167
185
|
(message) => {
|
|
@@ -170,6 +188,7 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
170
188
|
setIframeLoaded(true);
|
|
171
189
|
debug("Format:iframePostMessage", {
|
|
172
190
|
params: {
|
|
191
|
+
code,
|
|
173
192
|
messages: context?.messages,
|
|
174
193
|
sdk: "sdk-react-native",
|
|
175
194
|
otherParams,
|
|
@@ -236,7 +255,7 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
236
255
|
messageHandler({ data });
|
|
237
256
|
} catch (e) {
|
|
238
257
|
debug("Format:iframeMessageError", {
|
|
239
|
-
params: { error: e },
|
|
258
|
+
params: { error: e, messageId, code, otherParams },
|
|
240
259
|
error: e
|
|
241
260
|
});
|
|
242
261
|
console.error("error parsing message from webview", e);
|
|
@@ -247,7 +266,7 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
247
266
|
try {
|
|
248
267
|
const data = JSON.parse(event.nativeEvent.data);
|
|
249
268
|
debugModal("Format:modalIframeMessage", {
|
|
250
|
-
params: { data },
|
|
269
|
+
params: { data, messageId, code, otherParams },
|
|
251
270
|
message: data
|
|
252
271
|
});
|
|
253
272
|
const messageHandler = handleIframeMessage(
|
|
@@ -291,7 +310,7 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
291
310
|
messageHandler({ data });
|
|
292
311
|
} catch (e) {
|
|
293
312
|
debugModal("Format:modalIframeMessageError", {
|
|
294
|
-
params: { error: e },
|
|
313
|
+
params: { error: e, messageId, code, otherParams },
|
|
295
314
|
error: e
|
|
296
315
|
});
|
|
297
316
|
console.error("error parsing message from webview", e);
|
|
@@ -303,16 +322,21 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
303
322
|
if (!iframeLoaded || !context?.adServerUrl || !bid || !webViewRef.current) {
|
|
304
323
|
debug("Format:iframePostMessageNotLoaded", {
|
|
305
324
|
params: {
|
|
325
|
+
messageId,
|
|
306
326
|
iframeLoaded,
|
|
307
327
|
contextAdServerUrl: context?.adServerUrl,
|
|
308
|
-
bid
|
|
328
|
+
bid,
|
|
329
|
+
code,
|
|
330
|
+
otherParams
|
|
309
331
|
}
|
|
310
332
|
});
|
|
311
333
|
return;
|
|
312
334
|
}
|
|
313
335
|
debug("Format:iframePostMessage", {
|
|
314
336
|
params: {
|
|
315
|
-
|
|
337
|
+
messageId,
|
|
338
|
+
otherParams,
|
|
339
|
+
code
|
|
316
340
|
}
|
|
317
341
|
});
|
|
318
342
|
sendMessage(webViewRef, "update-iframe", code, {
|
|
@@ -322,13 +346,22 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
322
346
|
}, [paramsString, iframeLoaded, context?.adServerUrl, bid, code]);
|
|
323
347
|
const checkIfInViewport = () => {
|
|
324
348
|
if (!containerRef.current) {
|
|
325
|
-
debug("Format:checkIfInViewportNoContainer"
|
|
349
|
+
debug("Format:checkIfInViewportNoContainer", {
|
|
350
|
+
params: {
|
|
351
|
+
messageId,
|
|
352
|
+
code,
|
|
353
|
+
otherParams
|
|
354
|
+
}
|
|
355
|
+
});
|
|
326
356
|
return;
|
|
327
357
|
}
|
|
328
358
|
debug("Format:checkIfInViewportMeasure", {
|
|
329
359
|
params: {
|
|
330
360
|
windowWidth,
|
|
331
|
-
windowHeight
|
|
361
|
+
windowHeight,
|
|
362
|
+
messageId,
|
|
363
|
+
code,
|
|
364
|
+
otherParams
|
|
332
365
|
}
|
|
333
366
|
});
|
|
334
367
|
containerRef.current.measureInWindow((containerX, containerY, containerWidth, containerHeight) => {
|
|
@@ -343,6 +376,9 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
343
376
|
});
|
|
344
377
|
debug("Format:checkIfInViewportMeasureSend", {
|
|
345
378
|
params: {
|
|
379
|
+
messageId,
|
|
380
|
+
code,
|
|
381
|
+
otherParams,
|
|
346
382
|
windowWidth,
|
|
347
383
|
windowHeight,
|
|
348
384
|
containerWidth,
|
|
@@ -356,7 +392,13 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
356
392
|
};
|
|
357
393
|
useEffect(() => {
|
|
358
394
|
if (!isAdViewVisible) {
|
|
359
|
-
debug("Format:checkIfInViewportNotVisible"
|
|
395
|
+
debug("Format:checkIfInViewportNotVisible", {
|
|
396
|
+
params: {
|
|
397
|
+
messageId,
|
|
398
|
+
code,
|
|
399
|
+
otherParams
|
|
400
|
+
}
|
|
401
|
+
});
|
|
360
402
|
return;
|
|
361
403
|
}
|
|
362
404
|
const interval = setInterval(() => {
|
|
@@ -364,27 +406,48 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
364
406
|
}, 250);
|
|
365
407
|
return () => {
|
|
366
408
|
clearInterval(interval);
|
|
367
|
-
debug("Format:checkIfInViewportCleanup"
|
|
409
|
+
debug("Format:checkIfInViewportCleanup", {
|
|
410
|
+
params: {
|
|
411
|
+
messageId,
|
|
412
|
+
code,
|
|
413
|
+
otherParams
|
|
414
|
+
}
|
|
415
|
+
});
|
|
368
416
|
};
|
|
369
417
|
}, [isAdViewVisible]);
|
|
370
418
|
useEffect(() => {
|
|
371
419
|
const showSubscription = Keyboard.addListener("keyboardDidShow", (e) => {
|
|
372
420
|
debug("Format:keyboardDidShow", {
|
|
373
421
|
params: {
|
|
374
|
-
keyboardHeight: e?.endCoordinates?.height ?? 0
|
|
422
|
+
keyboardHeight: e?.endCoordinates?.height ?? 0,
|
|
423
|
+
messageId,
|
|
424
|
+
code,
|
|
425
|
+
otherParams
|
|
375
426
|
}
|
|
376
427
|
});
|
|
377
428
|
keyboardHeightRef.current = e?.endCoordinates?.height ?? 0;
|
|
378
429
|
});
|
|
379
430
|
const hideSubscription = Keyboard.addListener("keyboardDidHide", () => {
|
|
380
|
-
debug("Format:keyboardDidHide"
|
|
431
|
+
debug("Format:keyboardDidHide", {
|
|
432
|
+
params: {
|
|
433
|
+
messageId,
|
|
434
|
+
code,
|
|
435
|
+
otherParams
|
|
436
|
+
}
|
|
437
|
+
});
|
|
381
438
|
keyboardHeightRef.current = 0;
|
|
382
439
|
});
|
|
383
440
|
return () => {
|
|
384
441
|
showSubscription.remove();
|
|
385
442
|
hideSubscription.remove();
|
|
386
443
|
keyboardHeightRef.current = 0;
|
|
387
|
-
debug("Format:keyboardEffectCleanup"
|
|
444
|
+
debug("Format:keyboardEffectCleanup", {
|
|
445
|
+
params: {
|
|
446
|
+
messageId,
|
|
447
|
+
code,
|
|
448
|
+
otherParams
|
|
449
|
+
}
|
|
450
|
+
});
|
|
388
451
|
};
|
|
389
452
|
}, []);
|
|
390
453
|
if (!context || !bid || !iframeUrl) {
|
|
@@ -392,7 +455,10 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
392
455
|
params: {
|
|
393
456
|
context,
|
|
394
457
|
bid,
|
|
395
|
-
iframeUrl
|
|
458
|
+
iframeUrl,
|
|
459
|
+
messageId,
|
|
460
|
+
code,
|
|
461
|
+
otherParams
|
|
396
462
|
}
|
|
397
463
|
});
|
|
398
464
|
return null;
|
|
@@ -411,11 +477,23 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
411
477
|
...iframeStyles
|
|
412
478
|
},
|
|
413
479
|
onError: () => {
|
|
414
|
-
debug("Format:iframeError"
|
|
480
|
+
debug("Format:iframeError", {
|
|
481
|
+
params: {
|
|
482
|
+
messageId,
|
|
483
|
+
code,
|
|
484
|
+
otherParams
|
|
485
|
+
}
|
|
486
|
+
});
|
|
415
487
|
reset();
|
|
416
488
|
},
|
|
417
489
|
onLoad: () => {
|
|
418
|
-
debug("Format:iframeLoad"
|
|
490
|
+
debug("Format:iframeLoad", {
|
|
491
|
+
params: {
|
|
492
|
+
messageId,
|
|
493
|
+
code,
|
|
494
|
+
otherParams
|
|
495
|
+
}
|
|
496
|
+
});
|
|
419
497
|
}
|
|
420
498
|
}
|
|
421
499
|
);
|
|
@@ -448,11 +526,23 @@ var Format = ({ code, messageId, wrapper, onEvent, ...otherParams }) => {
|
|
|
448
526
|
borderWidth: 0
|
|
449
527
|
},
|
|
450
528
|
onError: () => {
|
|
451
|
-
debug("Format:modalError"
|
|
529
|
+
debug("Format:modalError", {
|
|
530
|
+
params: {
|
|
531
|
+
messageId,
|
|
532
|
+
code,
|
|
533
|
+
otherParams
|
|
534
|
+
}
|
|
535
|
+
});
|
|
452
536
|
resetModal();
|
|
453
537
|
},
|
|
454
538
|
onLoad: () => {
|
|
455
|
-
debug("Format:modalLoad"
|
|
539
|
+
debug("Format:modalLoad", {
|
|
540
|
+
params: {
|
|
541
|
+
messageId,
|
|
542
|
+
code,
|
|
543
|
+
otherParams
|
|
544
|
+
}
|
|
545
|
+
});
|
|
456
546
|
setModalLoaded(true);
|
|
457
547
|
}
|
|
458
548
|
}
|
|
@@ -496,7 +586,7 @@ import { Appearance, Dimensions, PixelRatio, Platform } from "react-native";
|
|
|
496
586
|
import DeviceInfo from "react-native-device-info";
|
|
497
587
|
|
|
498
588
|
// package.json
|
|
499
|
-
var version = "3.0.7-rc.
|
|
589
|
+
var version = "3.0.7-rc.2";
|
|
500
590
|
|
|
501
591
|
// src/NativeRNKontext.ts
|
|
502
592
|
import { TurboModuleRegistry } from "react-native";
|
package/package.json
CHANGED
package/src/formats/Format.tsx
CHANGED
|
@@ -89,9 +89,21 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
const resetModal = () => {
|
|
92
|
-
debugModal('Format:resetModal'
|
|
92
|
+
debugModal('Format:resetModal', {
|
|
93
|
+
params: {
|
|
94
|
+
messageId,
|
|
95
|
+
code,
|
|
96
|
+
otherParams,
|
|
97
|
+
}
|
|
98
|
+
})
|
|
93
99
|
if (modalInitTimeoutRef.current) {
|
|
94
|
-
debugModal('Format:resetModalTimeout'
|
|
100
|
+
debugModal('Format:resetModalTimeout', {
|
|
101
|
+
params: {
|
|
102
|
+
messageId,
|
|
103
|
+
code,
|
|
104
|
+
otherParams,
|
|
105
|
+
}
|
|
106
|
+
})
|
|
95
107
|
clearTimeout(modalInitTimeoutRef.current)
|
|
96
108
|
modalInitTimeoutRef.current = null
|
|
97
109
|
}
|
|
@@ -132,7 +144,13 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
132
144
|
})
|
|
133
145
|
}
|
|
134
146
|
|
|
135
|
-
debug('Format:updateState'
|
|
147
|
+
debug('Format:updateState', {
|
|
148
|
+
params: {
|
|
149
|
+
messageId,
|
|
150
|
+
code,
|
|
151
|
+
otherParams
|
|
152
|
+
}
|
|
153
|
+
})
|
|
136
154
|
|
|
137
155
|
const onMessage = (event: WebViewMessageEvent) => {
|
|
138
156
|
try {
|
|
@@ -140,7 +158,7 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
140
158
|
|
|
141
159
|
debug('Format:iframeMessage', {
|
|
142
160
|
message: data,
|
|
143
|
-
params: { data }
|
|
161
|
+
params: { data, messageId, code, otherParams }
|
|
144
162
|
})
|
|
145
163
|
|
|
146
164
|
const messageHandler = handleIframeMessage(
|
|
@@ -150,6 +168,7 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
150
168
|
setIframeLoaded(true)
|
|
151
169
|
debug('Format:iframePostMessage', {
|
|
152
170
|
params: {
|
|
171
|
+
code,
|
|
153
172
|
messages: context?.messages,
|
|
154
173
|
sdk: 'sdk-react-native',
|
|
155
174
|
otherParams,
|
|
@@ -227,7 +246,7 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
227
246
|
messageHandler({ data } as IframeMessageEvent)
|
|
228
247
|
} catch (e) {
|
|
229
248
|
debug('Format:iframeMessageError', {
|
|
230
|
-
params: { error: e },
|
|
249
|
+
params: { error: e, messageId, code, otherParams },
|
|
231
250
|
error: e,
|
|
232
251
|
})
|
|
233
252
|
console.error('error parsing message from webview', e)
|
|
@@ -240,7 +259,7 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
240
259
|
const data = JSON.parse(event.nativeEvent.data) as IframeMessage
|
|
241
260
|
|
|
242
261
|
debugModal('Format:modalIframeMessage', {
|
|
243
|
-
params: { data },
|
|
262
|
+
params: { data, messageId, code, otherParams },
|
|
244
263
|
message: data,
|
|
245
264
|
})
|
|
246
265
|
|
|
@@ -292,7 +311,7 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
292
311
|
messageHandler({ data } as IframeMessageEvent)
|
|
293
312
|
} catch (e) {
|
|
294
313
|
debugModal('Format:modalIframeMessageError', {
|
|
295
|
-
params: { error: e },
|
|
314
|
+
params: { error: e, messageId, code, otherParams },
|
|
296
315
|
error: e,
|
|
297
316
|
})
|
|
298
317
|
console.error('error parsing message from webview', e)
|
|
@@ -306,16 +325,21 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
306
325
|
if (!iframeLoaded || !context?.adServerUrl || !bid || !webViewRef.current) {
|
|
307
326
|
debug('Format:iframePostMessageNotLoaded', {
|
|
308
327
|
params: {
|
|
328
|
+
messageId,
|
|
309
329
|
iframeLoaded,
|
|
310
330
|
contextAdServerUrl: context?.adServerUrl,
|
|
311
331
|
bid,
|
|
332
|
+
code,
|
|
333
|
+
otherParams,
|
|
312
334
|
}
|
|
313
335
|
})
|
|
314
336
|
return
|
|
315
337
|
}
|
|
316
338
|
debug('Format:iframePostMessage', {
|
|
317
339
|
params: {
|
|
318
|
-
|
|
340
|
+
messageId,
|
|
341
|
+
otherParams,
|
|
342
|
+
code,
|
|
319
343
|
}
|
|
320
344
|
})
|
|
321
345
|
sendMessage(webViewRef, 'update-iframe', code, {
|
|
@@ -327,7 +351,13 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
327
351
|
|
|
328
352
|
const checkIfInViewport = () => {
|
|
329
353
|
if (!containerRef.current) {
|
|
330
|
-
debug('Format:checkIfInViewportNoContainer'
|
|
354
|
+
debug('Format:checkIfInViewportNoContainer', {
|
|
355
|
+
params: {
|
|
356
|
+
messageId,
|
|
357
|
+
code,
|
|
358
|
+
otherParams,
|
|
359
|
+
}
|
|
360
|
+
})
|
|
331
361
|
return
|
|
332
362
|
}
|
|
333
363
|
|
|
@@ -335,6 +365,9 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
335
365
|
params: {
|
|
336
366
|
windowWidth,
|
|
337
367
|
windowHeight,
|
|
368
|
+
messageId,
|
|
369
|
+
code,
|
|
370
|
+
otherParams,
|
|
338
371
|
}
|
|
339
372
|
})
|
|
340
373
|
|
|
@@ -350,6 +383,9 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
350
383
|
})
|
|
351
384
|
debug('Format:checkIfInViewportMeasureSend', {
|
|
352
385
|
params: {
|
|
386
|
+
messageId,
|
|
387
|
+
code,
|
|
388
|
+
otherParams,
|
|
353
389
|
windowWidth,
|
|
354
390
|
windowHeight,
|
|
355
391
|
containerWidth,
|
|
@@ -364,7 +400,13 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
364
400
|
|
|
365
401
|
useEffect(() => {
|
|
366
402
|
if (!isAdViewVisible) {
|
|
367
|
-
debug('Format:checkIfInViewportNotVisible'
|
|
403
|
+
debug('Format:checkIfInViewportNotVisible', {
|
|
404
|
+
params: {
|
|
405
|
+
messageId,
|
|
406
|
+
code,
|
|
407
|
+
otherParams,
|
|
408
|
+
}
|
|
409
|
+
})
|
|
368
410
|
return
|
|
369
411
|
}
|
|
370
412
|
|
|
@@ -374,7 +416,13 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
374
416
|
|
|
375
417
|
return () => {
|
|
376
418
|
clearInterval(interval)
|
|
377
|
-
debug('Format:checkIfInViewportCleanup'
|
|
419
|
+
debug('Format:checkIfInViewportCleanup', {
|
|
420
|
+
params: {
|
|
421
|
+
messageId,
|
|
422
|
+
code,
|
|
423
|
+
otherParams,
|
|
424
|
+
}
|
|
425
|
+
})
|
|
378
426
|
}
|
|
379
427
|
}, [isAdViewVisible])
|
|
380
428
|
|
|
@@ -383,12 +431,21 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
383
431
|
debug('Format:keyboardDidShow', {
|
|
384
432
|
params: {
|
|
385
433
|
keyboardHeight: e?.endCoordinates?.height ?? 0,
|
|
434
|
+
messageId,
|
|
435
|
+
code,
|
|
436
|
+
otherParams,
|
|
386
437
|
}
|
|
387
438
|
})
|
|
388
439
|
keyboardHeightRef.current = e?.endCoordinates?.height ?? 0
|
|
389
440
|
})
|
|
390
441
|
const hideSubscription = Keyboard.addListener('keyboardDidHide', () => {
|
|
391
|
-
debug('Format:keyboardDidHide'
|
|
442
|
+
debug('Format:keyboardDidHide', {
|
|
443
|
+
params: {
|
|
444
|
+
messageId,
|
|
445
|
+
code,
|
|
446
|
+
otherParams,
|
|
447
|
+
}
|
|
448
|
+
})
|
|
392
449
|
keyboardHeightRef.current = 0
|
|
393
450
|
})
|
|
394
451
|
|
|
@@ -396,7 +453,13 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
396
453
|
showSubscription.remove()
|
|
397
454
|
hideSubscription.remove()
|
|
398
455
|
keyboardHeightRef.current = 0
|
|
399
|
-
debug('Format:keyboardEffectCleanup'
|
|
456
|
+
debug('Format:keyboardEffectCleanup', {
|
|
457
|
+
params: {
|
|
458
|
+
messageId,
|
|
459
|
+
code,
|
|
460
|
+
otherParams,
|
|
461
|
+
}
|
|
462
|
+
})
|
|
400
463
|
}
|
|
401
464
|
}, [])
|
|
402
465
|
|
|
@@ -406,6 +469,9 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
406
469
|
context,
|
|
407
470
|
bid,
|
|
408
471
|
iframeUrl,
|
|
472
|
+
messageId,
|
|
473
|
+
code,
|
|
474
|
+
otherParams,
|
|
409
475
|
}
|
|
410
476
|
})
|
|
411
477
|
return null
|
|
@@ -424,11 +490,23 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
424
490
|
...iframeStyles,
|
|
425
491
|
}}
|
|
426
492
|
onError={() => {
|
|
427
|
-
debug('Format:iframeError'
|
|
493
|
+
debug('Format:iframeError', {
|
|
494
|
+
params: {
|
|
495
|
+
messageId,
|
|
496
|
+
code,
|
|
497
|
+
otherParams,
|
|
498
|
+
}
|
|
499
|
+
})
|
|
428
500
|
reset()
|
|
429
501
|
}}
|
|
430
502
|
onLoad={() => {
|
|
431
|
-
debug('Format:iframeLoad'
|
|
503
|
+
debug('Format:iframeLoad', {
|
|
504
|
+
params: {
|
|
505
|
+
messageId,
|
|
506
|
+
code,
|
|
507
|
+
otherParams,
|
|
508
|
+
}
|
|
509
|
+
})
|
|
432
510
|
}}
|
|
433
511
|
/>
|
|
434
512
|
)
|
|
@@ -459,11 +537,23 @@ const Format = ({ code, messageId, wrapper, onEvent, ...otherParams }: FormatPro
|
|
|
459
537
|
borderWidth: 0,
|
|
460
538
|
}}
|
|
461
539
|
onError={() => {
|
|
462
|
-
debug('Format:modalError'
|
|
540
|
+
debug('Format:modalError', {
|
|
541
|
+
params: {
|
|
542
|
+
messageId,
|
|
543
|
+
code,
|
|
544
|
+
otherParams,
|
|
545
|
+
}
|
|
546
|
+
})
|
|
463
547
|
resetModal()
|
|
464
548
|
}}
|
|
465
549
|
onLoad={() => {
|
|
466
|
-
debug('Format:modalLoad'
|
|
550
|
+
debug('Format:modalLoad', {
|
|
551
|
+
params: {
|
|
552
|
+
messageId,
|
|
553
|
+
code,
|
|
554
|
+
otherParams,
|
|
555
|
+
}
|
|
556
|
+
})
|
|
467
557
|
setModalLoaded(true)
|
|
468
558
|
}}
|
|
469
559
|
/>
|