@vinaverse/react-native 0.1.0-alpha.5 → 0.1.0-alpha.6
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/README.md +57 -1
- package/dist/ask.cjs +58 -0
- package/dist/ask.cjs.map +1 -0
- package/dist/ask.d.cts +25 -0
- package/dist/ask.d.ts +25 -0
- package/dist/ask.js +5 -0
- package/dist/ask.js.map +1 -0
- package/dist/chat.cjs +266 -0
- package/dist/chat.cjs.map +1 -0
- package/dist/chat.d.cts +449 -0
- package/dist/chat.d.ts +449 -0
- package/dist/chat.js +5 -0
- package/dist/chat.js.map +1 -0
- package/dist/chunk-643GOUTG.cjs +75 -0
- package/dist/chunk-643GOUTG.cjs.map +1 -0
- package/dist/chunk-H2Y2YW2Q.cjs +2651 -0
- package/dist/chunk-H2Y2YW2Q.cjs.map +1 -0
- package/dist/chunk-NJWRZ55G.js +254 -0
- package/dist/chunk-NJWRZ55G.js.map +1 -0
- package/dist/chunk-OGPMGGYS.cjs +261 -0
- package/dist/chunk-OGPMGGYS.cjs.map +1 -0
- package/dist/chunk-OWUKWVEZ.cjs +53 -0
- package/dist/chunk-OWUKWVEZ.cjs.map +1 -0
- package/dist/chunk-PRXHS57U.js +40 -0
- package/dist/chunk-PRXHS57U.js.map +1 -0
- package/dist/chunk-PYPO6F7L.cjs +44 -0
- package/dist/chunk-PYPO6F7L.cjs.map +1 -0
- package/dist/chunk-SF6LJTVJ.js +2567 -0
- package/dist/chunk-SF6LJTVJ.js.map +1 -0
- package/dist/chunk-WKRCCPSN.js +48 -0
- package/dist/chunk-WKRCCPSN.js.map +1 -0
- package/dist/chunk-Y7P7DDHD.js +73 -0
- package/dist/chunk-Y7P7DDHD.js.map +1 -0
- package/dist/index.cjs +264 -2998
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -606
- package/dist/index.d.ts +10 -606
- package/dist/index.js +5 -2930
- package/dist/index.js.map +1 -1
- package/dist/launcher.cjs +79 -0
- package/dist/launcher.cjs.map +1 -0
- package/dist/launcher.d.cts +121 -0
- package/dist/launcher.d.ts +121 -0
- package/dist/launcher.js +6 -0
- package/dist/launcher.js.map +1 -0
- package/dist/theme-BhiEGv64.d.cts +35 -0
- package/dist/theme-BhiEGv64.d.ts +35 -0
- package/package.json +54 -9
package/dist/index.d.cts
CHANGED
|
@@ -1,607 +1,11 @@
|
|
|
1
|
-
import { GreetingStorage } from '@vinaverse/react/agent';
|
|
2
1
|
export { AgentRuntimeProvider, GreetingStorage, UseAgentConversation, UseAgentLauncher, greetedKey, useAgentConversation, useAgentFeatures, useAgentLauncher, useAgentName, useAgentProfile, useAgentRuntime, useAgentStatus } from '@vinaverse/react/agent';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly name: string;
|
|
14
|
-
readonly avatarUrl: string | null;
|
|
15
|
-
/** While a person from the business replies: their role. */
|
|
16
|
-
readonly takeoverBy: string | null;
|
|
17
|
-
readonly Default: ComponentType<Omit<HeaderProps, 'Default'>>;
|
|
18
|
-
}
|
|
19
|
-
interface MessageBubbleProps {
|
|
20
|
-
readonly item: MessageItem;
|
|
21
|
-
/** The text to draw: the message's, or the streamed text so far. */
|
|
22
|
-
readonly text: string;
|
|
23
|
-
readonly Default: ComponentType<Omit<MessageBubbleProps, 'Default'>>;
|
|
24
|
-
}
|
|
25
|
-
interface ComposerProps {
|
|
26
|
-
readonly placeholder: string;
|
|
27
|
-
readonly responding: boolean;
|
|
28
|
-
readonly onSend: (text: string) => void;
|
|
29
|
-
readonly onStop: () => void;
|
|
30
|
-
readonly Default: ComponentType<Omit<ComposerProps, 'Default'>>;
|
|
31
|
-
}
|
|
32
|
-
interface EmptyStateProps {
|
|
33
|
-
readonly agentName: string;
|
|
34
|
-
/** The tenant's greeting and chips for the session's mode (`Session.welcome`), or null. */
|
|
35
|
-
readonly welcome: Welcome$1 | null;
|
|
36
|
-
/** Sends a chip's `message` as the person's own text. */
|
|
37
|
-
readonly onChip: (message: string) => void;
|
|
38
|
-
}
|
|
39
|
-
/** `components.CardGroup`: the cards one turn drew together with `group.layout: carousel`, in order. */
|
|
40
|
-
interface CardGroupProps {
|
|
41
|
-
readonly items: readonly CardItem[];
|
|
42
|
-
}
|
|
43
|
-
/** The props the kit gives its list: FlashList's, so FlashList or LegendList take them as they are. */
|
|
44
|
-
interface ListProps {
|
|
45
|
-
readonly data: readonly TimelineItem[];
|
|
46
|
-
readonly renderItem: (info: {
|
|
47
|
-
item: TimelineItem;
|
|
48
|
-
index: number;
|
|
49
|
-
}) => ReactElement | null;
|
|
50
|
-
readonly keyExtractor: (item: TimelineItem) => string;
|
|
51
|
-
readonly getItemType: (item: TimelineItem) => string;
|
|
52
|
-
readonly maintainVisibleContentPosition: {
|
|
53
|
-
readonly startRenderingFromBottom: boolean;
|
|
54
|
-
readonly autoscrollToBottomThreshold: number;
|
|
55
|
-
readonly animateAutoScrollToBottom: boolean;
|
|
56
|
-
};
|
|
57
|
-
readonly ListFooterComponent: ReactElement | null;
|
|
58
|
-
readonly ListEmptyComponent: ReactElement | null;
|
|
59
|
-
readonly keyboardShouldPersistTaps: 'handled';
|
|
60
|
-
readonly contentContainerStyle: object;
|
|
61
|
-
}
|
|
62
|
-
/** A failure the person needs a way out of: a turn that failed before any reply, or no session to talk to. */
|
|
63
|
-
interface FailureState {
|
|
64
|
-
/** `turn_failed`: a turn failed before any of its reply; `unavailable`: the backend gave no session, or none it could use. */
|
|
65
|
-
readonly kind: 'turn_failed' | 'unavailable';
|
|
66
|
-
/** Why: the turn's error `code` (`internal`, `timeout`, …), or the conversation's status (`unavailable`, `unauthorized`). */
|
|
67
|
-
readonly reason: string | null;
|
|
68
|
-
/** Try again, when it can be: the person's text again for a turn the server allows to retry, a new session otherwise. */
|
|
69
|
-
readonly retry: (() => void) | undefined;
|
|
70
|
-
/** The conversation, once a session named it: for your support records. */
|
|
71
|
-
readonly conversationId: string | null;
|
|
72
|
-
}
|
|
73
|
-
/** A slot for a failure (`components.Error`, `components.Unavailable`): the state, and the kit's own part to wrap. */
|
|
74
|
-
interface FailureProps {
|
|
75
|
-
readonly state: FailureState;
|
|
76
|
-
readonly Default: ComponentType<{
|
|
77
|
-
readonly state: FailureState;
|
|
78
|
-
}>;
|
|
79
|
-
}
|
|
80
|
-
/** One action on every failure, drawn as a button by the kit's own parts: a person is always the way out. */
|
|
81
|
-
interface FailureAction {
|
|
82
|
-
/** Default: the copy's `talkToPerson` ("Talk to a person"), in the person's language. */
|
|
83
|
-
readonly label?: string;
|
|
84
|
-
readonly onPress: (state: FailureState) => void;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare function CardCarousel(props: CardGroupProps): react.JSX.Element;
|
|
88
|
-
|
|
89
|
-
declare function CardFrame(props: {
|
|
90
|
-
readonly label: string;
|
|
91
|
-
readonly restored?: boolean;
|
|
92
|
-
readonly children?: ReactNode;
|
|
93
|
-
readonly testID?: string;
|
|
94
|
-
}): react.JSX.Element;
|
|
95
|
-
/** A rating in millionths as the locale writes it, one decimal: 4.8, or 4,8 in Spanish and Portuguese. */
|
|
96
|
-
declare function ratingText(valuePpm: number, locale: string | undefined): string;
|
|
97
|
-
/** A photo the image policy allows: https, and from one of its hosts when it names them. */
|
|
98
|
-
declare function allowedImage(url: string | undefined, hosts: readonly string[] | undefined): string | null;
|
|
99
|
-
|
|
100
|
-
interface CardProps {
|
|
101
|
-
readonly card: HeldCard;
|
|
102
|
-
/** The card read once for drawing, every field checked (`readCard`): kind, target, photo, rating, price, group, links. */
|
|
103
|
-
readonly read: ReadCard | null;
|
|
104
|
-
/** A proposal being decided: draw its buttons busy. */
|
|
105
|
-
readonly busy: boolean;
|
|
106
|
-
/** Restored after a restart: draw it as it was, taking no answer or action. */
|
|
107
|
-
readonly restored: boolean;
|
|
108
|
-
/** The kit's own renderer for this kind, to wrap rather than rewrite. */
|
|
109
|
-
readonly Default: ComponentType<Omit<CardProps, 'Default'>>;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/** The kit's own renderer for a kind. */
|
|
113
|
-
declare function defaultCard(kind: string): ComponentType<Omit<CardProps, 'Default'>>;
|
|
114
|
-
declare const CardView: react.NamedExoticComponent<{
|
|
115
|
-
readonly item: CardItem;
|
|
116
|
-
}>;
|
|
117
|
-
|
|
118
|
-
declare function InfoCard(props: Omit<CardProps, 'Default'>): react.JSX.Element;
|
|
119
|
-
/** A card's actions: a link that passes the deep-link rule opens the tenant's page, any other goes to the session. */
|
|
120
|
-
declare function CardActions(props: Omit<CardProps, 'Default'>): react.JSX.Element | null;
|
|
121
|
-
|
|
122
|
-
declare function LinksCard(props: Omit<CardProps, 'Default'>): react.JSX.Element;
|
|
123
|
-
|
|
124
|
-
declare function ListingCard(props: Omit<CardProps, 'Default'>): react.JSX.Element;
|
|
125
|
-
/** The first letters of the first two words: "Bell's Barber Lounge" is "BB". */
|
|
126
|
-
declare function monogram(title: string): string;
|
|
127
|
-
|
|
128
|
-
declare function NextStepCard(props: Omit<CardProps, 'Default'>): react.JSX.Element;
|
|
129
|
-
|
|
130
|
-
/** A field's value as text, by its type (`text`, `list`, `time_range`, `address`, `money_cents`). */
|
|
131
|
-
declare function fieldText(type: string, value: unknown, locale: string | undefined, timeZone: string | undefined): string;
|
|
132
|
-
declare function ProposalCard(props: Omit<CardProps, 'Default'>): react.JSX.Element | null;
|
|
133
|
-
|
|
134
|
-
declare function QuestionCard(props: Omit<CardProps, 'Default'>): react.JSX.Element | null;
|
|
135
|
-
/** A recorded answer, in words. */
|
|
136
|
-
declare function answerText(question: Question, locale: string | undefined, otherLabel: string): string | null;
|
|
137
|
-
|
|
138
|
-
declare function TimeSlotsCard(props: Omit<CardProps, 'Default'>): react.JSX.Element;
|
|
139
|
-
|
|
140
|
-
declare const ActivityLine: react.NamedExoticComponent<object>;
|
|
141
|
-
|
|
142
|
-
type ProposalDecision = 'confirm' | 'decline';
|
|
143
|
-
/** What the kit asks of the tenant's app. Only `onProposal` and `onOpenLink` are needed for the cards that use them. */
|
|
144
|
-
interface ChatHandlers {
|
|
145
|
-
/**
|
|
146
|
-
* The person confirmed or declined a proposal: call your backend with the person's own token, then say what
|
|
147
|
-
* happened (`confirmed`, `declined`, `failed`, or `expired` when it had expired). The kit reports it to the session.
|
|
148
|
-
*/
|
|
149
|
-
readonly onProposal?: (card: HeldCard, decision: ProposalDecision) => Promise<ProposalOutcome>;
|
|
150
|
-
/**
|
|
151
|
-
* Open a card's link in your app: a deep link that already passed the deep-link rule (route by the page it names),
|
|
152
|
-
* or a `links` card's https page (your in-app browser; without this handler the system opens it).
|
|
153
|
-
*/
|
|
154
|
-
readonly onOpenLink?: (link: string, card: HeldCard) => void;
|
|
155
|
-
/** A card action without a link (`show_times`, …): sent to the session; this tells your app too. */
|
|
156
|
-
readonly onCardAction?: (card: HeldCard, action: string) => void;
|
|
157
|
-
/** A photo question: let the person pick one, upload it to your backend, and give back its `upload_ref`. */
|
|
158
|
-
readonly onPickPhoto?: (question: Question, card: HeldCard) => Promise<{
|
|
159
|
-
readonly upload_ref: string;
|
|
160
|
-
} | null>;
|
|
161
|
-
/**
|
|
162
|
-
* A way out on a failed turn and on "couldn't connect": a button with your label (default "Talk to a person"),
|
|
163
|
-
* drawn by the kit's own parts when no `components.Error` or `components.Unavailable` replaces them.
|
|
164
|
-
*/
|
|
165
|
-
readonly failureAction?: FailureAction;
|
|
166
|
-
/** Development warnings: a theme that is hard to read, copy that says "assistant". */
|
|
167
|
-
readonly onWarning?: (message: string) => void;
|
|
168
|
-
/**
|
|
169
|
-
* The person tapped a card about something of yours (its `ref`: a professional, a space, a booking): open its page
|
|
170
|
-
* with your router. Without it, only the card's own actions open anything.
|
|
171
|
-
*/
|
|
172
|
-
readonly onOpenTarget?: (target: AgentCardTarget, card: HeldCard) => void;
|
|
173
|
-
/** Card photos arrive: fetch them ahead with your image library (`Image.prefetch`), so the cards draw at once. */
|
|
174
|
-
readonly prefetchImage?: (url: string) => void;
|
|
175
|
-
/** Reads a line to a screen reader (a finished reply, the launcher's greeting). Default: the platform's. */
|
|
176
|
-
readonly announce?: (text: string) => void;
|
|
177
|
-
/** A chip was tapped (a welcome chip, a starter, the suggestion); its message is sent as the person's own. */
|
|
178
|
-
readonly onChip?: (chip: Chip) => void;
|
|
179
|
-
}
|
|
180
|
-
/** Which card photos are drawn, in what frame, and what stands in for one that is not. */
|
|
181
|
-
interface ImagePolicy {
|
|
182
|
-
/** Hosts a photo may come from (exact names); default any https host. */
|
|
183
|
-
readonly hosts?: readonly string[];
|
|
184
|
-
/** Width / height of a listing's photo frame. Default 1.6 (16:10). */
|
|
185
|
-
readonly aspectRatio?: number;
|
|
186
|
-
/** What stands in for a missing, refused or failed photo. Default the name's monogram. */
|
|
187
|
-
readonly Placeholder?: ComponentType<{
|
|
188
|
-
readonly title: string;
|
|
189
|
-
}>;
|
|
190
|
-
}
|
|
191
|
-
/** Parts a tenant can replace. Each gets the default's props and the default itself (`Default`), to wrap it. */
|
|
192
|
-
interface ChatSlots {
|
|
193
|
-
readonly Header?: ComponentType<HeaderProps>;
|
|
194
|
-
readonly MessageBubble?: ComponentType<MessageBubbleProps>;
|
|
195
|
-
readonly Composer?: ComponentType<ComposerProps>;
|
|
196
|
-
readonly EmptyState?: ComponentType<EmptyStateProps>;
|
|
197
|
-
readonly Image?: ComponentType<ImageProps>;
|
|
198
|
-
/** A list with FlashList's props (LegendList works). Default: FlashList. */
|
|
199
|
-
readonly ListComponent?: ComponentType<ListProps>;
|
|
200
|
-
/** A turn that failed before any reply: replaces the "Something went wrong." row. */
|
|
201
|
-
readonly Error?: ComponentType<FailureProps>;
|
|
202
|
-
/** No session to talk to: replaces the "Couldn't connect." banner. */
|
|
203
|
-
readonly Unavailable?: ComponentType<FailureProps>;
|
|
204
|
-
/**
|
|
205
|
-
* Draws a turn's cards that ask for a carousel (`group.layout: carousel`) in one row: the kit's `CardCarousel`, or
|
|
206
|
-
* yours. Without it they draw one under another. Opt-in, so an app that never draws a carousel does not ship one.
|
|
207
|
-
*/
|
|
208
|
-
readonly CardGroup?: ComponentType<CardGroupProps>;
|
|
209
|
-
/** Card renderers by kind (`professional`, `proposal`, …). */
|
|
210
|
-
readonly cards?: Readonly<Partial<Record<string, ComponentType<CardProps>>>>;
|
|
211
|
-
}
|
|
212
|
-
interface ChatContextValue {
|
|
213
|
-
readonly store: ConversationStore;
|
|
214
|
-
readonly handlers: RefObject<ChatHandlers>;
|
|
215
|
-
readonly slots: ChatSlots;
|
|
216
|
-
readonly agentAvatar: string | undefined;
|
|
217
|
-
readonly timeZone: string | undefined;
|
|
218
|
-
/** The failure action's label when there is one (`label` undefined: the copy's); `onPress` is read from `handlers`. */
|
|
219
|
-
readonly failureAction: {
|
|
220
|
-
readonly label: string | undefined;
|
|
221
|
-
} | null;
|
|
222
|
-
/** Chips for an empty conversation when the session brings no welcome. */
|
|
223
|
-
readonly starters: readonly Chip[] | undefined;
|
|
224
|
-
readonly imagePolicy: ImagePolicy | undefined;
|
|
225
|
-
}
|
|
226
|
-
/** A tap target that sends `message` as the person's own text (a welcome chip, a starter, a suggestion). */
|
|
227
|
-
type Chip = Welcome$1['chips'][number];
|
|
228
|
-
/** The conversation, handlers and slots; only inside `VinaverseChat` (or `VinaverseChatProvider`). */
|
|
229
|
-
declare function useChat(): ChatContextValue;
|
|
230
|
-
|
|
231
|
-
interface Theme {
|
|
232
|
-
readonly scheme: ColorScheme;
|
|
233
|
-
readonly colors: Colors;
|
|
234
|
-
readonly font: typeof font & {
|
|
235
|
-
readonly family?: string;
|
|
236
|
-
};
|
|
237
|
-
readonly space: typeof space;
|
|
238
|
-
readonly radius: typeof radius;
|
|
239
|
-
readonly motion: typeof motion;
|
|
240
|
-
readonly size: typeof size;
|
|
241
|
-
}
|
|
242
|
-
/** A tenant's brand: colors per scheme, a font family, radii. Anything left out keeps the Vinaverse default. */
|
|
243
|
-
interface ThemeOverrides {
|
|
244
|
-
readonly light?: Partial<Colors>;
|
|
245
|
-
readonly dark?: Partial<Colors>;
|
|
246
|
-
readonly fontFamily?: string;
|
|
247
|
-
readonly radius?: Partial<typeof radius>;
|
|
248
|
-
readonly space?: Partial<typeof space>;
|
|
249
|
-
}
|
|
250
|
-
type ColorSchemeSetting = 'system' | 'light' | 'dark';
|
|
251
|
-
/** The theme for a scheme, with the tenant's overrides on top. */
|
|
252
|
-
declare function createTheme(scheme: ColorScheme, overrides?: ThemeOverrides): Theme;
|
|
253
|
-
/** The pairs a tenant's colors made hard to read, in either scheme, as messages for a development warning. */
|
|
254
|
-
declare function themeProblems(overrides?: ThemeOverrides): string[];
|
|
255
|
-
declare function ThemeProvider(props: {
|
|
256
|
-
readonly theme?: ThemeOverrides | undefined;
|
|
257
|
-
readonly colorScheme?: ColorSchemeSetting | undefined;
|
|
258
|
-
readonly children?: ReactNode;
|
|
259
|
-
}): ReactNode;
|
|
260
|
-
declare function useTheme(): Theme;
|
|
261
|
-
|
|
262
|
-
interface VinaverseChatProps extends ChatHandlers {
|
|
263
|
-
/** The conversation (`createConversation`), created where it can outlive the screen. */
|
|
264
|
-
readonly conversation: ConversationStore;
|
|
265
|
-
/** The person's locale: the copy, dates, money and text direction (pass the same one to `getSession`). */
|
|
266
|
-
readonly locale?: string;
|
|
267
|
-
/** For dates and times on cards; default: the device's. */
|
|
268
|
-
readonly timeZone?: string;
|
|
269
|
-
readonly copy?: CopyOverrides;
|
|
270
|
-
readonly theme?: ThemeOverrides;
|
|
271
|
-
readonly colorScheme?: ColorSchemeSetting;
|
|
272
|
-
/** Parts to replace. Keep the object stable (module level, or memoized). */
|
|
273
|
-
readonly components?: ChatSlots;
|
|
274
|
-
/** The agent's picture, until the session carries one. */
|
|
275
|
-
readonly agentAvatar?: string;
|
|
276
|
-
/** Hide the header (a screen that draws its own); the disclosure stays. */
|
|
277
|
-
readonly hideHeader?: boolean;
|
|
278
|
-
/** iOS: the height above the keyboard that is not this view's (a navigation header). */
|
|
279
|
-
readonly keyboardVerticalOffset?: number;
|
|
280
|
-
/**
|
|
281
|
-
* How the composer stays above the keyboard. Default: `padding` on iOS, none on Android (the window resizes). An
|
|
282
|
-
* edge-to-edge Android app whose window does not resize passes `padding`; one that manages the keyboard itself
|
|
283
|
-
* (react-native-keyboard-controller) passes `none`.
|
|
284
|
-
*/
|
|
285
|
-
readonly keyboardBehavior?: 'padding' | 'height' | 'position' | 'none';
|
|
286
|
-
readonly style?: StyleProp<ViewStyle>;
|
|
287
|
-
/** Chips for an empty conversation when the session brings no welcome (`Session.welcome` comes first). Keep stable. */
|
|
288
|
-
readonly starters?: readonly Chip[];
|
|
289
|
-
/** Which card photos are drawn, their frame, and what stands in for one that is not. Keep stable. */
|
|
290
|
-
readonly imagePolicy?: ImagePolicy;
|
|
291
|
-
/** One chip above the composer: a question about where the person now is (`AgentChat` offers it when they moved). */
|
|
292
|
-
readonly suggestion?: Chip | null;
|
|
293
|
-
/** Drawn under the composer, inside the kit's providers (`AgentChat`'s thumbs and footer). */
|
|
294
|
-
readonly footer?: ReactNode;
|
|
295
|
-
}
|
|
296
|
-
/** The providers alone, for a tenant composing its own layout from the exported parts. */
|
|
297
|
-
declare function VinaverseChatProvider(props: Omit<VinaverseChatProps, 'hideHeader' | 'keyboardVerticalOffset' | 'keyboardBehavior' | 'style' | 'suggestion' | 'footer'> & {
|
|
298
|
-
readonly children?: ReactNode;
|
|
299
|
-
}): ReactNode;
|
|
300
|
-
declare function VinaverseChat(props: VinaverseChatProps): ReactNode;
|
|
301
|
-
|
|
302
|
-
interface AgentEndedProps {
|
|
303
|
-
readonly onStartNew: () => void;
|
|
304
|
-
/** The API's code (`conversation_not_found`, `conversation_expired`), when it gave one. */
|
|
305
|
-
readonly code: string | null;
|
|
306
|
-
}
|
|
307
|
-
/** No agent here: switched off for this tenant, mode or person, or the backend refused the session. */
|
|
308
|
-
interface AgentUnavailableScreenProps {
|
|
309
|
-
/** Why: `off`, `auth`, `invalid_session`, … */
|
|
310
|
-
readonly reason: AgentFailureReason | null;
|
|
311
|
-
readonly code: string | null;
|
|
312
|
-
/** A person instead (the chat's `onContact`); absent when the app gave none. */
|
|
313
|
-
readonly onContact: (() => void) | undefined;
|
|
314
|
-
/** Ask again (after a sign-in, or the agent switched back on). */
|
|
315
|
-
readonly onRetry: () => void;
|
|
316
|
-
}
|
|
317
|
-
interface AgentUnreachableProps {
|
|
318
|
-
readonly onRetry: () => void;
|
|
319
|
-
/** Why: `network`, `server`, `rate_limited`, … */
|
|
320
|
-
readonly reason: AgentFailureReason | null;
|
|
321
|
-
}
|
|
322
|
-
/** A slot gets the kit's own part as `Default`, to wrap rather than rewrite. */
|
|
323
|
-
type Slot$1<P> = ComponentType<P & {
|
|
324
|
-
readonly Default: ComponentType<P>;
|
|
325
|
-
}>;
|
|
326
|
-
interface AgentFooterProps {
|
|
327
|
-
/** The newest whole reply's turn, to rate; null when there is none. */
|
|
328
|
-
readonly turnId: string | null;
|
|
329
|
-
readonly rating: AgentRating | undefined;
|
|
330
|
-
readonly onRate: (rating: AgentRating) => void;
|
|
331
|
-
readonly onOpenPrivacy: (() => void) | undefined;
|
|
332
|
-
}
|
|
333
|
-
interface AgentChatSlots extends ChatSlots {
|
|
334
|
-
readonly Ended?: Slot$1<AgentEndedProps>;
|
|
335
|
-
readonly Unreachable?: Slot$1<AgentUnreachableProps>;
|
|
336
|
-
/**
|
|
337
|
-
* The whole screen when there is no agent (off, or the session refused). Not `Unavailable`: that is the chat's own
|
|
338
|
-
* "couldn't connect" banner, still drawn for a session that drops.
|
|
339
|
-
*/
|
|
340
|
-
readonly UnavailableScreen?: Slot$1<AgentUnavailableScreenProps>;
|
|
341
|
-
/** Under the composer; null hides it. Default: thumbs on the newest whole reply, and the privacy link. */
|
|
342
|
-
readonly Footer?: Slot$1<AgentFooterProps> | null;
|
|
343
|
-
}
|
|
344
|
-
interface AgentChatProps extends Omit<VinaverseChatProps, 'conversation' | 'components' | 'suggestion' | 'footer'> {
|
|
345
|
-
/** Whose conversation: one per person, mode, business and thread. */
|
|
346
|
-
readonly agentKey: AgentKey;
|
|
347
|
-
/** Where the person asks from, told to the agent as a session opens. */
|
|
348
|
-
readonly place?: AgentPlace | null;
|
|
349
|
-
readonly entryPoint?: string | null;
|
|
350
|
-
/** The question about this place, offered when the session was told another one (`moved`). */
|
|
351
|
-
readonly askAbout?: string | null;
|
|
352
|
-
/** A person: offered on a failed turn, "couldn't connect" and no agent. */
|
|
353
|
-
readonly onContact?: () => void;
|
|
354
|
-
readonly onOpenPrivacy?: () => void;
|
|
355
|
-
/** The agent's name until the session or the status gives one. */
|
|
356
|
-
readonly agentName?: string;
|
|
357
|
-
/**
|
|
358
|
-
* A first question for a flow that asks for itself (setting a business up): a chip the person taps, offered until they
|
|
359
|
-
* say anything. Never sent in their name: what the transcript shows as theirs, they typed or tapped.
|
|
360
|
-
*/
|
|
361
|
-
readonly opener?: Chip | null;
|
|
362
|
-
readonly components?: AgentChatSlots;
|
|
363
|
-
}
|
|
364
|
-
declare function AgentChat(props: AgentChatProps): ReactNode;
|
|
365
|
-
/** The newest reply when it came whole (not cut off, not a refusal): the one to rate. */
|
|
366
|
-
declare function newestWholeReply(view: {
|
|
367
|
-
readonly items: readonly _vinaverse_client_conversation.TimelineItem[];
|
|
368
|
-
}): string | null;
|
|
369
|
-
/** The conversation is over: a new one starts only when the person asks. */
|
|
370
|
-
declare function DefaultEnded(props: AgentEndedProps): ReactNode;
|
|
371
|
-
/** No agent here: says so, and offers a person when the app has one. */
|
|
372
|
-
declare function DefaultUnavailableScreen(props: AgentUnavailableScreenProps): ReactNode;
|
|
373
|
-
/** The app's backend could not be reached, after its tries: try again. */
|
|
374
|
-
declare function DefaultUnreachable(props: AgentUnreachableProps): ReactNode;
|
|
375
|
-
/** Thumbs on the newest whole reply (thanks once given), and the privacy link. */
|
|
376
|
-
declare function AgentFooter(props: AgentFooterProps): ReactNode;
|
|
377
|
-
|
|
378
|
-
/** The launcher's button side, in dp. */
|
|
379
|
-
declare const LAUNCHER_SIZE = 56;
|
|
380
|
-
/** The launcher's look: a ring around the button, its shadow, the bubble's tail toward it. */
|
|
381
|
-
interface LauncherAppearance {
|
|
382
|
-
/** Default none. */
|
|
383
|
-
readonly ring?: {
|
|
384
|
-
readonly color: string;
|
|
385
|
-
readonly width: number;
|
|
386
|
-
} | null;
|
|
387
|
-
/** Default true. */
|
|
388
|
-
readonly shadow?: boolean;
|
|
389
|
-
/** Default true. */
|
|
390
|
-
readonly tail?: boolean;
|
|
391
|
-
}
|
|
392
|
-
/** Where it floats: the screen's edge, its distance from the bottom (above a tab bar) and from the side. */
|
|
393
|
-
interface LauncherPlacement {
|
|
394
|
-
/** Default `right`. */
|
|
395
|
-
readonly edge?: 'left' | 'right';
|
|
396
|
-
/** Default 16. */
|
|
397
|
-
readonly bottom?: number;
|
|
398
|
-
/** Default 16. */
|
|
399
|
-
readonly inset?: number;
|
|
400
|
-
}
|
|
401
|
-
interface LauncherButtonProps {
|
|
402
|
-
readonly label: string;
|
|
403
|
-
readonly name: string;
|
|
404
|
-
readonly onPress: () => void;
|
|
405
|
-
readonly Mark: ComponentType<{
|
|
406
|
-
readonly size: number;
|
|
407
|
-
readonly color: string;
|
|
408
|
-
}> | undefined;
|
|
409
|
-
readonly ring: {
|
|
410
|
-
readonly color: string;
|
|
411
|
-
readonly width: number;
|
|
412
|
-
} | null;
|
|
413
|
-
readonly shadow: boolean;
|
|
414
|
-
}
|
|
415
|
-
interface LauncherGreetingProps {
|
|
416
|
-
readonly text: string;
|
|
417
|
-
readonly closeLabel: string;
|
|
418
|
-
readonly onOpen: () => void;
|
|
419
|
-
readonly onClose: () => void;
|
|
420
|
-
readonly tail: boolean;
|
|
421
|
-
readonly edge: 'left' | 'right';
|
|
422
|
-
}
|
|
423
|
-
/** How the button and the bubble come in; `reducedMotion` when the person asked for none. */
|
|
424
|
-
interface LauncherEntranceProps {
|
|
425
|
-
readonly part: 'button' | 'greeting';
|
|
426
|
-
readonly reducedMotion: boolean;
|
|
427
|
-
readonly children: ReactNode;
|
|
428
|
-
}
|
|
429
|
-
type Slot<P> = ComponentType<P & {
|
|
430
|
-
readonly Default: ComponentType<P>;
|
|
431
|
-
}>;
|
|
432
|
-
/** Where the person opened the agent from: the app's route, and the mode. */
|
|
433
|
-
interface LauncherContext {
|
|
434
|
-
readonly route: string | null;
|
|
435
|
-
readonly mode: string;
|
|
436
|
-
}
|
|
437
|
-
interface AgentLauncherProps {
|
|
438
|
-
readonly subject: string | null;
|
|
439
|
-
readonly mode: string;
|
|
440
|
-
readonly onOpen: (from: LauncherContext) => void;
|
|
441
|
-
/** The app's current route; with `routes`, the launcher shows only on those. */
|
|
442
|
-
readonly route?: string | null;
|
|
443
|
-
readonly routes?: readonly string[];
|
|
444
|
-
/** The app says step aside (a sheet is up, a map with its own cards…). */
|
|
445
|
-
readonly hidden?: boolean;
|
|
446
|
-
/** Hidden while the keyboard is up. Default true. */
|
|
447
|
-
readonly hideWithKeyboard?: boolean;
|
|
448
|
-
/** Where it remembers the greeting was shown (the app's preferences store); default: for this launch only. */
|
|
449
|
-
readonly storage?: GreetingStorage;
|
|
450
|
-
/** The storage's key for a person and mode (a record the app already keeps); default `greetedKey`. */
|
|
451
|
-
readonly storageKey?: (subject: string | null, mode: string) => string;
|
|
452
|
-
/** The greeting's words, or by mode; default the copy's `launcherGreeting`. */
|
|
453
|
-
readonly greeting?: string | ((mode: string) => string);
|
|
454
|
-
/** How long after showing the greeting appears. Default 1200 ms. */
|
|
455
|
-
readonly delayMs?: number;
|
|
456
|
-
/** The app's brand mark inside the button; default the agent name's first letter. */
|
|
457
|
-
readonly Mark?: ComponentType<{
|
|
458
|
-
readonly size: number;
|
|
459
|
-
readonly color: string;
|
|
460
|
-
}>;
|
|
461
|
-
/** Reads the greeting to a screen reader as it appears. Default: the platform's. */
|
|
462
|
-
readonly announce?: (text: string) => void;
|
|
463
|
-
readonly components?: {
|
|
464
|
-
readonly Button?: Slot<LauncherButtonProps>;
|
|
465
|
-
readonly Greeting?: Slot<LauncherGreetingProps>;
|
|
466
|
-
/** Default: a short fade and scale; none with reduced motion. */
|
|
467
|
-
readonly Entrance?: Slot<LauncherEntranceProps>;
|
|
468
|
-
};
|
|
469
|
-
readonly appearance?: LauncherAppearance;
|
|
470
|
-
/** Where it floats over the app's screens; `style` comes after it, for anything else. */
|
|
471
|
-
readonly placement?: LauncherPlacement;
|
|
472
|
-
readonly style?: StyleProp<ViewStyle>;
|
|
473
|
-
/** As on the chat: the person's locale, the app's words, theme and color scheme. */
|
|
474
|
-
readonly locale?: string;
|
|
475
|
-
readonly copy?: CopyOverrides;
|
|
476
|
-
readonly theme?: ThemeOverrides;
|
|
477
|
-
readonly colorScheme?: ColorSchemeSetting;
|
|
478
|
-
}
|
|
479
|
-
declare function AgentLauncher(props: AgentLauncherProps): ReactNode;
|
|
480
|
-
/** Whether the keyboard is up. */
|
|
481
|
-
declare function useKeyboardShown(): boolean;
|
|
482
|
-
/** The kit's entrance: a short fade and scale up; none when the person asked for reduced motion. */
|
|
483
|
-
declare function LauncherEntrance(props: LauncherEntranceProps): ReactNode;
|
|
484
|
-
/** The kit's greeting bubble: the words (a tap opens the agent), a close button, and a tail toward the button. */
|
|
485
|
-
declare function LauncherGreeting(props: LauncherGreetingProps): ReactNode;
|
|
486
|
-
/** The kit's round button: the app's mark, else the agent name's first letter; its ring and shadow as asked. */
|
|
487
|
-
declare function LauncherButton(props: LauncherButtonProps): ReactNode;
|
|
488
|
-
|
|
489
|
-
interface AskAboutRowProps {
|
|
490
|
-
/** "Ask Example Agent about Riley Sample". */
|
|
491
|
-
readonly title: string;
|
|
492
|
-
readonly body?: string;
|
|
493
|
-
readonly onPress: () => void;
|
|
494
|
-
/** The app's brand mark at the row's start; default the agent name's first letter. */
|
|
495
|
-
readonly Mark?: ComponentType<{
|
|
496
|
-
readonly size: number;
|
|
497
|
-
readonly color: string;
|
|
498
|
-
}>;
|
|
499
|
-
readonly locale?: string;
|
|
500
|
-
readonly copy?: CopyOverrides;
|
|
501
|
-
readonly theme?: ThemeOverrides;
|
|
502
|
-
readonly colorScheme?: ColorSchemeSetting;
|
|
503
|
-
}
|
|
504
|
-
declare function AskAboutRow(props: AskAboutRowProps): ReactNode;
|
|
505
|
-
|
|
506
|
-
declare const Avatar: react.NamedExoticComponent<{
|
|
507
|
-
readonly name: string;
|
|
508
|
-
readonly uri: string | null;
|
|
509
|
-
readonly person?: boolean;
|
|
510
|
-
}>;
|
|
511
|
-
|
|
512
|
-
interface ButtonProps {
|
|
513
|
-
readonly label: string;
|
|
514
|
-
readonly onPress: () => void;
|
|
515
|
-
readonly variant?: 'primary' | 'secondary' | 'text';
|
|
516
|
-
readonly disabled?: boolean;
|
|
517
|
-
readonly busy?: boolean;
|
|
518
|
-
/** A role other than a button: `radio` and `checkbox` for choices. */
|
|
519
|
-
readonly role?: 'button' | 'radio' | 'checkbox' | 'link';
|
|
520
|
-
readonly selected?: boolean;
|
|
521
|
-
readonly hint?: string;
|
|
522
|
-
readonly children?: ReactNode;
|
|
523
|
-
readonly testID?: string;
|
|
524
|
-
}
|
|
525
|
-
declare const Button: react.NamedExoticComponent<ButtonProps>;
|
|
526
|
-
|
|
527
|
-
declare function DefaultHeader(props: Omit<HeaderProps, 'Default'>): react.JSX.Element;
|
|
528
|
-
declare const ChatHeader: react.NamedExoticComponent<object>;
|
|
529
|
-
|
|
530
|
-
declare const ChatSkeleton: react.NamedExoticComponent<object>;
|
|
531
|
-
|
|
532
|
-
declare function DefaultComposer(props: Omit<ComposerProps, 'Default'>): react.JSX.Element;
|
|
533
|
-
declare const Composer: react.NamedExoticComponent<{
|
|
534
|
-
readonly onError?: (error: unknown) => void;
|
|
535
|
-
}>;
|
|
536
|
-
|
|
537
|
-
declare const DisclosureBar: react.NamedExoticComponent<object>;
|
|
538
|
-
|
|
539
|
-
/** The tenant's failure action as a button, or nothing when there is none. */
|
|
540
|
-
declare function FailureActionButton(props: {
|
|
541
|
-
readonly state: FailureState;
|
|
542
|
-
}): ReactNode;
|
|
543
|
-
|
|
544
|
-
declare function DefaultBubble(props: Omit<MessageBubbleProps, 'Default'>): react.JSX.Element;
|
|
545
|
-
declare const MessageBubble: react.NamedExoticComponent<{
|
|
546
|
-
readonly item: MessageItem;
|
|
547
|
-
/** The first of a run from the same author: its label is shown. */
|
|
548
|
-
readonly showAuthor: boolean;
|
|
549
|
-
}>;
|
|
550
|
-
/** The reply streaming now: the only cell that re-renders as the text arrives. */
|
|
551
|
-
declare const StreamingBubble: react.NamedExoticComponent<{
|
|
552
|
-
readonly item: MessageItem;
|
|
553
|
-
readonly showAuthor: boolean;
|
|
554
|
-
}>;
|
|
555
|
-
|
|
556
|
-
/** Rows of one kind recycle together. */
|
|
557
|
-
declare function itemType(item: TimelineItem): string;
|
|
558
|
-
/**
|
|
559
|
-
* Runs of two or more consecutive cards with one carousel group (`group.layout: carousel`, the same `group.id`): by
|
|
560
|
-
* the first card's key, and the keys of the cards the run draws after it. A run equal to the previous one is the
|
|
561
|
-
* same array, so its row does not render again.
|
|
562
|
-
*/
|
|
563
|
-
declare function carousels(items: readonly TimelineItem[], previous: ReadonlyMap<string, readonly CardItem[]>): {
|
|
564
|
-
runs: Map<string, readonly CardItem[]>;
|
|
565
|
-
inside: Set<string>;
|
|
566
|
-
};
|
|
567
|
-
declare const Row: react.NamedExoticComponent<{
|
|
568
|
-
readonly item: TimelineItem;
|
|
569
|
-
readonly showAuthor: boolean;
|
|
570
|
-
/** The carousel this card starts (`components.CardGroup`). */
|
|
571
|
-
readonly run?: readonly CardItem[] | undefined;
|
|
572
|
-
/** A card a carousel earlier in the list draws. */
|
|
573
|
-
readonly inside?: boolean;
|
|
574
|
-
}>;
|
|
575
|
-
declare const MessageList: react.NamedExoticComponent<object>;
|
|
576
|
-
|
|
577
|
-
declare const StatusBanner: react.NamedExoticComponent<object>;
|
|
578
|
-
/** The kit's own "Couldn't connect." banner: try again, and the tenant's failure action when there is one. */
|
|
579
|
-
declare function DefaultUnavailable(props: {
|
|
580
|
-
readonly state: FailureState;
|
|
581
|
-
}): ReactNode;
|
|
582
|
-
|
|
583
|
-
declare const SystemRow: react.NamedExoticComponent<{
|
|
584
|
-
readonly item: SystemItem;
|
|
585
|
-
}>;
|
|
586
|
-
/** The kit's own failed-turn row: "Something went wrong.", and the tenant's failure action when there is one. */
|
|
587
|
-
declare function DefaultTurnFailed(props: {
|
|
588
|
-
readonly state: FailureState;
|
|
589
|
-
}): ReactNode;
|
|
590
|
-
|
|
591
|
-
declare const Welcome: react.NamedExoticComponent<{
|
|
592
|
-
readonly welcome: Welcome$1;
|
|
593
|
-
readonly onChip: (message: string) => void;
|
|
594
|
-
}>;
|
|
595
|
-
|
|
596
|
-
/** The part of the conversation store the adapter drives. */
|
|
597
|
-
interface LifecycleTarget {
|
|
598
|
-
setForeground(foreground: boolean): void;
|
|
599
|
-
}
|
|
600
|
-
/** Tells the store when the app comes to the foreground or goes to the background (it pings only in the foreground). */
|
|
601
|
-
declare function useNativeLifecycle(store: LifecycleTarget): void;
|
|
602
|
-
/** Whether the person asked for reduced motion: animations and animated scrolling stay off. */
|
|
603
|
-
declare function useReducedMotion(): boolean;
|
|
604
|
-
/** Reads a line to a screen reader, without moving focus. */
|
|
605
|
-
declare function announce(text: string): void;
|
|
606
|
-
|
|
607
|
-
export { ActivityLine, AgentChat, type AgentChatProps, type AgentChatSlots, type AgentEndedProps, AgentFooter, type AgentFooterProps, AgentLauncher, type AgentLauncherProps, type AgentUnavailableScreenProps, type AgentUnreachableProps, AskAboutRow, type AskAboutRowProps, Avatar, Button, type ButtonProps, CardActions, CardCarousel, CardFrame, type CardGroupProps, type CardProps, CardView, type ChatHandlers, ChatHeader, ChatSkeleton, type ChatSlots, type Chip, type ColorSchemeSetting, Composer, type ComposerProps, DefaultBubble, DefaultComposer, DefaultEnded, DefaultHeader, DefaultTurnFailed, DefaultUnavailable, DefaultUnavailableScreen, DefaultUnreachable, DisclosureBar, type EmptyStateProps, type FailureAction, FailureActionButton, type FailureProps, type FailureState, type HeaderProps, type ImagePolicy, InfoCard, LAUNCHER_SIZE, type LauncherAppearance, LauncherButton, type LauncherButtonProps, type LauncherContext, LauncherEntrance, type LauncherEntranceProps, LauncherGreeting, type LauncherGreetingProps, type LauncherPlacement, type LifecycleTarget, LinksCard, type ListProps, ListingCard, MessageBubble, type MessageBubbleProps, MessageList, NextStepCard, ProposalCard, type ProposalDecision, QuestionCard, Row, StatusBanner, StreamingBubble, SystemRow, type Theme, type ThemeOverrides, ThemeProvider, TimeSlotsCard, VinaverseChat, type VinaverseChatProps, VinaverseChatProvider, Welcome, allowedImage, announce, answerText, carousels, createTheme, defaultCard, fieldText, itemType, monogram, newestWholeReply, ratingText, themeProblems, useChat, useKeyboardShown, useNativeLifecycle, useReducedMotion, useTheme };
|
|
2
|
+
export { ActivityLine, AgentChat, AgentChatProps, AgentChatSlots, AgentEndedProps, AgentFooter, AgentFooterProps, AgentUnavailableScreenProps, AgentUnreachableProps, Avatar, Button, ButtonProps, CardActions, CardCarousel, CardFrame, CardGroupProps, CardProps, CardView, ChatHandlers, ChatHeader, ChatSkeleton, ChatSlots, Chip, Composer, ComposerProps, DefaultBubble, DefaultComposer, DefaultEnded, DefaultHeader, DefaultTurnFailed, DefaultUnavailable, DefaultUnavailableScreen, DefaultUnreachable, DisclosureBar, EmptyStateProps, FailureAction, FailureActionButton, FailureProps, FailureState, HeaderProps, ImagePolicy, InfoCard, LifecycleTarget, LinksCard, ListProps, ListingCard, MessageBubble, MessageBubbleProps, MessageList, NextStepCard, ProposalCard, ProposalDecision, QuestionCard, Row, StatusBanner, StreamingBubble, SystemRow, TimeSlotsCard, VinaverseChat, VinaverseChatProps, VinaverseChatProvider, Welcome, allowedImage, announce, answerText, carousels, defaultCard, fieldText, itemType, monogram, newestWholeReply, ratingText, useChat, useNativeLifecycle, useReducedMotion } from './chat.cjs';
|
|
3
|
+
export { C as ColorSchemeSetting, T as Theme, a as ThemeOverrides, b as ThemeProvider, c as createTheme, t as themeProblems, u as useTheme } from './theme-BhiEGv64.cjs';
|
|
4
|
+
export { AgentLauncher, AgentLauncherProps, LAUNCHER_SIZE, LauncherAppearance, LauncherButton, LauncherButtonProps, LauncherContext, LauncherEntrance, LauncherEntranceProps, LauncherGreeting, LauncherGreetingProps, LauncherPlacement, useKeyboardShown } from './launcher.cjs';
|
|
5
|
+
export { AskAboutRow, AskAboutRowProps } from './ask.cjs';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@vinaverse/client/conversation';
|
|
8
|
+
import '@vinaverse/client/agent';
|
|
9
|
+
import 'react-native';
|
|
10
|
+
import '@vinaverse/react';
|
|
11
|
+
import '@vinaverse/tokens';
|