@kontextso/sdk-react-native 0.0.10-rc.4 → 0.0.10-rc.6

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
@@ -651,7 +651,10 @@ async function* readDataStream(reader, {
651
651
  const chunks = [];
652
652
  let totalLength = 0;
653
653
  while (true) {
654
- const { value } = await reader.read();
654
+ let { value } = await reader.read();
655
+ if (typeof value === "number") {
656
+ value = new Uint8Array([value]);
657
+ }
655
658
  if (value) {
656
659
  chunks.push(value);
657
660
  totalLength += value.length;
@@ -1365,13 +1368,16 @@ var InlineAd = ({ code, messageId, wrapper }) => {
1365
1368
  const ad = useAd({ code, messageId });
1366
1369
  const [linkIncluded, setLinkIncluded] = (0, import_react10.useState)(false);
1367
1370
  const context = (0, import_react10.useContext)(AdsContext);
1368
- const styles = getStyles(context)?.inlineAd;
1369
1371
  useAdViewed(ad);
1370
1372
  (0, import_react10.useEffect)(() => {
1371
1373
  if (ad?.content && !ad.isStreaming && !ad.content.match(/\[.*?\]\(.*?\)/) && !linkIncluded) {
1372
1374
  setLinkIncluded(true);
1373
1375
  }
1374
1376
  }, [ad]);
1377
+ if (!context) {
1378
+ log.error("AdsContext is null");
1379
+ return null;
1380
+ }
1375
1381
  if (!ad || !ad.content || context?.isDisabled) return null;
1376
1382
  if (ad.isLoading || ad.content?.trim().toLowerCase().includes("none"))
1377
1383
  return null;
@@ -1394,6 +1400,7 @@ var InlineAd = ({ code, messageId, wrapper }) => {
1394
1400
  if (ad.clicked && ad.rewardContent) {
1395
1401
  adContent = ad.rewardContent;
1396
1402
  }
1403
+ const styles = getStyles(context)?.inlineAd;
1397
1404
  const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native4.View, { style: styles?.container, children: [
1398
1405
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native4.View, { style: styles?.adBadgeContainer, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native4.Text, { style: styles?.adBadgeText, children: "Ad" }) }),
1399
1406
  ad.imageUrl && ad.mediaPlacement === "top" && !ad.isStreaming && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -1482,6 +1489,7 @@ var ErrorBoundary = class extends import_react11.default.Component {
1482
1489
  }
1483
1490
  componentDidCatch(error, info) {
1484
1491
  const adServerUrl = this.props.adserverUrl;
1492
+ log.warn("ErrorBoundary componentDidCatch", error, info);
1485
1493
  if (adServerUrl) {
1486
1494
  captureErrorFn2(adServerUrl, error, info?.componentStack, this.props.reqBodyParams);
1487
1495
  }
package/dist/index.mjs CHANGED
@@ -619,7 +619,10 @@ async function* readDataStream(reader, {
619
619
  const chunks = [];
620
620
  let totalLength = 0;
621
621
  while (true) {
622
- const { value } = await reader.read();
622
+ let { value } = await reader.read();
623
+ if (typeof value === "number") {
624
+ value = new Uint8Array([value]);
625
+ }
623
626
  if (value) {
624
627
  chunks.push(value);
625
628
  totalLength += value.length;
@@ -1333,13 +1336,16 @@ var InlineAd = ({ code, messageId, wrapper }) => {
1333
1336
  const ad = useAd({ code, messageId });
1334
1337
  const [linkIncluded, setLinkIncluded] = useState7(false);
1335
1338
  const context = useContext6(AdsContext);
1336
- const styles = getStyles(context)?.inlineAd;
1337
1339
  useAdViewed(ad);
1338
1340
  useEffect8(() => {
1339
1341
  if (ad?.content && !ad.isStreaming && !ad.content.match(/\[.*?\]\(.*?\)/) && !linkIncluded) {
1340
1342
  setLinkIncluded(true);
1341
1343
  }
1342
1344
  }, [ad]);
1345
+ if (!context) {
1346
+ log.error("AdsContext is null");
1347
+ return null;
1348
+ }
1343
1349
  if (!ad || !ad.content || context?.isDisabled) return null;
1344
1350
  if (ad.isLoading || ad.content?.trim().toLowerCase().includes("none"))
1345
1351
  return null;
@@ -1362,6 +1368,7 @@ var InlineAd = ({ code, messageId, wrapper }) => {
1362
1368
  if (ad.clicked && ad.rewardContent) {
1363
1369
  adContent = ad.rewardContent;
1364
1370
  }
1371
+ const styles = getStyles(context)?.inlineAd;
1365
1372
  const content = /* @__PURE__ */ jsxs2(View3, { style: styles?.container, children: [
1366
1373
  /* @__PURE__ */ jsx5(View3, { style: styles?.adBadgeContainer, children: /* @__PURE__ */ jsx5(Text3, { style: styles?.adBadgeText, children: "Ad" }) }),
1367
1374
  ad.imageUrl && ad.mediaPlacement === "top" && !ad.isStreaming && /* @__PURE__ */ jsx5(
@@ -1450,6 +1457,7 @@ var ErrorBoundary = class extends React5.Component {
1450
1457
  }
1451
1458
  componentDidCatch(error, info) {
1452
1459
  const adServerUrl = this.props.adserverUrl;
1460
+ log.warn("ErrorBoundary componentDidCatch", error, info);
1453
1461
  if (adServerUrl) {
1454
1462
  captureErrorFn2(adServerUrl, error, info?.componentStack, this.props.reqBodyParams);
1455
1463
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontextso/sdk-react-native",
3
- "version": "0.0.10-rc.4",
3
+ "version": "0.0.10-rc.6",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",