@vinaverse/react-native 0.1.0-alpha.10 → 0.1.0-alpha.12

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.
@@ -1,14 +1,12 @@
1
- import { useTheme, useReducedMotion, announce, useNativeLifecycle, themeProblems, ThemeProvider, useAgentSweep } from './chunk-EFEXTVIT.js';
2
- import { useAgentRuntime, useAgentConversation, useAgentName } from '@vinaverse/react/agent';
3
- export { AgentRuntimeProvider, forgetGreeting, greetedKey, useAgentConversation, useAgentFeatures, useAgentLauncher, useAgentName, useAgentProfile, useAgentRuntime, useAgentStatus, useAgentStatusState } from '@vinaverse/react/agent';
4
- import { FlashList } from '@shopify/flash-list';
5
- import { useCopy, formatMoney, formatTimeRange, formatDayTime, useConversationSelector, formatDate, useStreamingText, bannedWordsIn, CopyProvider } from '@vinaverse/react';
6
- import { Pressable, ActivityIndicator, Text, View, Image, Linking, TextInput, useWindowDimensions, Platform, KeyboardAvoidingView } from 'react-native';
1
+ import { useTheme, useReducedMotion, announce } from './chunk-EFEXTVIT.js';
2
+ import { useContext, memo, useState, useMemo, useRef, useCallback, useEffect, createContext } from 'react';
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+ import { Pressable, ActivityIndicator, Text, View, Image, Linking, TextInput, useWindowDimensions } from 'react-native';
5
+ import { useCopy, formatMoney, formatTimeRange, formatDayTime, useConversationSelector, formatDate, useStreamingText } from '@vinaverse/react';
6
+ import { answerProblem, codePoints } from '@vinaverse/client/conversation';
7
7
  import { readCard } from '@vinaverse/client/agent';
8
- import { useContext, memo, useState, useMemo, useCallback, useRef, useEffect, createContext } from 'react';
9
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
10
- import { answerProblem, codePoints, MAX_TEXT } from '@vinaverse/client/conversation';
11
- import { motion, contrastRatio, colors, size } from '@vinaverse/tokens';
8
+ import { FlashList } from '@shopify/flash-list';
9
+ import { contrastRatio, colors, size } from '@vinaverse/tokens';
12
10
 
13
11
  var ChatContext = /* @__PURE__ */ createContext(
14
12
  null
@@ -1497,106 +1495,6 @@ var ChatHeader = /* @__PURE__ */ memo(function ChatHeader2() {
1497
1495
  };
1498
1496
  return Header ? /* @__PURE__ */ jsx(Header, { ...props, Default: DefaultHeader }) : /* @__PURE__ */ jsx(DefaultHeader, { ...props });
1499
1497
  });
