@kontextso/sdk-react-native 0.0.8-rc.5 → 0.0.8-rc.7
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 +4 -2
- package/dist/index.mjs +13 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -98,6 +98,7 @@ var fetchRetry = async (input, init, maxRetries = 3, retryPeriod = 500) => {
|
|
|
98
98
|
var fixUrl = (adserverUrl, ad) => {
|
|
99
99
|
if (ad.content) {
|
|
100
100
|
ad.content = ad.content.replace("/impression/", `${adserverUrl}/impression/`);
|
|
101
|
+
ad.content = ad.content.replace("/ad/", `${adserverUrl}/impression/`);
|
|
101
102
|
}
|
|
102
103
|
return { ...ad, url: `${adserverUrl}${ad.url}` };
|
|
103
104
|
};
|
|
@@ -277,7 +278,7 @@ var log = new Logger();
|
|
|
277
278
|
var log_default = log;
|
|
278
279
|
|
|
279
280
|
// package.json
|
|
280
|
-
var version = "0.0.8-rc.
|
|
281
|
+
var version = "0.0.8-rc.6";
|
|
281
282
|
|
|
282
283
|
// src/hooks/useInitializeAds.tsx
|
|
283
284
|
var SINGLE_INIT_TIMEOUT_BUDGET_MS = 3e3;
|
|
@@ -1050,7 +1051,8 @@ var AdsProvider = ({
|
|
|
1050
1051
|
userId,
|
|
1051
1052
|
logLevel,
|
|
1052
1053
|
onAdView,
|
|
1053
|
-
onAdClick
|
|
1054
|
+
onAdClick,
|
|
1055
|
+
...props
|
|
1054
1056
|
}
|
|
1055
1057
|
)
|
|
1056
1058
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
// src/formats/InlineAd.tsx
|
|
9
|
-
import { useContext as useContext6, useEffect as
|
|
9
|
+
import { useContext as useContext6, useEffect as useEffect7, useState as useState8 } from "react";
|
|
10
10
|
import {
|
|
11
11
|
Image,
|
|
12
12
|
Linking as Linking3,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "react-native";
|
|
18
18
|
|
|
19
19
|
// src/hooks/useAdViewed.tsx
|
|
20
|
-
import { useEffect as
|
|
20
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
21
21
|
|
|
22
22
|
// src/context/AdsProvider.tsx
|
|
23
23
|
import React2, { useState as useState4 } from "react";
|
|
@@ -72,6 +72,7 @@ var fetchRetry = async (input, init, maxRetries = 3, retryPeriod = 500) => {
|
|
|
72
72
|
var fixUrl = (adserverUrl, ad) => {
|
|
73
73
|
if (ad.content) {
|
|
74
74
|
ad.content = ad.content.replace("/impression/", `${adserverUrl}/impression/`);
|
|
75
|
+
ad.content = ad.content.replace("/ad/", `${adserverUrl}/impression/`);
|
|
75
76
|
}
|
|
76
77
|
return { ...ad, url: `${adserverUrl}${ad.url}` };
|
|
77
78
|
};
|
|
@@ -251,7 +252,7 @@ var log = new Logger();
|
|
|
251
252
|
var log_default = log;
|
|
252
253
|
|
|
253
254
|
// package.json
|
|
254
|
-
var version = "0.0.8-rc.
|
|
255
|
+
var version = "0.0.8-rc.6";
|
|
255
256
|
|
|
256
257
|
// src/hooks/useInitializeAds.tsx
|
|
257
258
|
var SINGLE_INIT_TIMEOUT_BUDGET_MS = 3e3;
|
|
@@ -1024,7 +1025,8 @@ var AdsProvider = ({
|
|
|
1024
1025
|
userId,
|
|
1025
1026
|
logLevel,
|
|
1026
1027
|
onAdView,
|
|
1027
|
-
onAdClick
|
|
1028
|
+
onAdClick,
|
|
1029
|
+
...props
|
|
1028
1030
|
}
|
|
1029
1031
|
)
|
|
1030
1032
|
}
|
|
@@ -1057,7 +1059,7 @@ function useAdViewed(ad) {
|
|
|
1057
1059
|
log_default.warn("[BRAIN] Error sending view request", e);
|
|
1058
1060
|
}
|
|
1059
1061
|
};
|
|
1060
|
-
|
|
1062
|
+
useEffect4(() => {
|
|
1061
1063
|
if (!ad || ad.isError || ad.isLoading || ad.isStreaming || ad.viewed || stillMounted) {
|
|
1062
1064
|
return;
|
|
1063
1065
|
}
|
|
@@ -1067,7 +1069,7 @@ function useAdViewed(ad) {
|
|
|
1067
1069
|
setStillMounted(true);
|
|
1068
1070
|
}, 1e3);
|
|
1069
1071
|
}, [ad]);
|
|
1070
|
-
|
|
1072
|
+
useEffect4(() => {
|
|
1071
1073
|
if (stillMounted) {
|
|
1072
1074
|
log_default.log("[BRAIN] sending request");
|
|
1073
1075
|
sendRequest();
|
|
@@ -1119,17 +1121,17 @@ function MarkdownText({
|
|
|
1119
1121
|
|
|
1120
1122
|
// src/components/VideoPlayer.tsx
|
|
1121
1123
|
import { ResizeMode, Video } from "expo-av";
|
|
1122
|
-
import { useContext as useContext4, useEffect as
|
|
1124
|
+
import { useContext as useContext4, useEffect as useEffect6, useRef, useState as useState7 } from "react";
|
|
1123
1125
|
import { Linking as Linking2, Text as Text2, TouchableOpacity, View as View2 } from "react-native";
|
|
1124
1126
|
|
|
1125
1127
|
// src/components/VideoProgressBar.tsx
|
|
1126
|
-
import { useState as useState6, useEffect as
|
|
1128
|
+
import { useState as useState6, useEffect as useEffect5, useContext as useContext3 } from "react";
|
|
1127
1129
|
import { View } from "react-native";
|
|
1128
1130
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1129
1131
|
function VideoProgressBar({ videoRef }) {
|
|
1130
1132
|
const [progress, setProgress] = useState6(0);
|
|
1131
1133
|
const styles = useContext3(AdsContext)?.styles?.videoPlayer?.videoProgress;
|
|
1132
|
-
|
|
1134
|
+
useEffect5(() => {
|
|
1133
1135
|
const interval = setInterval(() => {
|
|
1134
1136
|
if (!videoRef.current) {
|
|
1135
1137
|
return;
|
|
@@ -1169,7 +1171,7 @@ var VideoPlayer = ({
|
|
|
1169
1171
|
const [showDownloadBadge, setShowDownloadBadge] = useState7(false);
|
|
1170
1172
|
const lastCallbackTimeRef = useRef(0);
|
|
1171
1173
|
const styles = useContext4(AdsContext)?.styles?.videoPlayer;
|
|
1172
|
-
|
|
1174
|
+
useEffect6(() => {
|
|
1173
1175
|
const interval = setInterval(() => {
|
|
1174
1176
|
if (videoRef.current) {
|
|
1175
1177
|
videoRef.current.getStatusAsync().then((status) => {
|
|
@@ -1306,7 +1308,7 @@ var InlineAd = ({ code, messageId, wrapper }) => {
|
|
|
1306
1308
|
const context = useContext6(AdsContext);
|
|
1307
1309
|
const styles = context?.styles?.inlineAd;
|
|
1308
1310
|
useAdViewed(ad);
|
|
1309
|
-
|
|
1311
|
+
useEffect7(() => {
|
|
1310
1312
|
if (ad?.content && !ad.isStreaming && !ad.content.match(/\[.*?\]\(.*?\)/) && !linkIncluded) {
|
|
1311
1313
|
setLinkIncluded(true);
|
|
1312
1314
|
}
|