@vinaverse/react-native 0.1.0-alpha.12 → 0.1.0-alpha.13
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 +16 -3
- package/dist/ask.cjs +10 -5
- package/dist/ask.d.cts +35 -5
- package/dist/ask.d.ts +35 -5
- package/dist/ask.js +3 -2
- package/dist/chat.cjs +69 -69
- package/dist/chat.d.cts +44 -8
- package/dist/chat.d.ts +44 -8
- package/dist/chat.js +3 -3
- package/dist/{chunk-XAG2P447.cjs → chunk-272ACDLI.cjs} +248 -104
- package/dist/chunk-272ACDLI.cjs.map +1 -0
- package/dist/{chunk-EFEXTVIT.js → chunk-35A77CNF.js} +11 -3
- package/dist/chunk-35A77CNF.js.map +1 -0
- package/dist/{chunk-NMKJ7LIJ.cjs → chunk-35T5QPMT.cjs} +31 -7
- package/dist/chunk-35T5QPMT.cjs.map +1 -0
- package/dist/{chunk-7KPCO443.js → chunk-GFD4T3IA.js} +28 -4
- package/dist/chunk-GFD4T3IA.js.map +1 -0
- package/dist/{chunk-2J2LIJLW.js → chunk-MCVW6TZD.js} +113 -33
- package/dist/chunk-MCVW6TZD.js.map +1 -0
- package/dist/{chunk-KSHDF3MG.js → chunk-QSMMC4RZ.js} +216 -74
- package/dist/chunk-QSMMC4RZ.js.map +1 -0
- package/dist/{chunk-POJP52GE.js → chunk-TY4TISCR.js} +4 -4
- package/dist/chunk-TY4TISCR.js.map +1 -0
- package/dist/{chunk-6QYDPGRS.cjs → chunk-UMCOOQT6.cjs} +11 -3
- package/dist/chunk-UMCOOQT6.cjs.map +1 -0
- package/dist/{chunk-MG32E4JI.cjs → chunk-VWAAUCE3.cjs} +11 -11
- package/dist/chunk-VWAAUCE3.cjs.map +1 -0
- package/dist/{chunk-4PXQ7DEY.cjs → chunk-YVCMKSJG.cjs} +140 -60
- package/dist/chunk-YVCMKSJG.cjs.map +1 -0
- package/dist/{context-gHCLFsJh.d.ts → context-B4ctXjm5.d.cts} +22 -1
- package/dist/{context-gHCLFsJh.d.cts → context-B4ctXjm5.d.ts} +22 -1
- package/dist/history.cjs +52 -48
- package/dist/history.cjs.map +1 -1
- package/dist/history.d.cts +12 -3
- package/dist/history.d.ts +12 -3
- package/dist/history.js +13 -9
- package/dist/history.js.map +1 -1
- package/dist/index.cjs +83 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/launcher.cjs +10 -10
- package/dist/launcher.js +2 -2
- package/package.json +7 -7
- package/dist/chunk-2J2LIJLW.js.map +0 -1
- package/dist/chunk-4PXQ7DEY.cjs.map +0 -1
- package/dist/chunk-6QYDPGRS.cjs.map +0 -1
- package/dist/chunk-7KPCO443.js.map +0 -1
- package/dist/chunk-EFEXTVIT.js.map +0 -1
- package/dist/chunk-KSHDF3MG.js.map +0 -1
- package/dist/chunk-MG32E4JI.cjs.map +0 -1
- package/dist/chunk-NMKJ7LIJ.cjs.map +0 -1
- package/dist/chunk-POJP52GE.js.map +0 -1
- package/dist/chunk-XAG2P447.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUMCOOQT6_cjs = require('./chunk-UMCOOQT6.cjs');
|
|
4
4
|
var react = require('@vinaverse/react');
|
|
5
5
|
var agent = require('@vinaverse/react/agent');
|
|
6
6
|
var react$1 = require('react');
|
|
@@ -9,7 +9,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
9
9
|
|
|
10
10
|
var LAUNCHER_SIZE = 56;
|
|
11
11
|
function AgentLauncher(props) {
|
|
12
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.CopyProvider, { locale: props.locale, copy: props.copy, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.CopyProvider, { locale: props.locale, copy: props.copy, children: /* @__PURE__ */ jsxRuntime.jsx(chunkUMCOOQT6_cjs.ThemeProvider, { theme: props.theme, colorScheme: props.colorScheme, children: /* @__PURE__ */ jsxRuntime.jsx(Launcher, { ...props }) }) });
|
|
13
13
|
}
|
|
14
14
|
function useKeyboardShown() {
|
|
15
15
|
const [shown, setShown] = react$1.useState(false);
|
|
@@ -32,10 +32,10 @@ function useKeyboardShown() {
|
|
|
32
32
|
}
|
|
33
33
|
function Launcher(props) {
|
|
34
34
|
const { t } = react.useCopy();
|
|
35
|
-
const name = agent.useAgentName(t("agentFallbackName"));
|
|
35
|
+
const name = agent.useAgentName(t("agentFallbackName"), props.mode);
|
|
36
36
|
const keyboard = useKeyboardShown();
|
|
37
|
-
const reducedMotion =
|
|
38
|
-
|
|
37
|
+
const reducedMotion = chunkUMCOOQT6_cjs.useReducedMotion();
|
|
38
|
+
chunkUMCOOQT6_cjs.useAgentSweep(agent.useAgentRuntime());
|
|
39
39
|
const { route = null, routes, mode } = props;
|
|
40
40
|
const visible = props.hidden !== true && !(keyboard && props.hideWithKeyboard !== false) && (!routes || route !== null && routes.includes(route));
|
|
41
41
|
const launcher = agent.useAgentLauncher({
|
|
@@ -48,7 +48,7 @@ function Launcher(props) {
|
|
|
48
48
|
...props.delayMs === void 0 ? {} : { delayMs: props.delayMs }
|
|
49
49
|
});
|
|
50
50
|
const text = typeof props.greeting === "function" ? props.greeting(mode) : props.greeting ?? t("launcherGreeting", { agent: name });
|
|
51
|
-
const say = props.announce ??
|
|
51
|
+
const say = props.announce ?? chunkUMCOOQT6_cjs.announce;
|
|
52
52
|
const said = react$1.useRef(false);
|
|
53
53
|
react$1.useEffect(() => {
|
|
54
54
|
if (!launcher.greets) {
|
|
@@ -117,7 +117,7 @@ function Launcher(props) {
|
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
119
|
function LauncherEntrance(props) {
|
|
120
|
-
const { motion } =
|
|
120
|
+
const { motion } = chunkUMCOOQT6_cjs.useTheme();
|
|
121
121
|
const shown = react$1.useRef(new reactNative.Animated.Value(props.reducedMotion ? 1 : 0)).current;
|
|
122
122
|
react$1.useEffect(() => {
|
|
123
123
|
if (props.reducedMotion) {
|
|
@@ -153,7 +153,7 @@ function LauncherEntrance(props) {
|
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
155
|
function LauncherGreeting(props) {
|
|
156
|
-
const { colors, radius, space, font } =
|
|
156
|
+
const { colors, radius, space, font } = chunkUMCOOQT6_cjs.useTheme();
|
|
157
157
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
158
158
|
reactNative.View,
|
|
159
159
|
{
|
|
@@ -217,7 +217,7 @@ function LauncherGreeting(props) {
|
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
219
|
function LauncherButton(props) {
|
|
220
|
-
const { colors, font } =
|
|
220
|
+
const { colors, font } = chunkUMCOOQT6_cjs.useTheme();
|
|
221
221
|
const { Mark, ring } = props;
|
|
222
222
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
223
223
|
reactNative.Pressable,
|
|
@@ -264,5 +264,5 @@ exports.LauncherButton = LauncherButton;
|
|
|
264
264
|
exports.LauncherEntrance = LauncherEntrance;
|
|
265
265
|
exports.LauncherGreeting = LauncherGreeting;
|
|
266
266
|
exports.useKeyboardShown = useKeyboardShown;
|
|
267
|
-
//# sourceMappingURL=chunk-
|
|
268
|
-
//# sourceMappingURL=chunk-
|
|
267
|
+
//# sourceMappingURL=chunk-VWAAUCE3.cjs.map
|
|
268
|
+
//# sourceMappingURL=chunk-VWAAUCE3.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AgentLauncher.tsx"],"names":["jsx","CopyProvider","ThemeProvider","useState","useEffect","Platform","Keyboard","useCopy","useAgentName","useReducedMotion","useAgentSweep","useAgentRuntime","useAgentLauncher","announce","useRef","jsxs","View","useTheme","Animated","Pressable","Text"],"mappings":";;;;;;;;;AA0CO,IAAM,aAAA,GAAgB;AAkGtB,SA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E,SAAA,EAAW,CAAA;AAAA,UACX,WAAA,EAAa,MAAA;AAAA,UACb,aAAA,EAAe,GAAA;AAAA,UACf,YAAA,EAAc,CAAA;AAAA,UACd,YAAA,EAAc,EAAE,KAAA,EAAO,CAAA,EAAG,QAAQ,CAAA;AAAE,YAEtC;AAAC,OACP,CAAA;AAAA,MACA,MAAA,EAAO,2BAAA;AAAA,MAEN,QAAA,EAAA,IAAA,kCACE,IAAA,EAAA,EAAK,IAAA,EAAM,IAAI,KAAA,EAAO,MAAA,CAAO,WAAW,CAAA,mBAEzCnB,cAAA;AAAA,QAACoB,gBAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO;AAAA,YACL,OAAO,MAAA,CAAO,SAAA;AAAA,YACd,QAAA,EAAU,KAAK,IAAA,CAAK,EAAA;AAAA,YACpB,UAAA,EAAY;AAAA,WACd;AAAA,UAEE,iBAAM,IAAA,CAAK,IAAA,GAAO,CAAC,CAAA,IAAK,KAAK,WAAA;AAAY;AAAA;AAC7C;AAAA,GAEJ;AAEJ","file":"chunk-VWAAUCE3.cjs","sourcesContent":["// The agent's floating launcher: a round button over the app's screens and, once per person and mode, a greeting\n// bubble above it, read to screen readers as it appears. Where it shows is a policy: the routes the app allows, never\n// with the keyboard up, never while the app says it should step aside (a sheet, a map). The app places it (`placement`,\n// `style`), gives its brand mark (`Mark`), sets its ring, shadow and the bubble's tail (`appearance`), and can replace\n// the button, the bubble and how they come in (slots, each given the kit's own part; no motion when reduced).\nimport { type CopyOverrides, CopyProvider, useCopy } from '@vinaverse/react';\nimport {\n type GreetingStorage,\n useAgentLauncher,\n useAgentName,\n useAgentRuntime,\n} from '@vinaverse/react/agent';\nimport {\n type ComponentType,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport {\n Animated,\n Keyboard,\n Platform,\n Pressable,\n type StyleProp,\n Text,\n View,\n type ViewStyle,\n} from 'react-native';\nimport {\n announce as platformAnnounce,\n useAgentSweep,\n useReducedMotion,\n} from '../platform.js';\nimport {\n type ColorSchemeSetting,\n type ThemeOverrides,\n ThemeProvider,\n useTheme,\n} from '../theme.js';\n\n/** The launcher's button side, in dp. */\nexport const LAUNCHER_SIZE = 56;\n\n/** The launcher's look: a ring around the button, its shadow, the bubble's tail toward it. */\nexport interface LauncherAppearance {\n /** Default none. */\n readonly ring?: { readonly color: string; readonly width: number } | null;\n /** Default true. */\n readonly shadow?: boolean;\n /** Default true. */\n readonly tail?: boolean;\n}\n\n/** Where it floats: the screen's edge, its distance from the bottom (above a tab bar) and from the side. */\nexport interface LauncherPlacement {\n /** Default `right`. */\n readonly edge?: 'left' | 'right';\n /** Default 16. */\n readonly bottom?: number;\n /** Default 16. */\n readonly inset?: number;\n}\n\nexport interface LauncherButtonProps {\n readonly label: string;\n readonly name: string;\n readonly onPress: () => void;\n readonly Mark:\n | ComponentType<{ readonly size: number; readonly color: string }>\n | undefined;\n readonly ring: { readonly color: string; readonly width: number } | null;\n readonly shadow: boolean;\n}\nexport interface LauncherGreetingProps {\n readonly text: string;\n readonly closeLabel: string;\n readonly onOpen: () => void;\n readonly onClose: () => void;\n readonly tail: boolean;\n readonly edge: 'left' | 'right';\n}\n/** How the button and the bubble come in; `reducedMotion` when the person asked for none. */\nexport interface LauncherEntranceProps {\n readonly part: 'button' | 'greeting';\n readonly reducedMotion: boolean;\n readonly children: ReactNode;\n}\ntype Slot<P> = ComponentType<P & { readonly Default: ComponentType<P> }>;\n\n/** Where the person opened the agent from: the app's route, the mode, and `entryPoint` to give the chat. */\nexport interface LauncherContext {\n readonly route: string | null;\n readonly mode: string;\n readonly entryPoint: 'launcher';\n}\n\nexport interface AgentLauncherProps {\n readonly subject: string | null;\n readonly mode: string;\n readonly onOpen: (from: LauncherContext) => void;\n /** The app's current route; with `routes`, the launcher shows only on those. */\n readonly route?: string | null;\n readonly routes?: readonly string[];\n /** The app says step aside (a sheet is up, a map with its own cards…). */\n readonly hidden?: boolean;\n /** Hidden while the keyboard is up. Default true. */\n readonly hideWithKeyboard?: boolean;\n /** Where it remembers the greeting was shown (the app's preferences store); default: for this launch only. */\n readonly storage?: GreetingStorage;\n /** The storage's key for a person and mode (a record the app already keeps); default `greetedKey`. */\n readonly storageKey?: (subject: string | null, mode: string) => string;\n /** The greeting's words, or by mode; default the copy's `launcherGreeting`. */\n readonly greeting?: string | ((mode: string) => string);\n /** How long after showing the greeting appears. Default 1200 ms. */\n readonly delayMs?: number;\n /** The app's brand mark inside the button; default the agent name's first letter. */\n readonly Mark?: ComponentType<{\n readonly size: number;\n readonly color: string;\n }>;\n /** Reads the greeting to a screen reader as it appears. Default: the platform's. */\n readonly announce?: (text: string) => void;\n readonly components?: {\n readonly Button?: Slot<LauncherButtonProps>;\n readonly Greeting?: Slot<LauncherGreetingProps>;\n /** Default: a short fade and scale; none with reduced motion. */\n readonly Entrance?: Slot<LauncherEntranceProps>;\n };\n readonly appearance?: LauncherAppearance;\n /** Where it floats over the app's screens; `style` comes after it, for anything else. */\n readonly placement?: LauncherPlacement;\n readonly style?: StyleProp<ViewStyle>;\n /** As on the chat: the person's locale, the app's words, theme and color scheme. */\n readonly locale?: string;\n readonly copy?: CopyOverrides;\n readonly theme?: ThemeOverrides;\n readonly colorScheme?: ColorSchemeSetting;\n}\n\nexport function AgentLauncher(props: AgentLauncherProps): ReactNode {\n return (\n <CopyProvider locale={props.locale} copy={props.copy}>\n <ThemeProvider theme={props.theme} colorScheme={props.colorScheme}>\n <Launcher {...props} />\n </ThemeProvider>\n </CopyProvider>\n );\n}\n\n/** Whether the keyboard is up: on iOS from the moment it starts to rise or fall, on Android (no `Will` events) once it has. */\nexport function useKeyboardShown(): boolean {\n const [shown, setShown] = useState(false);\n useEffect(() => {\n const ios = Platform.OS === 'ios';\n const show = Keyboard.addListener(\n ios ? 'keyboardWillShow' : 'keyboardDidShow',\n () => setShown(true),\n );\n const hide = Keyboard.addListener(\n ios ? 'keyboardWillHide' : 'keyboardDidHide',\n () => setShown(false),\n );\n return () => {\n show.remove();\n hide.remove();\n };\n }, []);\n return shown;\n}\n\nfunction Launcher(props: AgentLauncherProps): ReactNode {\n const { t } = useCopy();\n const name = useAgentName(t('agentFallbackName'), props.mode);\n const keyboard = useKeyboardShown();\n const reducedMotion = useReducedMotion();\n useAgentSweep(useAgentRuntime());\n const { route = null, routes, mode } = props;\n const visible =\n props.hidden !== true &&\n !(keyboard && props.hideWithKeyboard !== false) &&\n (!routes || (route !== null && routes.includes(route)));\n const launcher = useAgentLauncher({\n subject: props.subject,\n mode,\n visible,\n onOpen: () => props.onOpen({ route, mode, entryPoint: 'launcher' }),\n ...(props.storage ? { storage: props.storage } : {}),\n ...(props.storageKey ? { storageKey: props.storageKey } : {}),\n ...(props.delayMs === undefined ? {} : { delayMs: props.delayMs }),\n });\n const text =\n typeof props.greeting === 'function'\n ? props.greeting(mode)\n : (props.greeting ?? t('launcherGreeting', { agent: name }));\n const say = props.announce ?? platformAnnounce;\n const said = useRef(false);\n useEffect(() => {\n if (!launcher.greets) {\n said.current = false;\n return;\n }\n if (said.current) return;\n said.current = true; // once per greeting, however often the app's `announce` changes\n say(text);\n }, [launcher.greets, text, say]);\n if (!launcher.shows) return null;\n const edge = props.placement?.edge ?? 'right';\n const look = props.appearance ?? {};\n const greeting: LauncherGreetingProps = {\n text,\n closeLabel: t('close'),\n onOpen: launcher.open,\n onClose: launcher.dismiss,\n tail: look.tail !== false,\n edge,\n };\n const button: LauncherButtonProps = {\n label: t('launcherOpen', { agent: name }),\n name,\n onPress: launcher.open,\n Mark: props.Mark,\n ring: look.ring ?? null,\n shadow: look.shadow !== false,\n };\n const { Greeting, Button, Entrance } = props.components ?? {};\n const enter = (part: LauncherEntranceProps['part'], children: ReactNode) =>\n Entrance ? (\n <Entrance\n part={part}\n reducedMotion={reducedMotion}\n Default={LauncherEntrance}\n >\n {children}\n </Entrance>\n ) : (\n <LauncherEntrance part={part} reducedMotion={reducedMotion}>\n {children}\n </LauncherEntrance>\n );\n return (\n <View\n pointerEvents=\"box-none\"\n style={[\n {\n position: 'absolute',\n bottom: props.placement?.bottom ?? 16,\n [edge]: props.placement?.inset ?? 16,\n alignItems: edge === 'right' ? 'flex-end' : 'flex-start',\n gap: 8,\n },\n props.style,\n ]}\n testID=\"vinaverse-launcher\"\n >\n {launcher.greets\n ? enter(\n 'greeting',\n Greeting ? (\n <Greeting {...greeting} Default={LauncherGreeting} />\n ) : (\n <LauncherGreeting {...greeting} />\n ),\n )\n : null}\n {enter(\n 'button',\n Button ? (\n <Button {...button} Default={LauncherButton} />\n ) : (\n <LauncherButton {...button} />\n ),\n )}\n </View>\n );\n}\n\n/** The kit's entrance: a short fade and scale up; none when the person asked for reduced motion. */\nexport function LauncherEntrance(props: LauncherEntranceProps): ReactNode {\n const { motion } = useTheme();\n const shown = useRef(new Animated.Value(props.reducedMotion ? 1 : 0)).current;\n useEffect(() => {\n if (props.reducedMotion) {\n shown.setValue(1);\n return;\n }\n const run = Animated.timing(shown, {\n toValue: 1,\n duration: motion.normal,\n useNativeDriver: true,\n });\n run.start();\n return () => run.stop();\n }, [shown, props.reducedMotion, motion.normal]);\n return (\n <Animated.View\n pointerEvents=\"box-none\"\n style={{\n opacity: shown,\n transform: [\n {\n scale: shown.interpolate({\n inputRange: [0, 1],\n outputRange: [0.9, 1],\n }),\n },\n ],\n }}\n testID={`vinaverse-launcher-entrance-${props.part}`}\n >\n {props.children}\n </Animated.View>\n );\n}\n\n/** The kit's greeting bubble: the words (a tap opens the agent), a close button, and a tail toward the button. */\nexport function LauncherGreeting(props: LauncherGreetingProps): ReactNode {\n const { colors, radius, space, font } = useTheme();\n return (\n <View\n style={{\n maxWidth: 296,\n flexDirection: 'row',\n alignItems: 'flex-start',\n borderRadius: radius.lg,\n backgroundColor: colors.text,\n }}\n testID=\"vinaverse-launcher-greeting\"\n >\n {props.tail ? (\n <View\n accessible={false}\n style={{\n position: 'absolute',\n bottom: -5,\n [props.edge]: LAUNCHER_SIZE / 2 - 6,\n width: 12,\n height: 12,\n backgroundColor: colors.text,\n transform: [{ rotate: '45deg' }],\n }}\n testID=\"vinaverse-launcher-tail\"\n />\n ) : null}\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={props.text}\n onPress={props.onOpen}\n style={{\n flexShrink: 1,\n paddingVertical: space.sm,\n paddingLeft: space.md,\n }}\n >\n <Text style={{ color: colors.background, fontSize: font.size.md }}>\n {props.text}\n </Text>\n </Pressable>\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={props.closeLabel}\n onPress={props.onClose}\n style={{\n minWidth: 44,\n minHeight: 44,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n testID=\"vinaverse-launcher-close\"\n >\n <Text style={{ color: colors.background, fontSize: font.size.md }}>\n ×\n </Text>\n </Pressable>\n </View>\n );\n}\n\n/** The kit's round button: the app's mark, else the agent name's first letter; its ring and shadow as asked. */\nexport function LauncherButton(props: LauncherButtonProps): ReactNode {\n const { colors, font } = useTheme();\n const { Mark, ring } = props;\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={props.label}\n onPress={props.onPress}\n style={({ pressed }) => ({\n width: LAUNCHER_SIZE,\n height: LAUNCHER_SIZE,\n borderRadius: LAUNCHER_SIZE / 2,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: colors.primary,\n opacity: pressed ? 0.85 : 1,\n ...(ring ? { borderWidth: ring.width, borderColor: ring.color } : {}),\n ...(props.shadow\n ? {\n elevation: 6,\n shadowColor: '#000',\n shadowOpacity: 0.2,\n shadowRadius: 8,\n shadowOffset: { width: 0, height: 3 },\n }\n : {}),\n })}\n testID=\"vinaverse-launcher-button\"\n >\n {Mark ? (\n <Mark size={34} color={colors.onPrimary} />\n ) : (\n <Text\n style={{\n color: colors.onPrimary,\n fontSize: font.size.lg,\n fontWeight: '600',\n }}\n >\n {(props.name.trim()[0] ?? '?').toUpperCase()}\n </Text>\n )}\n </Pressable>\n );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk272ACDLI_cjs = require('./chunk-272ACDLI.cjs');
|
|
4
|
+
var chunkUMCOOQT6_cjs = require('./chunk-UMCOOQT6.cjs');
|
|
5
5
|
var agent = require('@vinaverse/react/agent');
|
|
6
6
|
var react = require('@vinaverse/react');
|
|
7
7
|
var react$1 = require('react');
|
|
@@ -12,7 +12,7 @@ var tokens = require('@vinaverse/tokens');
|
|
|
12
12
|
|
|
13
13
|
function DefaultComposer(props) {
|
|
14
14
|
const { t, direction } = react.useCopy();
|
|
15
|
-
const { colors, radius, space, font, size } =
|
|
15
|
+
const { colors, radius, space, font, size } = chunkUMCOOQT6_cjs.useTheme();
|
|
16
16
|
const [text, setText] = react$1.useState("");
|
|
17
17
|
const length = conversation.codePoints(text);
|
|
18
18
|
const canSend = text.trim().length > 0 && length <= conversation.MAX_TEXT;
|
|
@@ -65,14 +65,14 @@ function DefaultComposer(props) {
|
|
|
65
65
|
}
|
|
66
66
|
),
|
|
67
67
|
props.responding && !text ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
68
|
-
|
|
68
|
+
chunk272ACDLI_cjs.Button,
|
|
69
69
|
{
|
|
70
70
|
label: t("stop"),
|
|
71
71
|
onPress: props.onStop,
|
|
72
72
|
testID: "vinaverse-stop"
|
|
73
73
|
}
|
|
74
74
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
75
|
-
|
|
75
|
+
chunk272ACDLI_cjs.Button,
|
|
76
76
|
{
|
|
77
77
|
label: t("send"),
|
|
78
78
|
variant: "primary",
|
|
@@ -86,7 +86,7 @@ function DefaultComposer(props) {
|
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
var Composer = /* @__PURE__ */ react$1.memo(function Composer2(props) {
|
|
89
|
-
const { store, slots } =
|
|
89
|
+
const { store, slots } = chunk272ACDLI_cjs.useChat();
|
|
90
90
|
const { t } = react.useCopy();
|
|
91
91
|
const takeover = react.useConversationSelector(store, (v) => v.takeover);
|
|
92
92
|
const name = react.useConversationSelector(store, (v) => v.agent.name);
|
|
@@ -112,7 +112,7 @@ var Composer = /* @__PURE__ */ react$1.memo(function Composer2(props) {
|
|
|
112
112
|
});
|
|
113
113
|
var CONNECTING_DELAY = tokens.motion.bannerDelay;
|
|
114
114
|
var StatusBanner = /* @__PURE__ */ react$1.memo(function StatusBanner2() {
|
|
115
|
-
const { store, slots } =
|
|
115
|
+
const { store, slots } = chunk272ACDLI_cjs.useChat();
|
|
116
116
|
const { t } = react.useCopy();
|
|
117
117
|
const banner = react.useConversationSelector(store, (v) => v.banner);
|
|
118
118
|
const status = react.useConversationSelector(store, (v) => v.status);
|
|
@@ -139,7 +139,7 @@ var StatusBanner = /* @__PURE__ */ react$1.memo(function StatusBanner2() {
|
|
|
139
139
|
if (banner === null || banner === "connecting" && !late) return null;
|
|
140
140
|
if (banner === "unavailable")
|
|
141
141
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
142
|
-
|
|
142
|
+
chunk272ACDLI_cjs.FailureSlot,
|
|
143
143
|
{
|
|
144
144
|
slot: slots.Unavailable,
|
|
145
145
|
state: unavailable,
|
|
@@ -153,14 +153,14 @@ var StatusBanner = /* @__PURE__ */ react$1.memo(function StatusBanner2() {
|
|
|
153
153
|
continued_elsewhere: t("bannerContinuedElsewhere")
|
|
154
154
|
}[banner];
|
|
155
155
|
const action = banner === "continued_elsewhere" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
156
|
-
|
|
156
|
+
chunk272ACDLI_cjs.Button,
|
|
157
157
|
{
|
|
158
158
|
label: t("continueHere"),
|
|
159
159
|
variant: "text",
|
|
160
160
|
onPress: () => void store.continueHere()
|
|
161
161
|
}
|
|
162
162
|
) : banner === "offline" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
163
|
-
|
|
163
|
+
chunk272ACDLI_cjs.Button,
|
|
164
164
|
{
|
|
165
165
|
label: t("tryAgain"),
|
|
166
166
|
variant: "text",
|
|
@@ -173,12 +173,12 @@ function DefaultUnavailable(props) {
|
|
|
173
173
|
const { t } = react.useCopy();
|
|
174
174
|
const { retry } = props.state;
|
|
175
175
|
return /* @__PURE__ */ jsxRuntime.jsxs(Banner, { text: t("bannerUnavailable"), children: [
|
|
176
|
-
retry ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
177
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
176
|
+
retry ? /* @__PURE__ */ jsxRuntime.jsx(chunk272ACDLI_cjs.Button, { label: t("tryAgain"), variant: "text", onPress: retry }) : null,
|
|
177
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk272ACDLI_cjs.FailureActionButton, { state: props.state })
|
|
178
178
|
] });
|
|
179
179
|
}
|
|
180
180
|
function Banner(props) {
|
|
181
|
-
const { colors, space, font } =
|
|
181
|
+
const { colors, space, font } = chunkUMCOOQT6_cjs.useTheme();
|
|
182
182
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
183
183
|
reactNative.View,
|
|
184
184
|
{
|
|
@@ -215,8 +215,13 @@ function VinaverseChatProvider(props) {
|
|
|
215
215
|
agentAvatar,
|
|
216
216
|
timeZone,
|
|
217
217
|
starters,
|
|
218
|
-
imagePolicy
|
|
218
|
+
imagePolicy,
|
|
219
|
+
welcomeChips,
|
|
220
|
+
listHeader,
|
|
221
|
+
disclosure
|
|
219
222
|
} = props;
|
|
223
|
+
const times = props.messageTimes ?? true;
|
|
224
|
+
const messageTimes = times === false ? null : times === true ? 10 : times.gapMinutes ?? 10;
|
|
220
225
|
const handlers = react$1.useRef(props);
|
|
221
226
|
handlers.current = props;
|
|
222
227
|
const slots = useStableSlots(components);
|
|
@@ -235,7 +240,11 @@ function VinaverseChatProvider(props) {
|
|
|
235
240
|
timeZone,
|
|
236
241
|
failureAction,
|
|
237
242
|
starters,
|
|
238
|
-
imagePolicy
|
|
243
|
+
imagePolicy,
|
|
244
|
+
messageTimes,
|
|
245
|
+
welcomeChips: welcomeChips !== false,
|
|
246
|
+
listHeader,
|
|
247
|
+
disclosure
|
|
239
248
|
}),
|
|
240
249
|
[
|
|
241
250
|
conversation,
|
|
@@ -244,17 +253,21 @@ function VinaverseChatProvider(props) {
|
|
|
244
253
|
timeZone,
|
|
245
254
|
failureAction,
|
|
246
255
|
starters,
|
|
247
|
-
imagePolicy
|
|
256
|
+
imagePolicy,
|
|
257
|
+
messageTimes,
|
|
258
|
+
welcomeChips,
|
|
259
|
+
listHeader,
|
|
260
|
+
disclosure
|
|
248
261
|
]
|
|
249
262
|
);
|
|
250
|
-
|
|
263
|
+
chunkUMCOOQT6_cjs.useNativeLifecycle(conversation);
|
|
251
264
|
react$1.useEffect(() => {
|
|
252
265
|
conversation.start();
|
|
253
266
|
}, [conversation]);
|
|
254
267
|
const { onWarning, theme, copy } = props;
|
|
255
268
|
react$1.useEffect(() => {
|
|
256
269
|
if (!onWarning) return;
|
|
257
|
-
for (const problem of
|
|
270
|
+
for (const problem of chunkUMCOOQT6_cjs.themeProblems(theme))
|
|
258
271
|
onWarning(`Vinaverse theme: ${problem}`, { code: "theme" });
|
|
259
272
|
for (const key of react.bannedWordsIn(copy ?? {}))
|
|
260
273
|
onWarning(
|
|
@@ -262,10 +275,13 @@ function VinaverseChatProvider(props) {
|
|
|
262
275
|
{ code: "copy" }
|
|
263
276
|
);
|
|
264
277
|
}, [onWarning, theme, copy]);
|
|
265
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.CopyProvider, { locale: props.locale, copy: props.copy, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
278
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.CopyProvider, { locale: props.locale, copy: props.copy, children: /* @__PURE__ */ jsxRuntime.jsx(chunkUMCOOQT6_cjs.ThemeProvider, { theme: props.theme, colorScheme: props.colorScheme, children: /* @__PURE__ */ jsxRuntime.jsx(chunk272ACDLI_cjs.ChatContextProvider, { value, children: props.children }) }) });
|
|
266
279
|
}
|
|
267
280
|
function VinaverseChat(props) {
|
|
268
|
-
return /* @__PURE__ */ jsxRuntime.jsx(VinaverseChatProvider, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
281
|
+
return /* @__PURE__ */ jsxRuntime.jsx(VinaverseChatProvider, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ChatBody, { ...props }) });
|
|
282
|
+
}
|
|
283
|
+
function ChatBody(props) {
|
|
284
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
269
285
|
Layout,
|
|
270
286
|
{
|
|
271
287
|
hideHeader: props.hideHeader === true,
|
|
@@ -277,10 +293,10 @@ function VinaverseChat(props) {
|
|
|
277
293
|
suggestionTestID: props.suggestionTestID ?? "vinaverse-suggestion",
|
|
278
294
|
footer: props.footer
|
|
279
295
|
}
|
|
280
|
-
)
|
|
296
|
+
);
|
|
281
297
|
}
|
|
282
298
|
function Layout(props) {
|
|
283
|
-
const { colors } =
|
|
299
|
+
const { colors } = chunkUMCOOQT6_cjs.useTheme();
|
|
284
300
|
const { direction } = react.useCopy();
|
|
285
301
|
const { onError } = props;
|
|
286
302
|
const reportError = react$1.useMemo(
|
|
@@ -297,10 +313,10 @@ function Layout(props) {
|
|
|
297
313
|
props.style
|
|
298
314
|
],
|
|
299
315
|
children: [
|
|
300
|
-
props.hideHeader ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
301
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
316
|
+
props.hideHeader ? null : /* @__PURE__ */ jsxRuntime.jsx(chunk272ACDLI_cjs.ChatHeader, {}),
|
|
317
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk272ACDLI_cjs.DisclosureBar, {}),
|
|
302
318
|
/* @__PURE__ */ jsxRuntime.jsx(StatusBanner, {}),
|
|
303
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
319
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(chunk272ACDLI_cjs.MessageList, {}) }),
|
|
304
320
|
props.suggestion ? /* @__PURE__ */ jsxRuntime.jsx(Suggestion, { chip: props.suggestion, testID: props.suggestionTestID }) : null,
|
|
305
321
|
/* @__PURE__ */ jsxRuntime.jsx(Composer, { ...reportError ? { onError: reportError } : {} }),
|
|
306
322
|
props.footer
|
|
@@ -309,10 +325,10 @@ function Layout(props) {
|
|
|
309
325
|
);
|
|
310
326
|
}
|
|
311
327
|
function Suggestion(props) {
|
|
312
|
-
const { store, handlers } =
|
|
313
|
-
const { space } =
|
|
328
|
+
const { store, handlers } = chunk272ACDLI_cjs.useChat();
|
|
329
|
+
const { space } = chunkUMCOOQT6_cjs.useTheme();
|
|
314
330
|
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { paddingHorizontal: space.lg, alignItems: "flex-start" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
315
|
-
|
|
331
|
+
chunk272ACDLI_cjs.Button,
|
|
316
332
|
{
|
|
317
333
|
label: props.chip.label,
|
|
318
334
|
testID: props.testID,
|
|
@@ -346,6 +362,8 @@ function AgentChat(props) {
|
|
|
346
362
|
agentKey,
|
|
347
363
|
place,
|
|
348
364
|
entryPoint,
|
|
365
|
+
entry,
|
|
366
|
+
anchor,
|
|
349
367
|
askAbout,
|
|
350
368
|
onContact,
|
|
351
369
|
onOpenPrivacy,
|
|
@@ -356,16 +374,26 @@ function AgentChat(props) {
|
|
|
356
374
|
...chat
|
|
357
375
|
} = props;
|
|
358
376
|
const runtime = agent.useAgentRuntime();
|
|
359
|
-
|
|
377
|
+
chunkUMCOOQT6_cjs.useAgentSweep(runtime);
|
|
378
|
+
const { preview, ...told } = place ?? {};
|
|
360
379
|
const { conversation, state, startNew } = agent.useAgentConversation(agentKey, {
|
|
361
|
-
place: place
|
|
362
|
-
entryPoint: entryPoint ?? null
|
|
380
|
+
place: place ? told : null,
|
|
381
|
+
entryPoint: entryPoint ?? null,
|
|
382
|
+
anchor: anchor ?? null,
|
|
383
|
+
entry: entry ?? null
|
|
363
384
|
});
|
|
364
385
|
const store = conversation.store;
|
|
365
386
|
const spoke = react.useConversationSelector(
|
|
366
387
|
store,
|
|
367
388
|
(v) => v.items.some((i) => i.type === "message" && i.role === "person")
|
|
368
389
|
);
|
|
390
|
+
const aboutType = anchor?.type ?? place?.entity?.type;
|
|
391
|
+
const verified = react.useConversationSelector(
|
|
392
|
+
store,
|
|
393
|
+
(v) => v.items.some(
|
|
394
|
+
(i) => i.type === "card" && i.card.kind === "anchor" && i.card.card.anchor?.anchor_type === aboutType
|
|
395
|
+
)
|
|
396
|
+
);
|
|
369
397
|
const { Ended, Unreachable, UnavailableScreen, Footer, ...slots } = components ?? {};
|
|
370
398
|
const copy = react$1.useMemo(
|
|
371
399
|
() => agentName ? { ...props.copy, agentFallbackName: agentName } : props.copy,
|
|
@@ -405,6 +433,7 @@ function AgentChat(props) {
|
|
|
405
433
|
conversation: store,
|
|
406
434
|
components: slots
|
|
407
435
|
};
|
|
436
|
+
let screen = null;
|
|
408
437
|
if (state.failure === "ended") {
|
|
409
438
|
const own = {
|
|
410
439
|
onStartNew: startNew,
|
|
@@ -412,41 +441,62 @@ function AgentChat(props) {
|
|
|
412
441
|
code: state.code,
|
|
413
442
|
onContact
|
|
414
443
|
};
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
if (state.failure === "unreachable") {
|
|
444
|
+
screen = Ended ? /* @__PURE__ */ jsxRuntime.jsx(Ended, { ...own, Default: DefaultEnded }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultEnded, { ...own });
|
|
445
|
+
} else if (state.failure === "unreachable") {
|
|
418
446
|
const own = {
|
|
419
447
|
onRetry: conversation.retry,
|
|
420
448
|
reason: state.reason,
|
|
421
449
|
onContact
|
|
422
450
|
};
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
if (state.failure === "unavailable") {
|
|
451
|
+
screen = Unreachable ? /* @__PURE__ */ jsxRuntime.jsx(Unreachable, { ...own, Default: DefaultUnreachable }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultUnreachable, { ...own });
|
|
452
|
+
} else if (state.failure === "unavailable") {
|
|
426
453
|
const own = {
|
|
427
454
|
reason: state.reason,
|
|
428
455
|
code: state.code,
|
|
429
456
|
onContact,
|
|
430
457
|
onRetry: conversation.retry
|
|
431
458
|
};
|
|
432
|
-
|
|
459
|
+
screen = UnavailableScreen ? /* @__PURE__ */ jsxRuntime.jsx(UnavailableScreen, { ...own, Default: DefaultUnavailableScreen }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultUnavailableScreen, { ...own });
|
|
433
460
|
}
|
|
434
461
|
const offered = opener && !spoke ? opener : null;
|
|
462
|
+
const shownTitle = preview && !verified ? preview.title : null;
|
|
463
|
+
const shownPhoto = preview?.image_url;
|
|
464
|
+
const header = react$1.useMemo(
|
|
465
|
+
() => shownTitle === null ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
466
|
+
Provisional,
|
|
467
|
+
{
|
|
468
|
+
preview: {
|
|
469
|
+
title: shownTitle,
|
|
470
|
+
...shownPhoto ? { image_url: shownPhoto } : {}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
),
|
|
474
|
+
[shownTitle, shownPhoto]
|
|
475
|
+
);
|
|
476
|
+
const leads = !offered && !spoke && !!askAbout && !!place?.entity;
|
|
435
477
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
436
|
-
|
|
478
|
+
VinaverseChatProvider,
|
|
437
479
|
{
|
|
438
480
|
...shared,
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
481
|
+
welcomeChips: !leads,
|
|
482
|
+
listHeader: header,
|
|
483
|
+
children: screen ? /* @__PURE__ */ jsxRuntime.jsx(Centered, { children: /* @__PURE__ */ jsxRuntime.jsx(ScreenMode.Provider, { value: agentKey.mode, children: screen }) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
484
|
+
ChatBody,
|
|
443
485
|
{
|
|
444
|
-
|
|
445
|
-
state,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
486
|
+
...shared,
|
|
487
|
+
suggestion: offered ?? ((leads || state.moved) && askAbout ? { label: askAbout, message: askAbout } : null),
|
|
488
|
+
...offered ? { suggestionTestID: openerTestID ?? "vinaverse-opener" } : {},
|
|
489
|
+
footer: Footer === null ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
490
|
+
FooterFor,
|
|
491
|
+
{
|
|
492
|
+
store,
|
|
493
|
+
state,
|
|
494
|
+
rate: conversation.rate,
|
|
495
|
+
canRate: conversation.canRate,
|
|
496
|
+
Footer,
|
|
497
|
+
onOpenPrivacy
|
|
498
|
+
}
|
|
499
|
+
)
|
|
450
500
|
}
|
|
451
501
|
)
|
|
452
502
|
}
|
|
@@ -475,8 +525,38 @@ function newestWholeReply(view) {
|
|
|
475
525
|
}
|
|
476
526
|
return null;
|
|
477
527
|
}
|
|
528
|
+
var ScreenMode = /* @__PURE__ */ react$1.createContext(void 0);
|
|
529
|
+
function Provisional(props) {
|
|
530
|
+
const { title, image_url } = props.preview;
|
|
531
|
+
const { slots, imagePolicy } = chunk272ACDLI_cjs.useChat();
|
|
532
|
+
const { t } = react.useCopy();
|
|
533
|
+
const { radius, space } = chunkUMCOOQT6_cjs.useTheme();
|
|
534
|
+
const url = chunk272ACDLI_cjs.allowedImage(image_url, imagePolicy?.hosts);
|
|
535
|
+
const Img = slots.Image ?? reactNative.Image;
|
|
536
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
537
|
+
chunk272ACDLI_cjs.CardFrame,
|
|
538
|
+
{
|
|
539
|
+
label: `${t("askingAbout")} ${title}`,
|
|
540
|
+
testID: "vinaverse-ask-preview",
|
|
541
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { flexDirection: "row", gap: space.sm }, children: [
|
|
542
|
+
url ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
543
|
+
Img,
|
|
544
|
+
{
|
|
545
|
+
source: { uri: url },
|
|
546
|
+
style: { width: 40, height: 40, borderRadius: radius.md },
|
|
547
|
+
testID: "vinaverse-ask-preview-photo"
|
|
548
|
+
}
|
|
549
|
+
) : null,
|
|
550
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { flex: 1 }, children: [
|
|
551
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk272ACDLI_cjs.Body, { muted: true, children: t("askingAbout") }),
|
|
552
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunk272ACDLI_cjs.Title, { numberOfLines: 1, children: title })
|
|
553
|
+
] })
|
|
554
|
+
] })
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
}
|
|
478
558
|
function Centered(props) {
|
|
479
|
-
const { colors, space } =
|
|
559
|
+
const { colors, space } = chunkUMCOOQT6_cjs.useTheme();
|
|
480
560
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
481
561
|
reactNative.View,
|
|
482
562
|
{
|
|
@@ -492,7 +572,7 @@ function Centered(props) {
|
|
|
492
572
|
);
|
|
493
573
|
}
|
|
494
574
|
function Notice(props) {
|
|
495
|
-
const { colors, space, font } =
|
|
575
|
+
const { colors, space, font } = chunkUMCOOQT6_cjs.useTheme();
|
|
496
576
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
497
577
|
reactNative.View,
|
|
498
578
|
{
|
|
@@ -523,7 +603,7 @@ function Notice(props) {
|
|
|
523
603
|
}
|
|
524
604
|
),
|
|
525
605
|
props.action && props.onPress ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
526
|
-
|
|
606
|
+
chunk272ACDLI_cjs.Button,
|
|
527
607
|
{
|
|
528
608
|
label: props.action,
|
|
529
609
|
variant: "primary",
|
|
@@ -548,7 +628,7 @@ function DefaultEnded(props) {
|
|
|
548
628
|
}
|
|
549
629
|
function DefaultUnavailableScreen(props) {
|
|
550
630
|
const { t } = react.useCopy();
|
|
551
|
-
const name = agent.useAgentName(t("agentFallbackName"));
|
|
631
|
+
const name = agent.useAgentName(t("agentFallbackName"), react$1.useContext(ScreenMode));
|
|
552
632
|
const title = t("agentOff", { agent: name });
|
|
553
633
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
554
634
|
Notice,
|
|
@@ -561,7 +641,7 @@ function DefaultUnavailableScreen(props) {
|
|
|
561
641
|
}
|
|
562
642
|
function DefaultUnreachable(props) {
|
|
563
643
|
const { t } = react.useCopy();
|
|
564
|
-
const name = agent.useAgentName(t("agentFallbackName"));
|
|
644
|
+
const name = agent.useAgentName(t("agentFallbackName"), react$1.useContext(ScreenMode));
|
|
565
645
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
566
646
|
Notice,
|
|
567
647
|
{
|
|
@@ -574,7 +654,7 @@ function DefaultUnreachable(props) {
|
|
|
574
654
|
}
|
|
575
655
|
function AgentFooter(props) {
|
|
576
656
|
const { t } = react.useCopy();
|
|
577
|
-
const { colors, space, font } =
|
|
657
|
+
const { colors, space, font } = chunkUMCOOQT6_cjs.useTheme();
|
|
578
658
|
const muted = { color: colors.textMuted, fontSize: font.size.sm };
|
|
579
659
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
580
660
|
reactNative.View,
|
|
@@ -590,7 +670,7 @@ function AgentFooter(props) {
|
|
|
590
670
|
props.turnId === null ? null : props.rating ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: muted, children: t("helpfulThanks") }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
591
671
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: muted, children: t("helpful") }),
|
|
592
672
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
593
|
-
|
|
673
|
+
chunk272ACDLI_cjs.Button,
|
|
594
674
|
{
|
|
595
675
|
label: t("helpfulYes"),
|
|
596
676
|
variant: "text",
|
|
@@ -598,7 +678,7 @@ function AgentFooter(props) {
|
|
|
598
678
|
}
|
|
599
679
|
),
|
|
600
680
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
601
|
-
|
|
681
|
+
chunk272ACDLI_cjs.Button,
|
|
602
682
|
{
|
|
603
683
|
label: t("helpfulNo"),
|
|
604
684
|
variant: "text",
|
|
@@ -607,7 +687,7 @@ function AgentFooter(props) {
|
|
|
607
687
|
)
|
|
608
688
|
] }),
|
|
609
689
|
props.onOpenPrivacy ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
610
|
-
|
|
690
|
+
chunk272ACDLI_cjs.Button,
|
|
611
691
|
{
|
|
612
692
|
label: t("privacy"),
|
|
613
693
|
variant: "text",
|
|
@@ -676,5 +756,5 @@ exports.StatusBanner = StatusBanner;
|
|
|
676
756
|
exports.VinaverseChat = VinaverseChat;
|
|
677
757
|
exports.VinaverseChatProvider = VinaverseChatProvider;
|
|
678
758
|
exports.newestWholeReply = newestWholeReply;
|
|
679
|
-
//# sourceMappingURL=chunk-
|
|
680
|
-
//# sourceMappingURL=chunk-
|
|
759
|
+
//# sourceMappingURL=chunk-YVCMKSJG.cjs.map
|
|
760
|
+
//# sourceMappingURL=chunk-YVCMKSJG.cjs.map
|