1500
- function DefaultComposer(props) {
1501
- const { t, direction } = useCopy();
1502
- const { colors, radius, space, font, size: size2 } = useTheme();
1503
- const [text, setText] = useState("");
1504
- const length = codePoints(text);
1505
- const canSend = text.trim().length > 0 && length <= MAX_TEXT;
1506
- const send = () => {
1507
- if (!canSend) return;
1508
- props.onSend(text);
1509
- setText("");
1510
- };
1511
- return /* @__PURE__ */ jsxs(
1512
- View,
1513
- {
1514
- style: {
1515
- flexDirection: "row",
1516
- alignItems: "flex-end",
1517
- gap: space.sm,
1518
- paddingHorizontal: space.lg,
1519
- paddingVertical: space.sm,
1520
- borderTopWidth: 1,
1521
- borderTopColor: colors.divider,
1522
- backgroundColor: colors.background
1523
- },
1524
- children: [
1525
- /* @__PURE__ */ jsx(
1526
- TextInput,
1527
- {
1528
- value: text,
1529
- onChangeText: setText,
1530
- placeholder: props.placeholder,
1531
- placeholderTextColor: colors.textMuted,
1532
- accessibilityLabel: props.placeholder,
1533
- multiline: true,
1534
- maxLength: MAX_TEXT * 2,
1535
- testID: "vinaverse-composer-input",
1536
- style: {
1537
- flex: 1,
1538
- minHeight: size2.touchTarget,
1539
- maxHeight: 140,
1540
- paddingHorizontal: space.md,
1541
- paddingVertical: space.sm,
1542
- borderRadius: radius.lg,
1543
- borderWidth: 1,
1544
- borderColor: colors.border,
1545
- color: colors.text,
1546
- backgroundColor: colors.surface,
1547
- fontSize: font.size.md,
1548
- textAlign: direction === "rtl" ? "right" : "left",
1549
- writingDirection: direction,
1550
- ...font.family ? { fontFamily: font.family } : {}
1551
- }
1552
- }
1553
- ),
1554
- props.responding && !text ? /* @__PURE__ */ jsx(
1555
- Button,
1556
- {
1557
- label: t("stop"),
1558
- onPress: props.onStop,
1559
- testID: "vinaverse-stop"
1560
- }
1561
- ) : /* @__PURE__ */ jsx(
1562
- Button,
1563
- {
1564
- label: t("send"),
1565
- variant: "primary",
1566
- disabled: !canSend,
1567
- onPress: send,
1568
- testID: "vinaverse-send"
1569
- }
1570
- )
1571
- ]
1572
- }
1573
- );
1574
- }
1575
- var Composer = /* @__PURE__ */ memo(function Composer2(props) {
1576
- const { store, slots } = useChat();
1577
- const { t } = useCopy();
1578
- const takeover = useConversationSelector(store, (v) => v.takeover);
1579
- const name = useConversationSelector(store, (v) => v.agent.name);
1580
- const responding = useConversationSelector(store, (v) => v.responding);
1581
- const { onError } = props;
1582
- const onSend = useCallback(
1583
- (text) => {
1584
- try {
1585
- store.send(text);
1586
- } catch (error) {
1587
- onError?.(error);
1588
- }
1589
- },
1590
- [store, onError]
1591
- );
1592
- const onStop = useCallback(() => store.cancel(), [store]);
1593
- const placeholder = takeover ? t("composerPlaceholderTakeover", {
1594
- by: takeover.by || t("staffFallbackRole")
1595
- }) : t("composerPlaceholder", { agent: name ?? t("agentFallbackName") });
1596
- const Slot = slots.Composer;
1597
- const own = { placeholder, responding, onSend, onStop };
1598
- return Slot ? /* @__PURE__ */ jsx(Slot, { ...own, Default: DefaultComposer }) : /* @__PURE__ */ jsx(DefaultComposer, { ...own });
1599
- });
1600
1498
  var DisclosureBar = /* @__PURE__ */ memo(function DisclosureBar2() {
1601
1499
  const { store } = useChat();
1602
1500
  const { t } = useCopy();
@@ -1728,7 +1626,7 @@ function Frame(props) {
1728
1626
  const { colors, space, font } = useTheme();
1729
1627
  const author = useAuthor(item);
1730
1628
  const mine = item.role === "person";
1731
- const status = item.state === "sending" ? t("messageSending") : item.state === "held" ? t("messageHeld") : item.state === "not_sent" ? item.rejection?.message || t("messageNotSent") : item.state === "delivered" ? t("messageDelivered") : item.partial ? t("messageCutOff") : null;
1629
+ const status = item.state === "sending" ? t("messageSending") : item.state === "held" ? t("messageHeld") : item.state === "not_sent" ? item.rejection?.message || t("messageNotSent") : item.state === "delivered" ? t("messageDelivered") : item.partial ? t("messageCutOff") : item.refusal && mine ? t("messageRefused") : null;
1732
1630
  const Bubble = slots.MessageBubble;
1733
1631
  const bubble = Bubble ? /* @__PURE__ */ jsx(Bubble, { item, text, Default: DefaultBubble }) : /* @__PURE__ */ jsx(DefaultBubble, { item, text });
1734
1632
  return /* @__PURE__ */ jsxs(
@@ -1741,7 +1639,7 @@ function Frame(props) {
1741
1639
  maxWidth: "85%",
1742
1640
  marginHorizontal: space.lg,
1743
1641
  marginTop: props.showAuthor ? space.md : space.xs,
1744
- opacity: item.state === "sending" || item.state === "held" ? 0.75 : 1
1642
+ opacity: item.state === "sending" || item.state === "held" || item.refusal ? 0.75 : 1
1745
1643
  },
1746
1644
  children: [
1747
1645
  props.showAuthor && !mine ? /* @__PURE__ */ jsx(
@@ -2092,516 +1990,7 @@ function useAnnounceReplies(items) {
2092
1990
  (handlers.current?.announce ?? announce)(`${author}: ${last.text}`);
2093
1991
  }, [items, t, store, handlers]);
2094
1992
  }
2095
- var CONNECTING_DELAY = motion.bannerDelay;
2096
- var StatusBanner = /* @__PURE__ */ memo(function StatusBanner2() {
2097
- const { store, slots } = useChat();
2098
- const { t } = useCopy();
2099
- const banner = useConversationSelector(store, (v) => v.banner);
2100
- const status = useConversationSelector(store, (v) => v.status);
2101
- const conversationId = useConversationSelector(
2102
- store,
2103
- (v) => v.conversationId
2104
- );
2105
- const unavailable = useMemo(
2106
- () => ({
2107
- kind: "unavailable",
2108
- reason: status,
2109
- retry: () => store.start(),
2110
- conversationId
2111
- }),
2112
- [store, status, conversationId]
2113
- );
2114
- const [late, setLate] = useState(false);
2115
- useEffect(() => {
2116
- setLate(false);
2117
- if (banner !== "connecting") return;
2118
- const timer = setTimeout(() => setLate(true), CONNECTING_DELAY);
2119
- return () => clearTimeout(timer);
2120
- }, [banner]);
2121
- if (banner === null || banner === "connecting" && !late) return null;
2122
- if (banner === "unavailable")
2123
- return /* @__PURE__ */ jsx(
2124
- FailureSlot,
2125
- {
2126
- slot: slots.Unavailable,
2127
- state: unavailable,
2128
- Default: DefaultUnavailable
2129
- }
2130
- );
2131
- const text = {
2132
- connecting: t("bannerConnecting"),
2133
- reconnecting: t("bannerReconnecting"),
2134
- offline: t("bannerOffline"),
2135
- continued_elsewhere: t("bannerContinuedElsewhere")
2136
- }[banner];
2137
- const action = banner === "continued_elsewhere" ? /* @__PURE__ */ jsx(
2138
- Button,
2139
- {
2140
- label: t("continueHere"),
2141
- variant: "text",
2142
- onPress: () => void store.continueHere()
2143
- }
2144
- ) : banner === "offline" ? /* @__PURE__ */ jsx(
2145
- Button,
2146
- {
2147
- label: t("tryAgain"),
2148
- variant: "text",
2149
- onPress: () => store.start()
2150
- }
2151
- ) : null;
2152
- return /* @__PURE__ */ jsx(Banner, { text, children: action });
2153
- });
2154
- function DefaultUnavailable(props) {
2155
- const { t } = useCopy();
2156
- const { retry } = props.state;
2157
- return /* @__PURE__ */ jsxs(Banner, { text: t("bannerUnavailable"), children: [
2158
- retry ? /* @__PURE__ */ jsx(Button, { label: t("tryAgain"), variant: "text", onPress: retry }) : null,
2159
- /* @__PURE__ */ jsx(FailureActionButton, { state: props.state })
2160
- ] });
2161
- }
2162
- function Banner(props) {
2163
- const { colors, space, font } = useTheme();
2164
- return /* @__PURE__ */ jsxs(
2165
- View,
2166
- {
2167
- accessibilityLiveRegion: "polite",
2168
- accessibilityRole: "alert",
2169
- style: {
2170
- flexDirection: "row",
2171
- alignItems: "center",
2172
- justifyContent: "space-between",
2173
- gap: space.sm,
2174
- paddingHorizontal: space.lg,
2175
- paddingVertical: space.xs,
2176
- backgroundColor: colors.surface,
2177
- borderBottomWidth: 1,
2178
- borderBottomColor: colors.divider
2179
- },
2180
- children: [
2181
- /* @__PURE__ */ jsx(
2182
- Text,
2183
- {
2184
- style: { color: colors.text, fontSize: font.size.sm, flexShrink: 1 },
2185
- children: props.text
2186
- }
2187
- ),
2188
- props.children
2189
- ]
2190
- }
2191
- );
2192
- }
2193
- function VinaverseChatProvider(props) {
2194
- const {
2195
- conversation,
2196
- components,
2197
- agentAvatar,
2198
- timeZone,
2199
- starters,
2200
- imagePolicy
2201
- } = props;
2202
- const handlers = useRef(props);
2203
- handlers.current = props;
2204
- const slots = useStableSlots(components);
2205
- const hasAction = props.failureAction !== void 0;
2206
- const actionLabel = props.failureAction?.label;
2207
- const failureAction = useMemo(
2208
- () => hasAction ? { label: actionLabel } : null,
2209
- [hasAction, actionLabel]
2210
- );
2211
- const value = useMemo(
2212
- () => ({
2213
- store: conversation,
2214
- handlers,
2215
- slots,
2216
- agentAvatar,
2217
- timeZone,
2218
- failureAction,
2219
- starters,
2220
- imagePolicy
2221
- }),
2222
- [
2223
- conversation,
2224
- slots,
2225
- agentAvatar,
2226
- timeZone,
2227
- failureAction,
2228
- starters,
2229
- imagePolicy
2230
- ]
2231
- );
2232
- useNativeLifecycle(conversation);
2233
- useEffect(() => {
2234
- conversation.start();
2235
- }, [conversation]);
2236
- const { onWarning, theme, copy } = props;
2237
- useEffect(() => {
2238
- if (!onWarning) return;
2239
- for (const problem of themeProblems(theme))
2240
- onWarning(`Vinaverse theme: ${problem}`, { code: "theme" });
2241
- for (const key of bannedWordsIn(copy ?? {}))
2242
- onWarning(
2243
- `Vinaverse copy: "${key}" says assistant, bot or crew; the copy says agent.`,
2244
- { code: "copy" }
2245
- );
2246
- }, [onWarning, theme, copy]);
2247
- return /* @__PURE__ */ jsx(CopyProvider, { locale: props.locale, copy: props.copy, children: /* @__PURE__ */ jsx(ThemeProvider, { theme: props.theme, colorScheme: props.colorScheme, children: /* @__PURE__ */ jsx(ChatContextProvider, { value, children: props.children }) }) });
2248
- }
2249
- function VinaverseChat(props) {
2250
- return /* @__PURE__ */ jsx(VinaverseChatProvider, { ...props, children: /* @__PURE__ */ jsx(
2251
- Layout,
2252
- {
2253
- hideHeader: props.hideHeader === true,
2254
- keyboardVerticalOffset: props.keyboardVerticalOffset ?? 0,
2255
- keyboardBehavior: props.keyboardBehavior ?? (Platform.OS === "ios" ? "padding" : "none"),
2256
- style: props.style,
2257
- onError: props.onWarning,
2258
- suggestion: props.suggestion ?? null,
2259
- suggestionTestID: props.suggestionTestID ?? "vinaverse-suggestion",
2260
- footer: props.footer
2261
- }
2262
- ) });
2263
- }
2264
- function Layout(props) {
2265
- const { colors } = useTheme();
2266
- const { direction } = useCopy();
2267
- const { onError } = props;
2268
- const reportError = useMemo(
2269
- () => onError ? (e) => onError(String(e), { code: "send_failed" }) : void 0,
2270
- [onError]
2271
- );
2272
- return /* @__PURE__ */ jsxs(
2273
- KeyboardAvoidingView,
2274
- {
2275
- ...props.keyboardBehavior === "none" ? { enabled: false } : { behavior: props.keyboardBehavior },
2276
- keyboardVerticalOffset: props.keyboardVerticalOffset,
2277
- style: [
2278
- { flex: 1, backgroundColor: colors.background, direction },
2279
- props.style
2280
- ],
2281
- children: [
2282
- props.hideHeader ? null : /* @__PURE__ */ jsx(ChatHeader, {}),
2283
- /* @__PURE__ */ jsx(DisclosureBar, {}),
2284
- /* @__PURE__ */ jsx(StatusBanner, {}),
2285
- /* @__PURE__ */ jsx(View, { style: { flex: 1 }, children: /* @__PURE__ */ jsx(MessageList, {}) }),
2286
- props.suggestion ? /* @__PURE__ */ jsx(Suggestion, { chip: props.suggestion, testID: props.suggestionTestID }) : null,
2287
- /* @__PURE__ */ jsx(Composer, { ...reportError ? { onError: reportError } : {} }),
2288
- props.footer
2289
- ]
2290
- }
2291
- );
2292
- }
2293
- function Suggestion(props) {
2294
- const { store, handlers } = useChat();
2295
- const { space } = useTheme();
2296
- return /* @__PURE__ */ jsx(View, { style: { paddingHorizontal: space.lg, alignItems: "flex-start" }, children: /* @__PURE__ */ jsx(
2297
- Button,
2298
- {
2299
- label: props.chip.label,
2300
- testID: props.testID,
2301
- onPress: () => {
2302
- store.send(props.chip.message);
2303
- handlers.current?.onChip?.(props.chip);
2304
- }
2305
- }
2306
- ) });
2307
- }
2308
- function useStableSlots(slots) {
2309
- const held = useRef({});
2310
- const next = slots ?? {};
2311
- if (!sameSlots(held.current, next)) held.current = next;
2312
- return held.current;
2313
- }
2314
- function sameSlots(a, b) {
2315
- const keys = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]);
2316
- for (const key of keys) {
2317
- if (key === "cards") {
2318
- const ca = a.cards ?? {};
2319
- const cb = b.cards ?? {};
2320
- const kinds = /* @__PURE__ */ new Set([...Object.keys(ca), ...Object.keys(cb)]);
2321
- for (const kind of kinds) if (ca[kind] !== cb[kind]) return false;
2322
- } else if (a[key] !== b[key]) return false;
2323
- }
2324
- return true;
2325
- }
2326
- function AgentChat(props) {
2327
- const {
2328
- agentKey,
2329
- place,
2330
- entryPoint,
2331
- askAbout,
2332
- onContact,
2333
- onOpenPrivacy,
2334
- components,
2335
- agentName,
2336
- opener,
2337
- openerTestID,
2338
- ...chat
2339
- } = props;
2340
- const runtime = useAgentRuntime();
2341
- useAgentSweep(runtime);
2342
- const { conversation, state, startNew } = useAgentConversation(agentKey, {
2343
- place: place ?? null,
2344
- entryPoint: entryPoint ?? null
2345
- });
2346
- const store = conversation.store;
2347
- const spoke = useConversationSelector(
2348
- store,
2349
- (v) => v.items.some((i) => i.type === "message" && i.role === "person")
2350
- );
2351
- const { Ended, Unreachable, UnavailableScreen, Footer, ...slots } = components ?? {};
2352
- const copy = useMemo(
2353
- () => agentName ? { ...props.copy, agentFallbackName: agentName } : props.copy,
2354
- [agentName, props.copy]
2355
- );
2356
- const events = {
2357
- onOpenTarget: chat.onOpenTarget ? (target, card) => {
2358
- runtime.emit({
2359
- type: "target_opened",
2360
- key: conversation.key,
2361
- cardId: card.id,
2362
- kind: target.type
2363
- });
2364
- chat.onOpenTarget?.(target, card);
2365
- } : void 0,
2366
- onOpenLink: chat.onOpenLink ? (link, card) => {
2367
- runtime.emit({
2368
- type: "link_opened",
2369
- key: conversation.key,
2370
- cardId: card.id,
2371
- kind: card.kind
2372
- });
2373
- chat.onOpenLink?.(link, card);
2374
- } : void 0,
2375
- onChip: (chip) => {
2376
- runtime.emit({ type: "chip_tapped", key: conversation.key });
2377
- chat.onChip?.(chip);
2378
- }
2379
- };
2380
- const shared = {
2381
- ...chat,
2382
- ...events.onOpenTarget ? { onOpenTarget: events.onOpenTarget } : {},
2383
- ...events.onOpenLink ? { onOpenLink: events.onOpenLink } : {},
2384
- onChip: events.onChip,
2385
- ...copy ? { copy } : {},
2386
- ...onContact && !chat.failureAction ? { failureAction: { onPress: () => onContact() } } : {},
2387
- conversation: store,
2388
- components: slots
2389
- };
2390
- if (state.failure === "ended") {
2391
- const own = {
2392
- onStartNew: startNew,
2393
- reason: state.reason,
2394
- code: state.code,
2395
- onContact
2396
- };
2397
- return /* @__PURE__ */ jsx(VinaverseChatProvider, { ...shared, children: /* @__PURE__ */ jsx(Centered, { children: Ended ? /* @__PURE__ */ jsx(Ended, { ...own, Default: DefaultEnded }) : /* @__PURE__ */ jsx(DefaultEnded, { ...own }) }) });
2398
- }
2399
- if (state.failure === "unreachable") {
2400
- const own = {
2401
- onRetry: conversation.retry,
2402
- reason: state.reason,
2403
- onContact
2404
- };
2405
- return /* @__PURE__ */ jsx(VinaverseChatProvider, { ...shared, children: /* @__PURE__ */ jsx(Centered, { children: Unreachable ? /* @__PURE__ */ jsx(Unreachable, { ...own, Default: DefaultUnreachable }) : /* @__PURE__ */ jsx(DefaultUnreachable, { ...own }) }) });
2406
- }
2407
- if (state.failure === "unavailable") {
2408
- const own = {
2409
- reason: state.reason,
2410
- code: state.code,
2411
- onContact,
2412
- onRetry: conversation.retry
2413
- };
2414
- return /* @__PURE__ */ jsx(VinaverseChatProvider, { ...shared, children: /* @__PURE__ */ jsx(Centered, { children: UnavailableScreen ? /* @__PURE__ */ jsx(UnavailableScreen, { ...own, Default: DefaultUnavailableScreen }) : /* @__PURE__ */ jsx(DefaultUnavailableScreen, { ...own }) }) });
2415
- }
2416
- const offered = opener && !spoke ? opener : null;
2417
- return /* @__PURE__ */ jsx(
2418
- VinaverseChat,
2419
- {
2420
- ...shared,
2421
- suggestion: offered ?? (state.moved && askAbout ? { label: askAbout, message: askAbout } : null),
2422
- ...offered ? { suggestionTestID: openerTestID ?? "vinaverse-opener" } : {},
2423
- footer: Footer === null ? null : /* @__PURE__ */ jsx(
2424
- FooterFor,
2425
- {
2426
- store,
2427
- state,
2428
- rate: conversation.rate,
2429
- canRate: conversation.canRate,
2430
- Footer,
2431
- onOpenPrivacy
2432
- }
2433
- )
2434
- }
2435
- );
2436
- }
2437
- function FooterFor(props) {
2438
- const newest = useConversationSelector(props.store, newestWholeReply);
2439
- const turnId = newest && props.canRate(newest) ? newest : null;
2440
- const own = {
2441
- turnId,
2442
- rating: turnId ? props.state.ratings.get(turnId) : void 0,
2443
- onRate: (rating) => {
2444
- if (turnId) props.rate(turnId, rating);
2445
- },
2446
- onOpenPrivacy: props.onOpenPrivacy
2447
- };
2448
- const { Footer } = props;
2449
- return Footer ? /* @__PURE__ */ jsx(Footer, { ...own, Default: AgentFooter }) : /* @__PURE__ */ jsx(AgentFooter, { ...own });
2450
- }
2451
- function newestWholeReply(view) {
2452
- for (let i = view.items.length - 1; i >= 0; i--) {
2453
- const item = view.items[i];
2454
- if (item?.type !== "message" || item.role !== "agent") continue;
2455
- const whole = item.state === "sent" && !item.partial && !item.refusal && item.key.startsWith("a:");
2456
- return whole ? item.key.slice(2) : null;
2457
- }
2458
- return null;
2459
- }
2460
- function Centered(props) {
2461
- const { colors, space } = useTheme();
2462
- return /* @__PURE__ */ jsx(
2463
- View,
2464
- {
2465
- style: {
2466
- flex: 1,
2467
- alignItems: "center",
2468
- justifyContent: "center",
2469
- padding: space.xl,
2470
- backgroundColor: colors.background
2471
- },
2472
- children: props.children
2473
- }
2474
- );
2475
- }
2476
- function Notice(props) {
2477
- const { colors, space, font } = useTheme();
2478
- return /* @__PURE__ */ jsxs(
2479
- View,
2480
- {
2481
- accessibilityRole: "alert",
2482
- style: { alignItems: "center", gap: space.md },
2483
- children: [
2484
- /* @__PURE__ */ jsx(
2485
- Text,
2486
- {
2487
- style: {
2488
- color: colors.text,
2489
- fontSize: font.size.lg,
2490
- fontWeight: "600",
2491
- textAlign: "center"
2492
- },
2493
- children: props.title
2494
- }
2495
- ),
2496
- /* @__PURE__ */ jsx(
2497
- Text,
2498
- {
2499
- style: {
2500
- color: colors.textMuted,
2501
- fontSize: font.size.md,
2502
- textAlign: "center"
2503
- },
2504
- children: props.body
2505
- }
2506
- ),
2507
- props.action && props.onPress ? /* @__PURE__ */ jsx(
2508
- Button,
2509
- {
2510
- label: props.action,
2511
- variant: "primary",
2512
- onPress: props.onPress
2513
- }
2514
- ) : null
2515
- ]
2516
- }
2517
- );
2518
- }
2519
- function DefaultEnded(props) {
2520
- const { t } = useCopy();
2521
- return /* @__PURE__ */ jsx(
2522
- Notice,
2523
- {
2524
- title: t("agentEnded"),
2525
- body: t("agentEndedBody"),
2526
- action: t("agentStartOver"),
2527
- onPress: props.onStartNew
2528
- }
2529
- );
2530
- }
2531
- function DefaultUnavailableScreen(props) {
2532
- const { t } = useCopy();
2533
- const name = useAgentName(t("agentFallbackName"));
2534
- const title = t("agentOff", { agent: name });
2535
- return /* @__PURE__ */ jsx(
2536
- Notice,
2537
- {
2538
- title: title.charAt(0).toUpperCase() + title.slice(1),
2539
- body: t("agentOffBody"),
2540
- ...props.onContact ? { action: t("talkToPerson"), onPress: props.onContact } : {}
2541
- }
2542
- );
2543
- }
2544
- function DefaultUnreachable(props) {
2545
- const { t } = useCopy();
2546
- const name = useAgentName(t("agentFallbackName"));
2547
- return /* @__PURE__ */ jsx(
2548
- Notice,
2549
- {
2550
- title: t("agentUnreachable", { agent: name }),
2551
- body: t("agentUnreachableBody"),
2552
- action: t("tryAgain"),
2553
- onPress: props.onRetry
2554
- }
2555
- );
2556
- }
2557
- function AgentFooter(props) {
2558
- const { t } = useCopy();
2559
- const { colors, space, font } = useTheme();
2560
- const muted = { color: colors.textMuted, fontSize: font.size.sm };
2561
- return /* @__PURE__ */ jsxs(
2562
- View,
2563
- {
2564
- style: {
2565
- flexDirection: "row",
2566
- flexWrap: "wrap",
2567
- alignItems: "center",
2568
- gap: space.xs,
2569
- paddingHorizontal: space.lg
2570
- },
2571
- children: [
2572
- props.turnId === null ? null : props.rating ? /* @__PURE__ */ jsx(Text, { style: muted, children: t("helpfulThanks") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2573
- /* @__PURE__ */ jsx(Text, { style: muted, children: t("helpful") }),
2574
- /* @__PURE__ */ jsx(
2575
- Button,
2576
- {
2577
- label: t("helpfulYes"),
2578
- variant: "text",
2579
- onPress: () => props.onRate("up")
2580
- }
2581
- ),
2582
- /* @__PURE__ */ jsx(
2583
- Button,
2584
- {
2585
- label: t("helpfulNo"),
2586
- variant: "text",
2587
- onPress: () => props.onRate("down")
2588
- }
2589
- )
2590
- ] }),
2591
- props.onOpenPrivacy ? /* @__PURE__ */ jsx(
2592
- Button,
2593
- {
2594
- label: t("privacy"),
2595
- variant: "text",
2596
- role: "link",
2597
- onPress: props.onOpenPrivacy
2598
- }
2599
- ) : null
2600
- ]
2601
- }
2602
- );
2603
- }
2604
1993
 
2605
- export { ActivityLine, AgentChat, AgentFooter, Avatar, Button, CardActions, CardCarousel, CardFrame, CardView, ChatHeader, ChatSkeleton, Composer, DefaultBubble, DefaultComposer, DefaultEnded, DefaultHeader, DefaultTurnFailed, DefaultUnavailable, DefaultUnavailableScreen, DefaultUnreachable, DisclosureBar, FailureActionButton, InfoCard, LinksCard, ListingCard, MessageBubble, MessageList, NextStepCard, ProposalCard, QuestionCard, Row, StatusBanner, StreamingBubble, SystemRow, TimeSlotsCard, VinaverseChat, VinaverseChatProvider, Welcome, allowedImage, answerText, carousels, defaultCard, fieldText, itemType, monogram, newestWholeReply, ratingText, useChat };
2606
- //# sourceMappingURL=chunk-43I4ZAEK.js.map
2607
- //# sourceMappingURL=chunk-43I4ZAEK.js.map
1994
+ export { ActivityLine, Avatar, Button, CardActions, CardCarousel, CardFrame, CardView, ChatContextProvider, ChatHeader, ChatSkeleton, DefaultBubble, DefaultHeader, DefaultTurnFailed, DisclosureBar, FailureActionButton, FailureSlot, InfoCard, LinksCard, ListingCard, MessageBubble, MessageList, NextStepCard, ProposalCard, QuestionCard, Row, StreamingBubble, SystemRow, TimeSlotsCard, Welcome, allowedImage, answerText, carousels, defaultCard, fieldText, itemType, monogram, ratingText, useChat };
1995
+ //# sourceMappingURL=chunk-KSHDF3MG.js.map
1996
+ //# sourceMappingURL=chunk-KSHDF3MG.js.map