@adminide-stack/yantra-mobile 12.0.141-alpha.1 → 12.0.142-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.
Files changed (227) hide show
  1. package/lib/features/agent-chat/NativeAgentChat.js +21 -4
  2. package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
  3. package/lib/features/chat/ApprovalCard.js +353 -0
  4. package/lib/features/chat/ApprovalCard.js.map +1 -0
  5. package/lib/features/chat/AskUserCard.js +9 -2
  6. package/lib/features/chat/AskUserCard.js.map +1 -1
  7. package/lib/features/chat/askUser.js +25 -3
  8. package/lib/features/chat/askUser.js.map +1 -1
  9. package/lib/features/chat/queuedFollowUpRows.js +13 -0
  10. package/lib/features/chat/queuedFollowUpRows.js.map +1 -0
  11. package/lib/features/dictate/DictateExperience.js +59 -7
  12. package/lib/features/dictate/DictateExperience.js.map +1 -1
  13. package/lib/features/dictate/components/NoteView.js +227 -12
  14. package/lib/features/dictate/components/NoteView.js.map +1 -1
  15. package/lib/features/dictate/dictateClient.js +93 -23
  16. package/lib/features/dictate/dictateClient.js.map +1 -1
  17. package/lib/features/dictate/dictatePreference.js +19 -0
  18. package/lib/features/dictate/dictatePreference.js.map +1 -0
  19. package/lib/features/dictate/noteText.js +17 -2
  20. package/lib/features/dictate/noteText.js.map +1 -1
  21. package/lib/features/dictate/privacy.js +96 -0
  22. package/lib/features/dictate/privacy.js.map +1 -0
  23. package/lib/features/dictate/shownNote.js +24 -0
  24. package/lib/features/dictate/shownNote.js.map +1 -0
  25. package/lib/features/discover/DiscoverArticle.js +105 -92
  26. package/lib/features/discover/DiscoverArticle.js.map +1 -1
  27. package/lib/features/discover/DiscoverFeed.js +97 -48
  28. package/lib/features/discover/DiscoverFeed.js.map +1 -1
  29. package/lib/features/discover/DiscoverFollowUp.js +135 -0
  30. package/lib/features/discover/DiscoverFollowUp.js.map +1 -0
  31. package/lib/features/discover/DiscoverSidebar.js +555 -0
  32. package/lib/features/discover/DiscoverSidebar.js.map +1 -0
  33. package/lib/features/discover/DiscoverSkeletons.js +123 -0
  34. package/lib/features/discover/DiscoverSkeletons.js.map +1 -0
  35. package/lib/features/discover/DiscoverStoryCards.js +193 -87
  36. package/lib/features/discover/DiscoverStoryCards.js.map +1 -1
  37. package/lib/features/discover/followUpQuery.js +42 -0
  38. package/lib/features/discover/followUpQuery.js.map +1 -0
  39. package/lib/features/discover/markets.js +37 -0
  40. package/lib/features/discover/markets.js.map +1 -0
  41. package/lib/features/discover/useDiscoverSidebar.js +148 -0
  42. package/lib/features/discover/useDiscoverSidebar.js.map +1 -0
  43. package/lib/features/discover/weather.js +42 -0
  44. package/lib/features/discover/weather.js.map +1 -0
  45. package/lib/features/expenses/ExpensesAgentChatPane.js +1 -1
  46. package/lib/features/expenses/ExpensesAgentChatPane.js.map +1 -1
  47. package/lib/features/inbox/InboxAgentChatPane.js +1 -1
  48. package/lib/features/inbox/InboxAgentChatPane.js.map +1 -1
  49. package/lib/features/job-search/JobSearchAgentChatPane.js +1 -0
  50. package/lib/features/job-search/JobSearchAgentChatPane.js.map +1 -1
  51. package/lib/features/local-services/LocalServicesAgentChatPane.js +1 -1
  52. package/lib/features/local-services/LocalServicesAgentChatPane.js.map +1 -1
  53. package/lib/features/movies/MoviesAgentChatPane.js +1 -1
  54. package/lib/features/movies/MoviesAgentChatPane.js.map +1 -1
  55. package/lib/features/notion/NotionBlockSheets.js +206 -0
  56. package/lib/features/notion/NotionBlockSheets.js.map +1 -0
  57. package/lib/features/notion/NotionBlockView.js +36 -0
  58. package/lib/features/notion/NotionBlockView.js.map +1 -0
  59. package/lib/features/notion/NotionCommentsSheet.js +461 -0
  60. package/lib/features/notion/NotionCommentsSheet.js.map +1 -0
  61. package/lib/features/notion/NotionConnectionsSheet.js +244 -0
  62. package/lib/features/notion/NotionConnectionsSheet.js.map +1 -0
  63. package/lib/features/notion/NotionHistorySheet.js +439 -0
  64. package/lib/features/notion/NotionHistorySheet.js.map +1 -0
  65. package/lib/features/notion/NotionMediaBlocks.js +803 -0
  66. package/lib/features/notion/NotionMediaBlocks.js.map +1 -0
  67. package/lib/features/notion/NotionMentionSheet.js +279 -0
  68. package/lib/features/notion/NotionMentionSheet.js.map +1 -0
  69. package/lib/features/notion/NotionPageMenu.js +585 -0
  70. package/lib/features/notion/NotionPageMenu.js.map +1 -0
  71. package/lib/features/notion/NotionPageTree.js +220 -0
  72. package/lib/features/notion/NotionPageTree.js.map +1 -0
  73. package/lib/features/notion/NotionPageView.js +1253 -152
  74. package/lib/features/notion/NotionPageView.js.map +1 -1
  75. package/lib/features/notion/NotionShareSheet.js +606 -0
  76. package/lib/features/notion/NotionShareSheet.js.map +1 -0
  77. package/lib/features/notion/NotionSheets.js +87 -15
  78. package/lib/features/notion/NotionSheets.js.map +1 -1
  79. package/lib/features/notion/NotionSidebarSections.js +492 -0
  80. package/lib/features/notion/NotionSidebarSections.js.map +1 -0
  81. package/lib/features/notion/NotionWorkspaceAdmin.js +659 -0
  82. package/lib/features/notion/NotionWorkspaceAdmin.js.map +1 -0
  83. package/lib/features/notion/NotionWorkspaceView.js +257 -45
  84. package/lib/features/notion/NotionWorkspaceView.js.map +1 -1
  85. package/lib/features/notion/database/DatabaseCells.js +554 -0
  86. package/lib/features/notion/database/DatabaseCells.js.map +1 -0
  87. package/lib/features/notion/database/DatabaseDateLayouts.js +792 -0
  88. package/lib/features/notion/database/DatabaseDateLayouts.js.map +1 -0
  89. package/lib/features/notion/database/DatabaseLayouts.js +461 -0
  90. package/lib/features/notion/database/DatabaseLayouts.js.map +1 -0
  91. package/lib/features/notion/database/DatabaseSheets.js +791 -0
  92. package/lib/features/notion/database/DatabaseSheets.js.map +1 -0
  93. package/lib/features/notion/database/NotionDatabaseView.js +817 -0
  94. package/lib/features/notion/database/NotionDatabaseView.js.map +1 -0
  95. package/lib/features/notion/database/RowPropertiesPanel.js +162 -0
  96. package/lib/features/notion/database/RowPropertiesPanel.js.map +1 -0
  97. package/lib/features/notion/database/chartData.js +89 -0
  98. package/lib/features/notion/database/chartData.js.map +1 -0
  99. package/lib/features/notion/database/chartView.js +112 -0
  100. package/lib/features/notion/database/chartView.js.map +1 -0
  101. package/lib/features/notion/database/connectorButton.js +33 -0
  102. package/lib/features/notion/database/connectorButton.js.map +1 -0
  103. package/lib/features/notion/database/databaseCalc.js +208 -0
  104. package/lib/features/notion/database/databaseCalc.js.map +1 -0
  105. package/lib/features/notion/database/databaseCalendar.js +157 -0
  106. package/lib/features/notion/database/databaseCalendar.js.map +1 -0
  107. package/lib/features/notion/database/databaseCsv.js +98 -0
  108. package/lib/features/notion/database/databaseCsv.js.map +1 -0
  109. package/lib/features/notion/database/databaseCsvActions.js +58 -0
  110. package/lib/features/notion/database/databaseCsvActions.js.map +1 -0
  111. package/lib/features/notion/database/databaseFilter.js +473 -0
  112. package/lib/features/notion/database/databaseFilter.js.map +1 -0
  113. package/lib/features/notion/database/databaseFormula.js +1072 -0
  114. package/lib/features/notion/database/databaseFormula.js.map +1 -0
  115. package/lib/features/notion/database/databaseGroup.js +151 -0
  116. package/lib/features/notion/database/databaseGroup.js.map +1 -0
  117. package/lib/features/notion/database/databaseRollup.js +58 -0
  118. package/lib/features/notion/database/databaseRollup.js.map +1 -0
  119. package/lib/features/notion/database/databaseTimeline.js +156 -0
  120. package/lib/features/notion/database/databaseTimeline.js.map +1 -0
  121. package/lib/features/notion/database/databaseView.js +1188 -0
  122. package/lib/features/notion/database/databaseView.js.map +1 -0
  123. package/lib/features/notion/database/databaseViews.js +310 -0
  124. package/lib/features/notion/database/databaseViews.js.map +1 -0
  125. package/lib/features/notion/database/relationSource.js +92 -0
  126. package/lib/features/notion/database/relationSource.js.map +1 -0
  127. package/lib/features/notion/database/uniqueId.js +17 -0
  128. package/lib/features/notion/database/uniqueId.js.map +1 -0
  129. package/lib/features/notion/database/useNotionDatabase.js +617 -0
  130. package/lib/features/notion/database/useNotionDatabase.js.map +1 -0
  131. package/lib/features/notion/notionAgentRunStatus.js +39 -0
  132. package/lib/features/notion/notionAgentRunStatus.js.map +1 -0
  133. package/lib/features/notion/notionCodeLanguages.js +112 -0
  134. package/lib/features/notion/notionCodeLanguages.js.map +1 -0
  135. package/lib/features/notion/notionComments.js +86 -0
  136. package/lib/features/notion/notionComments.js.map +1 -0
  137. package/lib/features/notion/notionConnections.js +74 -0
  138. package/lib/features/notion/notionConnections.js.map +1 -0
  139. package/lib/features/notion/notionDocuments.js +453 -1
  140. package/lib/features/notion/notionDocuments.js.map +1 -1
  141. package/lib/features/notion/notionEditorModel.js +142 -7
  142. package/lib/features/notion/notionEditorModel.js.map +1 -1
  143. package/lib/features/notion/notionMarkdownShortcuts.js +51 -0
  144. package/lib/features/notion/notionMarkdownShortcuts.js.map +1 -0
  145. package/lib/features/notion/notionMedia.js +119 -0
  146. package/lib/features/notion/notionMedia.js.map +1 -0
  147. package/lib/features/notion/notionMentionDate.js +32 -0
  148. package/lib/features/notion/notionMentionDate.js.map +1 -0
  149. package/lib/features/notion/notionMentionOptions.js +162 -0
  150. package/lib/features/notion/notionMentionOptions.js.map +1 -0
  151. package/lib/features/notion/notionNotesAgent.js +445 -0
  152. package/lib/features/notion/notionNotesAgent.js.map +1 -0
  153. package/lib/features/notion/notionPageAccess.js +168 -0
  154. package/lib/features/notion/notionPageAccess.js.map +1 -0
  155. package/lib/features/notion/notionPageActions.js +138 -0
  156. package/lib/features/notion/notionPageActions.js.map +1 -0
  157. package/lib/features/notion/notionPageHistory.js +154 -0
  158. package/lib/features/notion/notionPageHistory.js.map +1 -0
  159. package/lib/features/notion/notionPageKinds.js +200 -0
  160. package/lib/features/notion/notionPageKinds.js.map +1 -0
  161. package/lib/features/notion/notionRecents.js +48 -0
  162. package/lib/features/notion/notionRecents.js.map +1 -0
  163. package/lib/features/notion/notionRichText.js +177 -0
  164. package/lib/features/notion/notionRichText.js.map +1 -0
  165. package/lib/features/notion/notionRichTitle.js +336 -0
  166. package/lib/features/notion/notionRichTitle.js.map +1 -0
  167. package/lib/features/notion/useNotionWorkspace.js +272 -13
  168. package/lib/features/notion/useNotionWorkspace.js.map +1 -1
  169. package/lib/features/notion/usePageActions.js +155 -0
  170. package/lib/features/notion/usePageActions.js.map +1 -0
  171. package/lib/features/resume/ResumeAgentChatPane.js +1 -1
  172. package/lib/features/resume/ResumeAgentChatPane.js.map +1 -1
  173. package/lib/features/shopping/ShoppingAgentChatPane.js +1 -1
  174. package/lib/features/shopping/ShoppingAgentChatPane.js.map +1 -1
  175. package/lib/features/study/StudyAgentChatPane.js +1 -1
  176. package/lib/features/study/StudyAgentChatPane.js.map +1 -1
  177. package/lib/features/travel/TravelAgentChatPane.js +1 -1
  178. package/lib/features/travel/TravelAgentChatPane.js.map +1 -1
  179. package/lib/features/webbuilder/WebBuilderExperience.js +40 -8
  180. package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
  181. package/lib/features/webbuilder/buildFragments.js +1 -1
  182. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  183. package/lib/features/webbuilder/codeFiles.js +302 -0
  184. package/lib/features/webbuilder/codeFiles.js.map +1 -0
  185. package/lib/features/webbuilder/codeHighlight.js +209 -0
  186. package/lib/features/webbuilder/codeHighlight.js.map +1 -0
  187. package/lib/features/webbuilder/components/CodeView.js +682 -52
  188. package/lib/features/webbuilder/components/CodeView.js.map +1 -1
  189. package/lib/features/webbuilder/components/PreviewScreen.js +59 -38
  190. package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
  191. package/lib/features/webbuilder/components/ProjectChat.js +3 -3
  192. package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
  193. package/lib/features/webbuilder/stepLabels.js +68 -0
  194. package/lib/features/webbuilder/stepLabels.js.map +1 -0
  195. package/lib/hooks/useHostChatSteering.js +45 -0
  196. package/lib/hooks/useHostChatSteering.js.map +1 -0
  197. package/lib/screens/Chat/index.js +2 -12
  198. package/lib/screens/Chat/index.js.map +1 -1
  199. package/lib/screens/ExpensesNative/useExpensesHostChat.js +25 -5
  200. package/lib/screens/ExpensesNative/useExpensesHostChat.js.map +1 -1
  201. package/lib/screens/InboxNative/useInboxHostChat.js +25 -5
  202. package/lib/screens/InboxNative/useInboxHostChat.js.map +1 -1
  203. package/lib/screens/JobSearchNative/useJobSearchHostChat.js +25 -5
  204. package/lib/screens/JobSearchNative/useJobSearchHostChat.js.map +1 -1
  205. package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js +25 -5
  206. package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js.map +1 -1
  207. package/lib/screens/MoviesNative/useMoviesHostChat.js +25 -5
  208. package/lib/screens/MoviesNative/useMoviesHostChat.js.map +1 -1
  209. package/lib/screens/NotionPage/index.js +2 -2
  210. package/lib/screens/NotionPage/index.js.map +1 -1
  211. package/lib/screens/ResumeNative/useResumeHostChat.js +25 -5
  212. package/lib/screens/ResumeNative/useResumeHostChat.js.map +1 -1
  213. package/lib/screens/ShoppingNative/useShoppingHostChat.js +25 -5
  214. package/lib/screens/ShoppingNative/useShoppingHostChat.js.map +1 -1
  215. package/lib/screens/StudyNative/useStudyHostChat.js +25 -5
  216. package/lib/screens/StudyNative/useStudyHostChat.js.map +1 -1
  217. package/lib/screens/TravelNative/useTravelHostChat.js +25 -5
  218. package/lib/screens/TravelNative/useTravelHostChat.js.map +1 -1
  219. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js +222 -0
  220. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js.map +1 -0
  221. package/lib/screens/WebBuilderNative/index.js +1 -1
  222. package/lib/screens/WebBuilderNative/index.js.map +1 -1
  223. package/lib/screens/WebBuilderNative/sandboxProxyApi.js +126 -4
  224. package/lib/screens/WebBuilderNative/sandboxProxyApi.js.map +1 -1
  225. package/lib/screens/WebBuilderNative/useWebBuilderHost.js +120 -11
  226. package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
  227. package/package.json +3 -3
