@adminide-stack/yantra-mobile 12.0.137 → 12.0.139

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.
Files changed (89) hide show
  1. package/lib/components/CustomDrawer.js +17 -1
  2. package/lib/components/CustomDrawer.js.map +1 -1
  3. package/lib/compute.js +106 -1
  4. package/lib/compute.js.map +1 -1
  5. package/lib/config/env-config.js +12 -0
  6. package/lib/config/env-config.js.map +1 -1
  7. package/lib/features/chat/ChatTranscript.js +2 -2
  8. package/lib/features/chat/ChatTranscript.js.map +1 -1
  9. package/lib/features/chat/surfaceNotes.js +4 -0
  10. package/lib/features/chat/surfaceNotes.js.map +1 -0
  11. package/lib/features/dictate/backgroundRecording.js.map +1 -1
  12. package/lib/features/dictate/useDictationRecorder.js +42 -1
  13. package/lib/features/dictate/useDictationRecorder.js.map +1 -1
  14. package/lib/features/home/useHomeWeather.js +85 -0
  15. package/lib/features/home/useHomeWeather.js.map +1 -0
  16. package/lib/features/home/weather.js +139 -0
  17. package/lib/features/home/weather.js.map +1 -0
  18. package/lib/features/notion/NotionPageView.js +819 -0
  19. package/lib/features/notion/NotionPageView.js.map +1 -0
  20. package/lib/features/notion/NotionSheets.js +452 -0
  21. package/lib/features/notion/NotionSheets.js.map +1 -0
  22. package/lib/features/notion/NotionTrashSheet.js +415 -0
  23. package/lib/features/notion/NotionTrashSheet.js.map +1 -0
  24. package/lib/features/notion/NotionWorkspaceView.js +837 -0
  25. package/lib/features/notion/NotionWorkspaceView.js.map +1 -0
  26. package/lib/features/notion/notionBlocks.js +203 -0
  27. package/lib/features/notion/notionBlocks.js.map +1 -0
  28. package/lib/features/notion/notionDocuments.js +182 -0
  29. package/lib/features/notion/notionDocuments.js.map +1 -0
  30. package/lib/features/notion/notionEditorModel.js +180 -0
  31. package/lib/features/notion/notionEditorModel.js.map +1 -0
  32. package/lib/features/notion/notionTemplates.js +406 -0
  33. package/lib/features/notion/notionTemplates.js.map +1 -0
  34. package/lib/features/notion/notionTheme.js +34 -0
  35. package/lib/features/notion/notionTheme.js.map +1 -0
  36. package/lib/features/notion/notionTrash.js +100 -0
  37. package/lib/features/notion/notionTrash.js.map +1 -0
  38. package/lib/features/notion/notionUi.js +310 -0
  39. package/lib/features/notion/notionUi.js.map +1 -0
  40. package/lib/features/notion/useNotionWorkspace.js +181 -0
  41. package/lib/features/notion/useNotionWorkspace.js.map +1 -0
  42. package/lib/features/webbuilder/buildFragments.js +15 -9
  43. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  44. package/lib/features/webbuilder/buildJob.js +3 -3
  45. package/lib/features/webbuilder/buildJob.js.map +1 -1
  46. package/lib/features/webbuilder/publicSandboxDomain.js +5 -0
  47. package/lib/features/webbuilder/publicSandboxDomain.js.map +1 -0
  48. package/lib/features/webbuilder/sandboxPublicHost.js +74 -0
  49. package/lib/features/webbuilder/sandboxPublicHost.js.map +1 -0
  50. package/lib/features/webbuilder/siteAddress.js +2 -1
  51. package/lib/features/webbuilder/siteAddress.js.map +1 -1
  52. package/lib/features/webbuilder/webbuilderPrompts.js +3 -2
  53. package/lib/features/webbuilder/webbuilderPrompts.js.map +1 -1
  54. package/lib/features/webbuilder/workflow.js +2 -2
  55. package/lib/features/webbuilder/workflow.js.map +1 -1
  56. package/lib/hooks/useChatApi.js +15 -3
  57. package/lib/hooks/useChatApi.js.map +1 -1
  58. package/lib/hooks/usePrerequisiteIds.js +15 -2
  59. package/lib/hooks/usePrerequisiteIds.js.map +1 -1
  60. package/lib/routes.json +107 -0
  61. package/lib/screens/Home/HomeScreen.js +20 -5
  62. package/lib/screens/Home/HomeScreen.js.map +1 -1
  63. package/lib/screens/Home/components/HomeHero.js +117 -0
  64. package/lib/screens/Home/components/HomeHero.js.map +1 -0
  65. package/lib/screens/Home/components/HomeSuggestions.js +108 -85
  66. package/lib/screens/Home/components/HomeSuggestions.js.map +1 -1
  67. package/lib/screens/Home/components/HomeWash.js +44 -0
  68. package/lib/screens/Home/components/HomeWash.js.map +1 -0
  69. package/lib/screens/Home/components/homeCatalog.js +125 -0
  70. package/lib/screens/Home/components/homeCatalog.js.map +1 -0
  71. package/lib/screens/Notion/index.js +18 -0
  72. package/lib/screens/Notion/index.js.map +1 -0
  73. package/lib/screens/NotionPage/index.js +19 -0
  74. package/lib/screens/NotionPage/index.js.map +1 -0
  75. package/lib/screens/WebBuilderNative/sandboxProxyApi.js +2 -2
  76. package/lib/screens/WebBuilderNative/sandboxProxyApi.js.map +1 -1
  77. package/lib/screens/WebBuilderNative/useRestoredSandboxes.js +16 -8
  78. package/lib/screens/WebBuilderNative/useRestoredSandboxes.js.map +1 -1
  79. package/lib/screens/WebBuilderNative/useWebBuilderGallery.js +6 -5
  80. package/lib/screens/WebBuilderNative/useWebBuilderGallery.js.map +1 -1
  81. package/lib/screens/WebBuilderNative/useWebBuilderHost.js +5 -4
  82. package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
  83. package/lib/screens/WebBuilderNative/webbuilderTransport.js +4 -3
  84. package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
  85. package/lib/services/savedWorkspace.js +44 -0
  86. package/lib/services/savedWorkspace.js.map +1 -0
  87. package/lib/theme/mobileTokens.js +1 -0
  88. package/lib/theme/mobileTokens.js.map +1 -1
  89. package/package.json +3 -3
