@kontextso/sdk-react-native 0.0.10-rc.8 → 0.1.0

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
@@ -3109,11 +3109,7 @@ var InlineAd = ({ code, messageId, wrapper }) => {
3109
3109
  setLinkIncluded(true);
3110
3110
  }
3111
3111
  }, [ad]);
3112
- if (!context) {
3113
- log.error("AdsContext is null");
3114
- return null;
3115
- }
3116
- if (!ad || !ad.content || context?.isDisabled) return null;
3112
+ if (!context || !ad || !ad.content || context?.isDisabled) return null;
3117
3113
  if (ad.isLoading || ad.content?.trim().toLowerCase().includes("none"))
3118
3114
  return null;
3119
3115
  const onProgress = (progress) => {
@@ -3238,9 +3234,14 @@ var ErrorBoundary = class extends import_react11.default.Component {
3238
3234
  };
3239
3235
 
3240
3236
  // src/context/AdsProvider.tsx
3241
- var import_react_native_fetch_api = require("react-native-fetch-api");
3237
+ var import_react_native5 = require("react-native");
3242
3238
  var import_jsx_runtime6 = require("react/jsx-runtime");
3243
3239
  var VISITOR_ID_KEY2 = "brain-visitor-id";
3240
+ var customFetch = fetch;
3241
+ if (import_react_native5.Platform.OS !== "web") {
3242
+ const reactNativeFetchApi = require("react-native-fetch-api");
3243
+ customFetch = reactNativeFetchApi.fetch;
3244
+ }
3244
3245
  ErrorUtils.setGlobalHandler((error, isFatal) => {
3245
3246
  if (!isFatal) {
3246
3247
  log.warn(error);
@@ -3294,7 +3295,7 @@ var AdsProvider = ({
3294
3295
  onAdView,
3295
3296
  onAdClick,
3296
3297
  reactNativePropStyles: styles,
3297
- customFetch: (input, init) => (0, import_react_native_fetch_api.fetch)(input, { ...init, reactNative: { stream: true } }),
3298
+ customFetch: (input, init) => customFetch(input, { ...init, reactNative: { stream: true } }),
3298
3299
  isReactNative: true
3299
3300
  }
3300
3301
  )
package/dist/index.mjs CHANGED
@@ -1,3 +1,10 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
1
8
  // src/formats/InlineAd.tsx
2
9
  import { useContext as useContext6, useEffect as useEffect8, useState as useState7 } from "react";
3
10
  import {
@@ -3077,11 +3084,7 @@ var InlineAd = ({ code, messageId, wrapper }) => {
3077
3084
  setLinkIncluded(true);
3078
3085
  }
3079
3086
  }, [ad]);
3080
- if (!context) {
3081
- log.error("AdsContext is null");
3082
- return null;
3083
- }
3084
- if (!ad || !ad.content || context?.isDisabled) return null;
3087
+ if (!context || !ad || !ad.content || context?.isDisabled) return null;
3085
3088
  if (ad.isLoading || ad.content?.trim().toLowerCase().includes("none"))
3086
3089
  return null;
3087
3090
  const onProgress = (progress) => {
@@ -3206,9 +3209,14 @@ var ErrorBoundary = class extends React5.Component {
3206
3209
  };
3207
3210
 
3208
3211
  // src/context/AdsProvider.tsx
3209
- import { fetch as customFetch } from "react-native-fetch-api";
3212
+ import { Platform as Platform2 } from "react-native";
3210
3213
  import { jsx as jsx6 } from "react/jsx-runtime";
3211
3214
  var VISITOR_ID_KEY2 = "brain-visitor-id";
3215
+ var customFetch = fetch;
3216
+ if (Platform2.OS !== "web") {
3217
+ const reactNativeFetchApi = __require("react-native-fetch-api");
3218
+ customFetch = reactNativeFetchApi.fetch;
3219
+ }
3212
3220
  ErrorUtils.setGlobalHandler((error, isFatal) => {
3213
3221
  if (!isFatal) {
3214
3222
  log.warn(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontextso/sdk-react-native",
3
- "version": "0.0.10-rc.8",
3
+ "version": "0.1.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",