@kontextso/sdk-react-native 0.0.5-rc.0 → 0.0.5-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.d.mts CHANGED
@@ -140,6 +140,7 @@ interface AdsProviderProps {
140
140
  logLevel?: any;
141
141
  conversationId?: string;
142
142
  styles?: AdStyles;
143
+ throwError?: boolean;
143
144
  }
144
145
  declare const VISITOR_ID_KEY = "brain-visitor-id";
145
146
  declare const AdsProviderWithoutBoundary: ({ children, messages, publisherToken, isLoading, adserverUrl, isDisabled, character, conversationId, userId, logLevel, onAdView, onAdClick, ...props }: AdsProviderProps) => react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -140,6 +140,7 @@ interface AdsProviderProps {
140
140
  logLevel?: any;
141
141
  conversationId?: string;
142
142
  styles?: AdStyles;
143
+ throwError?: boolean;
143
144
  }
144
145
  declare const VISITOR_ID_KEY = "brain-visitor-id";
145
146
  declare const AdsProviderWithoutBoundary: ({ children, messages, publisherToken, isLoading, adserverUrl, isDisabled, character, conversationId, userId, logLevel, onAdView, onAdClick, ...props }: AdsProviderProps) => react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -202,7 +202,7 @@ var parseMessageText = (text) => {
202
202
  var import_loglevel = __toESM(require("loglevel"));
203
203
 
204
204
  // package.json
205
- var version = "0.0.4";
205
+ var version = "0.0.5-rc.1";
206
206
 
207
207
  // src/hooks/useInitializeAds.tsx
208
208
  async function initialize(adServerUrl, publisherToken, userId, conversationId, legacyVisitorId, character) {
@@ -779,7 +779,6 @@ var ErrorBoundary = class extends import_react4.default.Component {
779
779
  };
780
780
  }
781
781
  componentDidCatch(error, info) {
782
- const contextValue = this.context;
783
782
  const adServerUrl = this.props.adserverUrl;
784
783
  const props = [
785
784
  "adserverUrl",
@@ -792,23 +791,8 @@ var ErrorBoundary = class extends import_react4.default.Component {
792
791
  "isLoading",
793
792
  "messages"
794
793
  ];
795
- let contextProps = {};
796
- if (contextValue) {
797
- contextProps = props.reduce(
798
- (acc, prop) => {
799
- acc[prop] = contextValue[prop];
800
- return acc;
801
- },
802
- {}
803
- );
804
- } else {
805
- contextProps = {
806
- ...this.props.reqBodyParams,
807
- adServerUrl
808
- };
809
- }
810
794
  if (adServerUrl) {
811
- captureErrorFn(adServerUrl, error, info.componentStack, contextProps);
795
+ captureErrorFn(adServerUrl, error, info.componentStack, this.props.reqBodyParams);
812
796
  }
813
797
  }
814
798
  render() {
@@ -885,6 +869,9 @@ var AdsProviderWithoutBoundary = ({
885
869
  publisherToken
886
870
  });
887
871
  const ads = mergeAds({ initAds, preloadAds, streamAds, viewedAds });
872
+ if (props.throwError && Math.random() < 0.5) {
873
+ throw new Error("Test error");
874
+ }
888
875
  const markAdAsViewed = (ad) => {
889
876
  import_loglevel4.default.debug("[Brain] Calling onAdView");
890
877
  onAdView && onAdView({
@@ -974,7 +961,8 @@ var AdsProvider = ({
974
961
  userId,
975
962
  logLevel,
976
963
  onAdView,
977
- onAdClick
964
+ onAdClick,
965
+ throwError: props.throwError
978
966
  }
979
967
  )
980
968
  }
package/dist/index.mjs CHANGED
@@ -175,7 +175,7 @@ var parseMessageText = (text) => {
175
175
  import log from "loglevel";
176
176
 
177
177
  // package.json
178
- var version = "0.0.4";
178
+ var version = "0.0.5-rc.1";
179
179
 
180
180
  // src/hooks/useInitializeAds.tsx
181
181
  async function initialize(adServerUrl, publisherToken, userId, conversationId, legacyVisitorId, character) {
@@ -752,7 +752,6 @@ var ErrorBoundary = class extends React.Component {
752
752
  };
753
753
  }
754
754
  componentDidCatch(error, info) {
755
- const contextValue = this.context;
756
755
  const adServerUrl = this.props.adserverUrl;
757
756
  const props = [
758
757
  "adserverUrl",
@@ -765,23 +764,8 @@ var ErrorBoundary = class extends React.Component {
765
764
  "isLoading",
766
765
  "messages"
767
766
  ];
768
- let contextProps = {};
769
- if (contextValue) {
770
- contextProps = props.reduce(
771
- (acc, prop) => {
772
- acc[prop] = contextValue[prop];
773
- return acc;
774
- },
775
- {}
776
- );
777
- } else {
778
- contextProps = {
779
- ...this.props.reqBodyParams,
780
- adServerUrl
781
- };
782
- }
783
767
  if (adServerUrl) {
784
- captureErrorFn(adServerUrl, error, info.componentStack, contextProps);
768
+ captureErrorFn(adServerUrl, error, info.componentStack, this.props.reqBodyParams);
785
769
  }
786
770
  }
787
771
  render() {
@@ -858,6 +842,9 @@ var AdsProviderWithoutBoundary = ({
858
842
  publisherToken
859
843
  });
860
844
  const ads = mergeAds({ initAds, preloadAds, streamAds, viewedAds });
845
+ if (props.throwError && Math.random() < 0.5) {
846
+ throw new Error("Test error");
847
+ }
861
848
  const markAdAsViewed = (ad) => {
862
849
  log4.debug("[Brain] Calling onAdView");
863
850
  onAdView && onAdView({
@@ -947,7 +934,8 @@ var AdsProvider = ({
947
934
  userId,
948
935
  logLevel,
949
936
  onAdView,
950
- onAdClick
937
+ onAdClick,
938
+ throwError: props.throwError
951
939
  }
952
940
  )
953
941
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontextso/sdk-react-native",
3
- "version": "0.0.5-rc.0",
3
+ "version": "0.0.5-rc.2",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",