@kontextso/sdk-react-native 0.0.10-rc.9 → 0.1.1-rc.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
@@ -3133,7 +3133,6 @@ var InlineAd = ({ code, messageId, wrapper }) => {
3133
3133
  }
3134
3134
  const styles = getStyles(context)?.inlineAd;
3135
3135
  const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native4.View, { style: styles?.container, children: [
3136
- /* @__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" }) }),
3137
3136
  ad.imageUrl && ad.mediaPlacement === "top" && !ad.isStreaming && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3138
3137
  import_react_native4.TouchableOpacity,
3139
3138
  {
@@ -3157,13 +3156,16 @@ var InlineAd = ({ code, messageId, wrapper }) => {
3157
3156
  clickUrl: ad.url
3158
3157
  }
3159
3158
  ),
3160
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native4.Text, { style: styles?.contentContainer, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3161
- MarkdownText,
3162
- {
3163
- onLinkClick: () => context?.onAdClickInternal(ad),
3164
- content: adContent
3165
- }
3166
- ) }),
3159
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native4.Text, { style: styles?.contentContainer, children: [
3160
+ /* @__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" }) }),
3161
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3162
+ MarkdownText,
3163
+ {
3164
+ onLinkClick: () => context?.onAdClickInternal(ad),
3165
+ content: adContent
3166
+ }
3167
+ )
3168
+ ] }),
3167
3169
  ad.imageUrl && ad.mediaPlacement === "bottom" && !ad.isStreaming && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3168
3170
  import_react_native4.TouchableOpacity,
3169
3171
  {
@@ -3234,9 +3236,14 @@ var ErrorBoundary = class extends import_react11.default.Component {
3234
3236
  };
3235
3237
 
3236
3238
  // src/context/AdsProvider.tsx
3237
- var import_react_native_fetch_api = require("react-native-fetch-api");
3239
+ var import_react_native5 = require("react-native");
3238
3240
  var import_jsx_runtime6 = require("react/jsx-runtime");
3239
3241
  var VISITOR_ID_KEY2 = "brain-visitor-id";
3242
+ var customFetch = fetch;
3243
+ if (import_react_native5.Platform.OS !== "web") {
3244
+ const reactNativeFetchApi = require("react-native-fetch-api");
3245
+ customFetch = reactNativeFetchApi.fetch;
3246
+ }
3240
3247
  ErrorUtils.setGlobalHandler((error, isFatal) => {
3241
3248
  if (!isFatal) {
3242
3249
  log.warn(error);
@@ -3290,7 +3297,7 @@ var AdsProvider = ({
3290
3297
  onAdView,
3291
3298
  onAdClick,
3292
3299
  reactNativePropStyles: styles,
3293
- customFetch: (input, init) => (0, import_react_native_fetch_api.fetch)(input, { ...init, reactNative: { stream: true } }),
3300
+ customFetch: (input, init) => customFetch(input, { ...init, reactNative: { stream: true } }),
3294
3301
  isReactNative: true
3295
3302
  }
3296
3303
  )
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 {
@@ -3101,7 +3108,6 @@ var InlineAd = ({ code, messageId, wrapper }) => {
3101
3108
  }
3102
3109
  const styles = getStyles(context)?.inlineAd;
3103
3110
  const content = /* @__PURE__ */ jsxs2(View3, { style: styles?.container, children: [
3104
- /* @__PURE__ */ jsx5(View3, { style: styles?.adBadgeContainer, children: /* @__PURE__ */ jsx5(Text3, { style: styles?.adBadgeText, children: "Ad" }) }),
3105
3111
  ad.imageUrl && ad.mediaPlacement === "top" && !ad.isStreaming && /* @__PURE__ */ jsx5(
3106
3112
  TouchableOpacity2,
3107
3113
  {
@@ -3125,13 +3131,16 @@ var InlineAd = ({ code, messageId, wrapper }) => {
3125
3131
  clickUrl: ad.url
3126
3132
  }
3127
3133
  ),
3128
- /* @__PURE__ */ jsx5(Text3, { style: styles?.contentContainer, children: /* @__PURE__ */ jsx5(
3129
- MarkdownText,
3130
- {
3131
- onLinkClick: () => context?.onAdClickInternal(ad),
3132
- content: adContent
3133
- }
3134
- ) }),
3134
+ /* @__PURE__ */ jsxs2(Text3, { style: styles?.contentContainer, children: [
3135
+ /* @__PURE__ */ jsx5(View3, { style: styles?.adBadgeContainer, children: /* @__PURE__ */ jsx5(Text3, { style: styles?.adBadgeText, children: "Ad" }) }),
3136
+ /* @__PURE__ */ jsx5(
3137
+ MarkdownText,
3138
+ {
3139
+ onLinkClick: () => context?.onAdClickInternal(ad),
3140
+ content: adContent
3141
+ }
3142
+ )
3143
+ ] }),
3135
3144
  ad.imageUrl && ad.mediaPlacement === "bottom" && !ad.isStreaming && /* @__PURE__ */ jsx5(
3136
3145
  TouchableOpacity2,
3137
3146
  {
@@ -3202,9 +3211,14 @@ var ErrorBoundary = class extends React5.Component {
3202
3211
  };
3203
3212
 
3204
3213
  // src/context/AdsProvider.tsx
3205
- import { fetch as customFetch } from "react-native-fetch-api";
3214
+ import { Platform as Platform2 } from "react-native";
3206
3215
  import { jsx as jsx6 } from "react/jsx-runtime";
3207
3216
  var VISITOR_ID_KEY2 = "brain-visitor-id";
3217
+ var customFetch = fetch;
3218
+ if (Platform2.OS !== "web") {
3219
+ const reactNativeFetchApi = __require("react-native-fetch-api");
3220
+ customFetch = reactNativeFetchApi.fetch;
3221
+ }
3208
3222
  ErrorUtils.setGlobalHandler((error, isFatal) => {
3209
3223
  if (!isFatal) {
3210
3224
  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.9",
3
+ "version": "0.1.1-rc.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",