@vinaverse/react-native 0.1.0-alpha.10 → 0.1.0-alpha.11
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 +25 -1
- package/dist/chat.cjs +118 -117
- package/dist/chat.d.cts +7 -205
- package/dist/chat.d.ts +7 -205
- package/dist/chat.js +2 -1
- package/dist/chunk-2J2LIJLW.js +624 -0
- package/dist/chunk-2J2LIJLW.js.map +1 -0
- package/dist/chunk-4PXQ7DEY.cjs +680 -0
- package/dist/chunk-4PXQ7DEY.cjs.map +1 -0
- package/dist/{chunk-43I4ZAEK.js → chunk-KSHDF3MG.js} +13 -624
- package/dist/chunk-KSHDF3MG.js.map +1 -0
- package/dist/{chunk-NRYNK7E4.cjs → chunk-XAG2P447.cjs} +11 -675
- package/dist/chunk-XAG2P447.cjs.map +1 -0
- package/dist/context-gHCLFsJh.d.cts +212 -0
- package/dist/context-gHCLFsJh.d.ts +212 -0
- package/dist/history.cjs +673 -0
- package/dist/history.cjs.map +1 -0
- package/dist/history.d.cts +177 -0
- package/dist/history.d.ts +177 -0
- package/dist/history.js +618 -0
- package/dist/history.js.map +1 -0
- package/dist/index.cjs +133 -132
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/package.json +79 -10
- package/dist/chunk-43I4ZAEK.js.map +0 -1
- package/dist/chunk-NRYNK7E4.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Composer.tsx","../src/components/StatusBanner.tsx","../src/components/VinaverseChat.tsx","../src/components/AgentChat.tsx"],"names":["useCopy","useTheme","useState","codePoints","MAX_TEXT","jsxs","View","jsx","TextInput","Button","memo","Composer","useChat","useConversationSelector","useCallback","motion","StatusBanner","useMemo","useEffect","FailureSlot","FailureActionButton","Text","useRef","useNativeLifecycle","themeProblems","bannedWordsIn","CopyProvider","ThemeProvider","ChatContextProvider","Platform","KeyboardAvoidingView","ChatHeader","DisclosureBar","MessageList","useAgentRuntime","useAgentSweep","useAgentConversation","useAgentName","Fragment"],"mappings":";;;;;;;;;;;;AAYO,SAAS,gBAAgB,KAAA,EAAuC;AACrE,EAAA,MAAM,EAAE,CAAA,EAAG,SAAA,EAAU,GAAIA,aAAA,EAAQ;AACjC,EAAA,MAAM,EAAE,MAAA,EAAQ,MAAA,EAAQ,OAAO,IAAA,EAAM,IAAA,KAASC,0BAAA,EAAS;AACvD,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAIC,iBAAS,EAAE,CAAA;AACnC,EAAA,MAAM,MAAA,GAASC,wBAAW,IAAI,CAAA;AAC9B,EAAA,MAAM,UAAU,IAAA,CAAK,IAAA,EAAK,CAAE,MAAA,GAAS,KAAK,MAAA,IAAUC,qBAAA;AACpD,EAAA,MAAM,OAAO,MAAM;AACjB,IAAA,IAAI,CAAC,OAAA,EAAS;AACd,IAAA,KAAA,CAAM,OAAO,IAAI,CAAA;AACjB,IAAA,OAAA,CAAQ,EAAE,CAAA;AAAA,EACZ,CAAA;AACA,EAAA,uBACEC,eAAA;AAAA,IAACC,gBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO;AAAA,QACL,aAAA,EAAe,KAAA;AAAA,QACf,UAAA,EAAY,UAAA;AAAA,QACZ,KAAK,KAAA,CAAM,EAAA;AAAA,QACX,mBAAmB,KAAA,CAAM,EAAA;AAAA,QACzB,iBAAiB,KAAA,CAAM,EAAA;AAAA,QACvB,cAAA,EAAgB,CAAA;AAAA,QAChB,gBAAgB,MAAA,CAAO,OAAA;AAAA,QACvB,iBAAiB,MAAA,CAAO;AAAA,OAC1B;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAAC,cAAA;AAAA,UAACC,qBAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO,IAAA;AAAA,YACP,YAAA,EAAc,OAAA;AAAA,YACd,aAAa,KAAA,CAAM,WAAA;AAAA,YACnB,sBAAsB,MAAA,CAAO,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E,wBAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO,EAAE,SAAS,CAAA;AAAA,YAClB,OAAA,EAAQ,MAAA;AAAA,YACR,IAAA,EAAK,MAAA;AAAA,YACL,SAAS,KAAA,CAAM;AAAA;AAAA,SACjB,GACE;AAAA;AAAA;AAAA,GACN;AAEJ","file":"chunk-4PXQ7DEY.cjs","sourcesContent":["// Where the person types. Its text is its own state, so typing renders nothing else. Enabled from the first frame:\n// a message typed before the session is ready is held and sent once it is. Stop replaces Send while the agent\n// replies and nothing is typed.\nimport { codePoints, MAX_TEXT } from '@vinaverse/client/conversation';\nimport { useConversationSelector, useCopy } from '@vinaverse/react';\nimport { memo, useCallback, useState } from 'react';\nimport { TextInput, View } from 'react-native';\nimport { useChat } from '../context.js';\nimport { useTheme } from '../theme.js';\nimport { Button } from './Button.js';\nimport type { ComposerProps } from './types.js';\n\nexport function DefaultComposer(props: Omit<ComposerProps, 'Default'>) {\n const { t, direction } = useCopy();\n const { colors, radius, space, font, size } = useTheme();\n const [text, setText] = useState('');\n const length = codePoints(text);\n const canSend = text.trim().length > 0 && length <= MAX_TEXT;\n const send = () => {\n if (!canSend) return;\n props.onSend(text);\n setText('');\n };\n return (\n <View\n style={{\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap: space.sm,\n paddingHorizontal: space.lg,\n paddingVertical: space.sm,\n borderTopWidth: 1,\n borderTopColor: colors.divider,\n backgroundColor: colors.background,\n }}\n >\n <TextInput\n value={text}\n onChangeText={setText}\n placeholder={props.placeholder}\n placeholderTextColor={colors.textMuted}\n accessibilityLabel={props.placeholder}\n multiline\n maxLength={MAX_TEXT * 2}\n testID=\"vinaverse-composer-input\"\n style={{\n flex: 1,\n minHeight: size.touchTarget,\n maxHeight: 140,\n paddingHorizontal: space.md,\n paddingVertical: space.sm,\n borderRadius: radius.lg,\n borderWidth: 1,\n borderColor: colors.border,\n color: colors.text,\n backgroundColor: colors.surface,\n fontSize: font.size.md,\n textAlign: direction === 'rtl' ? 'right' : 'left',\n writingDirection: direction,\n ...(font.family ? { fontFamily: font.family } : {}),\n }}\n />\n {props.responding && !text ? (\n <Button\n label={t('stop')}\n onPress={props.onStop}\n testID=\"vinaverse-stop\"\n />\n ) : (\n <Button\n label={t('send')}\n variant=\"primary\"\n disabled={!canSend}\n onPress={send}\n testID=\"vinaverse-send\"\n />\n )}\n </View>\n );\n}\n\nexport const Composer = /* @__PURE__ */ memo(function Composer(props: {\n readonly onError?: (error: unknown) => void;\n}) {\n const { store, slots } = useChat();\n const { t } = useCopy();\n const takeover = useConversationSelector(store, (v) => v.takeover);\n const name = useConversationSelector(store, (v) => v.agent.name);\n const responding = useConversationSelector(store, (v) => v.responding);\n const { onError } = props;\n const onSend = useCallback(\n (text: string) => {\n try {\n store.send(text);\n } catch (error) {\n onError?.(error);\n }\n },\n [store, onError],\n );\n const onStop = useCallback(() => store.cancel(), [store]);\n const placeholder = takeover\n ? t('composerPlaceholderTakeover', {\n by: takeover.by || t('staffFallbackRole'),\n })\n : t('composerPlaceholder', { agent: name ?? t('agentFallbackName') });\n const Slot = slots.Composer;\n const own = { placeholder, responding, onSend, onStop };\n return Slot ? (\n <Slot {...own} Default={DefaultComposer} />\n ) : (\n <DefaultComposer {...own} />\n );\n});\n","// What the connection means for the person, in words, with the one action that helps: continue here, or try again;\n// on \"couldn't connect\", also the tenant's way out (`Failure.tsx`), or the tenant's own part in its place.\n// \"Connecting…\" waits 600 ms, so a quick connection never flashes a banner.\nimport { useConversationSelector, useCopy } from '@vinaverse/react';\nimport { motion } from '@vinaverse/tokens';\nimport { memo, type ReactNode, useEffect, useMemo, useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { useChat } from '../context.js';\nimport { useTheme } from '../theme.js';\nimport { Button } from './Button.js';\nimport { FailureActionButton, FailureSlot } from './Failure.js';\nimport type { FailureState } from './types.js';\n\n/** How long \"Connecting…\" waits, shared with the Angular kit (`motion.bannerDelay`). */\nexport const CONNECTING_DELAY = motion.bannerDelay;\n\nexport const StatusBanner = /* @__PURE__ */ memo(function StatusBanner() {\n const { store, slots } = useChat();\n const { t } = useCopy();\n const banner = useConversationSelector(store, (v) => v.banner);\n const status = useConversationSelector(store, (v) => v.status);\n const conversationId = useConversationSelector(\n store,\n (v) => v.conversationId,\n );\n const unavailable = useMemo<FailureState>(\n () => ({\n kind: 'unavailable',\n reason: status,\n retry: () => store.start(),\n conversationId,\n }),\n [store, status, conversationId],\n );\n const [late, setLate] = useState(false);\n useEffect(() => {\n setLate(false);\n if (banner !== 'connecting') return;\n const timer = setTimeout(() => setLate(true), CONNECTING_DELAY);\n return () => clearTimeout(timer);\n }, [banner]);\n if (banner === null || (banner === 'connecting' && !late)) return null;\n if (banner === 'unavailable')\n return (\n <FailureSlot\n slot={slots.Unavailable}\n state={unavailable}\n Default={DefaultUnavailable}\n />\n );\n const text = {\n connecting: t('bannerConnecting'),\n reconnecting: t('bannerReconnecting'),\n offline: t('bannerOffline'),\n continued_elsewhere: t('bannerContinuedElsewhere'),\n }[banner];\n const action =\n banner === 'continued_elsewhere' ? (\n <Button\n label={t('continueHere')}\n variant=\"text\"\n onPress={() => void store.continueHere()}\n />\n ) : banner === 'offline' ? (\n <Button\n label={t('tryAgain')}\n variant=\"text\"\n onPress={() => store.start()}\n />\n ) : null;\n return <Banner text={text}>{action}</Banner>;\n});\n\n/** The kit's own \"Couldn't connect.\" banner: try again, and the tenant's failure action when there is one. */\nexport function DefaultUnavailable(props: {\n readonly state: FailureState;\n}): ReactNode {\n const { t } = useCopy();\n const { retry } = props.state;\n return (\n <Banner text={t('bannerUnavailable')}>\n {retry ? (\n <Button label={t('tryAgain')} variant=\"text\" onPress={retry} />\n ) : null}\n <FailureActionButton state={props.state} />\n </Banner>\n );\n}\n\nfunction Banner(props: {\n readonly text: string;\n readonly children?: ReactNode;\n}): ReactNode {\n const { colors, space, font } = useTheme();\n return (\n <View\n accessibilityLiveRegion=\"polite\"\n accessibilityRole=\"alert\"\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: space.sm,\n paddingHorizontal: space.lg,\n paddingVertical: space.xs,\n backgroundColor: colors.surface,\n borderBottomWidth: 1,\n borderBottomColor: colors.divider,\n }}\n >\n <Text\n style={{ color: colors.text, fontSize: font.size.sm, flexShrink: 1 }}\n >\n {props.text}\n </Text>\n {props.children}\n </View>\n );\n}\n","// The whole conversation, ready to drop into a screen: header, the AI disclosure, the connection's banner, the\n// messages and cards, the composer. Everything visual is replaceable through `theme`, `copy` and `components`; the\n// disclosure, who-wrote-what and the proposal wiring are the kit's and stay.\nimport type { ConversationStore } from '@vinaverse/client/conversation';\nimport {\n bannedWordsIn,\n type CopyOverrides,\n CopyProvider,\n useCopy,\n} from '@vinaverse/react';\nimport { type ReactNode, useEffect, useMemo, useRef } from 'react';\nimport {\n KeyboardAvoidingView,\n Platform,\n type StyleProp,\n View,\n type ViewStyle,\n} from 'react-native';\nimport {\n ChatContextProvider,\n type ChatHandlers,\n type ChatSlots,\n type ChatWarning,\n type Chip,\n type ImagePolicy,\n useChat,\n} from '../context.js';\nimport { useNativeLifecycle } from '../platform.js';\nimport {\n type ColorSchemeSetting,\n type ThemeOverrides,\n ThemeProvider,\n themeProblems,\n useTheme,\n} from '../theme.js';\nimport { Button } from './Button.js';\nimport { ChatHeader } from './ChatHeader.js';\nimport { Composer } from './Composer.js';\nimport { DisclosureBar } from './DisclosureBar.js';\nimport { MessageList } from './MessageList.js';\nimport { StatusBanner } from './StatusBanner.js';\n\nexport interface VinaverseChatProps extends ChatHandlers {\n /** The conversation (`createConversation`), created where it can outlive the screen. */\n readonly conversation: ConversationStore;\n /** The person's locale: the copy, dates, money and text direction (pass the same one to `getSession`). */\n readonly locale?: string;\n /** For dates and times on cards; default: the device's. */\n readonly timeZone?: string;\n readonly copy?: CopyOverrides;\n readonly theme?: ThemeOverrides;\n readonly colorScheme?: ColorSchemeSetting;\n /** Parts to replace. Keep the object stable (module level, or memoized). */\n readonly components?: ChatSlots;\n /** The agent's picture, until the session carries one. */\n readonly agentAvatar?: string;\n /** Hide the header (a screen that draws its own); the disclosure stays. */\n readonly hideHeader?: boolean;\n /** iOS: the height above the keyboard that is not this view's (a navigation header). */\n readonly keyboardVerticalOffset?: number;\n /**\n * How the composer stays above the keyboard. Default: `padding` on iOS, none on Android (the window resizes). An\n * edge-to-edge Android app whose window does not resize passes `padding`; one that manages the keyboard itself\n * (react-native-keyboard-controller) passes `none`.\n */\n readonly keyboardBehavior?: 'padding' | 'height' | 'position' | 'none';\n readonly style?: StyleProp<ViewStyle>;\n /** Chips for an empty conversation when the session brings no welcome (`Session.welcome` comes first). Keep stable. */\n readonly starters?: readonly Chip[];\n /** Which card photos are drawn, their frame, and what stands in for one that is not. Keep stable. */\n readonly imagePolicy?: ImagePolicy;\n /** One chip above the composer: a question about where the person now is (`AgentChat` offers it when they moved). */\n readonly suggestion?: Chip | null;\n /** The suggestion chip's test id. Default `vinaverse-suggestion`. */\n readonly suggestionTestID?: string;\n /** Drawn under the composer, inside the kit's providers (`AgentChat`'s thumbs and footer). */\n readonly footer?: ReactNode;\n}\n\n/** The providers alone, for a tenant composing its own layout from the exported parts. */\nexport function VinaverseChatProvider(\n props: Omit<\n VinaverseChatProps,\n | 'hideHeader'\n | 'keyboardVerticalOffset'\n | 'keyboardBehavior'\n | 'style'\n | 'suggestion'\n | 'suggestionTestID'\n | 'footer'\n > & {\n readonly children?: ReactNode;\n },\n): ReactNode {\n const {\n conversation,\n components,\n agentAvatar,\n timeZone,\n starters,\n imagePolicy,\n } = props;\n const handlers = useRef<ChatHandlers>(props);\n handlers.current = props;\n const slots = useStableSlots(components);\n const hasAction = props.failureAction !== undefined;\n const actionLabel = props.failureAction?.label;\n const failureAction = useMemo(\n () => (hasAction ? { label: actionLabel } : null),\n [hasAction, actionLabel],\n );\n const value = useMemo(\n () => ({\n store: conversation,\n handlers,\n slots,\n agentAvatar,\n timeZone,\n failureAction,\n starters,\n imagePolicy,\n }),\n [\n conversation,\n slots,\n agentAvatar,\n timeZone,\n failureAction,\n starters,\n imagePolicy,\n ],\n );\n useNativeLifecycle(conversation);\n useEffect(() => {\n conversation.start(); // early: a client secret opens its first connection within two minutes\n }, [conversation]);\n const { onWarning, theme, copy } = props;\n useEffect(() => {\n if (!onWarning) return;\n for (const problem of themeProblems(theme))\n onWarning(`Vinaverse theme: ${problem}`, { code: 'theme' });\n for (const key of bannedWordsIn(copy ?? {}))\n onWarning(\n `Vinaverse copy: \"${key}\" says assistant, bot or crew; the copy says agent.`,\n { code: 'copy' },\n );\n }, [onWarning, theme, copy]);\n return (\n <CopyProvider locale={props.locale} copy={props.copy}>\n <ThemeProvider theme={props.theme} colorScheme={props.colorScheme}>\n <ChatContextProvider value={value}>\n {props.children}\n </ChatContextProvider>\n </ThemeProvider>\n </CopyProvider>\n );\n}\n\nexport function VinaverseChat(props: VinaverseChatProps): ReactNode {\n return (\n <VinaverseChatProvider {...props}>\n <Layout\n hideHeader={props.hideHeader === true}\n keyboardVerticalOffset={props.keyboardVerticalOffset ?? 0}\n keyboardBehavior={\n props.keyboardBehavior ?? (Platform.OS === 'ios' ? 'padding' : 'none')\n }\n style={props.style}\n onError={props.onWarning}\n suggestion={props.suggestion ?? null}\n suggestionTestID={props.suggestionTestID ?? 'vinaverse-suggestion'}\n footer={props.footer}\n />\n </VinaverseChatProvider>\n );\n}\n\nfunction Layout(props: {\n readonly hideHeader: boolean;\n readonly keyboardVerticalOffset: number;\n readonly keyboardBehavior: 'padding' | 'height' | 'position' | 'none';\n readonly style: StyleProp<ViewStyle> | undefined;\n readonly onError:\n | ((message: string, warning: ChatWarning) => void)\n | undefined;\n readonly suggestion: Chip | null;\n readonly suggestionTestID: string;\n readonly footer: ReactNode;\n}) {\n const { colors } = useTheme();\n const { direction } = useCopy();\n const { onError } = props;\n const reportError = useMemo(\n () =>\n onError\n ? (e: unknown) => onError(String(e), { code: 'send_failed' })\n : undefined,\n [onError],\n );\n return (\n <KeyboardAvoidingView\n {...(props.keyboardBehavior === 'none'\n ? { enabled: false }\n : { behavior: props.keyboardBehavior })}\n keyboardVerticalOffset={props.keyboardVerticalOffset}\n style={[\n { flex: 1, backgroundColor: colors.background, direction },\n props.style,\n ]}\n >\n {props.hideHeader ? null : <ChatHeader />}\n <DisclosureBar />\n <StatusBanner />\n <View style={{ flex: 1 }}>\n <MessageList />\n </View>\n {props.suggestion ? (\n <Suggestion chip={props.suggestion} testID={props.suggestionTestID} />\n ) : null}\n <Composer {...(reportError ? { onError: reportError } : {})} />\n {props.footer}\n </KeyboardAvoidingView>\n );\n}\n\n/** One chip above the composer; a tap sends its message as the person's own text. */\nfunction Suggestion(props: { readonly chip: Chip; readonly testID: string }) {\n const { store, handlers } = useChat();\n const { space } = useTheme();\n return (\n <View style={{ paddingHorizontal: space.lg, alignItems: 'flex-start' }}>\n <Button\n label={props.chip.label}\n testID={props.testID}\n onPress={() => {\n store.send(props.chip.message);\n handlers.current?.onChip?.(props.chip);\n }}\n />\n </View>\n );\n}\n\n/** The slots object, kept the same while its parts are the same, so an inline `components={{…}}` re-renders nothing. */\nfunction useStableSlots(slots: ChatSlots | undefined): ChatSlots {\n const held = useRef<ChatSlots>({});\n const next = slots ?? {};\n if (!sameSlots(held.current, next)) held.current = next;\n return held.current;\n}\n\nfunction sameSlots(a: ChatSlots, b: ChatSlots): boolean {\n const keys = new Set([...Object.keys(a), ...Object.keys(b)]) as Set<\n keyof ChatSlots\n >;\n for (const key of keys) {\n if (key === 'cards') {\n const ca = a.cards ?? {};\n const cb = b.cards ?? {};\n const kinds = new Set([...Object.keys(ca), ...Object.keys(cb)]);\n for (const kind of kinds) if (ca[kind] !== cb[kind]) return false;\n } else if (a[key] !== b[key]) return false;\n }\n return true;\n}\n","// The agent's conversation for a key, on the runtime: the chat itself (`VinaverseChat`), and around it what an app used\n// to build by hand: a conversation that ended (start a new one), the backend out of reach (try again), a person when\n// there is no agent, the session's welcome or the app's starters, a question about where the person now is, thumbs on\n// the newest whole reply, and a footer. Built only on the public hooks; every part is a slot.\nimport type {\n AgentEntryPoint,\n AgentFailureReason,\n AgentKey,\n AgentPlace,\n AgentRating,\n} from '@vinaverse/client/agent';\nimport { useConversationSelector, useCopy } from '@vinaverse/react';\nimport {\n useAgentConversation,\n useAgentName,\n useAgentRuntime,\n} from '@vinaverse/react/agent';\nimport { type ComponentType, type ReactNode, useMemo } from 'react';\nimport { Text, View } from 'react-native';\nimport type { ChatSlots, Chip } from '../context.js';\nimport { useAgentSweep } from '../platform.js';\nimport { useTheme } from '../theme.js';\nimport { Button } from './Button.js';\nimport {\n VinaverseChat,\n type VinaverseChatProps,\n VinaverseChatProvider,\n} from './VinaverseChat.js';\n\n/**\n * The full-screen states (`Ended`, `Unreachable`, `UnavailableScreen`) are slots: each gets everything its screen\n * needs (why, the actions, a person to contact) and the kit's own part as `Default`, so an app replaces the layout and\n * the words entirely, or only the words through `copy`.\n */\nexport interface AgentEndedProps {\n readonly onStartNew: () => void;\n /** Why: `ended`, `not_found`, `expired`, `mismatch`, `completed`. */\n readonly reason: AgentFailureReason | null;\n /** The API's code (`conversation_not_found`, `conversation_expired`), when it gave one. */\n readonly code: string | null;\n /** A person instead (the chat's `onContact`); absent when the app gave none. */\n readonly onContact: (() => void) | undefined;\n}\n/** No agent here: switched off for this tenant, mode or person, or the backend refused the session. */\nexport interface AgentUnavailableScreenProps {\n /** Why: `off`, `auth`, `invalid_session`, … */\n readonly reason: AgentFailureReason | null;\n readonly code: string | null;\n /** A person instead (the chat's `onContact`); absent when the app gave none. */\n readonly onContact: (() => void) | undefined;\n /** Ask again (after a sign-in, or the agent switched back on). */\n readonly onRetry: () => void;\n}\nexport interface AgentUnreachableProps {\n readonly onRetry: () => void;\n /** Why: `network`, `server`, `rate_limited`, … */\n readonly reason: AgentFailureReason | null;\n /** A person instead (the chat's `onContact`); absent when the app gave none. */\n readonly onContact: (() => void) | undefined;\n}\n\n/** A slot gets the kit's own part as `Default`, to wrap rather than rewrite. */\ntype Slot<P> = ComponentType<P & { readonly Default: ComponentType<P> }>;\nexport interface AgentFooterProps {\n /** The newest whole reply's turn, to rate; null when there is none or it was restored from before. */\n readonly turnId: string | null;\n readonly rating: AgentRating | undefined;\n readonly onRate: (rating: AgentRating) => void;\n readonly onOpenPrivacy: (() => void) | undefined;\n}\n\nexport interface AgentChatSlots extends ChatSlots {\n readonly Ended?: Slot<AgentEndedProps>;\n readonly Unreachable?: Slot<AgentUnreachableProps>;\n /**\n * The whole screen when there is no agent (off, or the session refused). Not `Unavailable`: that is the chat's own\n * \"couldn't connect\" banner, still drawn for a session that drops.\n */\n readonly UnavailableScreen?: Slot<AgentUnavailableScreenProps>;\n /** Under the composer; null hides it. Default: thumbs on the newest whole reply, and the privacy link. */\n readonly Footer?: Slot<AgentFooterProps> | null;\n}\n\nexport interface AgentChatProps\n extends Omit<\n VinaverseChatProps,\n 'conversation' | 'components' | 'suggestion' | 'suggestionTestID' | 'footer'\n > {\n /** Whose conversation: one per person, mode, business and thread. */\n readonly agentKey: AgentKey;\n /** Where the person asks from, told to the agent as a session opens. */\n readonly place?: AgentPlace | null;\n /** How the person came in: `launcher` and `ask` from the kit's parts, `deep_link`, or the app's own words. */\n readonly entryPoint?: AgentEntryPoint | null;\n /** The question about this place, offered when the session was told another one (`moved`). */\n readonly askAbout?: string | null;\n /** A person: offered on a failed turn, \"couldn't connect\" and no agent. */\n readonly onContact?: () => void;\n readonly onOpenPrivacy?: () => void;\n /** The agent's name until the session or the status gives one. */\n readonly agentName?: string;\n /**\n * A first question for a flow that asks for itself (setting a business up): a chip the person taps, offered until they\n * say anything. Never sent in their name: what the transcript shows as theirs, they typed or tapped.\n */\n readonly opener?: Chip | null;\n /** The opener chip's test id. Default `vinaverse-opener`. */\n readonly openerTestID?: string;\n readonly components?: AgentChatSlots;\n}\n\nexport function AgentChat(props: AgentChatProps): ReactNode {\n const {\n agentKey,\n place,\n entryPoint,\n askAbout,\n onContact,\n onOpenPrivacy,\n components,\n agentName,\n opener,\n openerTestID,\n ...chat\n } = props;\n const runtime = useAgentRuntime();\n useAgentSweep(runtime);\n const { conversation, state, startNew } = useAgentConversation(agentKey, {\n place: place ?? null,\n entryPoint: entryPoint ?? null,\n });\n const store = conversation.store;\n const spoke = useConversationSelector(store, (v) =>\n v.items.some((i) => i.type === 'message' && i.role === 'person'),\n );\n const { Ended, Unreachable, UnavailableScreen, Footer, ...slots } =\n components ?? {};\n const copy = useMemo(\n () =>\n agentName ? { ...props.copy, agentFallbackName: agentName } : props.copy,\n [agentName, props.copy],\n );\n const events = {\n onOpenTarget: chat.onOpenTarget\n ? (\n target: Parameters<NonNullable<typeof chat.onOpenTarget>>[0],\n card: Parameters<NonNullable<typeof chat.onOpenTarget>>[1],\n ) => {\n runtime.emit({\n type: 'target_opened',\n key: conversation.key,\n cardId: card.id,\n kind: target.type,\n });\n chat.onOpenTarget?.(target, card);\n }\n : undefined,\n onOpenLink: chat.onOpenLink\n ? (\n link: string,\n card: Parameters<NonNullable<typeof chat.onOpenLink>>[1],\n ) => {\n runtime.emit({\n type: 'link_opened',\n key: conversation.key,\n cardId: card.id,\n kind: card.kind,\n });\n chat.onOpenLink?.(link, card);\n }\n : undefined,\n onChip: (chip: Parameters<NonNullable<typeof chat.onChip>>[0]) => {\n runtime.emit({ type: 'chip_tapped', key: conversation.key });\n chat.onChip?.(chip);\n },\n };\n const shared = {\n ...chat,\n ...(events.onOpenTarget ? { onOpenTarget: events.onOpenTarget } : {}),\n ...(events.onOpenLink ? { onOpenLink: events.onOpenLink } : {}),\n onChip: events.onChip,\n ...(copy ? { copy } : {}),\n ...(onContact && !chat.failureAction\n ? { failureAction: { onPress: () => onContact() } }\n : {}),\n conversation: store,\n components: slots,\n };\n if (state.failure === 'ended') {\n const own: AgentEndedProps = {\n onStartNew: startNew,\n reason: state.reason,\n code: state.code,\n onContact,\n };\n return (\n <VinaverseChatProvider {...shared}>\n <Centered>\n {Ended ? (\n <Ended {...own} Default={DefaultEnded} />\n ) : (\n <DefaultEnded {...own} />\n )}\n </Centered>\n </VinaverseChatProvider>\n );\n }\n if (state.failure === 'unreachable') {\n const own: AgentUnreachableProps = {\n onRetry: conversation.retry,\n reason: state.reason,\n onContact,\n };\n return (\n <VinaverseChatProvider {...shared}>\n <Centered>\n {Unreachable ? (\n <Unreachable {...own} Default={DefaultUnreachable} />\n ) : (\n <DefaultUnreachable {...own} />\n )}\n </Centered>\n </VinaverseChatProvider>\n );\n }\n if (state.failure === 'unavailable') {\n const own: AgentUnavailableScreenProps = {\n reason: state.reason,\n code: state.code,\n onContact,\n onRetry: conversation.retry,\n };\n return (\n <VinaverseChatProvider {...shared}>\n <Centered>\n {UnavailableScreen ? (\n <UnavailableScreen {...own} Default={DefaultUnavailableScreen} />\n ) : (\n <DefaultUnavailableScreen {...own} />\n )}\n </Centered>\n </VinaverseChatProvider>\n );\n }\n const offered = opener && !spoke ? opener : null;\n return (\n <VinaverseChat\n {...shared}\n suggestion={\n offered ??\n (state.moved && askAbout\n ? { label: askAbout, message: askAbout }\n : null)\n }\n {...(offered\n ? { suggestionTestID: openerTestID ?? 'vinaverse-opener' }\n : {})}\n footer={\n Footer === null ? null : (\n <FooterFor\n store={store}\n state={state}\n rate={conversation.rate}\n canRate={conversation.canRate}\n Footer={Footer}\n onOpenPrivacy={onOpenPrivacy}\n />\n )\n }\n />\n );\n}\n\nfunction FooterFor(props: {\n readonly store: Parameters<typeof useConversationSelector>[0];\n readonly state: { readonly ratings: ReadonlyMap<string, AgentRating> };\n readonly rate: (turnId: string, rating: AgentRating) => void;\n readonly canRate: (turnId: string) => boolean;\n readonly Footer: Slot<AgentFooterProps> | undefined;\n readonly onOpenPrivacy: (() => void) | undefined;\n}) {\n const newest = useConversationSelector(props.store, newestWholeReply);\n // A reply restored from before has no thumbs: it cannot be rated against the session it was given in.\n const turnId = newest && props.canRate(newest) ? newest : null;\n const own: AgentFooterProps = {\n turnId,\n rating: turnId ? props.state.ratings.get(turnId) : undefined,\n onRate: (rating) => {\n if (turnId) props.rate(turnId, rating);\n },\n onOpenPrivacy: props.onOpenPrivacy,\n };\n const { Footer } = props;\n return Footer ? (\n <Footer {...own} Default={AgentFooter} />\n ) : (\n <AgentFooter {...own} />\n );\n}\n\n/** The newest reply when it came whole (not cut off, not a refusal): the one to rate. */\nexport function newestWholeReply(view: {\n readonly items: readonly import('@vinaverse/client/conversation').TimelineItem[];\n}): string | null {\n for (let i = view.items.length - 1; i >= 0; i--) {\n const item = view.items[i];\n if (item?.type !== 'message' || item.role !== 'agent') continue;\n const whole =\n item.state === 'sent' &&\n !item.partial &&\n !item.refusal &&\n item.key.startsWith('a:');\n return whole ? item.key.slice(2) : null;\n }\n return null;\n}\n\nfunction Centered(props: { readonly children: ReactNode }) {\n const { colors, space } = useTheme();\n return (\n <View\n style={{\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: space.xl,\n backgroundColor: colors.background,\n }}\n >\n {props.children}\n </View>\n );\n}\n\nfunction Notice(props: {\n readonly title: string;\n readonly body: string;\n readonly action?: string;\n readonly onPress?: () => void;\n}) {\n const { colors, space, font } = useTheme();\n return (\n <View\n accessibilityRole=\"alert\"\n style={{ alignItems: 'center', gap: space.md }}\n >\n <Text\n style={{\n color: colors.text,\n fontSize: font.size.lg,\n fontWeight: '600',\n textAlign: 'center',\n }}\n >\n {props.title}\n </Text>\n <Text\n style={{\n color: colors.textMuted,\n fontSize: font.size.md,\n textAlign: 'center',\n }}\n >\n {props.body}\n </Text>\n {props.action && props.onPress ? (\n <Button\n label={props.action}\n variant=\"primary\"\n onPress={props.onPress}\n />\n ) : null}\n </View>\n );\n}\n\n/** The conversation is over: a new one starts only when the person asks. */\nexport function DefaultEnded(props: AgentEndedProps): ReactNode {\n const { t } = useCopy();\n return (\n <Notice\n title={t('agentEnded')}\n body={t('agentEndedBody')}\n action={t('agentStartOver')}\n onPress={props.onStartNew}\n />\n );\n}\n\n/** No agent here: says so, and offers a person when the app has one. */\nexport function DefaultUnavailableScreen(\n props: AgentUnavailableScreenProps,\n): ReactNode {\n const { t } = useCopy();\n const name = useAgentName(t('agentFallbackName'));\n const title = t('agentOff', { agent: name });\n return (\n <Notice\n title={title.charAt(0).toUpperCase() + title.slice(1)}\n body={t('agentOffBody')}\n {...(props.onContact\n ? { action: t('talkToPerson'), onPress: props.onContact }\n : {})}\n />\n );\n}\n\n/** The app's backend could not be reached, after its tries: try again. */\nexport function DefaultUnreachable(props: AgentUnreachableProps): ReactNode {\n const { t } = useCopy();\n const name = useAgentName(t('agentFallbackName'));\n return (\n <Notice\n title={t('agentUnreachable', { agent: name })}\n body={t('agentUnreachableBody')}\n action={t('tryAgain')}\n onPress={props.onRetry}\n />\n );\n}\n\n/** Thumbs on the newest whole reply (thanks once given), and the privacy link. */\nexport function AgentFooter(props: AgentFooterProps): ReactNode {\n const { t } = useCopy();\n const { colors, space, font } = useTheme();\n const muted = { color: colors.textMuted, fontSize: font.size.sm };\n return (\n <View\n style={{\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n gap: space.xs,\n paddingHorizontal: space.lg,\n }}\n >\n {props.turnId === null ? null : props.rating ? (\n <Text style={muted}>{t('helpfulThanks')}</Text>\n ) : (\n <>\n <Text style={muted}>{t('helpful')}</Text>\n <Button\n label={t('helpfulYes')}\n variant=\"text\"\n onPress={() => props.onRate('up')}\n />\n <Button\n label={t('helpfulNo')}\n variant=\"text\"\n onPress={() => props.onRate('down')}\n />\n </>\n )}\n {props.onOpenPrivacy ? (\n <Button\n label={t('privacy')}\n variant=\"text\"\n role=\"link\"\n onPress={props.onOpenPrivacy}\n />\n ) : null}\n </View>\n );\n}\n"]}
|