@kontextso/sdk-react-native 0.0.4

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.
@@ -0,0 +1,147 @@
1
+ import React from 'react';
2
+ import { StyleProp, TextStyle, ViewStyle, ImageStyle } from 'react-native';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ interface AdProps {
6
+ code: string;
7
+ messageId?: string;
8
+ wrapper?: (children: React.ReactNode) => JSX.Element;
9
+ }
10
+ declare const InlineAd: ({ code, messageId, wrapper }: AdProps) => JSX.Element | null;
11
+
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
+ messageId?: string;
37
+ product?: {
38
+ id: string;
39
+ title: string;
40
+ imageUrl: string;
41
+ url: string;
42
+ };
43
+ }
44
+ interface Character {
45
+ name: string;
46
+ greeting: string;
47
+ persona?: string;
48
+ is_nsfw?: boolean;
49
+ tags?: string[];
50
+ title?: string;
51
+ }
52
+ interface Placement {
53
+ id: number;
54
+ code: string;
55
+ format: string;
56
+ enabled: boolean;
57
+ config: any;
58
+ defaultAd?: Ad;
59
+ }
60
+ type InlineAdStyles = {
61
+ adBadgeContainer: StyleProp<TextStyle>;
62
+ adBadgeText: StyleProp<TextStyle>;
63
+ container: StyleProp<ViewStyle>;
64
+ imageContainer: StyleProp<ViewStyle>;
65
+ contentContainer: StyleProp<TextStyle>;
66
+ image: StyleProp<ImageStyle>;
67
+ };
68
+ type MarkdownStyles = {
69
+ link: StyleProp<TextStyle>;
70
+ em: StyleProp<TextStyle>;
71
+ normal: StyleProp<TextStyle>;
72
+ };
73
+ type VideoPlayerStyles = {
74
+ videoOuterContainerVertical: StyleProp<ViewStyle>;
75
+ videoOuterContainerHorizontal: StyleProp<ViewStyle>;
76
+ videoInnerContainerVertical: StyleProp<ViewStyle>;
77
+ videoInnerContainerHorizontal: StyleProp<ViewStyle>;
78
+ videoElementVertical: StyleProp<ViewStyle>;
79
+ videoElementHorizontal: StyleProp<ViewStyle>;
80
+ pauseOverlay: StyleProp<ViewStyle>;
81
+ playOverlay: StyleProp<ViewStyle>;
82
+ endOverlayTouch: StyleProp<ViewStyle>;
83
+ videoBadgeText: StyleProp<TextStyle>;
84
+ playButton: StyleProp<TextStyle>;
85
+ videoBadge: StyleProp<ViewStyle>;
86
+ endOverlay: StyleProp<ViewStyle>;
87
+ endButton: StyleProp<TextStyle>;
88
+ endText: StyleProp<TextStyle>;
89
+ videoPlacementTop: StyleProp<ViewStyle>;
90
+ videoPlacementBottom: StyleProp<ViewStyle>;
91
+ videoProgress: {
92
+ progressContainer: StyleProp<ViewStyle>;
93
+ progressBar: StyleProp<ViewStyle>;
94
+ };
95
+ };
96
+ type AdStyles = {
97
+ inlineAd?: Partial<InlineAdStyles>;
98
+ markdownText?: Partial<MarkdownStyles>;
99
+ videoPlayer?: Partial<VideoPlayerStyles>;
100
+ };
101
+
102
+ interface UseAdsProps {
103
+ code: string;
104
+ messageId?: string;
105
+ }
106
+ declare function useAd({ code, messageId }: UseAdsProps): Ad | null;
107
+
108
+ declare const AdsContext: React.Context<ContextType>;
109
+ type ContextType = (AdsProviderProps & {
110
+ ads: Ad[];
111
+ sessionId?: string;
112
+ enabledPlacements: Placement[];
113
+ markAdAsViewed: (ad: Ad) => void;
114
+ isInitialised: boolean;
115
+ onAdClickInternal: (ad: Ad) => void;
116
+ userId: string;
117
+ styles: AdStyles;
118
+ }) | null;
119
+ type PublicAd = {
120
+ id: string;
121
+ code: string;
122
+ messageId: string;
123
+ content: string;
124
+ };
125
+ type OnAdView = (ad: PublicAd) => void;
126
+ type OnAdClick = (ad: PublicAd) => void;
127
+ interface AdsProviderProps {
128
+ children: JSX.Element[] | JSX.Element;
129
+ messages: Message[];
130
+ publisherToken: string;
131
+ isLoading: boolean;
132
+ isDisabled?: boolean;
133
+ userId: string;
134
+ adserverUrl?: string;
135
+ streamAdServerUrl?: string;
136
+ onlyStream?: boolean;
137
+ character?: Character;
138
+ onAdView?: OnAdView;
139
+ onAdClick?: OnAdClick;
140
+ logLevel?: any;
141
+ conversationId?: string;
142
+ styles?: AdStyles;
143
+ }
144
+ declare const VISITOR_ID_KEY = "brain-visitor-id";
145
+ declare const AdsProvider: ({ children, messages, publisherToken, isLoading, adserverUrl, isDisabled, character, conversationId, userId, logLevel, onAdView, onAdClick, ...props }: AdsProviderProps) => react_jsx_runtime.JSX.Element;
146
+
147
+ export { type AdStyles, AdsContext, AdsProvider, type AdsProviderProps, type ContextType, InlineAd, VISITOR_ID_KEY, useAd };
@@ -0,0 +1,147 @@
1
+ import React from 'react';
2
+ import { StyleProp, TextStyle, ViewStyle, ImageStyle } from 'react-native';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ interface AdProps {
6
+ code: string;
7
+ messageId?: string;
8
+ wrapper?: (children: React.ReactNode) => JSX.Element;
9
+ }
10
+ declare const InlineAd: ({ code, messageId, wrapper }: AdProps) => JSX.Element | null;
11
+
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
+ messageId?: string;
37
+ product?: {
38
+ id: string;
39
+ title: string;
40
+ imageUrl: string;
41
+ url: string;
42
+ };
43
+ }
44
+ interface Character {
45
+ name: string;
46
+ greeting: string;
47
+ persona?: string;
48
+ is_nsfw?: boolean;
49
+ tags?: string[];
50
+ title?: string;
51
+ }
52
+ interface Placement {
53
+ id: number;
54
+ code: string;
55
+ format: string;
56
+ enabled: boolean;
57
+ config: any;
58
+ defaultAd?: Ad;
59
+ }
60
+ type InlineAdStyles = {
61
+ adBadgeContainer: StyleProp<TextStyle>;
62
+ adBadgeText: StyleProp<TextStyle>;
63
+ container: StyleProp<ViewStyle>;
64
+ imageContainer: StyleProp<ViewStyle>;
65
+ contentContainer: StyleProp<TextStyle>;
66
+ image: StyleProp<ImageStyle>;
67
+ };
68
+ type MarkdownStyles = {
69
+ link: StyleProp<TextStyle>;
70
+ em: StyleProp<TextStyle>;
71
+ normal: StyleProp<TextStyle>;
72
+ };
73
+ type VideoPlayerStyles = {
74
+ videoOuterContainerVertical: StyleProp<ViewStyle>;
75
+ videoOuterContainerHorizontal: StyleProp<ViewStyle>;
76
+ videoInnerContainerVertical: StyleProp<ViewStyle>;
77
+ videoInnerContainerHorizontal: StyleProp<ViewStyle>;
78
+ videoElementVertical: StyleProp<ViewStyle>;
79
+ videoElementHorizontal: StyleProp<ViewStyle>;
80
+ pauseOverlay: StyleProp<ViewStyle>;
81
+ playOverlay: StyleProp<ViewStyle>;
82
+ endOverlayTouch: StyleProp<ViewStyle>;
83
+ videoBadgeText: StyleProp<TextStyle>;
84
+ playButton: StyleProp<TextStyle>;
85
+ videoBadge: StyleProp<ViewStyle>;
86
+ endOverlay: StyleProp<ViewStyle>;
87
+ endButton: StyleProp<TextStyle>;
88
+ endText: StyleProp<TextStyle>;
89
+ videoPlacementTop: StyleProp<ViewStyle>;
90
+ videoPlacementBottom: StyleProp<ViewStyle>;
91
+ videoProgress: {
92
+ progressContainer: StyleProp<ViewStyle>;
93
+ progressBar: StyleProp<ViewStyle>;
94
+ };
95
+ };
96
+ type AdStyles = {
97
+ inlineAd?: Partial<InlineAdStyles>;
98
+ markdownText?: Partial<MarkdownStyles>;
99
+ videoPlayer?: Partial<VideoPlayerStyles>;
100
+ };
101
+
102
+ interface UseAdsProps {
103
+ code: string;
104
+ messageId?: string;
105
+ }
106
+ declare function useAd({ code, messageId }: UseAdsProps): Ad | null;
107
+
108
+ declare const AdsContext: React.Context<ContextType>;
109
+ type ContextType = (AdsProviderProps & {
110
+ ads: Ad[];
111
+ sessionId?: string;
112
+ enabledPlacements: Placement[];
113
+ markAdAsViewed: (ad: Ad) => void;
114
+ isInitialised: boolean;
115
+ onAdClickInternal: (ad: Ad) => void;
116
+ userId: string;
117
+ styles: AdStyles;
118
+ }) | null;
119
+ type PublicAd = {
120
+ id: string;
121
+ code: string;
122
+ messageId: string;
123
+ content: string;
124
+ };
125
+ type OnAdView = (ad: PublicAd) => void;
126
+ type OnAdClick = (ad: PublicAd) => void;
127
+ interface AdsProviderProps {
128
+ children: JSX.Element[] | JSX.Element;
129
+ messages: Message[];
130
+ publisherToken: string;
131
+ isLoading: boolean;
132
+ isDisabled?: boolean;
133
+ userId: string;
134
+ adserverUrl?: string;
135
+ streamAdServerUrl?: string;
136
+ onlyStream?: boolean;
137
+ character?: Character;
138
+ onAdView?: OnAdView;
139
+ onAdClick?: OnAdClick;
140
+ logLevel?: any;
141
+ conversationId?: string;
142
+ styles?: AdStyles;
143
+ }
144
+ declare const VISITOR_ID_KEY = "brain-visitor-id";
145
+ declare const AdsProvider: ({ children, messages, publisherToken, isLoading, adserverUrl, isDisabled, character, conversationId, userId, logLevel, onAdView, onAdClick, ...props }: AdsProviderProps) => react_jsx_runtime.JSX.Element;
146
+
147
+ export { type AdStyles, AdsContext, AdsProvider, type AdsProviderProps, type ContextType, InlineAd, VISITOR_ID_KEY, useAd };