@@ -0,0 +1,659 @@
1
+ import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useState,useEffect,useMemo}from'react';import {Modal,View,Text,Pressable,StyleSheet,KeyboardAvoidingView,Platform,ScrollView,TextInput,ActivityIndicator,Alert}from'react-native';import {useQuery,useApolloClient}from'@apollo/client/index.js';import {NATIVE_NOTION_WORKSPACE_DETAIL,NATIVE_NOTES_VIEWER,NATIVE_NOTION_MEMBERS,NATIVE_NOTION_ADD_MEMBER,NATIVE_NOTION_GUESTS,NATIVE_NOTION_UPDATE_WORKSPACE,NATIVE_NOTES_USERS,NATIVE_NOTION_UPDATE_MEMBER,NATIVE_NOTION_REMOVE_MEMBER,NATIVE_NOTION_REMOVE_GUEST}from'./notionDocuments.js';import {viewerWorkspaceRole,ROLE_LABEL,canManageWorkspace,serverErrorText,workspaceIconInput,WORKSPACE_ROLES}from'./notionPageActions.js';import {ui}from'./notionUi.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
+ function WorkspaceAdminSheet({
18
+ visible,
19
+ initialTab = "settings",
20
+ palette,
21
+ notion,
22
+ onClose
23
+ }) {
24
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
25
+ const [tab, setTab] = useState(initialTab);
26
+ useEffect(() => {
27
+ if (visible) setTab(initialTab);
28
+ }, [visible, initialTab]);
29
+ const workspaceId = (_b = (_a = notion.workspace) == null ? void 0 : _a.id) != null ? _b : "";
30
+ const detailQuery = useQuery(NATIVE_NOTION_WORKSPACE_DETAIL, {
31
+ variables: {
32
+ workspaceId
33
+ },
34
+ skip: !visible || !workspaceId,
35
+ fetchPolicy: "network-only"
36
+ });
37
+ const viewerQuery = useQuery(NATIVE_NOTES_VIEWER, {
38
+ skip: !visible,
39
+ fetchPolicy: "cache-first"
40
+ });
41
+ const detail = (_d = (_c = detailQuery.data) == null ? void 0 : _c.getWorkspace) != null ? _d : null;
42
+ const role = viewerWorkspaceRole(detail, (_f = (_e = viewerQuery.data) == null ? void 0 : _e.notesViewer) != null ? _f : null);
43
+ const manage = canManageWorkspace(role);
44
+ return /* @__PURE__ */ jsx(Modal, { visible, animationType: "slide", presentationStyle: "pageSheet", onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style: [ui.flex, {
45
+ backgroundColor: palette.bg
46
+ }], children: [
47
+ /* @__PURE__ */ jsxs(View, { style: [ui.sheetHeader, {
48
+ borderBottomColor: palette.hairline
49
+ }], children: [
50
+ /* @__PURE__ */ jsx(View, { style: [ui.sheetHeaderSide, ui.sheetHeaderLeft] }),
51
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [ui.sheetHeaderTitle, {
52
+ color: palette.text
53
+ }], children: (_h = (_g = notion.workspace) == null ? void 0 : _g.name) != null ? _h : "Workspace" }),
54
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: onClose, hitSlop: 8, style: ui.sheetHeaderSide, children: /* @__PURE__ */ jsx(Text, { style: [ui.sheetHeaderDone, {
55
+ color: palette.primary
56
+ }], children: "Done" }) })
57
+ ] }),
58
+ /* @__PURE__ */ jsx(View, { style: [styles.tabs, {
59
+ backgroundColor: palette.fill
60
+ }], children: ["settings", "members", "guests"].map((t) => /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "tab", accessibilityState: {
61
+ selected: tab === t
62
+ }, onPress: () => setTab(t), style: [styles.tab, tab === t && [styles.tabActive, {
63
+ backgroundColor: palette.card
64
+ }]], children: /* @__PURE__ */ jsx(Text, { style: [styles.tabLabel, {
65
+ color: tab === t ? palette.text : palette.textMuted
66
+ }], children: t === "settings" ? "Settings" : t === "members" ? "Members" : "Guests" }) }, t)) }),
67
+ !manage ? /* @__PURE__ */ jsx(Text, { style: [styles.readOnly, {
68
+ color: palette.textMuted
69
+ }], children: `You're ${role ? `a ${ROLE_LABEL[role].toLowerCase()}` : "not an admin"} here \u2014 only owners and admins can change the workspace.` }) : null,
70
+ visible && workspaceId ? /* @__PURE__ */ jsxs(KeyboardAvoidingView, { style: ui.flex, behavior: Platform.OS === "ios" ? "padding" : void 0, keyboardVerticalOffset: Platform.OS === "ios" ? 80 : 0, children: [
71
+ tab === "settings" ? /* @__PURE__ */ jsx(SettingsTab, { palette, notion, detail, loading: detailQuery.loading && !detail, manage, onSaved: () => {
72
+ detailQuery.refetch();
73
+ notion.refetchWorkspaces();
74
+ }, onDeleted: onClose }) : null,
75
+ tab === "members" ? /* @__PURE__ */ jsx(MembersTab, { palette, workspaceId, manage, viewer: (_j = (_i = viewerQuery.data) == null ? void 0 : _i.notesViewer) != null ? _j : null, onLeft: async () => {
76
+ var _a2, _b2;
77
+ onClose();
78
+ const res = await notion.refetchWorkspaces();
79
+ const next = ((_b2 = (_a2 = res.data) == null ? void 0 : _a2.listWorkspaces) != null ? _b2 : []).find((w) => w.id !== workspaceId);
80
+ if (next) notion.selectWorkspace(next.id);
81
+ } }) : null,
82
+ tab === "guests" ? /* @__PURE__ */ jsx(GuestsTab, { palette, workspaceId, manage }) : null
83
+ ] }) : null
84
+ ] }) });
85
+ }
86
+ function SettingsTab({
87
+ palette,
88
+ notion,
89
+ detail,
90
+ loading,
91
+ manage,
92
+ onSaved,
93
+ onDeleted
94
+ }) {
95
+ var _a, _b, _c, _d, _e;
96
+ const client = useApolloClient();
97
+ const [name, setName] = useState("");
98
+ const [icon, setIcon] = useState("");
99
+ const [busy, setBusy] = useState(false);
100
+ const [message, setMessage] = useState(null);
101
+ useEffect(() => {
102
+ var _a2, _b2, _c2, _d2, _e2;
103
+ if (!detail) return;
104
+ setName((_a2 = detail.name) != null ? _a2 : "");
105
+ setIcon((_e2 = (_d2 = (_b2 = detail.icon) == null ? void 0 : _b2.emoji) != null ? _d2 : (_c2 = detail.icon) == null ? void 0 : _c2.url) != null ? _e2 : "");
106
+ }, [detail]);
107
+ const dirty = !!detail && (name.trim() !== ((_a = detail.name) != null ? _a : "") || icon.trim() !== ((_e = (_d = (_b = detail.icon) == null ? void 0 : _b.emoji) != null ? _d : (_c = detail.icon) == null ? void 0 : _c.url) != null ? _e : ""));
108
+ const save = async () => {
109
+ if (!detail || !name.trim()) return;
110
+ setBusy(true);
111
+ setMessage(null);
112
+ const iconInput = workspaceIconInput(icon);
113
+ try {
114
+ await client.mutate({
115
+ mutation: NATIVE_NOTION_UPDATE_WORKSPACE,
116
+ variables: {
117
+ id: detail.id,
118
+ input: __spreadValues({
119
+ name: name.trim()
120
+ }, iconInput ? {
121
+ icon: iconInput
122
+ } : {
123
+ clearIcon: true
124
+ })
125
+ },
126
+ errorPolicy: "none"
127
+ });
128
+ setMessage({
129
+ text: "Saved"
130
+ });
131
+ onSaved();
132
+ } catch (err) {
133
+ setMessage({
134
+ text: serverErrorText(err),
135
+ error: true
136
+ });
137
+ } finally {
138
+ setBusy(false);
139
+ }
140
+ };
141
+ const remove = () => {
142
+ if (!detail) return;
143
+ Alert.alert(`Move \u201C${detail.name}\u201D to trash?`, "Its pages go with it. This affects everyone in the workspace.", [{
144
+ text: "Cancel",
145
+ style: "cancel"
146
+ }, {
147
+ text: "Move to trash",
148
+ style: "destructive",
149
+ onPress: async () => {
150
+ try {
151
+ await notion.deleteWorkspace(detail.id);
152
+ onDeleted();
153
+ } catch (err) {
154
+ setMessage({
155
+ text: serverErrorText(err),
156
+ error: true
157
+ });
158
+ }
159
+ }
160
+ }]);
161
+ };
162
+ if (loading) return /* @__PURE__ */ jsx(Loading, { palette });
163
+ return /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.content, keyboardShouldPersistTaps: "handled", children: [
164
+ /* @__PURE__ */ jsx(Text, { style: [styles.label, {
165
+ color: palette.textMuted
166
+ }], children: "Name" }),
167
+ /* @__PURE__ */ jsx(TextInput, { value: name, onChangeText: setName, editable: manage, placeholder: "Workspace name", placeholderTextColor: palette.textFaint, style: [styles.input, {
168
+ color: palette.text,
169
+ backgroundColor: palette.card
170
+ }] }),
171
+ /* @__PURE__ */ jsx(Text, { style: [styles.label, {
172
+ color: palette.textMuted
173
+ }], children: "Icon" }),
174
+ /* @__PURE__ */ jsx(TextInput, { value: icon, onChangeText: setIcon, editable: manage, placeholder: "An emoji, or an image URL", placeholderTextColor: palette.textFaint, autoCapitalize: "none", autoCorrect: false, style: [styles.input, {
175
+ color: palette.text,
176
+ backgroundColor: palette.card
177
+ }] }),
178
+ /* @__PURE__ */ jsx(Text, { style: [styles.help, {
179
+ color: palette.textFaint
180
+ }], children: "Leave empty to remove the icon." }),
181
+ message ? /* @__PURE__ */ jsx(Text, { style: [styles.message, {
182
+ color: message.error ? palette.danger : palette.textMuted
183
+ }], children: message.text }) : null,
184
+ manage ? /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: save, disabled: !dirty || busy || !name.trim(), style: [ui.primaryButton, styles.block, {
185
+ backgroundColor: palette.primary
186
+ }, (!dirty || busy || !name.trim()) && styles.disabled], children: busy ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: palette.onPrimary }) : /* @__PURE__ */ jsx(Text, { style: [ui.primaryButtonLabel, {
187
+ color: palette.onPrimary
188
+ }], children: "Save changes" }) }) : null,
189
+ manage ? /* @__PURE__ */ jsxs(View, { style: [styles.danger, {
190
+ borderColor: palette.dangerSoft
191
+ }], children: [
192
+ /* @__PURE__ */ jsx(Text, { style: [styles.dangerTitle, {
193
+ color: palette.text
194
+ }], children: "Move workspace to trash" }),
195
+ /* @__PURE__ */ jsx(Text, { style: [styles.help, {
196
+ color: palette.textMuted
197
+ }], children: "The workspace and its pages leave everyone's sidebar." }),
198
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: remove, style: [styles.dangerButton, {
199
+ backgroundColor: palette.dangerSoft
200
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.dangerLabel, {
201
+ color: palette.danger
202
+ }], children: "Move to trash" }) })
203
+ ] }) : null
204
+ ] });
205
+ }
206
+ function useUserNames(ids) {
207
+ const {
208
+ data
209
+ } = useQuery(NATIVE_NOTES_USERS, {
210
+ variables: {
211
+ ids
212
+ },
213
+ skip: !ids.length,
214
+ fetchPolicy: "cache-first"
215
+ });
216
+ return useMemo(() => {
217
+ var _a;
218
+ const out = /* @__PURE__ */ new Map();
219
+ ((_a = data == null ? void 0 : data.notesUsers) != null ? _a : []).forEach((u) => out.set(u.id, u));
220
+ return out;
221
+ }, [data]);
222
+ }
223
+ function MembersTab({
224
+ palette,
225
+ workspaceId,
226
+ manage,
227
+ viewer,
228
+ onLeft
229
+ }) {
230
+ const client = useApolloClient();
231
+ const isMe = (userId) => !!viewer && [viewer.id, viewer.email].some((x) => typeof x === "string" && x.trim().toLowerCase() === userId.trim().toLowerCase());
232
+ const {
233
+ data,
234
+ loading,
235
+ error,
236
+ refetch
237
+ } = useQuery(NATIVE_NOTION_MEMBERS, {
238
+ variables: {
239
+ workspaceId
240
+ },
241
+ fetchPolicy: "network-only"
242
+ });
243
+ const [members, setMembers] = useState(null);
244
+ useEffect(() => {
245
+ var _a;
246
+ return setMembers((_a = data == null ? void 0 : data.notionWorkspaceMembers) != null ? _a : null);
247
+ }, [data]);
248
+ const list = members != null ? members : [];
249
+ const users = useUserNames(useMemo(() => list.map((m) => m.userId), [list]));
250
+ const [newUser, setNewUser] = useState("");
251
+ const [newRole, setNewRole] = useState("member");
252
+ const [busy, setBusy] = useState(null);
253
+ const [message, setMessage] = useState(null);
254
+ const run = async (key, mutation, field, variables) => {
255
+ var _a;
256
+ setBusy(key);
257
+ setMessage(null);
258
+ try {
259
+ const res = await client.mutate({
260
+ mutation,
261
+ variables: __spreadValues({
262
+ workspaceId
263
+ }, variables),
264
+ errorPolicy: "none"
265
+ });
266
+ const next = (_a = res.data) == null ? void 0 : _a[field];
267
+ if (Array.isArray(next)) setMembers(next);
268
+ else await refetch();
269
+ return true;
270
+ } catch (err) {
271
+ setMessage(serverErrorText(err));
272
+ return false;
273
+ } finally {
274
+ setBusy(null);
275
+ }
276
+ };
277
+ const leave = () => Alert.alert("Leave this workspace?", "You'll lose access to its pages unless someone adds you again.", [{
278
+ text: "Cancel",
279
+ style: "cancel"
280
+ }, {
281
+ text: "Leave",
282
+ style: "destructive",
283
+ onPress: async () => {
284
+ const me = list.find((m) => isMe(m.userId));
285
+ if (!me) return;
286
+ const ok = await run(me.userId, NATIVE_NOTION_REMOVE_MEMBER, "removeNotionWorkspaceMember", {
287
+ userId: me.userId
288
+ });
289
+ if (ok) onLeft();
290
+ }
291
+ }]);
292
+ const memberMenu = (m, label) => {
293
+ var _a;
294
+ if (isMe(m.userId)) {
295
+ leave();
296
+ return;
297
+ }
298
+ if (!manage) return;
299
+ Alert.alert(label, `Role: ${(_a = ROLE_LABEL[m.role]) != null ? _a : m.role}`, [...WORKSPACE_ROLES.filter((r) => r !== m.role).map((r) => ({
300
+ text: `Make ${ROLE_LABEL[r].toLowerCase()}`,
301
+ onPress: () => {
302
+ run(m.userId, NATIVE_NOTION_UPDATE_MEMBER, "updateNotionWorkspaceMember", {
303
+ userId: m.userId,
304
+ role: r
305
+ });
306
+ }
307
+ })), {
308
+ text: "Remove from workspace",
309
+ style: "destructive",
310
+ onPress: () => {
311
+ run(m.userId, NATIVE_NOTION_REMOVE_MEMBER, "removeNotionWorkspaceMember", {
312
+ userId: m.userId
313
+ });
314
+ }
315
+ }, {
316
+ text: "Cancel",
317
+ style: "cancel"
318
+ }]);
319
+ };
320
+ if (loading && !data) return /* @__PURE__ */ jsx(Loading, { palette });
321
+ return /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.content, keyboardShouldPersistTaps: "handled", children: [
322
+ manage ? /* @__PURE__ */ jsxs(View, { style: [styles.card, {
323
+ backgroundColor: palette.card
324
+ }], children: [
325
+ /* @__PURE__ */ jsx(Text, { style: [styles.cardTitle, {
326
+ color: palette.text
327
+ }], children: "Add a member" }),
328
+ /* @__PURE__ */ jsx(TextInput, { value: newUser, onChangeText: setNewUser, placeholder: "Email or user id", placeholderTextColor: palette.textFaint, autoCapitalize: "none", autoCorrect: false, keyboardType: "email-address", style: [styles.input, {
329
+ color: palette.text,
330
+ backgroundColor: palette.fill
331
+ }] }),
332
+ /* @__PURE__ */ jsx(View, { style: styles.roleRow, children: ["admin", "member", "guest"].map((r) => /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", accessibilityState: {
333
+ selected: newRole === r
334
+ }, onPress: () => setNewRole(r), style: [styles.roleChip, {
335
+ backgroundColor: newRole === r ? palette.primarySoft : palette.fill
336
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.roleChipLabel, {
337
+ color: newRole === r ? palette.primary : palette.text
338
+ }], children: ROLE_LABEL[r] }) }, r)) }),
339
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", disabled: !newUser.trim() || busy === "add", onPress: async () => {
340
+ const ok = await run("add", NATIVE_NOTION_ADD_MEMBER, "addNotionWorkspaceMember", {
341
+ userId: newUser.trim(),
342
+ role: newRole
343
+ });
344
+ if (ok) setNewUser("");
345
+ }, style: [ui.primaryButton, styles.block, {
346
+ backgroundColor: palette.primary,
347
+ marginTop: 12
348
+ }, (!newUser.trim() || busy === "add") && styles.disabled], children: busy === "add" ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: palette.onPrimary }) : /* @__PURE__ */ jsx(Text, { style: [ui.primaryButtonLabel, {
349
+ color: palette.onPrimary
350
+ }], children: "Add" }) })
351
+ ] }) : null,
352
+ message || error ? /* @__PURE__ */ jsx(Text, { style: [styles.message, {
353
+ color: palette.danger
354
+ }], children: message != null ? message : serverErrorText(error) }) : null,
355
+ /* @__PURE__ */ jsx(Text, { style: [styles.label, {
356
+ color: palette.textMuted
357
+ }], children: `${list.length} members` }),
358
+ /* @__PURE__ */ jsx(View, { style: [ui.group, {
359
+ backgroundColor: palette.card
360
+ }], children: list.map((m, i) => {
361
+ var _a, _b;
362
+ const u = users.get(m.userId);
363
+ const label = ((_a = u == null ? void 0 : u.name) == null ? void 0 : _a.trim()) || (u == null ? void 0 : u.email) || m.userId;
364
+ return /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: () => memberMenu(m, label), disabled: !manage && !isMe(m.userId), style: ({
365
+ pressed
366
+ }) => [styles.person, pressed && {
367
+ backgroundColor: palette.pressed
368
+ }], children: [
369
+ /* @__PURE__ */ jsx(Avatar, { palette, label }),
370
+ /* @__PURE__ */ jsxs(View, { style: [styles.personBody, i < list.length - 1 && ui.hairline, {
371
+ borderBottomColor: palette.hairline
372
+ }], children: [
373
+ /* @__PURE__ */ jsxs(View, { style: ui.flex, children: [
374
+ /* @__PURE__ */ jsxs(Text, { numberOfLines: 1, style: [styles.personName, {
375
+ color: palette.text
376
+ }], children: [
377
+ label,
378
+ isMe(m.userId) ? " (you)" : ""
379
+ ] }),
380
+ (u == null ? void 0 : u.email) && u.email !== label ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.personSub, {
381
+ color: palette.textMuted
382
+ }], children: u.email }) : null
383
+ ] }),
384
+ busy === m.userId ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: palette.textMuted }) : /* @__PURE__ */ jsxs(Fragment, { children: [
385
+ /* @__PURE__ */ jsx(View, { style: [styles.rolePill, {
386
+ backgroundColor: palette.fill
387
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.rolePillLabel, {
388
+ color: palette.textMuted
389
+ }], children: (_b = ROLE_LABEL[m.role]) != null ? _b : m.role }) }),
390
+ isMe(m.userId) ? /* @__PURE__ */ jsx(Text, { style: [styles.removeLabel, {
391
+ color: palette.danger
392
+ }], children: "Leave" }) : null
393
+ ] })
394
+ ] })
395
+ ] }, m.userId);
396
+ }) })
397
+ ] });
398
+ }
399
+ function GuestsTab({
400
+ palette,
401
+ workspaceId,
402
+ manage
403
+ }) {
404
+ var _a;
405
+ const client = useApolloClient();
406
+ const {
407
+ data,
408
+ loading,
409
+ error,
410
+ refetch
411
+ } = useQuery(NATIVE_NOTION_GUESTS, {
412
+ variables: {
413
+ workspaceId
414
+ },
415
+ fetchPolicy: "network-only"
416
+ });
417
+ const guests = (_a = data == null ? void 0 : data.notionWorkspaceGuests) != null ? _a : [];
418
+ const users = useUserNames(useMemo(() => guests.map((g) => g.userId), [guests]));
419
+ const [message, setMessage] = useState(null);
420
+ const remove = (g, label) => Alert.alert(`Remove ${label}?`, "They lose access to every page shared with them here.", [{
421
+ text: "Cancel",
422
+ style: "cancel"
423
+ }, {
424
+ text: "Remove",
425
+ style: "destructive",
426
+ onPress: async () => {
427
+ try {
428
+ await client.mutate({
429
+ mutation: NATIVE_NOTION_REMOVE_GUEST,
430
+ variables: {
431
+ workspaceId,
432
+ userId: g.userId
433
+ },
434
+ errorPolicy: "none"
435
+ });
436
+ await refetch();
437
+ } catch (err) {
438
+ setMessage(serverErrorText(err));
439
+ }
440
+ }
441
+ }]);
442
+ if (loading && !data) return /* @__PURE__ */ jsx(Loading, { palette });
443
+ return /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.content, children: [
444
+ /* @__PURE__ */ jsx(Text, { style: [styles.help, {
445
+ color: palette.textMuted
446
+ }], children: "Guests can open only the pages shared with them." }),
447
+ message || error ? /* @__PURE__ */ jsx(Text, { style: [styles.message, {
448
+ color: palette.danger
449
+ }], children: message != null ? message : serverErrorText(error) }) : null,
450
+ !guests.length ? /* @__PURE__ */ jsx(Text, { style: [styles.empty, {
451
+ color: palette.textMuted
452
+ }], children: "No guests in this workspace." }) : /* @__PURE__ */ jsx(View, { style: [ui.group, {
453
+ backgroundColor: palette.card,
454
+ marginTop: 12
455
+ }], children: guests.map((g, i) => {
456
+ var _a2;
457
+ const u = users.get(g.userId);
458
+ const label = ((_a2 = u == null ? void 0 : u.name) == null ? void 0 : _a2.trim()) || (u == null ? void 0 : u.email) || g.userId;
459
+ return /* @__PURE__ */ jsxs(View, { style: styles.person, children: [
460
+ /* @__PURE__ */ jsx(Avatar, { palette, label }),
461
+ /* @__PURE__ */ jsxs(View, { style: [styles.personBody, i < guests.length - 1 && ui.hairline, {
462
+ borderBottomColor: palette.hairline
463
+ }], children: [
464
+ /* @__PURE__ */ jsxs(View, { style: ui.flex, children: [
465
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.personName, {
466
+ color: palette.text
467
+ }], children: label }),
468
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 2, style: [styles.personSub, {
469
+ color: palette.textMuted
470
+ }], children: g.pages.map((p) => p.title || "Untitled").join(", ") || "No pages" })
471
+ ] }),
472
+ manage ? /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: () => remove(g, label), hitSlop: 8, children: /* @__PURE__ */ jsx(Text, { style: [styles.removeLabel, {
473
+ color: palette.danger
474
+ }], children: "Remove" }) }) : null
475
+ ] })
476
+ ] }, g.userId);
477
+ }) })
478
+ ] });
479
+ }
480
+ function Avatar({
481
+ palette,
482
+ label
483
+ }) {
484
+ return /* @__PURE__ */ jsx(View, { style: [styles.avatar, {
485
+ backgroundColor: palette.primarySoft
486
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.avatarText, {
487
+ color: palette.primary
488
+ }], children: label.trim().charAt(0).toUpperCase() || "?" }) });
489
+ }
490
+ function Loading({
491
+ palette
492
+ }) {
493
+ return /* @__PURE__ */ jsx(View, { style: styles.loading, children: /* @__PURE__ */ jsx(ActivityIndicator, { color: palette.textMuted }) });
494
+ }
495
+ const styles = StyleSheet.create({
496
+ tabs: {
497
+ flexDirection: "row",
498
+ margin: 16,
499
+ marginBottom: 4,
500
+ padding: 3,
501
+ borderRadius: 12
502
+ },
503
+ tab: {
504
+ flex: 1,
505
+ alignItems: "center",
506
+ paddingVertical: 8,
507
+ borderRadius: 9
508
+ },
509
+ tabActive: {
510
+ shadowColor: "#000",
511
+ shadowOpacity: 0.08,
512
+ shadowRadius: 3,
513
+ shadowOffset: {
514
+ width: 0,
515
+ height: 1
516
+ },
517
+ elevation: 1
518
+ },
519
+ tabLabel: {
520
+ fontSize: 14,
521
+ fontWeight: "600"
522
+ },
523
+ readOnly: {
524
+ fontSize: 13,
525
+ marginHorizontal: 20,
526
+ marginTop: 8
527
+ },
528
+ content: {
529
+ padding: 16,
530
+ paddingBottom: 48
531
+ },
532
+ loading: {
533
+ paddingVertical: 48,
534
+ alignItems: "center"
535
+ },
536
+ label: {
537
+ fontSize: 13,
538
+ fontWeight: "600",
539
+ marginTop: 16,
540
+ marginBottom: 6,
541
+ marginLeft: 2
542
+ },
543
+ input: {
544
+ fontSize: 16,
545
+ height: 48,
546
+ paddingHorizontal: 14,
547
+ borderRadius: 12
548
+ },
549
+ help: {
550
+ fontSize: 13,
551
+ marginTop: 6,
552
+ marginLeft: 2,
553
+ lineHeight: 18
554
+ },
555
+ message: {
556
+ fontSize: 14,
557
+ marginTop: 12
558
+ },
559
+ block: {
560
+ alignSelf: "stretch"
561
+ },
562
+ disabled: {
563
+ opacity: 0.45
564
+ },
565
+ danger: {
566
+ marginTop: 32,
567
+ padding: 16,
568
+ borderRadius: 16,
569
+ borderWidth: 1
570
+ },
571
+ dangerTitle: {
572
+ fontSize: 16,
573
+ fontWeight: "700"
574
+ },
575
+ dangerButton: {
576
+ marginTop: 12,
577
+ alignItems: "center",
578
+ paddingVertical: 12,
579
+ borderRadius: 12
580
+ },
581
+ dangerLabel: {
582
+ fontSize: 15,
583
+ fontWeight: "700"
584
+ },
585
+ card: {
586
+ padding: 16,
587
+ borderRadius: 16
588
+ },
589
+ cardTitle: {
590
+ fontSize: 16,
591
+ fontWeight: "700",
592
+ marginBottom: 10
593
+ },
594
+ roleRow: {
595
+ flexDirection: "row",
596
+ gap: 8,
597
+ marginTop: 10
598
+ },
599
+ roleChip: {
600
+ paddingHorizontal: 14,
601
+ paddingVertical: 8,
602
+ borderRadius: 999
603
+ },
604
+ roleChipLabel: {
605
+ fontSize: 14,
606
+ fontWeight: "600"
607
+ },
608
+ person: {
609
+ flexDirection: "row",
610
+ alignItems: "center",
611
+ paddingLeft: 14
612
+ },
613
+ personBody: {
614
+ flex: 1,
615
+ flexDirection: "row",
616
+ alignItems: "center",
617
+ gap: 8,
618
+ marginLeft: 12,
619
+ paddingRight: 14,
620
+ minHeight: 60
621
+ },
622
+ personName: {
623
+ fontSize: 16,
624
+ fontWeight: "600"
625
+ },
626
+ personSub: {
627
+ fontSize: 13,
628
+ marginTop: 2
629
+ },
630
+ rolePill: {
631
+ paddingHorizontal: 10,
632
+ paddingVertical: 4,
633
+ borderRadius: 999
634
+ },
635
+ rolePillLabel: {
636
+ fontSize: 12,
637
+ fontWeight: "700"
638
+ },
639
+ removeLabel: {
640
+ fontSize: 14,
641
+ fontWeight: "700"
642
+ },
643
+ avatar: {
644
+ width: 36,
645
+ height: 36,
646
+ borderRadius: 18,
647
+ alignItems: "center",
648
+ justifyContent: "center"
649
+ },
650
+ avatarText: {
651
+ fontSize: 15,
652
+ fontWeight: "700"
653
+ },
654
+ empty: {
655
+ fontSize: 15,
656
+ textAlign: "center",
657
+ paddingVertical: 32
658
+ }
659
+ });export{WorkspaceAdminSheet};//# sourceMappingURL=NotionWorkspaceAdmin.js.map