@adminide-stack/yantra-mobile 12.0.137 → 12.0.139-alpha.0
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/lib/components/CustomDrawer.js +17 -1
- package/lib/components/CustomDrawer.js.map +1 -1
- package/lib/compute.js +106 -1
- package/lib/compute.js.map +1 -1
- package/lib/config/env-config.js +12 -0
- package/lib/config/env-config.js.map +1 -1
- package/lib/features/chat/ChatTranscript.js +2 -2
- package/lib/features/chat/ChatTranscript.js.map +1 -1
- package/lib/features/chat/surfaceNotes.js +4 -0
- package/lib/features/chat/surfaceNotes.js.map +1 -0
- package/lib/features/devices/readings.js.map +1 -1
- package/lib/features/devices/session.js +2 -22
- package/lib/features/devices/session.js.map +1 -1
- package/lib/features/dictate/backgroundRecording.js.map +1 -1
- package/lib/features/dictate/useDictationRecorder.js +42 -1
- package/lib/features/dictate/useDictationRecorder.js.map +1 -1
- package/lib/features/home/useHomeWeather.js +85 -0
- package/lib/features/home/useHomeWeather.js.map +1 -0
- package/lib/features/home/weather.js +139 -0
- package/lib/features/home/weather.js.map +1 -0
- package/lib/features/notion/NotionPageView.js +819 -0
- package/lib/features/notion/NotionPageView.js.map +1 -0
- package/lib/features/notion/NotionSheets.js +452 -0
- package/lib/features/notion/NotionSheets.js.map +1 -0
- package/lib/features/notion/NotionTrashSheet.js +415 -0
- package/lib/features/notion/NotionTrashSheet.js.map +1 -0
- package/lib/features/notion/NotionWorkspaceView.js +837 -0
- package/lib/features/notion/NotionWorkspaceView.js.map +1 -0
- package/lib/features/notion/notionBlocks.js +203 -0
- package/lib/features/notion/notionBlocks.js.map +1 -0
- package/lib/features/notion/notionDocuments.js +182 -0
- package/lib/features/notion/notionDocuments.js.map +1 -0
- package/lib/features/notion/notionEditorModel.js +180 -0
- package/lib/features/notion/notionEditorModel.js.map +1 -0
- package/lib/features/notion/notionTemplates.js +406 -0
- package/lib/features/notion/notionTemplates.js.map +1 -0
- package/lib/features/notion/notionTheme.js +34 -0
- package/lib/features/notion/notionTheme.js.map +1 -0
- package/lib/features/notion/notionTrash.js +100 -0
- package/lib/features/notion/notionTrash.js.map +1 -0
- package/lib/features/notion/notionUi.js +310 -0
- package/lib/features/notion/notionUi.js.map +1 -0
- package/lib/features/notion/useNotionWorkspace.js +181 -0
- package/lib/features/notion/useNotionWorkspace.js.map +1 -0
- package/lib/features/webbuilder/buildFragments.js +15 -9
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/buildJob.js +3 -3
- package/lib/features/webbuilder/buildJob.js.map +1 -1
- package/lib/features/webbuilder/publicSandboxDomain.js +5 -0
- package/lib/features/webbuilder/publicSandboxDomain.js.map +1 -0
- package/lib/features/webbuilder/sandboxPublicHost.js +74 -0
- package/lib/features/webbuilder/sandboxPublicHost.js.map +1 -0
- package/lib/features/webbuilder/siteAddress.js +2 -1
- package/lib/features/webbuilder/siteAddress.js.map +1 -1
- package/lib/features/webbuilder/webbuilderPrompts.js +3 -2
- package/lib/features/webbuilder/webbuilderPrompts.js.map +1 -1
- package/lib/features/webbuilder/workflow.js +2 -2
- package/lib/features/webbuilder/workflow.js.map +1 -1
- package/lib/hooks/useChatApi.js +15 -3
- package/lib/hooks/useChatApi.js.map +1 -1
- package/lib/hooks/usePrerequisiteIds.js +15 -2
- package/lib/hooks/usePrerequisiteIds.js.map +1 -1
- package/lib/routes.json +107 -0
- package/lib/screens/Devices/index.js +3 -205
- package/lib/screens/Devices/index.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js +20 -5
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/HomeHero.js +117 -0
- package/lib/screens/Home/components/HomeHero.js.map +1 -0
- package/lib/screens/Home/components/HomeSuggestions.js +108 -85
- package/lib/screens/Home/components/HomeSuggestions.js.map +1 -1
- package/lib/screens/Home/components/HomeWash.js +44 -0
- package/lib/screens/Home/components/HomeWash.js.map +1 -0
- package/lib/screens/Home/components/homeCatalog.js +125 -0
- package/lib/screens/Home/components/homeCatalog.js.map +1 -0
- package/lib/screens/Notion/index.js +18 -0
- package/lib/screens/Notion/index.js.map +1 -0
- package/lib/screens/NotionPage/index.js +19 -0
- package/lib/screens/NotionPage/index.js.map +1 -0
- package/lib/screens/WebBuilderNative/sandboxProxyApi.js +2 -2
- package/lib/screens/WebBuilderNative/sandboxProxyApi.js.map +1 -1
- package/lib/screens/WebBuilderNative/useRestoredSandboxes.js +16 -8
- package/lib/screens/WebBuilderNative/useRestoredSandboxes.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderGallery.js +6 -5
- package/lib/screens/WebBuilderNative/useWebBuilderGallery.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +5 -4
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
- package/lib/screens/WebBuilderNative/webbuilderTransport.js +4 -3
- package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
- package/lib/services/savedWorkspace.js +44 -0
- package/lib/services/savedWorkspace.js.map +1 -0
- package/lib/theme/mobileTokens.js +1 -0
- package/lib/theme/mobileTokens.js.map +1 -1
- package/package.json +4 -4
- package/lib/features/devices/bodyComposition.js +0 -116
- package/lib/features/devices/bodyComposition.js.map +0 -1
|
@@ -1,116 +1,139 @@
|
|
|
1
|
-
import {jsxs,jsx}from'react/jsx-runtime';import {useState,
|
|
2
|
-
id: "connect-apps",
|
|
3
|
-
label: "Connect your apps",
|
|
4
|
-
icon: "puzzle-outline",
|
|
5
|
-
prompt: "Show me which apps I can connect, and help me connect the ones I use daily."
|
|
6
|
-
}, {
|
|
7
|
-
id: "design",
|
|
8
|
-
label: "Design a landing page",
|
|
9
|
-
icon: "palette-outline",
|
|
10
|
-
prompt: "Design a landing page for my product. Start with the hero and the pricing section."
|
|
11
|
-
}, {
|
|
12
|
-
id: "canvas",
|
|
13
|
-
label: "Open a canvas",
|
|
14
|
-
icon: "view-grid-outline",
|
|
15
|
-
prompt: "Open a canvas and help me lay out the assets for this project.",
|
|
16
|
-
nativeRoute: "MainStack.CanvasNative"
|
|
17
|
-
}, {
|
|
18
|
-
id: "poster",
|
|
19
|
-
label: "Turn a paper into a poster",
|
|
20
|
-
icon: "post-outline",
|
|
21
|
-
prompt: "Turn this research paper into a 48 x 36 inch conference poster I can edit and print."
|
|
22
|
-
}, {
|
|
23
|
-
id: "inbox",
|
|
24
|
-
label: "Get to inbox zero",
|
|
25
|
-
icon: "email-outline",
|
|
26
|
-
prompt: "Go through my inbox, tell me what actually needs a reply, and draft those replies."
|
|
27
|
-
}];
|
|
28
|
-
function HomeSuggestions({
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import {useState,useCallback}from'react';import {View,StyleSheet,Pressable}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {Text}from'@admin-layout/gluestack-ui-mobile';import {drawSuggestions}from'./homeCatalog.js';function HomeSuggestions({
|
|
29
2
|
isDark,
|
|
30
3
|
primaryTextColor,
|
|
31
4
|
secondaryTextColor,
|
|
32
5
|
onInjectPrompt,
|
|
33
6
|
onOpenRoute,
|
|
34
|
-
|
|
7
|
+
count = 4
|
|
35
8
|
}) {
|
|
36
|
-
const [
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/* @__PURE__ */ jsx(Pressable, { onPress: shuffle, hitSlop: 8, accessibilityRole: "button", accessibilityLabel: "Shuffle suggestions", style: ({
|
|
9
|
+
const [suggestions, setSuggestions] = useState(() => drawSuggestions(count));
|
|
10
|
+
const shuffle = useCallback(() => setSuggestions(drawSuggestions(count)), [count]);
|
|
11
|
+
const tileBg = isDark ? "rgba(246,174,49,0.14)" : "#FBEADB";
|
|
12
|
+
const tileInk = isDark ? "#F6B24A" : "#A84E09";
|
|
13
|
+
const cardBg = isDark ? "#111827" : "#FFFFFF";
|
|
14
|
+
const cardBorder = isDark ? "rgba(148,163,184,0.22)" : "#ECE7DF";
|
|
15
|
+
const divider = isDark ? "rgba(148,163,184,0.16)" : "#F1ECE4";
|
|
16
|
+
const pressedBg = isDark ? "rgba(148,163,184,0.10)" : "rgba(15,23,42,0.04)";
|
|
17
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.wrap, children: [
|
|
18
|
+
/* @__PURE__ */ jsxs(View, { style: styles.headingRow, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles.heading, {
|
|
20
|
+
color: primaryTextColor
|
|
21
|
+
}], children: "Start something" }),
|
|
22
|
+
/* @__PURE__ */ jsxs(Pressable, { onPress: shuffle, hitSlop: 8, accessibilityRole: "button", accessibilityLabel: "Shuffle suggestions", style: ({
|
|
51
23
|
pressed
|
|
52
|
-
}) => [styles.shuffle, pressed &&
|
|
24
|
+
}) => [styles.shuffle, pressed && {
|
|
25
|
+
backgroundColor: pressedBg
|
|
26
|
+
}], children: [
|
|
27
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "shuffle-variant", size: 16, color: secondaryTextColor }),
|
|
28
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.shuffleLabel, {
|
|
29
|
+
color: secondaryTextColor
|
|
30
|
+
}], children: "Shuffle" })
|
|
31
|
+
] })
|
|
53
32
|
] }),
|
|
54
|
-
/* @__PURE__ */ jsx(View, {
|
|
33
|
+
/* @__PURE__ */ jsx(View, { accessibilityRole: "list", style: [styles.card, {
|
|
34
|
+
backgroundColor: cardBg,
|
|
35
|
+
borderColor: cardBorder
|
|
36
|
+
}], children: suggestions.map((item, index) => /* @__PURE__ */ jsxs(Pressable, { onPress: () => item.nativeRoute && onOpenRoute ? onOpenRoute(item.nativeRoute) : onInjectPrompt(item.prompt, item.mode), accessibilityRole: "button", accessibilityLabel: item.label, accessibilityHint: item.hint, style: ({
|
|
55
37
|
pressed
|
|
56
|
-
}) => [styles.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
}) => [styles.row, pressed && {
|
|
39
|
+
backgroundColor: pressedBg
|
|
40
|
+
}], children: [
|
|
41
|
+
/* @__PURE__ */ jsx(View, { style: [styles.tile, {
|
|
42
|
+
backgroundColor: tileBg
|
|
43
|
+
}], children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: item.icon, size: 18, color: tileInk }) }),
|
|
44
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.rowBody, index > 0 && {
|
|
45
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
46
|
+
borderTopColor: divider
|
|
47
|
+
}], children: [
|
|
48
|
+
/* @__PURE__ */ jsxs(View, { style: styles.rowText, children: [
|
|
49
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.label, {
|
|
50
|
+
color: primaryTextColor
|
|
51
|
+
}], children: item.label }),
|
|
52
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.hint, {
|
|
53
|
+
color: secondaryTextColor
|
|
54
|
+
}], children: item.hint })
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "chevron-right", size: 20, color: secondaryTextColor })
|
|
57
|
+
] })
|
|
64
58
|
] }, item.id)) })
|
|
65
59
|
] });
|
|
66
60
|
}
|
|
67
61
|
const styles = StyleSheet.create({
|
|
68
62
|
wrap: {
|
|
69
63
|
width: "100%",
|
|
70
|
-
|
|
71
|
-
marginTop: 28,
|
|
72
|
-
alignItems: "center",
|
|
73
|
-
gap: 12
|
|
74
|
-
},
|
|
75
|
-
wrapCompact: {
|
|
76
|
-
marginTop: 12,
|
|
77
|
-
gap: 8
|
|
64
|
+
marginTop: 32
|
|
78
65
|
},
|
|
79
|
-
|
|
66
|
+
headingRow: {
|
|
80
67
|
flexDirection: "row",
|
|
81
68
|
alignItems: "center",
|
|
82
|
-
|
|
69
|
+
justifyContent: "space-between",
|
|
70
|
+
marginBottom: 10
|
|
83
71
|
},
|
|
84
|
-
|
|
85
|
-
fontSize:
|
|
72
|
+
heading: {
|
|
73
|
+
fontSize: 17,
|
|
74
|
+
fontWeight: "600",
|
|
75
|
+
letterSpacing: -0.2
|
|
86
76
|
},
|
|
87
77
|
shuffle: {
|
|
88
|
-
|
|
89
|
-
height: 28,
|
|
78
|
+
flexDirection: "row",
|
|
90
79
|
alignItems: "center",
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
gap: 5,
|
|
81
|
+
height: 32,
|
|
82
|
+
paddingHorizontal: 10,
|
|
83
|
+
marginRight: -10,
|
|
84
|
+
borderRadius: 999
|
|
85
|
+
},
|
|
86
|
+
shuffleLabel: {
|
|
87
|
+
fontSize: 14,
|
|
88
|
+
fontWeight: "500"
|
|
89
|
+
},
|
|
90
|
+
card: {
|
|
91
|
+
borderRadius: 16,
|
|
92
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
93
|
+
overflow: "hidden",
|
|
94
|
+
shadowColor: "#3C280A",
|
|
95
|
+
shadowOpacity: 0.06,
|
|
96
|
+
shadowRadius: 12,
|
|
97
|
+
shadowOffset: {
|
|
98
|
+
width: 0,
|
|
99
|
+
height: 4
|
|
100
|
+
},
|
|
101
|
+
elevation: 1
|
|
93
102
|
},
|
|
94
|
-
|
|
103
|
+
row: {
|
|
95
104
|
flexDirection: "row",
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
paddingLeft: 14
|
|
107
|
+
},
|
|
108
|
+
tile: {
|
|
109
|
+
width: 36,
|
|
110
|
+
height: 36,
|
|
111
|
+
borderRadius: 10,
|
|
112
|
+
alignItems: "center",
|
|
113
|
+
justifyContent: "center"
|
|
99
114
|
},
|
|
100
|
-
|
|
115
|
+
// Text and chevron share a body so the divider starts at the text, as iOS lists inset it.
|
|
116
|
+
rowBody: {
|
|
117
|
+
flex: 1,
|
|
101
118
|
flexDirection: "row",
|
|
102
119
|
alignItems: "center",
|
|
103
|
-
gap:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
120
|
+
gap: 8,
|
|
121
|
+
minHeight: 64,
|
|
122
|
+
marginLeft: 12,
|
|
123
|
+
paddingRight: 12,
|
|
124
|
+
paddingVertical: 10
|
|
108
125
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
126
|
+
rowText: {
|
|
127
|
+
flex: 1,
|
|
128
|
+
minWidth: 0
|
|
129
|
+
},
|
|
130
|
+
label: {
|
|
131
|
+
fontSize: 15,
|
|
132
|
+
fontWeight: "600"
|
|
112
133
|
},
|
|
113
|
-
|
|
114
|
-
|
|
134
|
+
hint: {
|
|
135
|
+
marginTop: 2,
|
|
136
|
+
fontSize: 13,
|
|
137
|
+
lineHeight: 18
|
|
115
138
|
}
|
|
116
139
|
});export{HomeSuggestions,HomeSuggestions as default};//# sourceMappingURL=HomeSuggestions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomeSuggestions.js","sources":["../../../../src/screens/Home/components/HomeSuggestions.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState } from 'react';\nimport { Pressable, StyleSheet, View } from 'react-native';\nimport { MaterialCommunityIcons } from '@expo/vector-icons';\nimport { Text } from '@admin-layout/gluestack-ui-mobile';\nimport { mobileTokens } from '../../../theme/mobileTokens';\nimport type { RoutingMode } from '../types';\n\ntype IconName = React.ComponentProps<typeof MaterialCommunityIcons>['name'];\n\ntype HomeSuggestion = {\n id: string;\n label: string;\n icon: IconName;\n prompt: string;\n mode?: RoutingMode;\n /** Navigate here instead of injecting the prompt, when the host wires\n * navigation - a real native screen beats asking the agent to open one. */\n nativeRoute?: string;\n};\n\n/** Same starter set the browser home shows under the composer. */\nconst HOME_SUGGESTIONS: readonly HomeSuggestion[] = [\n {\n id: 'connect-apps',\n label: 'Connect your apps',\n icon: 'puzzle-outline',\n prompt: 'Show me which apps I can connect, and help me connect the ones I use daily.',\n },\n {\n id: 'design',\n label: 'Design a landing page',\n icon: 'palette-outline',\n prompt: 'Design a landing page for my product. Start with the hero and the pricing section.',\n },\n {\n id: 'canvas',\n label: 'Open a canvas',\n icon: 'view-grid-outline',\n prompt: 'Open a canvas and help me lay out the assets for this project.',\n nativeRoute: 'MainStack.CanvasNative',\n },\n {\n id: 'poster',\n label: 'Turn a paper into a poster',\n icon: 'post-outline',\n prompt: 'Turn this research paper into a 48 x 36 inch conference poster I can edit and print.',\n },\n {\n id: 'inbox',\n label: 'Get to inbox zero',\n icon: 'email-outline',\n prompt: 'Go through my inbox, tell me what actually needs a reply, and draft those replies.',\n },\n];\n\nexport type HomeSuggestionsProps = {\n isDark: boolean;\n primaryTextColor: string;\n secondaryTextColor: string;\n onInjectPrompt: (prompt: string, mode?: RoutingMode) => void;\n /** Open a native screen by route name; absent -> prompt fallback. */\n onOpenRoute?: (name: string) => void;\n compact?: boolean;\n};\n\nexport function HomeSuggestions({\n isDark,\n primaryTextColor,\n secondaryTextColor,\n onInjectPrompt,\n onOpenRoute,\n compact = false,\n}: HomeSuggestionsProps) {\n const [seed, setSeed] = useState(0);\n const suggestions = useMemo(() => {\n const rotated = [...HOME_SUGGESTIONS];\n const offset = seed % rotated.length;\n return [...rotated.slice(offset), ...rotated.slice(0, offset)];\n }, [seed]);\n\n const shuffle = useCallback(() => setSeed((n) => n + 1), []);\n const borderColor = isDark ? 'rgba(148,163,184,0.28)' : '#e2e8f0';\n const chipBg = isDark ? '#1e293b' : mobileTokens.color.surface;\n\n return (\n <View style={[styles.wrap, compact ? styles.wrapCompact : null]}>\n <View style={styles.captionRow}>\n <Text style={[styles.caption, { color: secondaryTextColor }]}>Not sure where to start?</Text>\n <Pressable\n onPress={shuffle}\n hitSlop={8}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Shuffle suggestions\"\n style={({ pressed }) => [styles.shuffle, pressed && styles.pressed]}\n >\n <MaterialCommunityIcons name=\"shuffle-variant\" size={14} color={secondaryTextColor} />\n </Pressable>\n </View>\n <View style={styles.chips}>\n {suggestions.map((item) => (\n <Pressable\n key={item.id}\n onPress={() =>\n item.nativeRoute && onOpenRoute\n ? onOpenRoute(item.nativeRoute)\n : onInjectPrompt(item.prompt, item.mode)\n }\n accessibilityRole=\"button\"\n accessibilityLabel={item.label}\n style={({ pressed }) => [\n styles.chip,\n { borderColor, backgroundColor: chipBg },\n pressed && styles.pressed,\n ]}\n >\n <MaterialCommunityIcons name={item.icon} size={14} color={secondaryTextColor} />\n <Text style={[styles.chipLabel, { color: primaryTextColor }]}>{item.label}</Text>\n </Pressable>\n ))}\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n width: '100%',\n maxWidth: 420,\n marginTop: 28,\n alignItems: 'center',\n gap: 12,\n },\n wrapCompact: {\n marginTop: 12,\n gap: 8,\n },\n captionRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n caption: {\n fontSize: 13,\n },\n shuffle: {\n width: 28,\n height: 28,\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: 8,\n },\n chips: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'center',\n gap: 8,\n },\n chip: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n height: 34,\n paddingHorizontal: 12,\n borderRadius: 999,\n borderWidth: 1,\n },\n chipLabel: {\n fontSize: 13,\n fontWeight: '500',\n },\n pressed: {\n opacity: 0.72,\n },\n});\n\nexport default HomeSuggestions;\n"],"names":[],"mappings":"sTAmBA,MAAM,mBAA8C,CAAC;AAAA,EACnD,EAAI,EAAA,cAAA;AAAA,EACJ,KAAO,EAAA,mBAAA;AAAA,EACP,IAAM,EAAA,gBAAA;AAAA,EACN,MAAQ,EAAA;AACV,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,QAAA;AAAA,EACJ,KAAO,EAAA,uBAAA;A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ACA,KAAO,EAAA;AAAA,IACL,aAAe,EAAA,KAAA;AAAA,IACf,QAAU,EAAA,MAAA;AAAA,IACV,cAAgB,EAAA,QAAA;AAAA,IAChB,GAAK,EAAA;AAAA,GACP;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,aAAe,EAAA,KAAA;AAAA,IACf,UAAY,EAAA,QAAA;AAAA,IACZ,GAAK,EAAA,CAAA;AAAA,IACL,MAAQ,EAAA,EAAA;AAAA,IACR,iBAAmB,EAAA,EAAA;AAAA,IACnB,YAAc,EAAA,GAAA;AAAA,IACd,WAAa,EAAA;AAAA,GACf;AAAA,EACA,SAAW,EAAA;AAAA,IACT,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA;AAAA,GACd;AAAA,EACA,OAAS,EAAA;AAAA,IACP,OAAS,EAAA;AAAA;AAEb,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"HomeSuggestions.js","sources":["../../../../src/screens/Home/components/HomeSuggestions.tsx"],"sourcesContent":["/**\n * \"Start something\" on the chat home, as the web's `HomeSuggestions` (features/chat/home-suggestions):\n * four things Yantra can actually do, as rows that say what each one is for, and Shuffle to see\n * others. A row does not send: it puts its prompt in the composer to edit first (Canvas, which has\n * a native screen, opens it). The catalogue is the web's `YANTRA_SUGGESTIONS`, with the glyphs the\n * mobile Apps launcher uses for the same capabilities.\n */\nimport React, { useCallback, useState } from 'react';\nimport { Pressable, StyleSheet, View } from 'react-native';\nimport { MaterialCommunityIcons } from '@expo/vector-icons';\nimport { Text } from '@admin-layout/gluestack-ui-mobile';\nimport type { RoutingMode } from '../types';\nimport { drawSuggestions } from './homeCatalog';\n\nexport type HomeSuggestionsProps = {\n isDark: boolean;\n primaryTextColor: string;\n secondaryTextColor: string;\n onInjectPrompt: (prompt: string, mode?: RoutingMode) => void;\n /** Open a native screen by route name; absent -> prompt fallback. */\n onOpenRoute?: (name: string) => void;\n /** How many rows show at once (the web's phone shows four). */\n count?: number;\n};\n\nexport function HomeSuggestions({\n isDark,\n primaryTextColor,\n secondaryTextColor,\n onInjectPrompt,\n onOpenRoute,\n count = 4,\n}: HomeSuggestionsProps) {\n const [suggestions, setSuggestions] = useState(() => drawSuggestions(count));\n const shuffle = useCallback(() => setSuggestions(drawSuggestions(count)), [count]);\n\n // The web's accent pair (--yr-accent-soft / --yr-accent-ink), so the tiles carry the brand.\n const tileBg = isDark ? 'rgba(246,174,49,0.14)' : '#FBEADB';\n const tileInk = isDark ? '#F6B24A' : '#A84E09';\n const cardBg = isDark ? '#111827' : '#FFFFFF';\n const cardBorder = isDark ? 'rgba(148,163,184,0.22)' : '#ECE7DF';\n const divider = isDark ? 'rgba(148,163,184,0.16)' : '#F1ECE4';\n const pressedBg = isDark ? 'rgba(148,163,184,0.10)' : 'rgba(15,23,42,0.04)';\n\n return (\n <View style={styles.wrap}>\n <View style={styles.headingRow}>\n <Text accessibilityRole=\"header\" style={[styles.heading, { color: primaryTextColor }]}>\n Start something\n </Text>\n <Pressable\n onPress={shuffle}\n hitSlop={8}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Shuffle suggestions\"\n style={({ pressed }) => [styles.shuffle, pressed && { backgroundColor: pressedBg }]}\n >\n <MaterialCommunityIcons name=\"shuffle-variant\" size={16} color={secondaryTextColor} />\n <Text style={[styles.shuffleLabel, { color: secondaryTextColor }]}>Shuffle</Text>\n </Pressable>\n </View>\n <View accessibilityRole=\"list\" style={[styles.card, { backgroundColor: cardBg, borderColor: cardBorder }]}>\n {suggestions.map((item, index) => (\n <Pressable\n key={item.id}\n onPress={() =>\n item.nativeRoute && onOpenRoute\n ? onOpenRoute(item.nativeRoute)\n : onInjectPrompt(item.prompt, item.mode)\n }\n accessibilityRole=\"button\"\n accessibilityLabel={item.label}\n accessibilityHint={item.hint}\n style={({ pressed }) => [styles.row, pressed && { backgroundColor: pressedBg }]}\n >\n <View style={[styles.tile, { backgroundColor: tileBg }]}>\n <MaterialCommunityIcons name={item.icon} size={18} color={tileInk} />\n </View>\n <View\n style={[\n styles.rowBody,\n index > 0 && { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: divider },\n ]}\n >\n <View style={styles.rowText}>\n <Text numberOfLines={1} style={[styles.label, { color: primaryTextColor }]}>\n {item.label}\n </Text>\n <Text numberOfLines={1} style={[styles.hint, { color: secondaryTextColor }]}>\n {item.hint}\n </Text>\n </View>\n <MaterialCommunityIcons name=\"chevron-right\" size={20} color={secondaryTextColor} />\n </View>\n </Pressable>\n ))}\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n width: '100%',\n marginTop: 32,\n },\n headingRow: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n marginBottom: 10,\n },\n heading: {\n fontSize: 17,\n fontWeight: '600',\n letterSpacing: -0.2,\n },\n shuffle: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 5,\n height: 32,\n paddingHorizontal: 10,\n marginRight: -10,\n borderRadius: 999,\n },\n shuffleLabel: {\n fontSize: 14,\n fontWeight: '500',\n },\n card: {\n borderRadius: 16,\n borderWidth: StyleSheet.hairlineWidth,\n overflow: 'hidden',\n shadowColor: '#3C280A',\n shadowOpacity: 0.06,\n shadowRadius: 12,\n shadowOffset: { width: 0, height: 4 },\n elevation: 1,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingLeft: 14,\n },\n tile: {\n width: 36,\n height: 36,\n borderRadius: 10,\n alignItems: 'center',\n justifyContent: 'center',\n },\n // Text and chevron share a body so the divider starts at the text, as iOS lists inset it.\n rowBody: {\n flex: 1,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n minHeight: 64,\n marginLeft: 12,\n paddingRight: 12,\n paddingVertical: 10,\n },\n rowText: {\n flex: 1,\n minWidth: 0,\n },\n label: {\n fontSize: 15,\n fontWeight: '600',\n },\n hint: {\n marginTop: 2,\n fontSize: 13,\n lineHeight: 18,\n },\n});\n\nexport default HomeSuggestions;\n"],"names":[],"mappings":"mSAuBO,SAAS,eAAgB,C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AAA;AAAA,IACL,SAAW,EAAA,EAAA;AAAA,IACX,UAAY,EAAA,EAAA;AAAA,IACZ,YAAc,EAAA,EAAA;AAAA,IACd,eAAiB,EAAA;AAAA,GACnB;AAAA,EACA,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,CAAA;AAAA,IACN,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,KAAO,EAAA;AAAA,IACL,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA;AAAA,GACd;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,SAAW,EAAA,CAAA;AAAA,IACX,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA;AAAA;AAEhB,CAAC,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';import {View,StyleSheet}from'react-native';import Svg,{Defs,RadialGradient,Stop,Rect}from'react-native-svg';const WASH = {
|
|
2
|
+
light: {
|
|
3
|
+
top: {
|
|
4
|
+
color: "#E6730F",
|
|
5
|
+
opacity: 0.09
|
|
6
|
+
},
|
|
7
|
+
mid: {
|
|
8
|
+
color: "#F6AE31",
|
|
9
|
+
opacity: 0.08
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
dark: {
|
|
13
|
+
top: {
|
|
14
|
+
color: "#F6AE31",
|
|
15
|
+
opacity: 0.07
|
|
16
|
+
},
|
|
17
|
+
mid: {
|
|
18
|
+
color: "#E6730F",
|
|
19
|
+
opacity: 0.05
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function HomeWash({
|
|
24
|
+
isDark
|
|
25
|
+
}) {
|
|
26
|
+
const {
|
|
27
|
+
top,
|
|
28
|
+
mid
|
|
29
|
+
} = isDark ? WASH.dark : WASH.light;
|
|
30
|
+
return /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: StyleSheet.absoluteFill, children: /* @__PURE__ */ jsxs(Svg, { width: "100%", height: "100%", children: [
|
|
31
|
+
/* @__PURE__ */ jsxs(Defs, { children: [
|
|
32
|
+
/* @__PURE__ */ jsxs(RadialGradient, { id: "homeWashTop", cx: "50%", cy: "0%", rx: "70%", ry: "52%", fx: "50%", fy: "0%", children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0", stopColor: top.color, stopOpacity: top.opacity }),
|
|
34
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0.72", stopColor: top.color, stopOpacity: 0 })
|
|
35
|
+
] }),
|
|
36
|
+
/* @__PURE__ */ jsxs(RadialGradient, { id: "homeWashMid", cx: "50%", cy: "48%", rx: "55%", ry: "40%", fx: "50%", fy: "48%", children: [
|
|
37
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0", stopColor: mid.color, stopOpacity: mid.opacity }),
|
|
38
|
+
/* @__PURE__ */ jsx(Stop, { offset: "0.7", stopColor: mid.color, stopOpacity: 0 })
|
|
39
|
+
] })
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ jsx(Rect, { width: "100%", height: "100%", fill: "url(#homeWashMid)" }),
|
|
42
|
+
/* @__PURE__ */ jsx(Rect, { width: "100%", height: "100%", fill: "url(#homeWashTop)" })
|
|
43
|
+
] }) });
|
|
44
|
+
}export{HomeWash,HomeWash as default};//# sourceMappingURL=HomeWash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomeWash.js","sources":["../../../../src/screens/Home/components/HomeWash.tsx"],"sourcesContent":["/**\n * The web chat home's static brand wash (`.yr-chat-col:has(.yr-home)` in homeStyles): a light\n * orange glow from the top centre and a fainter amber one at mid-height, over the screen colour.\n * Drawn behind the empty home only; it never moves and takes no touches.\n */\nimport React from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport Svg, { Defs, RadialGradient, Rect, Stop } from 'react-native-svg';\n\n/** The web's `--yr-wash` / `--yr-wash-2`, light and dark. */\nconst WASH = {\n light: { top: { color: '#E6730F', opacity: 0.09 }, mid: { color: '#F6AE31', opacity: 0.08 } },\n dark: { top: { color: '#F6AE31', opacity: 0.07 }, mid: { color: '#E6730F', opacity: 0.05 } },\n};\n\nexport function HomeWash({ isDark }: { isDark: boolean }) {\n const { top, mid } = isDark ? WASH.dark : WASH.light;\n return (\n <View pointerEvents=\"none\" style={StyleSheet.absoluteFill}>\n <Svg width=\"100%\" height=\"100%\">\n <Defs>\n {/* ellipse 70% x 52% at 50% 0%, fading out by 72% */}\n <RadialGradient id=\"homeWashTop\" cx=\"50%\" cy=\"0%\" rx=\"70%\" ry=\"52%\" fx=\"50%\" fy=\"0%\">\n <Stop offset=\"0\" stopColor={top.color} stopOpacity={top.opacity} />\n <Stop offset=\"0.72\" stopColor={top.color} stopOpacity={0} />\n </RadialGradient>\n {/* ellipse 55% x 40% at 50% 48%, fading out by 70% */}\n <RadialGradient id=\"homeWashMid\" cx=\"50%\" cy=\"48%\" rx=\"55%\" ry=\"40%\" fx=\"50%\" fy=\"48%\">\n <Stop offset=\"0\" stopColor={mid.color} stopOpacity={mid.opacity} />\n <Stop offset=\"0.7\" stopColor={mid.color} stopOpacity={0} />\n </RadialGradient>\n </Defs>\n <Rect width=\"100%\" height=\"100%\" fill=\"url(#homeWashMid)\" />\n <Rect width=\"100%\" height=\"100%\" fill=\"url(#homeWashTop)\" />\n </Svg>\n </View>\n );\n}\n\nexport default HomeWash;\n"],"names":[],"mappings":"qJAUA,MAAM,IAAO,GAAA;AAAA,EACX,KAAO,EAAA;AAAA,IACL,GAAK,EAAA;AAAA,MACH,KAAO,EAAA,SAAA;AAAA,MACP,OAAS,EAAA;AAAA,KACX;AAAA,IACA,GAAK,EAAA;AAAA,MACH,KAAO,EAAA,SAAA;AAAA,MACP,OAAS,EAAA;AAAA;AACX,GACF;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,GAAK,EAAA;AAAA,MACH,KAAO,EAAA,SAAA;AAAA,MACP,OAAS,EAAA;AAAA,KACX;AAAA,IACA,GAAK,EAAA;AAAA,MACH,KAAO,EAAA,SAAA;AAAA,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AAI,KAAO,EAAA,WAAA,EAAa,IAAI,OAAS,EAAA,CAAA;AAAA,wBACjE,GAAA,CAAC,QAAK,MAAO,EAAA,KAAA,EAAM,WAAW,GAAI,CAAA,KAAA,EAAO,aAAa,CAAG,EAAA;AAAA,OAC7D,EAAA;AAAA,KACJ,EAAA,CAAA;AAAA,wBACC,IAAK,EAAA,EAAA,KAAA,EAAM,QAAO,MAAO,EAAA,MAAA,EAAO,MAAK,mBAAoB,EAAA,CAAA;AAAA,wBACzD,IAAK,EAAA,EAAA,KAAA,EAAM,QAAO,MAAO,EAAA,MAAA,EAAO,MAAK,mBAAoB,EAAA;AAAA,GAAA,EAC9D,CACJ,EAAA,CAAA;AACR"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
const HOME_SUGGESTIONS = [{
|
|
2
|
+
id: "design",
|
|
3
|
+
icon: "palette-outline",
|
|
4
|
+
label: "Design a landing page",
|
|
5
|
+
hint: "Chat-driven design canvas \u2014 iterate on a real page, not a mockup",
|
|
6
|
+
prompt: "Design a landing page for my product. Start with the hero and the pricing section."
|
|
7
|
+
}, {
|
|
8
|
+
id: "webbuilder",
|
|
9
|
+
icon: "web",
|
|
10
|
+
label: "Build a working web app",
|
|
11
|
+
hint: "Scaffold and edit a real app from a prompt",
|
|
12
|
+
prompt: "Build me a small web app with a form that stores submissions and a page that lists them."
|
|
13
|
+
}, {
|
|
14
|
+
id: "poster",
|
|
15
|
+
icon: "post-outline",
|
|
16
|
+
label: "Turn a paper into a poster",
|
|
17
|
+
hint: "A paper PDF or arXiv link \u2192 an editable, print-ready conference poster",
|
|
18
|
+
prompt: "Turn this research paper into a 48 x 36 inch conference poster I can edit and print."
|
|
19
|
+
}, {
|
|
20
|
+
id: "canvas",
|
|
21
|
+
icon: "view-grid-outline",
|
|
22
|
+
label: "Open a canvas",
|
|
23
|
+
hint: "Spread images, video and audio out and work on them together",
|
|
24
|
+
prompt: "Open a canvas and help me lay out the assets for this project.",
|
|
25
|
+
nativeRoute: "MainStack.CanvasNative"
|
|
26
|
+
}, {
|
|
27
|
+
id: "workflow",
|
|
28
|
+
icon: "sitemap-outline",
|
|
29
|
+
label: "Automate something repetitive",
|
|
30
|
+
hint: "A visual workflow across 1,000+ connectors",
|
|
31
|
+
prompt: "Build a workflow that runs every morning and sends me a summary of what changed."
|
|
32
|
+
}, {
|
|
33
|
+
id: "computer",
|
|
34
|
+
icon: "monitor",
|
|
35
|
+
label: "Drive my browser",
|
|
36
|
+
hint: "The CLI runs your OS and browser for you",
|
|
37
|
+
prompt: "Open my browser, find the pricing pages of my top 3 competitors, and put them side by side."
|
|
38
|
+
}, {
|
|
39
|
+
id: "connect-apps",
|
|
40
|
+
icon: "puzzle-outline",
|
|
41
|
+
label: "Connect your apps",
|
|
42
|
+
hint: "Link a tool once, then just @-mention it in any chat",
|
|
43
|
+
prompt: "Show me which apps I can connect, and help me connect the ones I use daily."
|
|
44
|
+
}, {
|
|
45
|
+
id: "research",
|
|
46
|
+
icon: "magnify",
|
|
47
|
+
label: "Research a market",
|
|
48
|
+
hint: "Deep multi-source research, written up",
|
|
49
|
+
prompt: "Research the market for my idea \u2014 who the players are, how they price, and where the gaps are.",
|
|
50
|
+
mode: "deep-search"
|
|
51
|
+
}, {
|
|
52
|
+
id: "notion",
|
|
53
|
+
icon: "notebook-outline",
|
|
54
|
+
label: "Write it up in Notion",
|
|
55
|
+
hint: "Findings land as a real Notion page",
|
|
56
|
+
prompt: "Research this topic and write the findings up as a Notion page with sources."
|
|
57
|
+
}, {
|
|
58
|
+
id: "shopping",
|
|
59
|
+
icon: "shopping-outline",
|
|
60
|
+
label: "Compare products",
|
|
61
|
+
hint: "Search across sources and line them up",
|
|
62
|
+
prompt: "Compare the best options for what I need and show me the tradeoffs."
|
|
63
|
+
}, {
|
|
64
|
+
id: "travel",
|
|
65
|
+
icon: "airplane",
|
|
66
|
+
label: "Plan a trip",
|
|
67
|
+
hint: "Flights, hotels and a day-by-day plan",
|
|
68
|
+
prompt: "Plan a 4-day trip for me \u2014 flights, somewhere to stay, and what to do each day."
|
|
69
|
+
}, {
|
|
70
|
+
id: "meetings",
|
|
71
|
+
icon: "microphone-outline",
|
|
72
|
+
label: "Send a notetaker to a meeting",
|
|
73
|
+
hint: "Records, transcribes, and writes the notes up",
|
|
74
|
+
prompt: "Send the notetaker to my next meeting and write up the notes and action items afterwards."
|
|
75
|
+
}, {
|
|
76
|
+
id: "inbox",
|
|
77
|
+
icon: "inbox-outline",
|
|
78
|
+
label: "Get to inbox zero",
|
|
79
|
+
hint: "Triage the inbox and draft the replies",
|
|
80
|
+
prompt: "Go through my inbox, tell me what actually needs a reply, and draft those replies."
|
|
81
|
+
}, {
|
|
82
|
+
id: "crm",
|
|
83
|
+
icon: "account-group-outline",
|
|
84
|
+
label: "Chase my pipeline",
|
|
85
|
+
hint: "See what is stalling and what to do next",
|
|
86
|
+
prompt: "Look at my pipeline and tell me which deals are going cold and what I should send them."
|
|
87
|
+
}, {
|
|
88
|
+
id: "invoices",
|
|
89
|
+
icon: "file-document-outline",
|
|
90
|
+
label: "Get paid",
|
|
91
|
+
hint: "Invoice a customer and see what is still owed",
|
|
92
|
+
prompt: "Show me which invoices are unpaid, and send a reminder for the overdue ones."
|
|
93
|
+
}, {
|
|
94
|
+
id: "expenses",
|
|
95
|
+
icon: "receipt",
|
|
96
|
+
label: "Sort out expenses",
|
|
97
|
+
hint: "Claims, budgets, and card spend in one place",
|
|
98
|
+
prompt: "Summarise my spend this month and flag anything unusual."
|
|
99
|
+
}, {
|
|
100
|
+
id: "mailcampaign",
|
|
101
|
+
icon: "bullhorn-outline",
|
|
102
|
+
label: "Send a campaign",
|
|
103
|
+
hint: "Write it, segment it, send it",
|
|
104
|
+
prompt: "Draft an email campaign announcing what we shipped this month."
|
|
105
|
+
}, {
|
|
106
|
+
id: "smscampaign",
|
|
107
|
+
icon: "message-text-outline",
|
|
108
|
+
label: "Text your customers",
|
|
109
|
+
hint: "SMS campaigns with replies",
|
|
110
|
+
prompt: "Write a short text reminding my customers about this week's offer, then send it to my VIP list."
|
|
111
|
+
}];
|
|
112
|
+
function drawSuggestions(count, pool = HOME_SUGGESTIONS, random = Math.random) {
|
|
113
|
+
const remaining = [...pool];
|
|
114
|
+
const picked = [];
|
|
115
|
+
while (picked.length < count && remaining.length > 0) {
|
|
116
|
+
picked.push(remaining.splice(Math.floor(random() * remaining.length), 1)[0]);
|
|
117
|
+
}
|
|
118
|
+
return picked;
|
|
119
|
+
}
|
|
120
|
+
function greetingFor(hour) {
|
|
121
|
+
if (hour >= 5 && hour < 12) return "Good morning";
|
|
122
|
+
if (hour >= 12 && hour < 17) return "Good afternoon";
|
|
123
|
+
if (hour >= 17 && hour < 22) return "Good evening";
|
|
124
|
+
return "Working late";
|
|
125
|
+
}export{HOME_SUGGESTIONS,drawSuggestions,greetingFor};//# sourceMappingURL=homeCatalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"homeCatalog.js","sources":["../../../../src/screens/Home/components/homeCatalog.ts"],"sourcesContent":["/**\n * The chat home's pure parts, kept apart from the components so they run under jest: the\n * \"Start something\" catalogue and draw (the web's YANTRA_SUGGESTIONS / useHomeSuggestions) and\n * the greeting (the web's HomeHero `greetingFor`).\n */\nimport type { ComponentProps } from 'react';\nimport type { MaterialCommunityIcons } from '@expo/vector-icons';\nimport type { RoutingMode } from '../types';\n\ntype IconName = ComponentProps<typeof MaterialCommunityIcons>['name'];\n\nexport type HomeSuggestion = {\n id: string;\n label: string;\n /** What the row is for, on the line under its label. */\n hint: string;\n icon: IconName;\n prompt: string;\n mode?: RoutingMode;\n /** Navigate here instead of injecting the prompt, when the host wires navigation. */\n nativeRoute?: string;\n};\n\n/** The web's YANTRA_SUGGESTIONS, in its order. */\nexport const HOME_SUGGESTIONS: readonly HomeSuggestion[] = [\n {\n id: 'design',\n icon: 'palette-outline',\n label: 'Design a landing page',\n hint: 'Chat-driven design canvas — iterate on a real page, not a mockup',\n prompt: 'Design a landing page for my product. Start with the hero and the pricing section.',\n },\n {\n id: 'webbuilder',\n icon: 'web',\n label: 'Build a working web app',\n hint: 'Scaffold and edit a real app from a prompt',\n prompt: 'Build me a small web app with a form that stores submissions and a page that lists them.',\n },\n {\n id: 'poster',\n icon: 'post-outline',\n label: 'Turn a paper into a poster',\n hint: 'A paper PDF or arXiv link → an editable, print-ready conference poster',\n prompt: 'Turn this research paper into a 48 x 36 inch conference poster I can edit and print.',\n },\n {\n id: 'canvas',\n icon: 'view-grid-outline',\n label: 'Open a canvas',\n hint: 'Spread images, video and audio out and work on them together',\n prompt: 'Open a canvas and help me lay out the assets for this project.',\n nativeRoute: 'MainStack.CanvasNative',\n },\n {\n id: 'workflow',\n icon: 'sitemap-outline',\n label: 'Automate something repetitive',\n hint: 'A visual workflow across 1,000+ connectors',\n prompt: 'Build a workflow that runs every morning and sends me a summary of what changed.',\n },\n {\n id: 'computer',\n icon: 'monitor',\n label: 'Drive my browser',\n hint: 'The CLI runs your OS and browser for you',\n prompt: 'Open my browser, find the pricing pages of my top 3 competitors, and put them side by side.',\n },\n {\n id: 'connect-apps',\n icon: 'puzzle-outline',\n label: 'Connect your apps',\n hint: 'Link a tool once, then just @-mention it in any chat',\n prompt: 'Show me which apps I can connect, and help me connect the ones I use daily.',\n },\n {\n id: 'research',\n icon: 'magnify',\n label: 'Research a market',\n hint: 'Deep multi-source research, written up',\n prompt: 'Research the market for my idea — who the players are, how they price, and where the gaps are.',\n mode: 'deep-search',\n },\n {\n id: 'notion',\n icon: 'notebook-outline',\n label: 'Write it up in Notion',\n hint: 'Findings land as a real Notion page',\n prompt: 'Research this topic and write the findings up as a Notion page with sources.',\n },\n {\n id: 'shopping',\n icon: 'shopping-outline',\n label: 'Compare products',\n hint: 'Search across sources and line them up',\n prompt: 'Compare the best options for what I need and show me the tradeoffs.',\n },\n {\n id: 'travel',\n icon: 'airplane',\n label: 'Plan a trip',\n hint: 'Flights, hotels and a day-by-day plan',\n prompt: 'Plan a 4-day trip for me — flights, somewhere to stay, and what to do each day.',\n },\n {\n id: 'meetings',\n icon: 'microphone-outline',\n label: 'Send a notetaker to a meeting',\n hint: 'Records, transcribes, and writes the notes up',\n prompt: 'Send the notetaker to my next meeting and write up the notes and action items afterwards.',\n },\n {\n id: 'inbox',\n icon: 'inbox-outline',\n label: 'Get to inbox zero',\n hint: 'Triage the inbox and draft the replies',\n prompt: 'Go through my inbox, tell me what actually needs a reply, and draft those replies.',\n },\n {\n id: 'crm',\n icon: 'account-group-outline',\n label: 'Chase my pipeline',\n hint: 'See what is stalling and what to do next',\n prompt: 'Look at my pipeline and tell me which deals are going cold and what I should send them.',\n },\n {\n id: 'invoices',\n icon: 'file-document-outline',\n label: 'Get paid',\n hint: 'Invoice a customer and see what is still owed',\n prompt: 'Show me which invoices are unpaid, and send a reminder for the overdue ones.',\n },\n {\n id: 'expenses',\n icon: 'receipt',\n label: 'Sort out expenses',\n hint: 'Claims, budgets, and card spend in one place',\n prompt: 'Summarise my spend this month and flag anything unusual.',\n },\n {\n id: 'mailcampaign',\n icon: 'bullhorn-outline',\n label: 'Send a campaign',\n hint: 'Write it, segment it, send it',\n prompt: 'Draft an email campaign announcing what we shipped this month.',\n },\n {\n id: 'smscampaign',\n icon: 'message-text-outline',\n label: 'Text your customers',\n hint: 'SMS campaigns with replies',\n prompt: \"Write a short text reminding my customers about this week's offer, then send it to my VIP list.\",\n },\n];\n\n/** `count` distinct entries, drawn at random (the web's draw, without its welcome-answer weights). */\nexport function drawSuggestions(\n count: number,\n pool: readonly HomeSuggestion[] = HOME_SUGGESTIONS,\n random: () => number = Math.random,\n): HomeSuggestion[] {\n const remaining = [...pool];\n const picked: HomeSuggestion[] = [];\n while (picked.length < count && remaining.length > 0) {\n picked.push(remaining.splice(Math.floor(random() * remaining.length), 1)[0]);\n }\n return picked;\n}\n\n/** Same boundaries as the web's `greetingFor`; anything past ten at night reads as late. */\nexport function greetingFor(hour: number): string {\n if (hour >= 5 && hour < 12) return 'Good morning';\n if (hour >= 12 && hour < 17) return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OAAA,gBAAA;AACpC,EAAA,IAAI,IAAQ,IAAA,EAAA,IAAM,IAAO,GAAA,EAAA,EAAW,OAAA,cAAA;AACpC,EAAO,OAAA,cAAA;AACT"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {useMemo}from'react';import {StyleSheet}from'react-native';import {SafeAreaView}from'react-native-safe-area-context';import {useRoute}from'@react-navigation/native';import {NotionWorkspaceView}from'../../features/notion/NotionWorkspaceView.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';function NotionScreen() {
|
|
2
|
+
const route = useRoute();
|
|
3
|
+
const params = route.params;
|
|
4
|
+
const {
|
|
5
|
+
isDark
|
|
6
|
+
} = useAppTheme();
|
|
7
|
+
const orgName = useMemo(() => {
|
|
8
|
+
var _a;
|
|
9
|
+
const raw = (_a = params == null ? void 0 : params.orgName) != null ? _a : "";
|
|
10
|
+
return typeof raw === "string" && raw.trim() ? raw.trim() : null;
|
|
11
|
+
}, [params == null ? void 0 : params.orgName]);
|
|
12
|
+
return /* @__PURE__ */ jsx(SafeAreaView, { edges: ["left", "right"], style: styles.container, children: /* @__PURE__ */ jsx(NotionWorkspaceView, { orgName, isDark }) });
|
|
13
|
+
}
|
|
14
|
+
const styles = StyleSheet.create({
|
|
15
|
+
container: {
|
|
16
|
+
flex: 1
|
|
17
|
+
}
|
|
18
|
+
});export{NotionScreen as default};//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/screens/Notion/index.tsx"],"sourcesContent":["/**\n * Native Notion workspace (browser `/notion`), opened from the drawer.\n *\n * Header chrome (back, title) is owned by `NavigationHeader` via\n * `customHeader.props` in `compute.ts`.\n */\nimport React, { useMemo } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport { useRoute } from '@react-navigation/native';\nimport { NotionWorkspaceView } from '../../features/notion/NotionWorkspaceView';\nimport { useAppTheme } from '../../theme/AppThemeProvider';\n\nexport interface NotionRouteParams {\n orgName?: string | null;\n}\n\nexport default function NotionScreen() {\n const route = useRoute();\n const params = route.params as NotionRouteParams | undefined;\n const { isDark } = useAppTheme();\n\n const orgName = useMemo(() => {\n const raw = params?.orgName ?? '';\n return typeof raw === 'string' && raw.trim() ? raw.trim() : null;\n }, [params?.orgName]);\n\n return (\n <SafeAreaView edges={['left', 'right']} style={styles.container}>\n <NotionWorkspaceView orgName={orgName} isDark={isDark} />\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"],"names":[],"mappings":"yVAeA,SAAwB,YAAe,GAAA;AACrC,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAA,MAAM,SAAS,KAAM,CAAA,MAAA;AACrB,EAAM,MAAA;AAAA,IACJ;AAAA,MACE,WAAY,EAAA;AAChB,EAAM,MAAA,OAAA,GAAU,QAAQ,MAAM;AArBhC,IAAA,IAAA,EAAA;AAsBI,IAAM,MAAA,GAAA,GAAA,CAAM,EAAQ,GAAA,MAAA,IAAA,IAAA,GAAA,MAAA,GAAA,MAAA,CAAA,OAAA,KAAR,IAAmB,GAAA,EAAA,GAAA,EAAA;AAC/B,IAAO,OAAA,OAAO,QAAQ,QAAY,IAAA,GAAA,CAAI,MAAS,GAAA,GAAA,CAAI,MAAS,GAAA,IAAA;AAAA,GAC3D,EAAA,CAAC,MAAQ,IAAA,IAAA,GAAA,MAAA,GAAA,MAAA,CAAA,OAAO,CAAC,CAAA;AACpB,EAAA,uBAAQ,GAAA,CAAA,YAAA,EAAA,EAAa,KAAO,EAAA,CAAC,QAAQ,OAAO,CAAA,EAAG,KAAO,EAAA,MAAA,CAAO,SACnD,EAAA,QAAA,kBAAA,GAAA,CAAC,mBAAoB,EAAA,EAAA,OAAA,EAAkB,QAAgB,CAC3D,EAAA,CAAA;AACR;AACA,MAAM,MAAA,GAAS,WAAW,MAAO,CAAA;AAAA,EAC/B,SAAW,EAAA;AAAA,IACT,IAAM,EAAA;AAAA;AAEV,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {useMemo}from'react';import {StyleSheet}from'react-native';import {SafeAreaView}from'react-native-safe-area-context';import {useRoute}from'@react-navigation/native';import {NotionPageView}from'../../features/notion/NotionPageView.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';function NotionPageScreen() {
|
|
2
|
+
const route = useRoute();
|
|
3
|
+
const params = route.params;
|
|
4
|
+
const {
|
|
5
|
+
isDark
|
|
6
|
+
} = useAppTheme();
|
|
7
|
+
const orgName = useMemo(() => {
|
|
8
|
+
var _a;
|
|
9
|
+
const raw = (_a = params == null ? void 0 : params.orgName) != null ? _a : "";
|
|
10
|
+
return typeof raw === "string" && raw.trim() ? raw.trim() : null;
|
|
11
|
+
}, [params == null ? void 0 : params.orgName]);
|
|
12
|
+
const blockId = typeof (params == null ? void 0 : params.blockId) === "string" && params.blockId ? params.blockId : null;
|
|
13
|
+
return /* @__PURE__ */ jsx(SafeAreaView, { edges: ["left", "right"], style: styles.container, children: /* @__PURE__ */ jsx(NotionPageView, { orgName, blockId, isDark }) });
|
|
14
|
+
}
|
|
15
|
+
const styles = StyleSheet.create({
|
|
16
|
+
container: {
|
|
17
|
+
flex: 1
|
|
18
|
+
}
|
|
19
|
+
});export{NotionPageScreen as default};//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/screens/NotionPage/index.tsx"],"sourcesContent":["/**\n * Native Notion page (browser `/notion/page/:blockId`). Reached from the\n * Notion workspace or a sub-page link inside another page.\n */\nimport React, { useMemo } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport { useRoute } from '@react-navigation/native';\nimport { NotionPageView } from '../../features/notion/NotionPageView';\nimport { useAppTheme } from '../../theme/AppThemeProvider';\n\nexport interface NotionPageRouteParams {\n orgName?: string | null;\n blockId?: string | null;\n}\n\nexport default function NotionPageScreen() {\n const route = useRoute();\n const params = route.params as NotionPageRouteParams | undefined;\n const { isDark } = useAppTheme();\n\n const orgName = useMemo(() => {\n const raw = params?.orgName ?? '';\n return typeof raw === 'string' && raw.trim() ? raw.trim() : null;\n }, [params?.orgName]);\n const blockId = typeof params?.blockId === 'string' && params.blockId ? params.blockId : null;\n\n return (\n <SafeAreaView edges={['left', 'right']} style={styles.container}>\n <NotionPageView orgName={orgName} blockId={blockId} isDark={isDark} />\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"],"names":[],"mappings":"+UAcA,SAAwB,gBAAmB,GAAA;AACzC,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAA,MAAM,SAAS,KAAM,CAAA,MAAA;AACrB,EAAM,MAAA;AAAA,IACJ;AAAA,MACE,WAAY,EAAA;AAChB,EAAM,MAAA,OAAA,GAAU,QAAQ,MAAM;AApBhC,IAAA,IAAA,EAAA;AAqBI,IAAM,MAAA,GAAA,GAAA,CAAM,EAAQ,GAAA,MAAA,IAAA,IAAA,GAAA,MAAA,GAAA,MAAA,CAAA,OAAA,KAAR,IAAmB,GAAA,EAAA,GAAA,EAAA;AAC/B,IAAO,OAAA,OAAO,QAAQ,QAAY,IAAA,GAAA,CAAI,MAAS,GAAA,GAAA,CAAI,MAAS,GAAA,IAAA;AAAA,GAC3D,EAAA,CAAC,MAAQ,IAAA,IAAA,GAAA,MAAA,GAAA,MAAA,CAAA,OAAO,CAAC,CAAA;AACpB,EAAM,MAAA,OAAA,GAAU,QAAO,MAAQ,IAAA,IAAA,GAAA,MAAA,GAAA,MAAA,CAAA,OAAA,CAAA,KAAY,YAAY,MAAO,CAAA,OAAA,GAAU,OAAO,OAAU,GAAA,IAAA;AACzF,EAAA,uBAAQ,GAAA,CAAA,YAAA,EAAA,EAAa,KAAO,EAAA,CAAC,QAAQ,OAAO,CAAA,EAAG,KAAO,EAAA,MAAA,CAAO,WACnD,QAAC,kBAAA,GAAA,CAAA,cAAA,EAAA,EAAe,OAAkB,EAAA,OAAA,EAAkB,QAAgB,CACxE,EAAA,CAAA;AACR;AACA,MAAM,MAAA,GAAS,WAAW,MAAO,CAAA;AAAA,EAC/B,SAAW,EAAA;AAAA,IACT,IAAM,EAAA;AAAA;AAEV,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useRef,useCallback,useMemo}from'react';import {useApolloClient,gql}from'@apollo/client/index.js';import {OUTDATED_SERVER_RE,proxyResult}from'./webbuilderTransport.js';const SANDBOX_ACTION_MUTATION = gql`
|
|
1
|
+
import {useRef,useCallback,useMemo}from'react';import {useApolloClient,gql}from'@apollo/client/index.js';import {publicSandboxDomain}from'../../features/webbuilder/publicSandboxDomain.js';import {withPublicSandboxHosts}from'../../features/webbuilder/sandboxPublicHost.js';import {OUTDATED_SERVER_RE,proxyResult}from'./webbuilderTransport.js';const SANDBOX_ACTION_MUTATION = gql`
|
|
2
2
|
mutation aiCodeSandboxAction($channelId: String!, $sandboxId: String!, $action: String!, $params: JSON) {
|
|
3
3
|
aiCodeSandboxAction(channelId: $channelId, sandboxId: $sandboxId, action: $action, params: $params)
|
|
4
4
|
}
|
|
@@ -88,7 +88,7 @@ function useSandboxProxyApi() {
|
|
|
88
88
|
variables: {
|
|
89
89
|
channelId: input.channelId,
|
|
90
90
|
sandboxId: input.sandboxId,
|
|
91
|
-
sandboxUrl: input.sandboxUrl
|
|
91
|
+
sandboxUrl: input.sandboxUrl ? withPublicSandboxHosts(input.sandboxUrl, publicSandboxDomain()) : void 0,
|
|
92
92
|
snapshotId: input.snapshotId || void 0,
|
|
93
93
|
previousSandboxId: input.previousSandboxId || void 0
|
|
94
94
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandboxProxyApi.js","sources":["../../../src/screens/WebBuilderNative/sandboxProxyApi.ts"],"sourcesContent":["/**\n * The two backend fields a preview restore goes through (web `sandbox/sandboxProxy.ts`,\n * `previewDeployApi.persistSandboxIdentity`), on the app's Apollo client - the\n * backend that owns the build channels:\n *\n * - `aiCodeSandboxAction`: one connector action on a project's sandbox. The server\n * adds the sandbox key from the channel's settings (an agent build's too), so\n * the app never holds a key; a CREATE through it records the new sandbox.\n * - `aiCodePersistSandboxIdentity`: the new sandbox (and its preview) after a\n * restore, so the web and other devices open it instead of the expired one.\n *\n * Neither has a generated hook in `common/graphql`, so the documents live here.\n */\nimport { useCallback, useMemo, useRef } from 'react';\nimport { gql, useApolloClient } from '@apollo/client';\nimport { OUTDATED_SERVER_RE, proxyResult, type SandboxProxyCall } from './webbuilderTransport';\n\nconst SANDBOX_ACTION_MUTATION = gql`\n mutation aiCodeSandboxAction($channelId: String!, $sandboxId: String!, $action: String!, $params: JSON) {\n aiCodeSandboxAction(channelId: $channelId, sandboxId: $sandboxId, action: $action, params: $params)\n }\n`;\n\nconst PERSIST_SANDBOX_MUTATION = gql`\n mutation aiCodePersistSandboxIdentity(\n $channelId: String!\n $sandboxId: String!\n $sandboxUrl: String\n $snapshotId: String\n $previousSandboxId: String\n ) {\n aiCodePersistSandboxIdentity(\n channelId: $channelId\n sandboxId: $sandboxId\n sandboxUrl: $sandboxUrl\n snapshotId: $snapshotId\n previousSandboxId: $previousSandboxId\n ) {\n success\n message\n }\n }\n`;\n\nfunction messageOf(err: unknown): string {\n const e = err as { graphQLErrors?: Array<{ message?: string }>; message?: string } | null;\n return e?.graphQLErrors?.find((g) => g?.message)?.message || e?.message || String(err);\n}\n\nexport interface PersistSandboxInput {\n channelId: string;\n sandboxId: string;\n sandboxUrl?: string | null;\n snapshotId?: string | null;\n previousSandboxId?: string | null;\n}\n\nexport function useSandboxProxyApi() {\n const client = useApolloClient();\n /** Set once a server answers without the proxy: the session stays direct (web router `missing`). */\n const proxyMissing = useRef(false);\n\n const proxy = useCallback<SandboxProxyCall>(\n async (variables, timeoutMs) => {\n const controller = new AbortController();\n // The proxy waits for the connector: allow its timeout plus a margin (web: +30 s).\n const timer = setTimeout(() => controller.abort(), timeoutMs + 30_000);\n try {\n const result = await client.mutate({\n mutation: SANDBOX_ACTION_MUTATION,\n variables,\n fetchPolicy: 'no-cache',\n errorPolicy: 'all',\n context: { fetchOptions: { signal: controller.signal } },\n });\n const first = result.errors?.find((e) => e?.message)?.message;\n if (first) {\n if (OUTDATED_SERVER_RE.test(first)) return { outdated: true };\n return { outdated: false, result: { successful: false, error: first } };\n }\n return {\n outdated: false,\n result: proxyResult((result.data as { aiCodeSandboxAction?: unknown } | null)?.aiCodeSandboxAction),\n };\n } catch (err) {\n const message = messageOf(err);\n if (OUTDATED_SERVER_RE.test(message)) return { outdated: true };\n return { outdated: false, result: { successful: false, error: message } };\n } finally {\n clearTimeout(timer);\n }\n },\n [client],\n );\n\n const persist = useCallback(\n async (input: PersistSandboxInput): Promise<{ ok: boolean; message?: string }> => {\n try {\n const result = await client.mutate({\n mutation: PERSIST_SANDBOX_MUTATION,\n variables: {\n channelId: input.channelId,\n sandboxId: input.sandboxId,\n sandboxUrl: input.sandboxUrl
|
|
1
|
+
{"version":3,"file":"sandboxProxyApi.js","sources":["../../../src/screens/WebBuilderNative/sandboxProxyApi.ts"],"sourcesContent":["/**\n * The two backend fields a preview restore goes through (web `sandbox/sandboxProxy.ts`,\n * `previewDeployApi.persistSandboxIdentity`), on the app's Apollo client - the\n * backend that owns the build channels:\n *\n * - `aiCodeSandboxAction`: one connector action on a project's sandbox. The server\n * adds the sandbox key from the channel's settings (an agent build's too), so\n * the app never holds a key; a CREATE through it records the new sandbox.\n * - `aiCodePersistSandboxIdentity`: the new sandbox (and its preview) after a\n * restore, so the web and other devices open it instead of the expired one.\n * The preview is saved on the platform's sandbox domain when one is set.\n *\n * Neither has a generated hook in `common/graphql`, so the documents live here.\n */\nimport { useCallback, useMemo, useRef } from 'react';\nimport { gql, useApolloClient } from '@apollo/client';\nimport { publicSandboxDomain } from '../../features/webbuilder/publicSandboxDomain';\nimport { withPublicSandboxHosts } from '../../features/webbuilder/sandboxPublicHost';\nimport { OUTDATED_SERVER_RE, proxyResult, type SandboxProxyCall } from './webbuilderTransport';\n\nconst SANDBOX_ACTION_MUTATION = gql`\n mutation aiCodeSandboxAction($channelId: String!, $sandboxId: String!, $action: String!, $params: JSON) {\n aiCodeSandboxAction(channelId: $channelId, sandboxId: $sandboxId, action: $action, params: $params)\n }\n`;\n\nconst PERSIST_SANDBOX_MUTATION = gql`\n mutation aiCodePersistSandboxIdentity(\n $channelId: String!\n $sandboxId: String!\n $sandboxUrl: String\n $snapshotId: String\n $previousSandboxId: String\n ) {\n aiCodePersistSandboxIdentity(\n channelId: $channelId\n sandboxId: $sandboxId\n sandboxUrl: $sandboxUrl\n snapshotId: $snapshotId\n previousSandboxId: $previousSandboxId\n ) {\n success\n message\n }\n }\n`;\n\nfunction messageOf(err: unknown): string {\n const e = err as { graphQLErrors?: Array<{ message?: string }>; message?: string } | null;\n return e?.graphQLErrors?.find((g) => g?.message)?.message || e?.message || String(err);\n}\n\nexport interface PersistSandboxInput {\n channelId: string;\n sandboxId: string;\n sandboxUrl?: string | null;\n snapshotId?: string | null;\n previousSandboxId?: string | null;\n}\n\nexport function useSandboxProxyApi() {\n const client = useApolloClient();\n /** Set once a server answers without the proxy: the session stays direct (web router `missing`). */\n const proxyMissing = useRef(false);\n\n const proxy = useCallback<SandboxProxyCall>(\n async (variables, timeoutMs) => {\n const controller = new AbortController();\n // The proxy waits for the connector: allow its timeout plus a margin (web: +30 s).\n const timer = setTimeout(() => controller.abort(), timeoutMs + 30_000);\n try {\n const result = await client.mutate({\n mutation: SANDBOX_ACTION_MUTATION,\n variables,\n fetchPolicy: 'no-cache',\n errorPolicy: 'all',\n context: { fetchOptions: { signal: controller.signal } },\n });\n const first = result.errors?.find((e) => e?.message)?.message;\n if (first) {\n if (OUTDATED_SERVER_RE.test(first)) return { outdated: true };\n return { outdated: false, result: { successful: false, error: first } };\n }\n return {\n outdated: false,\n result: proxyResult((result.data as { aiCodeSandboxAction?: unknown } | null)?.aiCodeSandboxAction),\n };\n } catch (err) {\n const message = messageOf(err);\n if (OUTDATED_SERVER_RE.test(message)) return { outdated: true };\n return { outdated: false, result: { successful: false, error: message } };\n } finally {\n clearTimeout(timer);\n }\n },\n [client],\n );\n\n const persist = useCallback(\n async (input: PersistSandboxInput): Promise<{ ok: boolean; message?: string }> => {\n try {\n const result = await client.mutate({\n mutation: PERSIST_SANDBOX_MUTATION,\n variables: {\n channelId: input.channelId,\n sandboxId: input.sandboxId,\n sandboxUrl: input.sandboxUrl\n ? withPublicSandboxHosts(input.sandboxUrl, publicSandboxDomain())\n : undefined,\n snapshotId: input.snapshotId || undefined,\n previousSandboxId: input.previousSandboxId || undefined,\n },\n fetchPolicy: 'no-cache',\n errorPolicy: 'all',\n });\n const first = result.errors?.find((e) => e?.message)?.message;\n if (first) return { ok: false, message: first };\n const payload = (\n result.data as { aiCodePersistSandboxIdentity?: { success?: boolean; message?: string } } | null\n )?.aiCodePersistSandboxIdentity;\n return { ok: payload?.success !== false, message: payload?.message };\n } catch (err) {\n return { ok: false, message: messageOf(err) };\n }\n },\n [client],\n );\n\n return useMemo(() => ({ proxy, persist, proxyMissing }), [proxy, persist]);\n}\n"],"names":[],"mappings":"sVAmBA,MAAM,uBAA0B,GAAA,GAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAKhC,MAAM,wBAA2B,GAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAoBjC,SAAS,UAAU,GAAsB,EAAA;AA5CzC,EAAA,IAAA,EAAA,EAAA,EAAA;AA6CE,EAAA,MAAM,CAAI,GAAA,GAAA;AAMV,EAAA,OAAA,CAAA,CAAO,EAAG,GAAA,CAAA,EAAA,GAAA,CAAA,IAAA,IAAA,GAAA,MAAA,GAAA,CAAA,CAAA,aAAA,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