@@ -0,0 +1,837 @@
1
+ import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useMemo,useCallback,useState,useRef,useEffect}from'react';import {Alert,View,StyleSheet,Pressable,Text,ActivityIndicator,ScrollView,RefreshControl,Modal,TextInput,FlatList,KeyboardAvoidingView,Platform}from'react-native';import {Ionicons}from'@expo/vector-icons';import {useNavigation,useFocusEffect,CommonActions}from'@react-navigation/native';import {useQuery,useLazyQuery}from'@apollo/client/index.js';import {NATIVE_NOTION_INBOX_UNREAD,NATIVE_NOTION_SEARCH}from'./notionDocuments.js';import {nextMeetings,greeting,PAGE_TYPES}from'./notionBlocks.js';import {notionPalette}from'./notionTheme.js';import {WorkspaceBadge,ui,EmptyState,SectionHeader,Group,ListRow,PageRow,SheetHeader}from'./notionUi.js';import {MeetingRowView,InboxSheet,MeetingsSheet,AllPagesSheet,TemplatesSheet}from'./NotionSheets.js';import {TrashSheet}from'./NotionTrashSheet.js';import {useNotionWorkspace}from'./useNotionWorkspace.js';import {afterNativeModalClose}from'../../utils/drawerNavigation.js';var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ const SHEET_TITLES = {
18
+ inbox: "Inbox",
19
+ meetings: "Meetings",
20
+ all: "All pages",
21
+ templates: "Templates",
22
+ trash: "Trash"
23
+ };
24
+ const TINTS = {
25
+ ai: {
26
+ light: "#f3e8ff",
27
+ dark: "rgba(168,85,247,0.2)",
28
+ fg: "#9333ea"
29
+ },
30
+ page: {
31
+ light: "#fff1e6",
32
+ dark: "rgba(251,146,60,0.2)",
33
+ fg: "#ea580c"
34
+ },
35
+ templates: {
36
+ light: "#dcfce7",
37
+ dark: "rgba(34,197,94,0.2)",
38
+ fg: "#16a34a"
39
+ },
40
+ meeting: {
41
+ light: "#e0f2fe",
42
+ dark: "rgba(56,189,248,0.2)",
43
+ fg: "#0284c7"
44
+ },
45
+ inbox: {
46
+ light: "#fee2e2",
47
+ dark: "rgba(244,63,94,0.2)",
48
+ fg: "#e11d48"
49
+ },
50
+ trash: {
51
+ light: "#f5f5f4",
52
+ dark: "rgba(148,163,184,0.18)",
53
+ fg: "#78716c"
54
+ },
55
+ all: {
56
+ light: "#fef3c7",
57
+ dark: "rgba(245,158,11,0.2)",
58
+ fg: "#d97706"
59
+ }
60
+ };
61
+ function todayLabel(date = /* @__PURE__ */ new Date()) {
62
+ return date.toLocaleDateString(void 0, {
63
+ weekday: "long",
64
+ month: "long",
65
+ day: "numeric"
66
+ });
67
+ }
68
+ function NotionWorkspaceView({
69
+ orgName,
70
+ isDark
71
+ }) {
72
+ var _a, _b, _c, _d, _e, _f, _g, _h;
73
+ const palette = useMemo(() => notionPalette(isDark), [isDark]);
74
+ const tint = useCallback((key) => ({
75
+ fg: TINTS[key].fg,
76
+ bg: isDark ? TINTS[key].dark : TINTS[key].light
77
+ }), [isDark]);
78
+ const navigation = useNavigation();
79
+ const notion = useNotionWorkspace();
80
+ const [searching, setSearching] = useState(false);
81
+ const [sheet, setSheet] = useState(null);
82
+ const [menuOpen, setMenuOpen] = useState(false);
83
+ const [createOpen, setCreateOpen] = useState(false);
84
+ const [refreshing, setRefreshing] = useState(false);
85
+ const [busy, setBusy] = useState(null);
86
+ const hasWorkspace = Boolean(notion.workspace);
87
+ const unreadQuery = useQuery(NATIVE_NOTION_INBOX_UNREAD, {
88
+ fetchPolicy: "cache-and-network"
89
+ });
90
+ const unread = (_b = (_a = unreadQuery.data) == null ? void 0 : _a.notesInboxUnreadCount) != null ? _b : 0;
91
+ const refreshOnFocus = useRef(() => void 0);
92
+ refreshOnFocus.current = () => {
93
+ notion.refresh().catch(() => void 0);
94
+ unreadQuery.refetch().catch(() => void 0);
95
+ };
96
+ useFocusEffect(useCallback(() => {
97
+ refreshOnFocus.current();
98
+ }, []));
99
+ const upcoming = useMemo(() => nextMeetings(notion.meetings), [notion.meetings]);
100
+ const navigateToPage = useCallback((blockId) => {
101
+ navigation.dispatch(CommonActions.navigate({
102
+ name: "MainStack.NotionPage",
103
+ params: {
104
+ orgName,
105
+ blockId
106
+ }
107
+ }));
108
+ }, [navigation, orgName]);
109
+ const openPage = useCallback((blockId) => {
110
+ if (sheet) {
111
+ setSheet(null);
112
+ afterNativeModalClose(() => navigateToPage(blockId));
113
+ } else {
114
+ navigateToPage(blockId);
115
+ }
116
+ }, [navigateToPage, sheet]);
117
+ const askAi = useCallback(() => {
118
+ navigation.dispatch(CommonActions.navigate({
119
+ name: "MainStack.Chat",
120
+ params: orgName ? {
121
+ orgName
122
+ } : {}
123
+ }));
124
+ }, [navigation, orgName]);
125
+ const requireWorkspace = useCallback(() => {
126
+ if (hasWorkspace) return true;
127
+ setCreateOpen(true);
128
+ return false;
129
+ }, [hasWorkspace]);
130
+ const run = useCallback(async (kind) => {
131
+ if (!requireWorkspace() || busy) return;
132
+ setBusy(kind);
133
+ try {
134
+ const created = kind === "page" ? await notion.createPage() : await notion.createMeeting();
135
+ if (created == null ? void 0 : created.id) openPage(created.id);
136
+ } catch (err) {
137
+ Alert.alert(`Couldn't create the ${kind}`, err instanceof Error ? err.message : void 0);
138
+ } finally {
139
+ setBusy(null);
140
+ }
141
+ }, [busy, notion, openPage, requireWorkspace]);
142
+ const openSheet = useCallback((kind) => {
143
+ setSearching(false);
144
+ if (kind !== "inbox" && kind !== "trash" && !requireWorkspace()) return;
145
+ setSheet(kind);
146
+ }, [requireWorkspace]);
147
+ const onRefresh = useCallback(async () => {
148
+ setRefreshing(true);
149
+ try {
150
+ await Promise.all([notion.refresh(), unreadQuery.refetch()]);
151
+ } finally {
152
+ setRefreshing(false);
153
+ }
154
+ }, [notion, unreadQuery]);
155
+ const quickActions = [{
156
+ key: "ai",
157
+ label: "Ask AI",
158
+ icon: "sparkles",
159
+ onPress: askAi
160
+ }, {
161
+ key: "page",
162
+ label: "New page",
163
+ icon: "add",
164
+ onPress: () => run("page"),
165
+ busy: busy === "page"
166
+ }, {
167
+ key: "templates",
168
+ label: "Templates",
169
+ icon: "albums-outline",
170
+ onPress: () => openSheet("templates")
171
+ }, {
172
+ key: "meeting",
173
+ label: "Meeting",
174
+ icon: "calendar-outline",
175
+ onPress: () => run("meeting"),
176
+ busy: busy === "meeting"
177
+ }];
178
+ const browse = [{
179
+ key: "inbox",
180
+ icon: "notifications-outline",
181
+ subtitle: "Mentions and reminders",
182
+ badge: unread
183
+ }, {
184
+ key: "meetings",
185
+ icon: "calendar-outline",
186
+ subtitle: `${notion.meetings.length} meetings`
187
+ }, {
188
+ key: "all",
189
+ icon: "documents-outline",
190
+ subtitle: `${notion.pages.length} pages`
191
+ }, {
192
+ key: "templates",
193
+ icon: "albums-outline",
194
+ subtitle: "Start from a ready-made page"
195
+ }, {
196
+ key: "trash",
197
+ icon: "trash-outline",
198
+ subtitle: "Restore deleted pages"
199
+ }];
200
+ const commands = [{
201
+ key: "new",
202
+ label: "New page",
203
+ icon: "add",
204
+ tintKey: "page",
205
+ onPress: () => run("page")
206
+ }, {
207
+ key: "all",
208
+ label: "All pages",
209
+ icon: "documents-outline",
210
+ tintKey: "all",
211
+ onPress: () => openSheet("all")
212
+ }, {
213
+ key: "trash",
214
+ label: "Open Trash",
215
+ icon: "trash-outline",
216
+ tintKey: "trash",
217
+ onPress: () => openSheet("trash")
218
+ }, {
219
+ key: "templates",
220
+ label: "Browse template gallery",
221
+ icon: "albums-outline",
222
+ tintKey: "templates",
223
+ onPress: () => openSheet("templates")
224
+ }, {
225
+ key: "ai",
226
+ label: "Go to Yantra AI",
227
+ icon: "sparkles",
228
+ tintKey: "ai",
229
+ onPress: askAi
230
+ }, {
231
+ key: "meetings",
232
+ label: "Go to Meetings",
233
+ icon: "calendar-outline",
234
+ tintKey: "meeting",
235
+ onPress: () => openSheet("meetings")
236
+ }];
237
+ return /* @__PURE__ */ jsxs(View, { style: [styles.root, {
238
+ backgroundColor: palette.bg
239
+ }], children: [
240
+ /* @__PURE__ */ jsxs(View, { style: styles.header, children: [
241
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: hasWorkspace ? "Workspace menu" : "Create workspace", onPress: () => hasWorkspace ? setMenuOpen(true) : setCreateOpen(true), style: ({
242
+ pressed
243
+ }) => [styles.switcher, pressed && {
244
+ backgroundColor: palette.pressed
245
+ }], children: [
246
+ /* @__PURE__ */ jsx(WorkspaceBadge, { workspace: notion.workspace, palette }),
247
+ /* @__PURE__ */ jsxs(View, { style: styles.switcherText, children: [
248
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.switcherName, {
249
+ color: palette.text
250
+ }], children: (_d = (_c = notion.workspace) == null ? void 0 : _c.name) != null ? _d : "No workspace" }),
251
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.switcherMeta, {
252
+ color: palette.textMuted
253
+ }], children: hasWorkspace ? `${notion.pages.length} ${notion.pages.length === 1 ? "page" : "pages"}` : "Tap to create one" })
254
+ ] }),
255
+ /* @__PURE__ */ jsx(Ionicons, { name: "chevron-down", size: 16, color: palette.textMuted })
256
+ ] }),
257
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: unread ? `Inbox, ${unread} unread` : "Inbox", onPress: () => openSheet("inbox"), style: ({
258
+ pressed
259
+ }) => [styles.iconButton, {
260
+ backgroundColor: palette.fill
261
+ }, pressed && ui.pressedScale], children: [
262
+ /* @__PURE__ */ jsx(Ionicons, { name: "notifications-outline", size: 20, color: palette.text }),
263
+ unread ? /* @__PURE__ */ jsx(View, { style: [styles.badgeDot, {
264
+ backgroundColor: palette.primary,
265
+ borderColor: palette.bg
266
+ }], children: /* @__PURE__ */ jsx(Text, { style: styles.badgeDotText, children: unread > 9 ? "9+" : unread }) }) : null
267
+ ] }),
268
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: "New page", onPress: () => run("page"), style: ({
269
+ pressed
270
+ }) => [styles.iconButton, {
271
+ backgroundColor: palette.primary
272
+ }, pressed && ui.pressedScale], children: busy === "page" ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: palette.onPrimary }) : /* @__PURE__ */ jsx(Ionicons, { name: "create-outline", size: 20, color: palette.onPrimary }) })
273
+ ] }),
274
+ searching ? /* @__PURE__ */ jsx(SearchMode, { palette, tint, workspaceId: (_f = (_e = notion.workspace) == null ? void 0 : _e.id) != null ? _f : null, commands, onOpenPage: openPage, onCancel: () => setSearching(false) }) : /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.homeContent, refreshControl: /* @__PURE__ */ jsx(RefreshControl, { refreshing, onRefresh, tintColor: palette.textMuted }), children: [
275
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "search", onPress: () => setSearching(true), style: [styles.searchPill, {
276
+ backgroundColor: palette.fill
277
+ }], children: [
278
+ /* @__PURE__ */ jsx(Ionicons, { name: "search", size: 17, color: palette.textMuted }),
279
+ /* @__PURE__ */ jsx(Text, { style: [styles.searchPlaceholder, {
280
+ color: palette.textMuted
281
+ }], children: "Search pages or jump to\u2026" })
282
+ ] }),
283
+ /* @__PURE__ */ jsx(Text, { style: [styles.date, {
284
+ color: palette.textMuted
285
+ }], children: todayLabel().toUpperCase() }),
286
+ /* @__PURE__ */ jsx(Text, { style: [styles.greeting, {
287
+ color: palette.text
288
+ }], children: greeting() }),
289
+ /* @__PURE__ */ jsx(View, { style: styles.actions, children: quickActions.map((a) => {
290
+ const t = tint(a.key);
291
+ return /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: a.label, onPress: a.onPress, style: ({
292
+ pressed
293
+ }) => [styles.action, {
294
+ backgroundColor: pressed ? palette.pressed : palette.card
295
+ }, ui.cardShadow], children: [
296
+ /* @__PURE__ */ jsx(View, { style: [styles.actionIcon, {
297
+ backgroundColor: t.bg
298
+ }], children: a.busy ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: t.fg }) : /* @__PURE__ */ jsx(Ionicons, { name: a.icon, size: 20, color: t.fg }) }),
299
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.actionLabel, {
300
+ color: palette.text
301
+ }], children: a.label })
302
+ ] }, a.key);
303
+ }) }),
304
+ notion.loading ? /* @__PURE__ */ jsx(View, { style: styles.loading, children: /* @__PURE__ */ jsx(ActivityIndicator, { color: palette.textMuted }) }) : notion.error ? /* @__PURE__ */ jsx(EmptyState, { palette, icon: "cloud-offline-outline", title: "Couldn't load your workspace", text: "Check your connection and pull down to try again." }) : !hasWorkspace ? /* @__PURE__ */ jsx(EmptyState, { palette, icon: "albums-outline", title: "No workspace yet", text: "Create a workspace to start organizing your pages.", action: {
305
+ label: "Create workspace",
306
+ onPress: () => setCreateOpen(true)
307
+ } }) : /* @__PURE__ */ jsxs(Fragment, { children: [
308
+ upcoming.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
309
+ /* @__PURE__ */ jsx(SectionHeader, { label: "Upcoming meetings", palette, action: {
310
+ label: "See all",
311
+ onPress: () => openSheet("meetings")
312
+ } }),
313
+ /* @__PURE__ */ jsx(Group, { palette, children: upcoming.map((m, i) => /* @__PURE__ */ jsx(MeetingRowView, { row: m, palette, onPress: () => openPage(m.id), divider: i < upcoming.length - 1 }, m.id)) })
314
+ ] }) : null,
315
+ /* @__PURE__ */ jsx(SectionHeader, { label: "Browse", palette }),
316
+ /* @__PURE__ */ jsx(Group, { palette, children: browse.map((b, i) => {
317
+ const t = tint(b.key === "meetings" ? "meeting" : b.key);
318
+ return /* @__PURE__ */ jsx(ListRow, { palette, icon: b.icon, iconColor: t.fg, iconBg: t.bg, title: SHEET_TITLES[b.key], subtitle: b.subtitle, onPress: () => openSheet(b.key), divider: i < browse.length - 1, trailing: b.badge ? /* @__PURE__ */ jsxs(View, { style: styles.trailing, children: [
319
+ /* @__PURE__ */ jsx(View, { style: [styles.countBadge, {
320
+ backgroundColor: palette.primary
321
+ }], children: /* @__PURE__ */ jsx(Text, { style: styles.countBadgeText, children: b.badge }) }),
322
+ /* @__PURE__ */ jsx(Ionicons, { name: "chevron-forward", size: 16, color: palette.textFaint })
323
+ ] }) : void 0 }, b.key);
324
+ }) }),
325
+ /* @__PURE__ */ jsx(SectionHeader, { label: "My pages", count: notion.pages.length, palette, action: notion.pages.length > 8 ? {
326
+ label: "See all",
327
+ onPress: () => openSheet("all")
328
+ } : void 0 }),
329
+ notion.pages.length === 0 ? /* @__PURE__ */ jsx(EmptyState, { palette, icon: "document-text-outline", title: "No pages yet", text: "Start with a blank page or pick a template.", action: {
330
+ label: "New page",
331
+ onPress: () => run("page"),
332
+ busy: busy === "page"
333
+ } }) : /* @__PURE__ */ jsx(Group, { palette, children: notion.pages.slice(0, 8).map((page, i, shown) => /* @__PURE__ */ jsx(PageRow, { page, palette, onPress: () => openPage(page.id), divider: i < shown.length - 1 }, page.id)) })
334
+ ] })
335
+ ] }),
336
+ /* @__PURE__ */ jsx(Modal, { visible: sheet !== null, animationType: "slide", presentationStyle: "pageSheet", onRequestClose: () => setSheet(null), children: /* @__PURE__ */ jsx(View, { style: [styles.root, {
337
+ backgroundColor: palette.bg
338
+ }], children: sheet ? /* @__PURE__ */ jsxs(Fragment, { children: [
339
+ /* @__PURE__ */ jsx(SheetHeader, { title: SHEET_TITLES[sheet], onDone: () => setSheet(null), palette }),
340
+ sheet === "inbox" ? /* @__PURE__ */ jsx(InboxSheet, { palette, onOpenPage: openPage }) : null,
341
+ sheet === "meetings" ? /* @__PURE__ */ jsx(MeetingsSheet, { palette, notion, onOpenPage: openPage }) : null,
342
+ sheet === "all" ? /* @__PURE__ */ jsx(AllPagesSheet, { palette, notion, onOpenPage: openPage }) : null,
343
+ sheet === "templates" ? /* @__PURE__ */ jsx(TemplatesSheet, { palette, notion, onOpenPage: openPage }) : null,
344
+ sheet === "trash" ? /* @__PURE__ */ jsx(TrashSheet, { palette, notion, onOpenPage: openPage }) : null
345
+ ] }) : null }) }),
346
+ /* @__PURE__ */ jsx(WorkspaceMenu, { visible: menuOpen, palette, workspaces: notion.workspaces, activeId: (_h = (_g = notion.workspace) == null ? void 0 : _g.id) != null ? _h : null, onClose: () => setMenuOpen(false), onSelect: (id) => {
347
+ notion.selectWorkspace(id);
348
+ setMenuOpen(false);
349
+ }, onCreate: () => {
350
+ setMenuOpen(false);
351
+ setCreateOpen(true);
352
+ } }),
353
+ /* @__PURE__ */ jsx(CreateWorkspaceSheet, { visible: createOpen, palette, onClose: () => setCreateOpen(false), onCreate: notion.createWorkspace })
354
+ ] });
355
+ }
356
+ function SearchMode({
357
+ palette,
358
+ tint,
359
+ workspaceId,
360
+ commands,
361
+ onOpenPage,
362
+ onCancel
363
+ }) {
364
+ const [text, setText] = useState("");
365
+ const [runSearch, {
366
+ data,
367
+ loading,
368
+ error
369
+ }] = useLazyQuery(NATIVE_NOTION_SEARCH, {
370
+ fetchPolicy: "network-only"
371
+ });
372
+ const query = text.trim();
373
+ useEffect(() => {
374
+ if (!query) return void 0;
375
+ const timer = setTimeout(() => {
376
+ runSearch({
377
+ variables: {
378
+ input: __spreadValues({
379
+ query,
380
+ types: PAGE_TYPES,
381
+ pageSize: 30
382
+ }, workspaceId ? {
383
+ workspaceId
384
+ } : {})
385
+ }
386
+ });
387
+ }, 250);
388
+ return () => clearTimeout(timer);
389
+ }, [query, runSearch, workspaceId]);
390
+ const results = useMemo(() => {
391
+ var _a, _b;
392
+ const seen = /* @__PURE__ */ new Set();
393
+ return ((_b = (_a = data == null ? void 0 : data.searchBlocks) == null ? void 0 : _a.results) != null ? _b : []).filter((b) => {
394
+ if (b.inTrash || seen.has(b.id)) return false;
395
+ seen.add(b.id);
396
+ return true;
397
+ });
398
+ }, [data]);
399
+ const shownCommands = commands.filter((c) => !query || c.label.toLowerCase().includes(query.toLowerCase()));
400
+ let hint = "";
401
+ if (query && error) hint = "Search failed. Try again.";
402
+ else if (query && !loading && !results.length && !shownCommands.length) hint = "No matching pages";
403
+ return /* @__PURE__ */ jsxs(View, { style: ui.flex, children: [
404
+ /* @__PURE__ */ jsxs(View, { style: styles.searchBar, children: [
405
+ /* @__PURE__ */ jsxs(View, { style: [styles.searchField, {
406
+ backgroundColor: palette.fill
407
+ }], children: [
408
+ /* @__PURE__ */ jsx(Ionicons, { name: "search", size: 17, color: palette.textMuted }),
409
+ /* @__PURE__ */ jsx(TextInput, { value: text, onChangeText: setText, placeholder: "Search pages, jump to, or run a command\u2026", placeholderTextColor: palette.textMuted, autoFocus: true, autoCorrect: false, returnKeyType: "search", clearButtonMode: "while-editing", style: [styles.searchInput, {
410
+ color: palette.text
411
+ }] }),
412
+ loading ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: palette.textMuted }) : null
413
+ ] }),
414
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: onCancel, hitSlop: 8, children: /* @__PURE__ */ jsx(Text, { style: [styles.cancel, {
415
+ color: palette.primary
416
+ }], children: "Cancel" }) })
417
+ ] }),
418
+ /* @__PURE__ */ jsxs(ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: styles.searchContent, children: [
419
+ query && results.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
420
+ /* @__PURE__ */ jsx(Text, { style: [styles.searchSection, {
421
+ color: palette.textMuted
422
+ }], children: "Pages" }),
423
+ /* @__PURE__ */ jsx(Group, { palette, children: results.map((page, i) => /* @__PURE__ */ jsx(PageRow, { page, palette, onPress: () => onOpenPage(page.id), divider: i < results.length - 1 }, page.id)) })
424
+ ] }) : null,
425
+ shownCommands.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
426
+ /* @__PURE__ */ jsx(Text, { style: [styles.searchSection, {
427
+ color: palette.textMuted
428
+ }], children: "Quick actions" }),
429
+ /* @__PURE__ */ jsx(Group, { palette, children: shownCommands.map((c, i) => {
430
+ const t = tint(c.tintKey);
431
+ return /* @__PURE__ */ jsx(ListRow, { palette, icon: c.icon, iconColor: t.fg, iconBg: t.bg, title: c.label, onPress: c.onPress, divider: i < shownCommands.length - 1 }, c.key);
432
+ }) })
433
+ ] }) : null,
434
+ hint ? /* @__PURE__ */ jsx(Text, { style: [styles.hint, {
435
+ color: error ? palette.danger : palette.textMuted
436
+ }], children: hint }) : null
437
+ ] })
438
+ ] });
439
+ }
440
+ function WorkspaceMenu({
441
+ visible,
442
+ palette,
443
+ workspaces,
444
+ activeId,
445
+ onClose,
446
+ onSelect,
447
+ onCreate
448
+ }) {
449
+ return /* @__PURE__ */ jsx(Modal, { visible, transparent: true, animationType: "fade", onRequestClose: onClose, children: /* @__PURE__ */ jsx(Pressable, { style: [styles.backdrop, {
450
+ backgroundColor: palette.backdrop
451
+ }], onPress: onClose, children: /* @__PURE__ */ jsxs(Pressable, { style: [styles.bottomSheet, {
452
+ backgroundColor: palette.card
453
+ }], children: [
454
+ /* @__PURE__ */ jsx(View, { style: [styles.grabber, {
455
+ backgroundColor: palette.hairline
456
+ }] }),
457
+ /* @__PURE__ */ jsx(Text, { style: [styles.bottomSheetTitle, {
458
+ color: palette.text
459
+ }], children: "Workspaces" }),
460
+ /* @__PURE__ */ jsx(FlatList, { data: workspaces, keyExtractor: (w) => w.id, style: [styles.menuList, {
461
+ backgroundColor: palette.bg
462
+ }], renderItem: ({
463
+ item,
464
+ index
465
+ }) => /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityState: {
466
+ selected: item.id === activeId
467
+ }, onPress: () => onSelect(item.id), style: ({
468
+ pressed
469
+ }) => [styles.menuRow, pressed && {
470
+ backgroundColor: palette.pressed
471
+ }], children: [
472
+ /* @__PURE__ */ jsx(WorkspaceBadge, { workspace: item, palette, size: 32 }),
473
+ /* @__PURE__ */ jsxs(View, { style: [styles.menuRowBody, index < workspaces.length - 1 && ui.hairline, {
474
+ borderBottomColor: palette.hairline
475
+ }], children: [
476
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.menuRowLabel, {
477
+ color: palette.text
478
+ }], children: item.name }),
479
+ item.id === activeId ? /* @__PURE__ */ jsx(Ionicons, { name: "checkmark-circle", size: 22, color: palette.primary }) : null
480
+ ] })
481
+ ] }) }),
482
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: onCreate, style: ({
483
+ pressed
484
+ }) => [styles.secondaryButton, {
485
+ backgroundColor: palette.primarySoft
486
+ }, pressed && ui.pressedScale], children: [
487
+ /* @__PURE__ */ jsx(Ionicons, { name: "add", size: 18, color: palette.primary }),
488
+ /* @__PURE__ */ jsx(Text, { style: [styles.secondaryButtonLabel, {
489
+ color: palette.primary
490
+ }], children: "Create workspace" })
491
+ ] })
492
+ ] }) }) });
493
+ }
494
+ function CreateWorkspaceSheet({
495
+ visible,
496
+ palette,
497
+ onClose,
498
+ onCreate
499
+ }) {
500
+ const [name, setName] = useState("");
501
+ const [saving, setSaving] = useState(false);
502
+ useEffect(() => {
503
+ if (visible) setName("");
504
+ }, [visible]);
505
+ const submit = async () => {
506
+ if (saving) return;
507
+ setSaving(true);
508
+ try {
509
+ await onCreate(name);
510
+ onClose();
511
+ } catch (err) {
512
+ Alert.alert("Couldn't create the workspace", err instanceof Error ? err.message : void 0);
513
+ } finally {
514
+ setSaving(false);
515
+ }
516
+ };
517
+ return /* @__PURE__ */ jsx(Modal, { visible, transparent: true, animationType: "fade", onRequestClose: onClose, children: /* @__PURE__ */ jsx(KeyboardAvoidingView, { behavior: Platform.OS === "ios" ? "padding" : void 0, style: ui.flex, children: /* @__PURE__ */ jsx(Pressable, { style: [styles.backdrop, {
518
+ backgroundColor: palette.backdrop
519
+ }], onPress: onClose, children: /* @__PURE__ */ jsxs(Pressable, { style: [styles.bottomSheet, {
520
+ backgroundColor: palette.card
521
+ }], children: [
522
+ /* @__PURE__ */ jsx(View, { style: [styles.grabber, {
523
+ backgroundColor: palette.hairline
524
+ }] }),
525
+ /* @__PURE__ */ jsx(View, { style: [styles.dialogIcon, {
526
+ backgroundColor: palette.primarySoft
527
+ }], children: /* @__PURE__ */ jsx(Ionicons, { name: "albums-outline", size: 26, color: palette.primary }) }),
528
+ /* @__PURE__ */ jsx(Text, { style: [styles.dialogTitle, {
529
+ color: palette.text
530
+ }], children: "New workspace" }),
531
+ /* @__PURE__ */ jsx(Text, { style: [styles.dialogText, {
532
+ color: palette.textMuted
533
+ }], children: "Give your workspace a name. You can change it later." }),
534
+ /* @__PURE__ */ jsx(Text, { style: [styles.fieldLabel, {
535
+ color: palette.textMuted
536
+ }], children: "Name" }),
537
+ /* @__PURE__ */ jsx(TextInput, { value: name, onChangeText: setName, placeholder: "e.g. Marketing, Personal, Team Alpha", placeholderTextColor: palette.textFaint, autoFocus: true, returnKeyType: "done", onSubmitEditing: submit, style: [styles.dialogInput, {
538
+ color: palette.text,
539
+ backgroundColor: palette.fill
540
+ }] }),
541
+ /* @__PURE__ */ jsx(Text, { style: [styles.fieldHelp, {
542
+ color: palette.textFaint
543
+ }], children: "Leave blank to use \u201CUntitled workspace\u201D." }),
544
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: submit, disabled: saving, style: ({
545
+ pressed
546
+ }) => [ui.primaryButton, styles.blockButton, {
547
+ backgroundColor: palette.primary
548
+ }, pressed && ui.pressedScale], children: saving ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: palette.onPrimary }) : /* @__PURE__ */ jsx(Text, { style: [ui.primaryButtonLabel, {
549
+ color: palette.onPrimary
550
+ }], children: "Create" }) }),
551
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: onClose, style: styles.textButton, children: /* @__PURE__ */ jsx(Text, { style: [styles.textButtonLabel, {
552
+ color: palette.textMuted
553
+ }], children: "Cancel" }) })
554
+ ] }) }) }) });
555
+ }
556
+ const styles = StyleSheet.create({
557
+ root: {
558
+ flex: 1
559
+ },
560
+ loading: {
561
+ paddingVertical: 48,
562
+ alignItems: "center"
563
+ },
564
+ header: {
565
+ flexDirection: "row",
566
+ alignItems: "center",
567
+ gap: 8,
568
+ paddingHorizontal: 12,
569
+ paddingTop: 8,
570
+ paddingBottom: 4
571
+ },
572
+ switcher: {
573
+ flex: 1,
574
+ flexDirection: "row",
575
+ alignItems: "center",
576
+ gap: 10,
577
+ padding: 6,
578
+ borderRadius: 14
579
+ },
580
+ switcherText: {
581
+ flexShrink: 1
582
+ },
583
+ switcherName: {
584
+ fontSize: 17,
585
+ fontWeight: "700",
586
+ letterSpacing: -0.2
587
+ },
588
+ switcherMeta: {
589
+ fontSize: 13,
590
+ marginTop: 1
591
+ },
592
+ iconButton: {
593
+ width: 40,
594
+ height: 40,
595
+ borderRadius: 20,
596
+ alignItems: "center",
597
+ justifyContent: "center"
598
+ },
599
+ badgeDot: {
600
+ position: "absolute",
601
+ top: -2,
602
+ right: -2,
603
+ minWidth: 18,
604
+ height: 18,
605
+ paddingHorizontal: 4,
606
+ borderRadius: 9,
607
+ borderWidth: 2,
608
+ alignItems: "center",
609
+ justifyContent: "center"
610
+ },
611
+ badgeDotText: {
612
+ color: "#fff",
613
+ fontSize: 10,
614
+ fontWeight: "800"
615
+ },
616
+ homeContent: {
617
+ paddingHorizontal: 16,
618
+ paddingTop: 8,
619
+ paddingBottom: 48
620
+ },
621
+ searchPill: {
622
+ flexDirection: "row",
623
+ alignItems: "center",
624
+ gap: 8,
625
+ height: 40,
626
+ paddingHorizontal: 12,
627
+ borderRadius: 12
628
+ },
629
+ searchPlaceholder: {
630
+ fontSize: 16
631
+ },
632
+ date: {
633
+ fontSize: 12,
634
+ fontWeight: "600",
635
+ letterSpacing: 0.6,
636
+ marginTop: 24
637
+ },
638
+ greeting: {
639
+ fontSize: 32,
640
+ fontWeight: "800",
641
+ letterSpacing: -0.6,
642
+ marginTop: 4
643
+ },
644
+ actions: {
645
+ flexDirection: "row",
646
+ gap: 10,
647
+ marginTop: 20
648
+ },
649
+ action: {
650
+ flex: 1,
651
+ alignItems: "center",
652
+ gap: 8,
653
+ paddingVertical: 14,
654
+ borderRadius: 16
655
+ },
656
+ actionIcon: {
657
+ width: 44,
658
+ height: 44,
659
+ borderRadius: 14,
660
+ alignItems: "center",
661
+ justifyContent: "center"
662
+ },
663
+ actionLabel: {
664
+ fontSize: 13,
665
+ fontWeight: "600"
666
+ },
667
+ trailing: {
668
+ flexDirection: "row",
669
+ alignItems: "center",
670
+ gap: 6
671
+ },
672
+ countBadge: {
673
+ minWidth: 22,
674
+ height: 22,
675
+ paddingHorizontal: 6,
676
+ borderRadius: 11,
677
+ alignItems: "center",
678
+ justifyContent: "center"
679
+ },
680
+ countBadgeText: {
681
+ color: "#fff",
682
+ fontSize: 12,
683
+ fontWeight: "800"
684
+ },
685
+ searchBar: {
686
+ flexDirection: "row",
687
+ alignItems: "center",
688
+ gap: 12,
689
+ paddingHorizontal: 16,
690
+ paddingVertical: 8
691
+ },
692
+ searchField: {
693
+ flex: 1,
694
+ flexDirection: "row",
695
+ alignItems: "center",
696
+ gap: 8,
697
+ height: 40,
698
+ paddingHorizontal: 12,
699
+ borderRadius: 12
700
+ },
701
+ searchInput: {
702
+ flex: 1,
703
+ fontSize: 16,
704
+ paddingVertical: 0
705
+ },
706
+ cancel: {
707
+ fontSize: 16,
708
+ fontWeight: "500"
709
+ },
710
+ searchContent: {
711
+ paddingHorizontal: 16,
712
+ paddingBottom: 48
713
+ },
714
+ searchSection: {
715
+ fontSize: 13,
716
+ fontWeight: "600",
717
+ marginTop: 16,
718
+ marginBottom: 8,
719
+ marginLeft: 4
720
+ },
721
+ hint: {
722
+ fontSize: 15,
723
+ textAlign: "center",
724
+ paddingVertical: 40
725
+ },
726
+ backdrop: {
727
+ flex: 1,
728
+ justifyContent: "flex-end"
729
+ },
730
+ bottomSheet: {
731
+ borderTopLeftRadius: 24,
732
+ borderTopRightRadius: 24,
733
+ paddingHorizontal: 16,
734
+ paddingTop: 8,
735
+ paddingBottom: 36
736
+ },
737
+ grabber: {
738
+ alignSelf: "center",
739
+ width: 36,
740
+ height: 5,
741
+ borderRadius: 3,
742
+ marginBottom: 12
743
+ },
744
+ bottomSheetTitle: {
745
+ fontSize: 20,
746
+ fontWeight: "700",
747
+ marginBottom: 12,
748
+ marginLeft: 4
749
+ },
750
+ menuList: {
751
+ borderRadius: 16,
752
+ maxHeight: 320,
753
+ flexGrow: 0
754
+ },
755
+ menuRow: {
756
+ flexDirection: "row",
757
+ alignItems: "center",
758
+ paddingLeft: 12
759
+ },
760
+ menuRowBody: {
761
+ flex: 1,
762
+ flexDirection: "row",
763
+ alignItems: "center",
764
+ gap: 8,
765
+ marginLeft: 12,
766
+ paddingRight: 12,
767
+ paddingVertical: 14
768
+ },
769
+ menuRowLabel: {
770
+ flex: 1,
771
+ fontSize: 16,
772
+ fontWeight: "600"
773
+ },
774
+ secondaryButton: {
775
+ flexDirection: "row",
776
+ alignItems: "center",
777
+ justifyContent: "center",
778
+ gap: 6,
779
+ minHeight: 48,
780
+ marginTop: 14,
781
+ borderRadius: 14
782
+ },
783
+ secondaryButtonLabel: {
784
+ fontSize: 16,
785
+ fontWeight: "700"
786
+ },
787
+ dialogIcon: {
788
+ alignSelf: "center",
789
+ width: 60,
790
+ height: 60,
791
+ borderRadius: 18,
792
+ alignItems: "center",
793
+ justifyContent: "center",
794
+ marginTop: 4
795
+ },
796
+ dialogTitle: {
797
+ fontSize: 20,
798
+ fontWeight: "700",
799
+ textAlign: "center",
800
+ marginTop: 14
801
+ },
802
+ dialogText: {
803
+ fontSize: 15,
804
+ textAlign: "center",
805
+ marginTop: 6
806
+ },
807
+ fieldLabel: {
808
+ fontSize: 13,
809
+ fontWeight: "600",
810
+ marginTop: 20,
811
+ marginBottom: 6,
812
+ marginLeft: 2
813
+ },
814
+ dialogInput: {
815
+ fontSize: 16,
816
+ height: 48,
817
+ paddingHorizontal: 14,
818
+ borderRadius: 12
819
+ },
820
+ fieldHelp: {
821
+ fontSize: 13,
822
+ marginTop: 6,
823
+ marginLeft: 2
824
+ },
825
+ blockButton: {
826
+ alignSelf: "stretch"
827
+ },
828
+ textButton: {
829
+ alignItems: "center",
830
+ paddingVertical: 12,
831
+ marginTop: 4
832
+ },
833
+ textButtonLabel: {
834
+ fontSize: 16,
835
+ fontWeight: "600"
836
+ }
837
+ });export{NotionWorkspaceView};//# sourceMappingURL=NotionWorkspaceView.js.map