@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,606 @@
1
+ import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useState,useEffect,useMemo}from'react';import {Modal,KeyboardAvoidingView,View,Text,Pressable,StyleSheet,Platform,ScrollView,TextInput,ActivityIndicator,Alert,Clipboard,Linking}from'react-native';import {Ionicons}from'@expo/vector-icons';import {useApolloClient,useQuery}from'@apollo/client/index.js';import {NATIVE_NOTION_PERMISSIONS,NATIVE_NOTION_PUBLICATION,NATIVE_NOTION_REFRESH_DOMAIN,NATIVE_NOTION_REMOVE_DOMAIN,NATIVE_NOTION_ADD_DOMAIN,NATIVE_NOTION_UPDATE_PERMISSIONS,NATIVE_NOTION_PUBLISH,NATIVE_NOTION_UNPUBLISH}from'./notionDocuments.js';import {EMPTY_ACCESS,normalizePermissions,generalAccessOf,ACCESS_LEVELS,personInitial,levelLabel,setGeneralAccess,validateInvitee,addPerson,updatePersonLevel,removePerson,toPermissionInputs}from'./notionPageAccess.js';import {pageLinkUrl,serverErrorText}from'./notionPageActions.js';import {ui}from'./notionUi.js';import {webOrigin}from'./usePageActions.js';function ShareSheet({
2
+ visible,
3
+ palette,
4
+ pageId,
5
+ pageTitle,
6
+ onClose
7
+ }) {
8
+ const [tab, setTab] = useState("share");
9
+ useEffect(() => {
10
+ if (visible) setTab("share");
11
+ }, [visible]);
12
+ return /* @__PURE__ */ jsx(Modal, { visible, animationType: "slide", presentationStyle: "pageSheet", onRequestClose: onClose, children: /* @__PURE__ */ jsxs(KeyboardAvoidingView, { style: [ui.flex, {
13
+ backgroundColor: palette.bg
14
+ }], behavior: Platform.OS === "ios" ? "padding" : void 0, children: [
15
+ /* @__PURE__ */ jsxs(View, { style: [ui.sheetHeader, {
16
+ borderBottomColor: palette.hairline
17
+ }], children: [
18
+ /* @__PURE__ */ jsx(View, { style: [ui.sheetHeaderSide, ui.sheetHeaderLeft] }),
19
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [ui.sheetHeaderTitle, {
20
+ color: palette.text
21
+ }], children: pageTitle || "Share" }),
22
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: onClose, hitSlop: 8, style: ui.sheetHeaderSide, children: /* @__PURE__ */ jsx(Text, { style: [ui.sheetHeaderDone, {
23
+ color: palette.primary
24
+ }], children: "Done" }) })
25
+ ] }),
26
+ /* @__PURE__ */ jsx(View, { style: [styles.tabs, {
27
+ backgroundColor: palette.fill
28
+ }], children: ["share", "publish"].map((t) => /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "tab", accessibilityState: {
29
+ selected: tab === t
30
+ }, onPress: () => setTab(t), style: [styles.tab, tab === t && {
31
+ backgroundColor: palette.card
32
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.tabLabel, {
33
+ color: tab === t ? palette.text : palette.textMuted
34
+ }], children: t === "share" ? "Share" : "Publish" }) }, t)) }),
35
+ visible ? tab === "share" ? /* @__PURE__ */ jsx(ShareTab, { palette, pageId }) : /* @__PURE__ */ jsx(PublishTab, { palette, pageId }) : null
36
+ ] }) });
37
+ }
38
+ function ShareTab({
39
+ palette,
40
+ pageId
41
+ }) {
42
+ var _a;
43
+ const client = useApolloClient();
44
+ const {
45
+ data,
46
+ loading,
47
+ error
48
+ } = useQuery(NATIVE_NOTION_PERMISSIONS, {
49
+ variables: {
50
+ blockId: pageId
51
+ },
52
+ fetchPolicy: "network-only"
53
+ });
54
+ const [state, setState] = useState(EMPTY_ACCESS);
55
+ useEffect(() => {
56
+ var _a2;
57
+ if (data) setState(normalizePermissions((_a2 = data.getBlockPermissions) != null ? _a2 : []));
58
+ }, [data]);
59
+ const [invitee, setInvitee] = useState("");
60
+ const [level, setLevel] = useState("edit");
61
+ const [saving, setSaving] = useState(false);
62
+ const [message, setMessage] = useState(null);
63
+ const general = generalAccessOf(state);
64
+ const link = useMemo(() => pageLinkUrl(webOrigin(), pageId), [pageId]);
65
+ const commit = async (next) => {
66
+ const prev = state;
67
+ setState(next);
68
+ setSaving(true);
69
+ setMessage(null);
70
+ try {
71
+ await client.mutate({
72
+ mutation: NATIVE_NOTION_UPDATE_PERMISSIONS,
73
+ variables: {
74
+ input: {
75
+ blockId: pageId,
76
+ permissions: toPermissionInputs(next)
77
+ }
78
+ },
79
+ errorPolicy: "none"
80
+ });
81
+ return true;
82
+ } catch (err) {
83
+ setState(prev);
84
+ setMessage({
85
+ text: serverErrorText(err),
86
+ error: true
87
+ });
88
+ return false;
89
+ } finally {
90
+ setSaving(false);
91
+ }
92
+ };
93
+ const invite = async () => {
94
+ const v = validateInvitee(invitee);
95
+ if ("error" in v) {
96
+ setMessage({
97
+ text: v.error,
98
+ error: true
99
+ });
100
+ return;
101
+ }
102
+ if (await commit(addPerson(state, v.id, level))) {
103
+ setInvitee("");
104
+ setMessage({
105
+ text: "Invited"
106
+ });
107
+ }
108
+ };
109
+ const personMenu = (key, id) => Alert.alert(id, void 0, [...ACCESS_LEVELS.map((l) => ({
110
+ text: l.label,
111
+ onPress: () => commit(updatePersonLevel(state, key, l.value))
112
+ })), {
113
+ text: "Remove",
114
+ style: "destructive",
115
+ onPress: () => commit(removePerson(state, key))
116
+ }, {
117
+ text: "Cancel",
118
+ style: "cancel"
119
+ }]);
120
+ if (loading && !data) return /* @__PURE__ */ jsx(Busy, { palette });
121
+ return /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.content, keyboardShouldPersistTaps: "handled", children: [
122
+ /* @__PURE__ */ jsxs(View, { style: [styles.card, {
123
+ backgroundColor: palette.card
124
+ }], children: [
125
+ /* @__PURE__ */ jsx(TextInput, { value: invitee, onChangeText: setInvitee, placeholder: "Email or user id", placeholderTextColor: palette.textFaint, autoCapitalize: "none", autoCorrect: false, keyboardType: "email-address", onSubmitEditing: invite, style: [styles.input, {
126
+ color: palette.text,
127
+ backgroundColor: palette.fill
128
+ }] }),
129
+ /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, contentContainerStyle: styles.chips, children: ACCESS_LEVELS.map((l) => /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", accessibilityState: {
130
+ selected: level === l.value
131
+ }, onPress: () => setLevel(l.value), style: [styles.chip, {
132
+ backgroundColor: level === l.value ? palette.primarySoft : palette.fill
133
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.chipLabel, {
134
+ color: level === l.value ? palette.primary : palette.text
135
+ }], children: l.label }) }, l.value)) }),
136
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: invite, disabled: !invitee.trim() || saving, style: [ui.primaryButton, styles.block, {
137
+ backgroundColor: palette.primary,
138
+ marginTop: 12
139
+ }, (!invitee.trim() || saving) && styles.disabled], children: saving ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: palette.onPrimary }) : /* @__PURE__ */ jsx(Text, { style: [ui.primaryButtonLabel, {
140
+ color: palette.onPrimary
141
+ }], children: "Invite" }) })
142
+ ] }),
143
+ message || error ? /* @__PURE__ */ jsx(Text, { style: [styles.message, {
144
+ color: (message == null ? void 0 : message.error) || error ? palette.danger : palette.textMuted
145
+ }], children: (_a = message == null ? void 0 : message.text) != null ? _a : serverErrorText(error) }) : null,
146
+ /* @__PURE__ */ jsx(Text, { style: [styles.label, {
147
+ color: palette.textMuted
148
+ }], children: "People with access" }),
149
+ /* @__PURE__ */ jsx(View, { style: [ui.group, {
150
+ backgroundColor: palette.card
151
+ }], children: state.people.length ? state.people.map((p, i) => /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: () => personMenu(p.key, p.id), style: ({
152
+ pressed
153
+ }) => [styles.person, pressed && {
154
+ backgroundColor: palette.pressed
155
+ }], children: [
156
+ /* @__PURE__ */ jsx(View, { style: [styles.avatar, {
157
+ backgroundColor: palette.primarySoft
158
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.avatarText, {
159
+ color: palette.primary
160
+ }], children: personInitial(p.id) }) }),
161
+ /* @__PURE__ */ jsxs(View, { style: [styles.personBody, i < state.people.length - 1 && ui.hairline, {
162
+ borderBottomColor: palette.hairline
163
+ }], children: [
164
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.personName, {
165
+ color: palette.text
166
+ }], children: p.id }),
167
+ /* @__PURE__ */ jsx(Text, { style: [styles.level, {
168
+ color: palette.textMuted
169
+ }], children: levelLabel(p.level) }),
170
+ /* @__PURE__ */ jsx(Ionicons, { name: "chevron-down", size: 14, color: palette.textFaint })
171
+ ] })
172
+ ] }, p.key)) : /* @__PURE__ */ jsx(Text, { style: [styles.emptyRow, {
173
+ color: palette.textMuted
174
+ }], children: "Only workspace members so far." }) }),
175
+ /* @__PURE__ */ jsx(Text, { style: [styles.label, {
176
+ color: palette.textMuted
177
+ }], children: "General access" }),
178
+ /* @__PURE__ */ jsx(View, { style: [ui.group, {
179
+ backgroundColor: palette.card
180
+ }], children: ["restricted", "link"].map((g, i) => /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "radio", accessibilityState: {
181
+ checked: general === g
182
+ }, onPress: () => commit(setGeneralAccess(state, g)), style: ({
183
+ pressed
184
+ }) => [styles.person, pressed && {
185
+ backgroundColor: palette.pressed
186
+ }], children: [
187
+ /* @__PURE__ */ jsx(Ionicons, { name: g === "link" ? "globe-outline" : "lock-closed-outline", size: 19, color: palette.text }),
188
+ /* @__PURE__ */ jsxs(View, { style: [styles.personBody, i === 0 && ui.hairline, {
189
+ borderBottomColor: palette.hairline
190
+ }], children: [
191
+ /* @__PURE__ */ jsx(Text, { style: [styles.personName, {
192
+ color: palette.text
193
+ }], children: g === "link" ? "Anyone with the link can view" : "Only people invited" }),
194
+ general === g ? /* @__PURE__ */ jsx(Ionicons, { name: "checkmark", size: 20, color: palette.primary }) : null
195
+ ] })
196
+ ] }, g)) }),
197
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", onPress: () => {
198
+ Clipboard.setString(link);
199
+ setMessage({
200
+ text: "Link copied"
201
+ });
202
+ }, style: [styles.secondary, {
203
+ backgroundColor: palette.primarySoft
204
+ }], children: [
205
+ /* @__PURE__ */ jsx(Ionicons, { name: "link-outline", size: 18, color: palette.primary }),
206
+ /* @__PURE__ */ jsx(Text, { style: [styles.secondaryLabel, {
207
+ color: palette.primary
208
+ }], children: "Copy link" })
209
+ ] })
210
+ ] });
211
+ }
212
+ function PublishTab({
213
+ palette,
214
+ pageId
215
+ }) {
216
+ var _a;
217
+ const client = useApolloClient();
218
+ const {
219
+ data,
220
+ loading,
221
+ refetch
222
+ } = useQuery(NATIVE_NOTION_PUBLICATION, {
223
+ variables: {
224
+ blockId: pageId
225
+ },
226
+ fetchPolicy: "network-only"
227
+ });
228
+ const pub = (data == null ? void 0 : data.notionPublication) && data.notionPublication.status === "published" ? data.notionPublication : null;
229
+ const [visibility, setVisibility] = useState("public");
230
+ useEffect(() => {
231
+ if (pub) setVisibility(pub.visibility);
232
+ }, [pub]);
233
+ const [busy, setBusy] = useState(null);
234
+ const [domain, setDomain] = useState("");
235
+ const [message, setMessage] = useState(null);
236
+ const run = async (key, mutation, variables, done) => {
237
+ setBusy(key);
238
+ setMessage(null);
239
+ try {
240
+ await client.mutate({
241
+ mutation,
242
+ variables,
243
+ errorPolicy: "none"
244
+ });
245
+ await refetch();
246
+ if (done) setMessage({
247
+ text: done
248
+ });
249
+ return true;
250
+ } catch (err) {
251
+ setMessage({
252
+ text: serverErrorText(err),
253
+ error: true
254
+ });
255
+ return false;
256
+ } finally {
257
+ setBusy(null);
258
+ }
259
+ };
260
+ if (loading && !data) return /* @__PURE__ */ jsx(Busy, { palette });
261
+ return /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.content, keyboardShouldPersistTaps: "handled", children: [
262
+ /* @__PURE__ */ jsx(Text, { style: [styles.label, {
263
+ color: palette.textMuted
264
+ }], children: "Who can view" }),
265
+ /* @__PURE__ */ jsx(View, { style: [ui.group, {
266
+ backgroundColor: palette.card
267
+ }], children: [{
268
+ v: "public",
269
+ title: "Public",
270
+ sub: "Anyone with the link; search engines can index it"
271
+ }, {
272
+ v: "private",
273
+ title: "Private",
274
+ sub: "Only people signed in to your workspace"
275
+ }].map((o, i) => /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "radio", accessibilityState: {
276
+ checked: visibility === o.v
277
+ }, onPress: () => setVisibility(o.v), style: ({
278
+ pressed
279
+ }) => [styles.person, pressed && {
280
+ backgroundColor: palette.pressed
281
+ }], children: [
282
+ /* @__PURE__ */ jsx(Ionicons, { name: o.v === "public" ? "globe-outline" : "lock-closed-outline", size: 19, color: palette.text }),
283
+ /* @__PURE__ */ jsxs(View, { style: [styles.personBody, i === 0 && ui.hairline, {
284
+ borderBottomColor: palette.hairline
285
+ }], children: [
286
+ /* @__PURE__ */ jsxs(View, { style: ui.flex, children: [
287
+ /* @__PURE__ */ jsx(Text, { style: [styles.personName, {
288
+ color: palette.text
289
+ }], children: o.title }),
290
+ /* @__PURE__ */ jsx(Text, { style: [styles.sub, {
291
+ color: palette.textMuted
292
+ }], children: o.sub })
293
+ ] }),
294
+ visibility === o.v ? /* @__PURE__ */ jsx(Ionicons, { name: "checkmark", size: 20, color: palette.primary }) : null
295
+ ] })
296
+ ] }, o.v)) }),
297
+ pub ? /* @__PURE__ */ jsxs(View, { style: [styles.card, {
298
+ backgroundColor: palette.card,
299
+ marginTop: 16
300
+ }], children: [
301
+ /* @__PURE__ */ jsxs(View, { style: styles.liveHead, children: [
302
+ /* @__PURE__ */ jsx(View, { style: [styles.liveDot, {
303
+ backgroundColor: "#10b981"
304
+ }] }),
305
+ /* @__PURE__ */ jsx(Text, { style: [styles.personName, {
306
+ color: palette.text
307
+ }], children: "Published" })
308
+ ] }),
309
+ /* @__PURE__ */ jsx(Text, { selectable: true, numberOfLines: 2, style: [styles.url, {
310
+ color: palette.primary
311
+ }], children: pub.publicUrl }),
312
+ pub.storageError ? /* @__PURE__ */ jsx(Text, { style: [styles.sub, {
313
+ color: palette.danger
314
+ }], children: pub.storageError }) : null,
315
+ /* @__PURE__ */ jsxs(View, { style: styles.row, children: [
316
+ /* @__PURE__ */ jsx(SmallButton, { palette, label: "Copy link", onPress: () => {
317
+ Clipboard.setString(pub.publicUrl);
318
+ setMessage({
319
+ text: "Link copied"
320
+ });
321
+ } }),
322
+ /* @__PURE__ */ jsx(SmallButton, { palette, label: "View site", onPress: () => Linking.openURL(pub.publicUrl).catch(() => void 0) })
323
+ ] })
324
+ ] }) : null,
325
+ message ? /* @__PURE__ */ jsx(Text, { style: [styles.message, {
326
+ color: message.error ? palette.danger : palette.textMuted
327
+ }], children: message.text }) : null,
328
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: () => run("publish", NATIVE_NOTION_PUBLISH, {
329
+ input: {
330
+ blockId: pageId,
331
+ visibility
332
+ }
333
+ }, pub ? "Published again" : "Published"), disabled: Boolean(busy), style: [ui.primaryButton, styles.block, {
334
+ backgroundColor: palette.primary
335
+ }], children: busy === "publish" ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: palette.onPrimary }) : /* @__PURE__ */ jsx(Text, { style: [ui.primaryButtonLabel, {
336
+ color: palette.onPrimary
337
+ }], children: pub ? "Update published page" : "Publish to web" }) }),
338
+ pub ? /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress: () => Alert.alert("Unpublish?", "The public link stops working.", [{
339
+ text: "Cancel",
340
+ style: "cancel"
341
+ }, {
342
+ text: "Unpublish",
343
+ style: "destructive",
344
+ onPress: () => run("unpublish", NATIVE_NOTION_UNPUBLISH, {
345
+ blockId: pageId
346
+ }, "Unpublished")
347
+ }]), style: styles.textButton, children: /* @__PURE__ */ jsx(Text, { style: [styles.dangerLabel, {
348
+ color: palette.danger
349
+ }], children: "Unpublish" }) }) : null,
350
+ pub ? /* @__PURE__ */ jsxs(Fragment, { children: [
351
+ /* @__PURE__ */ jsx(Text, { style: [styles.label, {
352
+ color: palette.textMuted
353
+ }], children: "Custom domains" }),
354
+ /* @__PURE__ */ jsxs(View, { style: [styles.card, {
355
+ backgroundColor: palette.card
356
+ }], children: [
357
+ ((_a = pub.domains) != null ? _a : []).map((d) => {
358
+ var _a2;
359
+ return /* @__PURE__ */ jsxs(View, { style: [styles.domain, {
360
+ borderBottomColor: palette.hairline
361
+ }], children: [
362
+ /* @__PURE__ */ jsxs(View, { style: styles.liveHead, children: [
363
+ /* @__PURE__ */ jsx(Text, { style: [styles.personName, {
364
+ color: palette.text,
365
+ flex: 1
366
+ }], children: d.domain }),
367
+ /* @__PURE__ */ jsx(Text, { style: [styles.level, {
368
+ color: d.status === "active" ? "#10b981" : d.status === "error" ? palette.danger : palette.textMuted
369
+ }], children: d.status })
370
+ ] }),
371
+ d.message ? /* @__PURE__ */ jsx(Text, { style: [styles.sub, {
372
+ color: palette.textMuted
373
+ }], children: d.message }) : null,
374
+ ((_a2 = d.dnsRecords) != null ? _a2 : []).map((r, i) => (
375
+ // eslint-disable-next-line react/no-array-index-key
376
+ /* @__PURE__ */ jsx(Text, { selectable: true, style: [styles.dns, {
377
+ color: palette.text,
378
+ backgroundColor: palette.fill
379
+ }], children: `${r.type} ${r.name} \u2192 ${r.value}` }, i)
380
+ )),
381
+ /* @__PURE__ */ jsxs(View, { style: styles.row, children: [
382
+ /* @__PURE__ */ jsx(SmallButton, { palette, label: "Check", busy: busy === `r:${d.domain}`, onPress: () => run(`r:${d.domain}`, NATIVE_NOTION_REFRESH_DOMAIN, {
383
+ blockId: pageId,
384
+ domain: d.domain
385
+ }) }),
386
+ /* @__PURE__ */ jsx(SmallButton, { palette, label: "Remove", danger: true, onPress: () => run(`x:${d.domain}`, NATIVE_NOTION_REMOVE_DOMAIN, {
387
+ blockId: pageId,
388
+ domain: d.domain
389
+ }) })
390
+ ] })
391
+ ] }, d.domain);
392
+ }),
393
+ /* @__PURE__ */ jsxs(View, { style: styles.row, children: [
394
+ /* @__PURE__ */ jsx(TextInput, { value: domain, onChangeText: setDomain, placeholder: "docs.example.com", placeholderTextColor: palette.textFaint, autoCapitalize: "none", autoCorrect: false, keyboardType: "url", style: [styles.input, styles.flexInput, {
395
+ color: palette.text,
396
+ backgroundColor: palette.fill
397
+ }] }),
398
+ /* @__PURE__ */ jsx(SmallButton, { palette, label: "Add", busy: busy === "add", onPress: async () => {
399
+ if (!domain.trim()) return;
400
+ if (await run("add", NATIVE_NOTION_ADD_DOMAIN, {
401
+ blockId: pageId,
402
+ domain: domain.trim().toLowerCase()
403
+ })) setDomain("");
404
+ } })
405
+ ] })
406
+ ] })
407
+ ] }) : null
408
+ ] });
409
+ }
410
+ function SmallButton({
411
+ palette,
412
+ label,
413
+ onPress,
414
+ busy,
415
+ danger
416
+ }) {
417
+ return /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", onPress, disabled: busy, style: [styles.small, {
418
+ backgroundColor: danger ? palette.dangerSoft : palette.fill
419
+ }], children: busy ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: palette.textMuted }) : /* @__PURE__ */ jsx(Text, { style: [styles.smallLabel, {
420
+ color: danger ? palette.danger : palette.text
421
+ }], children: label }) });
422
+ }
423
+ function Busy({
424
+ palette
425
+ }) {
426
+ return /* @__PURE__ */ jsx(View, { style: styles.loading, children: /* @__PURE__ */ jsx(ActivityIndicator, { color: palette.textMuted }) });
427
+ }
428
+ const styles = StyleSheet.create({
429
+ tabs: {
430
+ flexDirection: "row",
431
+ margin: 16,
432
+ marginBottom: 4,
433
+ padding: 3,
434
+ borderRadius: 12
435
+ },
436
+ tab: {
437
+ flex: 1,
438
+ alignItems: "center",
439
+ paddingVertical: 8,
440
+ borderRadius: 9
441
+ },
442
+ tabLabel: {
443
+ fontSize: 14,
444
+ fontWeight: "600"
445
+ },
446
+ loading: {
447
+ paddingVertical: 48,
448
+ alignItems: "center"
449
+ },
450
+ content: {
451
+ padding: 16,
452
+ paddingBottom: 48
453
+ },
454
+ card: {
455
+ padding: 14,
456
+ borderRadius: 16
457
+ },
458
+ input: {
459
+ fontSize: 16,
460
+ height: 44,
461
+ paddingHorizontal: 12,
462
+ borderRadius: 10
463
+ },
464
+ flexInput: {
465
+ flex: 1
466
+ },
467
+ chips: {
468
+ gap: 8,
469
+ marginTop: 10
470
+ },
471
+ chip: {
472
+ paddingHorizontal: 12,
473
+ paddingVertical: 7,
474
+ borderRadius: 999
475
+ },
476
+ chipLabel: {
477
+ fontSize: 13,
478
+ fontWeight: "600"
479
+ },
480
+ block: {
481
+ alignSelf: "stretch"
482
+ },
483
+ disabled: {
484
+ opacity: 0.45
485
+ },
486
+ message: {
487
+ fontSize: 13,
488
+ marginTop: 10
489
+ },
490
+ label: {
491
+ fontSize: 13,
492
+ fontWeight: "600",
493
+ marginTop: 20,
494
+ marginBottom: 8,
495
+ marginLeft: 4
496
+ },
497
+ person: {
498
+ flexDirection: "row",
499
+ alignItems: "center",
500
+ paddingLeft: 14,
501
+ gap: 0
502
+ },
503
+ personBody: {
504
+ flex: 1,
505
+ flexDirection: "row",
506
+ alignItems: "center",
507
+ gap: 8,
508
+ marginLeft: 12,
509
+ paddingRight: 14,
510
+ minHeight: 52
511
+ },
512
+ personName: {
513
+ flexShrink: 1,
514
+ fontSize: 15,
515
+ fontWeight: "600"
516
+ },
517
+ level: {
518
+ marginLeft: "auto",
519
+ fontSize: 13,
520
+ fontWeight: "600"
521
+ },
522
+ sub: {
523
+ fontSize: 12,
524
+ marginTop: 2
525
+ },
526
+ avatar: {
527
+ width: 30,
528
+ height: 30,
529
+ borderRadius: 15,
530
+ alignItems: "center",
531
+ justifyContent: "center"
532
+ },
533
+ avatarText: {
534
+ fontSize: 13,
535
+ fontWeight: "800"
536
+ },
537
+ emptyRow: {
538
+ fontSize: 14,
539
+ padding: 14
540
+ },
541
+ secondary: {
542
+ flexDirection: "row",
543
+ alignItems: "center",
544
+ justifyContent: "center",
545
+ gap: 6,
546
+ minHeight: 46,
547
+ borderRadius: 12,
548
+ marginTop: 20
549
+ },
550
+ secondaryLabel: {
551
+ fontSize: 15,
552
+ fontWeight: "700"
553
+ },
554
+ liveHead: {
555
+ flexDirection: "row",
556
+ alignItems: "center",
557
+ gap: 8
558
+ },
559
+ liveDot: {
560
+ width: 8,
561
+ height: 8,
562
+ borderRadius: 4
563
+ },
564
+ url: {
565
+ fontSize: 14,
566
+ marginTop: 8
567
+ },
568
+ row: {
569
+ flexDirection: "row",
570
+ alignItems: "center",
571
+ gap: 8,
572
+ marginTop: 10
573
+ },
574
+ small: {
575
+ minHeight: 36,
576
+ paddingHorizontal: 14,
577
+ borderRadius: 10,
578
+ alignItems: "center",
579
+ justifyContent: "center"
580
+ },
581
+ smallLabel: {
582
+ fontSize: 14,
583
+ fontWeight: "700"
584
+ },
585
+ textButton: {
586
+ alignItems: "center",
587
+ paddingVertical: 12
588
+ },
589
+ dangerLabel: {
590
+ fontSize: 15,
591
+ fontWeight: "700"
592
+ },
593
+ domain: {
594
+ paddingBottom: 12,
595
+ marginBottom: 12,
596
+ borderBottomWidth: StyleSheet.hairlineWidth,
597
+ gap: 4
598
+ },
599
+ dns: {
600
+ fontFamily: Platform.OS === "ios" ? "Menlo" : "monospace",
601
+ fontSize: 12,
602
+ padding: 8,
603
+ borderRadius: 8,
604
+ marginTop: 4
605
+ }
606
+ });export{ShareSheet};//# sourceMappingURL=NotionShareSheet.js.map