@kontextso/sdk-react-native 0.0.9 → 0.0.10-rc.1

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
@@ -1,64 +1,16 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import React from 'react';
3
+ import { AdsProviderProps } from '@kontextso/sdk-common';
4
+ export { useAd } from '@kontextso/sdk-common';
2
5
  import { StyleProp, TextStyle, ViewStyle, ImageStyle } from 'react-native';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
6
 
5
7
  interface AdProps {
6
8
  code: string;
7
9
  messageId?: string;
8
10
  wrapper?: (children: React.ReactNode) => JSX.Element;
9
11
  }
10
- declare const InlineAd: ({ code, messageId, wrapper }: AdProps) => JSX.Element | null;
12
+ declare const InlineAd: ({ code, messageId, wrapper }: AdProps) => react_jsx_runtime.JSX.Element | null;
11
13
 
12
- interface Message {
13
- id: string;
14
- createdAt?: Date;
15
- content: string;
16
- role: string;
17
- }
18
- type VideoOrientation = 'vertical' | 'horizontal';
19
- interface Ad {
20
- id?: string;
21
- code: string;
22
- content?: string;
23
- url?: string;
24
- imageUrl?: string;
25
- videoUrl?: string;
26
- mediaPlacement?: string;
27
- videoEndText?: string;
28
- videoBadgeText?: string;
29
- videoCtaText?: string;
30
- videoPosterUrl?: string;
31
- videoOrientation?: VideoOrientation;
32
- isLoading?: boolean;
33
- isStreaming?: boolean;
34
- isError?: boolean;
35
- viewed?: boolean;
36
- clicked?: boolean;
37
- messageId?: string;
38
- rewardContent?: string;
39
- product?: {
40
- id: string;
41
- title: string;
42
- imageUrl: string;
43
- url: string;
44
- };
45
- }
46
- interface Character {
47
- name: string;
48
- greeting: string;
49
- persona?: string;
50
- is_nsfw?: boolean;
51
- tags?: string[];
52
- title?: string;
53
- }
54
- interface Placement {
55
- id: number;
56
- code: string;
57
- format: string;
58
- enabled: boolean;
59
- config: any;
60
- defaultAd?: Ad;
61
- }
62
14
  type InlineAdStyles = {
63
15
  adBadgeContainer: StyleProp<TextStyle>;
64
16
  adBadgeText: StyleProp<TextStyle>;
@@ -101,49 +53,10 @@ type AdStyles = {
101
53
  videoPlayer?: Partial<VideoPlayerStyles>;
102
54
  };
103
55
 
104
- interface UseAdsProps {
105
- code: string;
106
- messageId?: string;
107
- }
108
- declare function useAd({ code, messageId }: UseAdsProps): Ad | null;
109
-
110
- declare const AdsContext: React.Context<ContextType>;
111
- type ContextType = (AdsProviderProps & {
112
- ads: Ad[];
113
- sessionId?: string;
114
- enabledPlacements: Placement[];
115
- markAdAsViewed: (ad: Ad) => void;
116
- isInitialised: boolean;
117
- onAdClickInternal: (ad: Ad) => void;
118
- userId: string;
56
+ declare const VISITOR_ID_KEY = "brain-visitor-id";
57
+ type ReactNativeAdsProviderProps = Omit<AdsProviderProps, "customFetch" | "reactNativePropStyles" | "isReactNative"> & {
119
58
  styles: AdStyles;
120
- }) | null;
121
- type PublicAd = {
122
- id: string;
123
- code: string;
124
- messageId: string;
125
- content: string;
126
59
  };
127
- type OnAdView = (ad: PublicAd) => void;
128
- type OnAdClick = (ad: PublicAd) => void;
129
- interface AdsProviderProps {
130
- children: JSX.Element[] | JSX.Element;
131
- messages: Message[];
132
- publisherToken: string;
133
- isLoading: boolean;
134
- isDisabled?: boolean;
135
- userId: string;
136
- adserverUrl?: string;
137
- streamAdServerUrl?: string;
138
- onlyStream?: boolean;
139
- character?: Character;
140
- onAdView?: OnAdView;
141
- onAdClick?: OnAdClick;
142
- logLevel?: any;
143
- conversationId: string;
144
- styles?: AdStyles;
145
- }
146
- declare const VISITOR_ID_KEY = "brain-visitor-id";
147
- declare const AdsProvider: ({ children, messages, publisherToken, isLoading, adserverUrl, isDisabled, character, conversationId, userId, logLevel, onAdView, onAdClick, ...props }: AdsProviderProps) => react_jsx_runtime.JSX.Element;
60
+ declare const AdsProvider: ({ children, messages, publisherToken, isLoading, adserverUrl, isDisabled, character, conversationId, userId, logLevel, onAdView, onAdClick, styles, }: ReactNativeAdsProviderProps) => react_jsx_runtime.JSX.Element;
148
61
 
149
- export { type AdStyles, AdsContext, AdsProvider, type AdsProviderProps, type ContextType, InlineAd, VISITOR_ID_KEY, useAd };
62
+ export { type AdStyles, AdsProvider, InlineAd, VISITOR_ID_KEY };
package/dist/index.d.ts CHANGED
@@ -1,64 +1,16 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import React from 'react';
3
+ import { AdsProviderProps } from '@kontextso/sdk-common';
4
+ export { useAd } from '@kontextso/sdk-common';
2
5
  import { StyleProp, TextStyle, ViewStyle, ImageStyle } from 'react-native';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
6
 
5
7
  interface AdProps {
6
8
  code: string;
7
9
  messageId?: string;
8
10
  wrapper?: (children: React.ReactNode) => JSX.Element;
9
11
  }
10
- declare const InlineAd: ({ code, messageId, wrapper }: AdProps) => JSX.Element | null;
12
+ declare const InlineAd: ({ code, messageId, wrapper }: AdProps) => react_jsx_runtime.JSX.Element | null;
11
13
 
12
- interface Message {
13
- id: string;
14
- createdAt?: Date;
15
- content: string;
16
- role: string;
17
- }
18
- type VideoOrientation = 'vertical' | 'horizontal';
19
- interface Ad {
20
- id?: string;
21
- code: string;
22
- content?: string;
23
- url?: string;
24
- imageUrl?: string;
25
- videoUrl?: string;
26
- mediaPlacement?: string;
27
- videoEndText?: string;
28
- videoBadgeText?: string;
29
- videoCtaText?: string;
30
- videoPosterUrl?: string;
31
- videoOrientation?: VideoOrientation;
32
- isLoading?: boolean;
33
- isStreaming?: boolean;
34
- isError?: boolean;
35
- viewed?: boolean;
36
- clicked?: boolean;
37
- messageId?: string;
38
- rewardContent?: string;
39
- product?: {
40
- id: string;
41
- title: string;
42
- imageUrl: string;
43
- url: string;
44
- };
45
- }
46
- interface Character {
47
- name: string;
48
- greeting: string;
49
- persona?: string;
50
- is_nsfw?: boolean;
51
- tags?: string[];
52
- title?: string;
53
- }
54
- interface Placement {
55
- id: number;
56
- code: string;
57
- format: string;
58
- enabled: boolean;
59
- config: any;
60
- defaultAd?: Ad;
61
- }
62
14
  type InlineAdStyles = {
63
15
  adBadgeContainer: StyleProp<TextStyle>;
64
16
  adBadgeText: StyleProp<TextStyle>;
@@ -101,49 +53,10 @@ type AdStyles = {
101
53
  videoPlayer?: Partial<VideoPlayerStyles>;
102
54
  };
103
55
 
104
- interface UseAdsProps {
105
- code: string;
106
- messageId?: string;
107
- }
108
- declare function useAd({ code, messageId }: UseAdsProps): Ad | null;
109
-
110
- declare const AdsContext: React.Context<ContextType>;
111
- type ContextType = (AdsProviderProps & {
112
- ads: Ad[];
113
- sessionId?: string;
114
- enabledPlacements: Placement[];
115
- markAdAsViewed: (ad: Ad) => void;
116
- isInitialised: boolean;
117
- onAdClickInternal: (ad: Ad) => void;
118
- userId: string;
56
+ declare const VISITOR_ID_KEY = "brain-visitor-id";
57
+ type ReactNativeAdsProviderProps = Omit<AdsProviderProps, "customFetch" | "reactNativePropStyles" | "isReactNative"> & {
119
58
  styles: AdStyles;
120
- }) | null;
121
- type PublicAd = {
122
- id: string;
123
- code: string;
124
- messageId: string;
125
- content: string;
126
59
  };
127
- type OnAdView = (ad: PublicAd) => void;
128
- type OnAdClick = (ad: PublicAd) => void;
129
- interface AdsProviderProps {
130
- children: JSX.Element[] | JSX.Element;
131
- messages: Message[];
132
- publisherToken: string;
133
- isLoading: boolean;
134
- isDisabled?: boolean;
135
- userId: string;
136
- adserverUrl?: string;
137
- streamAdServerUrl?: string;
138
- onlyStream?: boolean;
139
- character?: Character;
140
- onAdView?: OnAdView;
141
- onAdClick?: OnAdClick;
142
- logLevel?: any;
143
- conversationId: string;
144
- styles?: AdStyles;
145
- }
146
- declare const VISITOR_ID_KEY = "brain-visitor-id";
147
- declare const AdsProvider: ({ children, messages, publisherToken, isLoading, adserverUrl, isDisabled, character, conversationId, userId, logLevel, onAdView, onAdClick, ...props }: AdsProviderProps) => react_jsx_runtime.JSX.Element;
60
+ declare const AdsProvider: ({ children, messages, publisherToken, isLoading, adserverUrl, isDisabled, character, conversationId, userId, logLevel, onAdView, onAdClick, styles, }: ReactNativeAdsProviderProps) => react_jsx_runtime.JSX.Element;
148
61
 
149
- export { type AdStyles, AdsContext, AdsProvider, type AdsProviderProps, type ContextType, InlineAd, VISITOR_ID_KEY, useAd };
62
+ export { type AdStyles, AdsProvider, InlineAd, VISITOR_ID_KEY };