@adminide-stack/yantra-mobile 12.0.167-alpha.0 → 12.0.167

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 (134) hide show
  1. package/lib/assets/kinds/character.webp +0 -0
  2. package/lib/assets/kinds/image.webp +0 -0
  3. package/lib/assets/kinds/video.webp +0 -0
  4. package/lib/assets/kinds/website.webp +0 -0
  5. package/lib/bridge/handlers/NavigationBridgeHandler.js +3 -2
  6. package/lib/bridge/handlers/NavigationBridgeHandler.js.map +1 -1
  7. package/lib/components/CustomDrawer.js +6 -2
  8. package/lib/components/CustomDrawer.js.map +1 -1
  9. package/lib/features/agent-chat/NativeAgentChat.js +17 -3
  10. package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
  11. package/lib/features/chat/ApprovalCard.js +8 -2
  12. package/lib/features/chat/ApprovalCard.js.map +1 -1
  13. package/lib/features/chat/AskUserCard.js +5 -3
  14. package/lib/features/chat/AskUserCard.js.map +1 -1
  15. package/lib/features/chat/ComposerModeSwitch.js +147 -0
  16. package/lib/features/chat/ComposerModeSwitch.js.map +1 -0
  17. package/lib/features/templates/__tests__/buildKinds.test.ts +54 -0
  18. package/lib/features/templates/__tests__/buildTemplateCards.test.ts +58 -6
  19. package/lib/features/templates/__tests__/templateSuggestion.test.ts +30 -0
  20. package/lib/features/templates/buildKinds.js +114 -0
  21. package/lib/features/templates/buildKinds.js.map +1 -0
  22. package/lib/features/templates/buildKinds.ts +189 -0
  23. package/lib/features/templates/buildTemplateCards.js +63 -18
  24. package/lib/features/templates/buildTemplateCards.js.map +1 -1
  25. package/lib/features/templates/buildTemplateCards.ts +88 -18
  26. package/lib/features/templates/index.ts +2 -0
  27. package/lib/features/templates/templateSuggestion.js +34 -0
  28. package/lib/features/templates/templateSuggestion.js.map +1 -0
  29. package/lib/features/templates/templateSuggestion.ts +57 -0
  30. package/lib/features/webbuilder/WebBuilderExperience.js +188 -28
  31. package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
  32. package/lib/features/webbuilder/approvalsLink.js +6 -0
  33. package/lib/features/webbuilder/approvalsLink.js.map +1 -0
  34. package/lib/features/webbuilder/buildFragments.js +19 -4
  35. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  36. package/lib/features/webbuilder/components/CloudSheet.js +18 -5
  37. package/lib/features/webbuilder/components/CloudSheet.js.map +1 -1
  38. package/lib/features/webbuilder/components/CodeView.js +7 -3
  39. package/lib/features/webbuilder/components/CodeView.js.map +1 -1
  40. package/lib/features/webbuilder/components/DomainFinder.js +263 -0
  41. package/lib/features/webbuilder/components/DomainFinder.js.map +1 -0
  42. package/lib/features/webbuilder/components/DraftsSheet.js +298 -0
  43. package/lib/features/webbuilder/components/DraftsSheet.js.map +1 -0
  44. package/lib/features/webbuilder/components/ImageEditPanel.js +266 -0
  45. package/lib/features/webbuilder/components/ImageEditPanel.js.map +1 -0
  46. package/lib/features/webbuilder/components/MentionMenu.js +155 -0
  47. package/lib/features/webbuilder/components/MentionMenu.js.map +1 -0
  48. package/lib/features/webbuilder/components/NotesSheet.js +138 -0
  49. package/lib/features/webbuilder/components/NotesSheet.js.map +1 -0
  50. package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
  51. package/lib/features/webbuilder/components/ProjectChat.js +17 -3
  52. package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
  53. package/lib/features/webbuilder/components/PublishSheet.js +200 -15
  54. package/lib/features/webbuilder/components/PublishSheet.js.map +1 -1
  55. package/lib/features/webbuilder/components/ShareSheet.js +48 -6
  56. package/lib/features/webbuilder/components/ShareSheet.js.map +1 -1
  57. package/lib/features/webbuilder/components/SiteCopyProgress.js +169 -0
  58. package/lib/features/webbuilder/components/SiteCopyProgress.js.map +1 -0
  59. package/lib/features/webbuilder/components/SiteStatusSheet.js +145 -2
  60. package/lib/features/webbuilder/components/SiteStatusSheet.js.map +1 -1
  61. package/lib/features/webbuilder/drafts.js +167 -0
  62. package/lib/features/webbuilder/drafts.js.map +1 -0
  63. package/lib/features/webbuilder/maskPng.js +113 -0
  64. package/lib/features/webbuilder/maskPng.js.map +1 -0
  65. package/lib/features/webbuilder/previewProbe.js.map +1 -1
  66. package/lib/features/webbuilder/stepLabels.js +21 -1
  67. package/lib/features/webbuilder/stepLabels.js.map +1 -1
  68. package/lib/features/webbuilder/web/chat/mentions.js +106 -0
  69. package/lib/features/webbuilder/web/chat/mentions.js.map +1 -0
  70. package/lib/features/webbuilder/web/chat/siteCopy.js +121 -0
  71. package/lib/features/webbuilder/web/chat/siteCopy.js.map +1 -0
  72. package/lib/features/webbuilder/web/code/imageEdit.js +30 -0
  73. package/lib/features/webbuilder/web/code/imageEdit.js.map +1 -0
  74. package/lib/features/webbuilder/web/design/linkedDesign.js +26 -0
  75. package/lib/features/webbuilder/web/design/linkedDesign.js.map +1 -0
  76. package/lib/features/webbuilder/web/project/buildLink.js +3 -0
  77. package/lib/features/webbuilder/web/project/buildLink.js.map +1 -0
  78. package/lib/features/webbuilder/web/project/drafts.js +57 -0
  79. package/lib/features/webbuilder/web/project/drafts.js.map +1 -0
  80. package/lib/features/webbuilder/web/project/navHistory.js +7 -0
  81. package/lib/features/webbuilder/web/project/navHistory.js.map +1 -0
  82. package/lib/features/webbuilder/web/project/serverSettings.js +15 -4
  83. package/lib/features/webbuilder/web/project/serverSettings.js.map +1 -1
  84. package/lib/features/webbuilder/web/publish/domainShop.js +79 -0
  85. package/lib/features/webbuilder/web/publish/domainShop.js.map +1 -0
  86. package/lib/features/webbuilder/web/publish/publishRequest.js +11 -0
  87. package/lib/features/webbuilder/web/publish/publishRequest.js.map +1 -0
  88. package/lib/features/webbuilder/web/publish/review/freshness.js +13 -0
  89. package/lib/features/webbuilder/web/publish/review/freshness.js.map +1 -0
  90. package/lib/features/webbuilder/web/publish/review/ignores.js +94 -0
  91. package/lib/features/webbuilder/web/publish/review/ignores.js.map +1 -0
  92. package/lib/features/webbuilder/web/publish/review/seo.js +230 -0
  93. package/lib/features/webbuilder/web/publish/review/seo.js.map +1 -0
  94. package/lib/features/webbuilder/web/publish/siteHealth.js +27 -3
  95. package/lib/features/webbuilder/web/publish/siteHealth.js.map +1 -1
  96. package/lib/features/webbuilder/web/publish/siteInsights.js +120 -3
  97. package/lib/features/webbuilder/web/publish/siteInsights.js.map +1 -1
  98. package/lib/features/webbuilder/web/sharing/shareLink.js +9 -0
  99. package/lib/features/webbuilder/web/sharing/shareLink.js.map +1 -0
  100. package/lib/features/webbuilder/web/webServices.js +1 -1
  101. package/lib/features/webbuilder/web/webServices.js.map +1 -1
  102. package/lib/hooks/useMarketplaceTemplateCards.js +3 -4
  103. package/lib/hooks/useMarketplaceTemplateCards.js.map +1 -1
  104. package/lib/hooks/useMarketplaceTemplateGroups.js +12 -5
  105. package/lib/hooks/useMarketplaceTemplateGroups.js.map +1 -1
  106. package/lib/hooks/useTemplatesResourceUri.js +12 -0
  107. package/lib/hooks/useTemplatesResourceUri.js.map +1 -0
  108. package/lib/screens/Chat/index.js +4 -22
  109. package/lib/screens/Chat/index.js.map +1 -1
  110. package/lib/screens/Home/HomeScreen.js +165 -179
  111. package/lib/screens/Home/HomeScreen.js.map +1 -1
  112. package/lib/screens/Home/components/BuildKindPicker.js +248 -0
  113. package/lib/screens/Home/components/BuildKindPicker.js.map +1 -0
  114. package/lib/screens/Home/components/BuildTemplatesSection.js +556 -117
  115. package/lib/screens/Home/components/BuildTemplatesSection.js.map +1 -1
  116. package/lib/screens/Home/components/KindThumb.js +444 -0
  117. package/lib/screens/Home/components/KindThumb.js.map +1 -0
  118. package/lib/screens/Home/components/TemplateSuggestionBanner.js +73 -0
  119. package/lib/screens/Home/components/TemplateSuggestionBanner.js.map +1 -0
  120. package/lib/screens/Home/components/buildTheme.js +68 -0
  121. package/lib/screens/Home/components/buildTheme.js.map +1 -0
  122. package/lib/screens/WebBuilder/index.js +11 -1
  123. package/lib/screens/WebBuilder/index.js.map +1 -1
  124. package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js +55 -0
  125. package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js.map +1 -0
  126. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js +4 -0
  127. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js.map +1 -1
  128. package/lib/screens/WebBuilderNative/index.js +31 -4
  129. package/lib/screens/WebBuilderNative/index.js.map +1 -1
  130. package/lib/screens/WebBuilderNative/useWebBuilderHost.js +1 -0
  131. package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
  132. package/lib/screens/WebBuilderNative/webbuilderTransport.js +5 -5
  133. package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
  134. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
- import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useMemo,useState,useCallback,useRef,useEffect}from'react';import {StyleSheet,Alert,Linking,Keyboard,BackHandler,View,Text,Share,Clipboard}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {GestureHandlerRootView}from'react-native-gesture-handler';import {useSafeInsets}from'../canvas/withRemoteSafeArea.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import {Tap,DIM}from'../inbox/components/Tap.js';import {isBareSeed,studioTurnText,siteScoreTurn}from'./studioCatalog.js';import {brandKitNote,findDesires,importBrandKit}from'../design/surface/brandKit.js';import {useBrandKitInUse}from'../design/surface/useBrandKitInUse.js';import {BrandSheet}from'../design/surface/BrandSheet.js';import {moveLegacyBrandKit}from'./brandKitMove.js';import {titleFromPrompt,displayHost}from'./buildFragments.js';import {parseToolActivity}from'../chat/toolActivity.js';import {friendlySteps,firstContentLanded}from'./stepLabels.js';import {restoreTurnNote}from'./webbuilderPrompts.js';import {webbuilderTheme}from'./webbuilderTheme.js';import {CodeView}from'./components/CodeView.js';import {ProjectChat}from'./components/ProjectChat.js';import {ViewportToggle,PreviewScreen,ViewPicker}from'./components/PreviewScreen.js';import {PublishSheet}from'./components/PublishSheet.js';import {BOTTOM_TABS_SPACE,BottomTabs}from'./components/BottomTabs.js';import {SiteScoreSheet}from'./components/SiteScoreSheet.js';import {ProjectsScreen}from'./components/ProjectsScreen.js';import {TemplatesSheet}from'./components/TemplatesSheet.js';import {StudioHome}from'./components/StudioHome.js';import {VersionsSheet}from'./components/VersionsSheet.js';import {IconButton,Sheet,Toast}from'./components/ui.js';import {exportMessage,exportTurn}from'./exportCode.js';import {ownCloudflareTurn,projectNameOfLiveUrl,plainActionError}from'./publishTools.js';import {SecretsSheet}from'./components/SecretsSheet.js';import {CloudSheet}from'./components/CloudSheet.js';import {notReadyHint,projectReadiness}from'./readiness.js';import {SiteStatusSheet}from'./components/SiteStatusSheet.js';import {useRetention,RetentionBanner}from'./components/RetentionBanner.js';import {useGithubAutoSync}from'./useGithubAutoSync.js';import {githubSyncStatus,repoNameOf,githubSettingsPatch}from'./web/github/githubSync.js';import {syncChip,canRunSync}from'./web/github/autoSync.js';import {normalizeGithubRepoUrl}from'./web/project/serverSettings.js';import {ShareSheet}from'./components/ShareSheet.js';import {roleCan}from'./web/sharing/roles.js';import {remixSnapshotParams,snapshotIdFromResult,remixSecretsCheck,buildRemixUrl}from'./web/sharing/share.js';import {OutOfCreditsCard,CreditsSheet}from'./components/Credits.js';import {billingPageUrl}from'./creditsLinks.js';import {useWebBuilderCredits}from'./useWebBuilderCredits.js';import {OUT_OF_CREDITS_TITLE,outOfCreditsText,chipLabel}from'./web/credits/credits.js';import {IntegrationsPanel}from'./components/IntegrationsPanel.js';import {createWebServices}from'./web/webServices.js';import {ProjectMenuSheet,ProjectSettingsSheet,GithubPushSheet,IntegrationsSheet,ImportProjectSheet}from'./components/ProjectSheets.js';import {demoVideoSource,webbuilderDemoHandoff,encodeCodezenHandoff}from'./codezenHandoff.js';import {PreviewAccessProvider,openPreviewInBrowser}from'./usePreviewAccess.js';import {probePreviewPrivacy}from'./previewProbe.js';import {siteShareTarget,PRIVATE_SHARE_TITLE,privateShareMessage}from'./shareLink.js';var __defProp = Object.defineProperty;
1
+ import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useMemo,useState,useCallback,useRef,useEffect}from'react';import {StyleSheet,Alert,Linking,Keyboard,BackHandler,View,Text,Share,Clipboard}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {GestureHandlerRootView}from'react-native-gesture-handler';import {useSafeInsets}from'../canvas/withRemoteSafeArea.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import {Tap,DIM}from'../inbox/components/Tap.js';import {isBareSeed,studioTurnText,siteScoreTurn}from'./studioCatalog.js';import {brandKitNote,findDesires,importBrandKit}from'../design/surface/brandKit.js';import {useBrandKitInUse}from'../design/surface/useBrandKitInUse.js';import {BrandSheet}from'../design/surface/BrandSheet.js';import {moveLegacyBrandKit}from'./brandKitMove.js';import {titleFromPrompt,displayHost}from'./buildFragments.js';import {parseToolActivity}from'../chat/toolActivity.js';import {friendlySteps,firstContentLanded}from'./stepLabels.js';import {restoreTurnNote}from'./webbuilderPrompts.js';import {webbuilderTheme}from'./webbuilderTheme.js';import {CodeView}from'./components/CodeView.js';import {ProjectChat}from'./components/ProjectChat.js';import {ViewportToggle,PreviewScreen,ViewPicker}from'./components/PreviewScreen.js';import {PublishSheet}from'./components/PublishSheet.js';import {BOTTOM_TABS_SPACE,BottomTabs}from'./components/BottomTabs.js';import {SiteScoreSheet}from'./components/SiteScoreSheet.js';import {ProjectsScreen}from'./components/ProjectsScreen.js';import {TemplatesSheet}from'./components/TemplatesSheet.js';import {StudioHome}from'./components/StudioHome.js';import {VersionsSheet}from'./components/VersionsSheet.js';import {IconButton,Sheet,Toast}from'./components/ui.js';import {exportMessage,exportTurn}from'./exportCode.js';import {ownCloudflareTurn,projectNameOfLiveUrl,plainActionError}from'./publishTools.js';import {SecretsSheet}from'./components/SecretsSheet.js';import {CloudSheet}from'./components/CloudSheet.js';import {MAX_IMAGE_EDIT_BYTES,imageMimeFor}from'./web/code/imageEdit.js';import {useSiteCopyProgress,SiteCopyCard}from'./components/SiteCopyProgress.js';import {copyLine}from'./web/chat/siteCopy.js';import {publishDeployCheck}from'./web/publish/siteInsights.js';import {DraftBanner,DraftsSheet}from'./components/DraftsSheet.js';import {draftBuild,createDrafts}from'./drafts.js';import {draftTurnNote}from'./web/project/drafts.js';import {notReadyHint,projectReadiness}from'./readiness.js';import {SiteStatusSheet}from'./components/SiteStatusSheet.js';import {useRetention,RetentionBanner}from'./components/RetentionBanner.js';import {useGithubAutoSync}from'./useGithubAutoSync.js';import {githubSyncStatus,repoNameOf,githubSettingsPatch}from'./web/github/githubSync.js';import {syncChip,canRunSync}from'./web/github/autoSync.js';import {normalizeGithubRepoUrl}from'./web/project/serverSettings.js';import {ShareSheet}from'./components/ShareSheet.js';import {approvalsSettingsUrl}from'./approvalsLink.js';import {NotesSheet}from'./components/NotesSheet.js';import {projectShareLink}from'./web/sharing/shareLink.js';import {ignoresPatch}from'./web/publish/review/ignores.js';import {publishRequestComment}from'./web/publish/publishRequest.js';import {roleCan}from'./web/sharing/roles.js';import {remixSnapshotParams,snapshotIdFromResult,remixSecretsCheck,buildRemixUrl}from'./web/sharing/share.js';import {OutOfCreditsCard,CreditsSheet}from'./components/Credits.js';import {billingPageUrl}from'./creditsLinks.js';import {useWebBuilderCredits}from'./useWebBuilderCredits.js';import {OUT_OF_CREDITS_TITLE,outOfCreditsText,chipLabel}from'./web/credits/credits.js';import {IntegrationsPanel}from'./components/IntegrationsPanel.js';import {createWebServices}from'./web/webServices.js';import {ProjectMenuSheet,ProjectSettingsSheet,GithubPushSheet,IntegrationsSheet,ImportProjectSheet}from'./components/ProjectSheets.js';import {demoVideoSource,webbuilderDemoHandoff,encodeCodezenHandoff}from'./codezenHandoff.js';import {PreviewAccessProvider,openPreviewInBrowser}from'./usePreviewAccess.js';import {probePreviewPrivacy}from'./previewProbe.js';import {siteShareTarget,PRIVATE_SHARE_TITLE,privateShareMessage}from'./shareLink.js';var __defProp = Object.defineProperty;
2
2
  var __defProps = Object.defineProperties;
3
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -17,10 +17,13 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ const ADD_COMMENT_MUTATION = `mutation aiCodeAddComment($channelId: String!, $input: JSON!) {
21
+ aiCodeAddComment(channelId: $channelId, input: $input)
22
+ }`;
20
23
  const CODEZEN_PREVIEW_MIN_VALID_MS = 9 * 6e4;
21
24
  const TOAST_MS = 2400;
22
25
  const TOAST_ACTION_MS = 6e3;
23
- const PUBLISH_WATCH_MS = 10 * 60 * 1e3;
26
+ const PUBLISH_WATCH_MS = 15 * 60 * 1e3;
24
27
  function WebBuilderExperience({
25
28
  isDark: hostIsDark,
26
29
  onExit,
@@ -59,7 +62,7 @@ function WebBuilderExperience({
59
62
  initialAgentSeed = null,
60
63
  previewAccess
61
64
  }) {
62
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
65
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
63
66
  const appTheme = useAppTheme();
64
67
  const isDark = hostIsDark != null ? hostIsDark : appTheme.isDark;
65
68
  const theme = useMemo(() => webbuilderTheme(isDark), [isDark]);
@@ -140,10 +143,16 @@ function WebBuilderExperience({
140
143
  const [selectedKey, setSelectedKey] = useState(null);
141
144
  useEffect(() => setSelectedKey(null), [activeChannelId]);
142
145
  const latest = (_a = builds[0]) != null ? _a : null;
143
- const build = useMemo(() => {
146
+ const projectBuild = useMemo(() => {
144
147
  var _a2;
145
148
  return selectedKey ? (_a2 = builds.find((b) => b.key === selectedKey)) != null ? _a2 : latest : latest;
146
149
  }, [builds, selectedKey, latest]);
150
+ const [openDraft, setOpenDraft] = useState(null);
151
+ useEffect(() => setOpenDraft(null), [activeChannelId]);
152
+ const build = useMemo(() => openDraft && projectBuild ? draftBuild(projectBuild, openDraft) : projectBuild, [openDraft, projectBuild]);
153
+ const inDraft = useCallback((text) => openDraft ? `${text}
154
+
155
+ ${draftTurnNote(openDraft, openDraft.sandboxId)}` : text, [openDraft]);
147
156
  const firstAsk = (_b = hostChat == null ? void 0 : hostChat.messages.find((m) => m.role === "user")) == null ? void 0 : _b.content;
148
157
  const askTitle = useMemo(() => titleFromPrompt(firstAsk), [firstAsk]);
149
158
  const siteTitle = (project == null ? void 0 : project.title) || (build == null ? void 0 : build.title) || askTitle || null;
@@ -190,7 +199,7 @@ function WebBuilderExperience({
190
199
  const engine = (_a2 = githubSyncRef.current) == null ? void 0 : _a2.engine;
191
200
  const channel = activeChannelId;
192
201
  if (!engine || !channel || !(build == null ? void 0 : build.sandboxId)) {
193
- hostChat.send(turn, files, build);
202
+ hostChat.send(inDraft(turn), files, build);
194
203
  return;
195
204
  }
196
205
  engine.beforeTurn(channel).catch(() => ({
@@ -206,9 +215,9 @@ function WebBuilderExperience({
206
215
  request: turn,
207
216
  preHead: gate.preHead
208
217
  };
209
- hostChat.send(turn, files, build);
218
+ hostChat.send(inDraft(turn), files, build);
210
219
  });
211
- }, [hostChat, build, activeChannelId, showToast]);
220
+ }, [hostChat, build, activeChannelId, showToast, inDraft]);
212
221
  const openChat = useCallback(() => {
213
222
  Keyboard.dismiss();
214
223
  setMode("chat");
@@ -228,6 +237,10 @@ function WebBuilderExperience({
228
237
  };
229
238
  const wakePreview = useCallback((asked = false) => {
230
239
  if (!build || waking) return;
240
+ if (openDraft) {
241
+ if (asked) showToast("This draft's preview has stopped. Go back to the project, or delete the draft.");
242
+ return;
243
+ }
231
244
  if (!asked && wokenFor.current === build.key) return;
232
245
  if (building || (hostChat == null ? void 0 : hostChat.busy)) return;
233
246
  wokenFor.current = build.key;
@@ -253,7 +266,7 @@ function WebBuilderExperience({
253
266
  kind: outcome === "gone" ? "gone" : "failed"
254
267
  });
255
268
  }).finally(() => setWaking(false));
256
- }, [build, waking, building, onResumePreview, hostChat]);
269
+ }, [build, waking, building, onResumePreview, hostChat, openDraft, showToast]);
257
270
  const askAiToRestore = useCallback((reason, snapshotId) => {
258
271
  if (!build || !hostChat || hostChat.busy) return;
259
272
  const name = siteTitle || build.title || "my site";
@@ -269,6 +282,10 @@ ${restoreTurnNote({
269
282
  }, [build, hostChat, siteTitle]);
270
283
  const restoreFromSavedCopy = useCallback(() => {
271
284
  if (!build || (previewTrouble == null ? void 0 : previewTrouble.kind) === "restoring") return;
285
+ if (openDraft) {
286
+ showToast("A draft can't be restored. Go back to the project, or delete the draft.");
287
+ return;
288
+ }
272
289
  if (!onRestorePreview) {
273
290
  askAiToRestore();
274
291
  return;
@@ -295,7 +312,7 @@ ${restoreTurnNote({
295
312
  snapshotId: result.snapshotId
296
313
  });
297
314
  });
298
- }, [build, previewTrouble == null ? void 0 : previewTrouble.kind, onRestorePreview, askAiToRestore, showToast]);
315
+ }, [build, previewTrouble == null ? void 0 : previewTrouble.kind, onRestorePreview, askAiToRestore, showToast, openDraft]);
299
316
  const [publishOpen, setPublishOpen] = useState(false);
300
317
  const [versionsOpen, setVersionsOpen] = useState(false);
301
318
  const [publishStarted, setPublishStarted] = useState(null);
@@ -320,10 +337,36 @@ ${restoreTurnNote({
320
337
  return;
321
338
  }
322
339
  if (!agentWorking && publishStarted.seenBusy && !(siteLive && siteLive !== publishStarted.live) && !landedLive) {
340
+ const run = publishStarted;
323
341
  setPublishStarted(null);
324
- showToast("Publishing didn't finish - the chat says why.");
342
+ if (!run.projectName || !run.target || !(publishTools == null ? void 0 : publishTools.run)) {
343
+ showToast("Publishing didn't finish - the chat says why.");
344
+ return;
345
+ }
346
+ const check = (startedAt) => {
347
+ publishTools.run(run.target, "WEBBUILDER_SITE_STATUS", {
348
+ projectName: run.projectName
349
+ }, 6e4).then((r) => {
350
+ if (!r.successful) {
351
+ showToast("Couldn't confirm the publish. Check the chat, or open Site status.");
352
+ return;
353
+ }
354
+ const data = r.data && typeof r.data === "object" ? r.data : {};
355
+ const verdict = publishDeployCheck(data, startedAt);
356
+ if (verdict.kind === "live") showToast("Your site is live");
357
+ else if (verdict.kind === "deploying") {
358
+ showToast("Your site is still going live.", {
359
+ label: "Check again",
360
+ onPress: () => check(startedAt)
361
+ });
362
+ } else if (verdict.kind === "failed") {
363
+ showToast(`Publishing stopped${verdict.stage ? ` at ${verdict.stage}` : ""}. The chat says why.`);
364
+ } else showToast("Publishing didn't reach the site - the chat says why.");
365
+ }).catch(() => showToast("Couldn't confirm the publish. Check the chat, or open Site status."));
366
+ };
367
+ check(run.at);
325
368
  }
326
- }, [agentWorking, publishStarted, siteLive, landedLive, showToast]);
369
+ }, [agentWorking, publishStarted, siteLive, landedLive, showToast, publishTools]);
327
370
  const publishing = publishingOnChat || Boolean(publishStarted && Date.now() - publishStarted.at < PUBLISH_WATCH_MS);
328
371
  const publish = useCallback(async (target, projectName, customDomain, force) => {
329
372
  if (!onPublish) return {
@@ -336,7 +379,9 @@ ${restoreTurnNote({
336
379
  key: target.key,
337
380
  live: siteLive,
338
381
  at: Date.now(),
339
- agent: target.origin === "agent"
382
+ agent: target.origin === "agent",
383
+ projectName,
384
+ target
340
385
  });
341
386
  showToast("Publishing started");
342
387
  }
@@ -412,7 +457,7 @@ ${restoreTurnNote({
412
457
  setMode("chat");
413
458
  return;
414
459
  }
415
- hostChat.send(text, void 0, build);
460
+ hostChat.send(inDraft(text), void 0, build);
416
461
  setMode("chat");
417
462
  };
418
463
  const downloadCode = () => {
@@ -442,7 +487,8 @@ ${restoreTurnNote({
442
487
  const webServices = useMemo(() => (projectTools == null ? void 0 : projectTools.graphql) && projectTools.scope ? createWebServices({
443
488
  transport: projectTools.graphql,
444
489
  scope: projectTools.scope,
445
- appUrl: projectTools.appUrl
490
+ appUrl: projectTools.appUrl,
491
+ agentUrl: projectTools.agentUrl
446
492
  }) : null, [projectTools]);
447
493
  const githubSync = useGithubAutoSync({
448
494
  services: webServices,
@@ -489,6 +535,54 @@ ${restoreTurnNote({
489
535
  });
490
536
  }, [divergedPrompt, syncEngine]);
491
537
  const [shareOpen, setShareOpen] = useState(false);
538
+ const [notesOpen, setNotesOpen] = useState(false);
539
+ const readSiteImage = useCallback(async (path) => {
540
+ if (!(build == null ? void 0 : build.sandboxId) || !(publishTools == null ? void 0 : publishTools.run)) return null;
541
+ const r = await publishTools.run(build, "WEBBUILDER_READ_FILE", {
542
+ sandbox_id: build.sandboxId,
543
+ path,
544
+ encoding: "base64",
545
+ maxBytes: MAX_IMAGE_EDIT_BYTES
546
+ }, 6e4).catch(() => null);
547
+ const d = (r == null ? void 0 : r.successful) && r.data && typeof r.data === "object" ? r.data : null;
548
+ const content = typeof (d == null ? void 0 : d.content) === "string" ? d.content : "";
549
+ return content ? `data:${imageMimeFor(path)};base64,${content}` : null;
550
+ }, [build, publishTools]);
551
+ const copyText = (hostChat == null ? void 0 : hostChat.busy) ? (_m = hostChat.streaming) != null ? _m : (_l = [...(_k = hostChat.messages) != null ? _k : []].reverse().find((m) => m.role === "assistant")) == null ? void 0 : _l.content : null;
552
+ const copyTarget = (_o = (_n = copyLine(copyText)) == null ? void 0 : _n.sandboxId) != null ? _o : null;
553
+ const siteCopy = useSiteCopyProgress(publishTools == null ? void 0 : publishTools.run, build, copyTarget);
554
+ const [draftsOpen, setDraftsOpen] = useState(false);
555
+ const drafts = useMemo(() => webServices && (publishTools == null ? void 0 : publishTools.run) && activeChannelId ? createDrafts({
556
+ services: webServices,
557
+ run: publishTools.run,
558
+ channelId: activeChannelId
559
+ }) : null, [webServices, publishTools == null ? void 0 : publishTools.run, activeChannelId]);
560
+ const openPublish = () => {
561
+ if (openDraft) {
562
+ Alert.alert("Accept to publish", `"${openDraft.name}" is a draft. Accept it into the project, then publish.`, [{
563
+ text: "Not now",
564
+ style: "cancel"
565
+ }, {
566
+ text: "Open Drafts",
567
+ onPress: () => setDraftsOpen(true)
568
+ }]);
569
+ return;
570
+ }
571
+ setPublishOpen(true);
572
+ };
573
+ const [reviewIgnores, setReviewIgnores] = useState([]);
574
+ useEffect(() => {
575
+ setReviewIgnores([]);
576
+ if (!webServices || !activeChannelId || !publishOpen) return void 0;
577
+ let live2 = true;
578
+ webServices.serverSettings(activeChannelId).then((s) => {
579
+ var _a2;
580
+ return live2 && setReviewIgnores((_a2 = s == null ? void 0 : s.reviewIgnores) != null ? _a2 : []);
581
+ }).catch(() => void 0);
582
+ return () => {
583
+ live2 = false;
584
+ };
585
+ }, [webServices, activeChannelId, publishOpen]);
492
586
  const retention = useRetention(projectTools == null ? void 0 : projectTools.graphql, activeChannelId);
493
587
  const [roleEpoch, setRoleEpoch] = useState(0);
494
588
  const [projectRole, setProjectRole] = useState(null);
@@ -681,6 +775,22 @@ ${secrets.note}` : ""}`, [{
681
775
  hint: "API keys your app reads as environment variables",
682
776
  run: () => setSecretsOpen(true)
683
777
  });
778
+ if ((projectBuild == null ? void 0 : projectBuild.sandboxId) && (publishTools == null ? void 0 : publishTools.run)) {
779
+ tools.push({
780
+ key: "drafts",
781
+ icon: "source-branch",
782
+ label: "Drafts",
783
+ hint: openDraft ? `In "${openDraft.name}"` : "Try changes on a copy, then accept them",
784
+ run: () => setDraftsOpen(true)
785
+ });
786
+ }
787
+ tools.push({
788
+ key: "notes",
789
+ icon: "notebook-edit-outline",
790
+ label: "Notes",
791
+ hint: "For your team; the AI does not read them",
792
+ run: () => setNotesOpen(true)
793
+ });
684
794
  }
685
795
  if (projectTools && hostChat) {
686
796
  const builtHint = notReadyHint(projectReadiness({
@@ -877,7 +987,7 @@ ${secrets.note}` : ""}`, [{
877
987
  }];
878
988
  };
879
989
  const openMore = () => setProjectMenuOpen(true);
880
- const page = /* @__PURE__ */ jsxs(GestureHandlerRootView, { style: [styles.fill, {
990
+ return /* @__PURE__ */ jsx(PreviewAccessProvider, { access: previewAccess, channelId: activeChannelId, children: /* @__PURE__ */ jsxs(GestureHandlerRootView, { style: [styles.fill, {
881
991
  backgroundColor: theme.screen
882
992
  }], children: [
883
993
  activeChannelId ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -909,13 +1019,19 @@ ${secrets.note}` : ""}`, [{
909
1019
  ] })
910
1020
  ] })
911
1021
  ] }),
912
- mode === "chat" ? /* @__PURE__ */ jsx(ProjectChat, { messages: (_k = hostChat == null ? void 0 : hostChat.messages) != null ? _k : [], streaming: (_l = hostChat == null ? void 0 : hostChat.streaming) != null ? _l : null, busy: Boolean(hostChat == null ? void 0 : hostChat.busy), error: (_m = hostChat == null ? void 0 : hostChat.error) != null ? _m : null, connected: Boolean(hostChat == null ? void 0 : hostChat.connected), building, build, siteTitle: siteTitle || "Your site", onSend: (text, files) => sendToAgent(text, files), codeActions: Boolean(hostChat && (build == null ? void 0 : build.sandboxId)), holdTurn, templates, onStartFromTemplate: (t, brief) => startSite({
1022
+ mode === "chat" ? /* @__PURE__ */ jsx(ProjectChat, { messages: (_p = hostChat == null ? void 0 : hostChat.messages) != null ? _p : [], streaming: (_q = hostChat == null ? void 0 : hostChat.streaming) != null ? _q : null, busy: Boolean(hostChat == null ? void 0 : hostChat.busy), error: (_r = hostChat == null ? void 0 : hostChat.error) != null ? _r : null, connected: Boolean(hostChat == null ? void 0 : hostChat.connected), building, build, siteTitle: siteTitle || "Your site", onSend: (text, files) => sendToAgent(text, files), codeActions: Boolean(hostChat && (build == null ? void 0 : build.sandboxId)), holdTurn, liveCard: siteCopy ? /* @__PURE__ */ jsx(SiteCopyCard, { view: siteCopy, theme }) : null, code: code != null ? code : void 0, permissionsUrl: approvalsSettingsUrl(projectTools == null ? void 0 : projectTools.appUrl), templates, onStartFromTemplate: (t, brief) => startSite({
913
1023
  brief,
914
1024
  template: t
915
- }), banner: /* @__PURE__ */ jsx(RetentionBanner, { view: retention, appUrl: projectTools == null ? void 0 : projectTools.appUrl, canExtend: projectRole !== "viewer", onDownload: (build == null ? void 0 : build.sandboxId) && !building ? downloadCode : void 0, theme }), costLine: ((_n = credits == null ? void 0 : credits.costLine) == null ? void 0 : _n.channelId) === activeChannelId ? credits.costLine.text : null, creditsCard: (credits == null ? void 0 : credits.cardOpen) ? /* @__PURE__ */ jsx(OutOfCreditsCard, { appUrl: projectTools == null ? void 0 : projectTools.appUrl, onCheckAgain: () => credits.refresh({
1025
+ }), banner: /* @__PURE__ */ jsxs(Fragment, { children: [
1026
+ openDraft ? /* @__PURE__ */ jsx(DraftBanner, { name: openDraft.name, onAccept: () => setDraftsOpen(true), onBack: () => {
1027
+ setOpenDraft(null);
1028
+ showToast("Back to the project.");
1029
+ }, theme }) : null,
1030
+ /* @__PURE__ */ jsx(RetentionBanner, { view: retention, appUrl: projectTools == null ? void 0 : projectTools.appUrl, canExtend: projectRole !== "viewer", onDownload: (build == null ? void 0 : build.sandboxId) && !building ? downloadCode : void 0, theme })
1031
+ ] }), costLine: ((_s = credits == null ? void 0 : credits.costLine) == null ? void 0 : _s.channelId) === activeChannelId ? credits.costLine.text : null, creditsCard: (credits == null ? void 0 : credits.cardOpen) ? /* @__PURE__ */ jsx(OutOfCreditsCard, { appUrl: projectTools == null ? void 0 : projectTools.appUrl, onCheckAgain: () => credits.refresh({
916
1032
  fresh: true
917
- }), onDismiss: credits.dismissCard, theme }) : null, onOpenPreview: () => setMode("preview"), onPublish: () => setPublishOpen(true), onPreviewAsleep: () => wakePreview(), previewDown: Boolean(previewTrouble && previewTrouble.kind !== "restoring"), ask: (_o = hostChat == null ? void 0 : hostChat.ask) != null ? _o : null, onAnswerAsk: (formatted) => hostChat == null ? void 0 : hostChat.send(formatted), loading: historyLoading, steering: hostChat == null ? void 0 : hostChat.steering, renderConnectorCard: hostChat == null ? void 0 : hostChat.renderConnectorCard, onCopyLink: copySiteLink, theme, bottomInset: insets.bottom }) : null,
918
- mode === "preview" ? /* @__PURE__ */ jsx(PreviewScreen, { build, building, loading: buildsLoading, previewNonce, onReload: () => setPreviewNonce((n) => n + 1), onWake: () => wakePreview(), waking, trouble: previewTrouble, onRetry: () => wakePreview(true), onRestore: restoreFromSavedCopy, onAskAiRestore: hostChat ? askAiToRestore : void 0, agentBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), steps: liveSteps, onPublish: () => setPublishOpen(true), publishLabel, error: (_p = hostChat == null ? void 0 : hostChat.error) != null ? _p : null, theme, bottomInset: insets.bottom, viewport, unpublished: Boolean(build == null ? void 0 : build.sandboxId) && !(build == null ? void 0 : build.liveUrl), readSourceFile: code && build ? (path) => code.readFile(build, path, false).then((r) => {
1033
+ }), onDismiss: credits.dismissCard, theme }) : null, onOpenPreview: () => setMode("preview"), onPublish: openPublish, onPreviewAsleep: () => wakePreview(), previewDown: Boolean(previewTrouble && previewTrouble.kind !== "restoring"), ask: (_t = hostChat == null ? void 0 : hostChat.ask) != null ? _t : null, onAnswerAsk: (formatted) => hostChat == null ? void 0 : hostChat.send(formatted), loading: historyLoading, steering: hostChat == null ? void 0 : hostChat.steering, renderConnectorCard: hostChat == null ? void 0 : hostChat.renderConnectorCard, onCopyLink: copySiteLink, theme, bottomInset: insets.bottom }) : null,
1034
+ mode === "preview" ? /* @__PURE__ */ jsx(PreviewScreen, { build, building, loading: buildsLoading, previewNonce, onReload: () => setPreviewNonce((n) => n + 1), onWake: () => wakePreview(), waking, trouble: previewTrouble, onRetry: () => wakePreview(true), onRestore: restoreFromSavedCopy, onAskAiRestore: hostChat ? askAiToRestore : void 0, agentBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), steps: liveSteps, onPublish: openPublish, publishLabel, error: (_u = hostChat == null ? void 0 : hostChat.error) != null ? _u : null, theme, bottomInset: insets.bottom, viewport, unpublished: Boolean(build == null ? void 0 : build.sandboxId) && !(build == null ? void 0 : build.liveUrl), readSourceFile: code && build ? (path) => code.readFile(build, path, false).then((r) => {
919
1035
  var _a2;
920
1036
  return r.ok ? (_a2 = r.content) != null ? _a2 : null : null;
921
1037
  }) : void 0, onShowCode: canShowCode ? () => setMode("code") : void 0, buildingCover }) : null,
@@ -933,7 +1049,14 @@ ${secrets.note}` : ""}`, [{
933
1049
  color: theme.ink
934
1050
  }], numberOfLines: 1, children: "Code" })
935
1051
  ] }),
936
- /* @__PURE__ */ jsx(CodeView, { files: (_q = build == null ? void 0 : build.files) != null ? _q : null, build, code, busy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), onWake: build && onResumePreview ? () => onResumePreview(build).then((outcome) => {
1052
+ /* @__PURE__ */ jsx(CodeView, { files: (_v = build == null ? void 0 : build.files) != null ? _v : null, build, code, readImage: (publishTools == null ? void 0 : publishTools.run) && (build == null ? void 0 : build.sandboxId) ? readSiteImage : void 0, onImageEdit: hostChat && roleCan(projectRole, "build") ? (req) => {
1053
+ if (!build || hostChat.busy || holdTurn()) return false;
1054
+ hostChat.send(inDraft(`${req.text}
1055
+
1056
+ ${req.note}`), req.attachments, build);
1057
+ setMode("chat");
1058
+ return true;
1059
+ } : void 0, busy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), onWake: build && onResumePreview ? () => onResumePreview(build).then((outcome) => {
937
1060
  if (outcome === "ok") setPreviewNonce((n) => n + 1);
938
1061
  return outcome;
939
1062
  }) : void 0, theme, onAsk: openChat })
@@ -949,7 +1072,7 @@ ${secrets.note}` : ""}`, [{
949
1072
  }, brand, brandOff, onBrandOffChange: setBrandOff, onBrand: () => setBrandOpen(true), onSiteScore: () => setScoreOpen(true), onStart: startSite, connecting: startBlocked, startNotice, theme, bottomInset: BOTTOM_TABS_SPACE + insets.bottom }) : /* @__PURE__ */ jsx(ProjectsScreen, { projects, loading: projectsLoading, error: projectsError, hasMore: projectsHasMore, onRefresh: onRefreshProjects, onLoadMore: onLoadMoreProjects, onOpen: (p) => onOpenProject(p.channelId), onNewProject: () => setHomeTab("create"), topInset: insets.top + 12, bottomInset: BOTTOM_TABS_SPACE + insets.bottom, theme }) }),
950
1073
  /* @__PURE__ */ jsx(BottomTabs, { tab: homeTab, onTab: setHomeTab, theme, bottomInset: insets.bottom })
951
1074
  ] }),
952
- /* @__PURE__ */ jsx(TemplatesSheet, { visible: templatesOpen, onClose: () => setTemplatesOpen(false), templates, loading: templatesLoading, error: templatesError, onReload: onReloadTemplates, selectedId: (_r = template == null ? void 0 : template.id) != null ? _r : null, onPick: pickTemplate, theme }),
1075
+ /* @__PURE__ */ jsx(TemplatesSheet, { visible: templatesOpen, onClose: () => setTemplatesOpen(false), templates, loading: templatesLoading, error: templatesError, onReload: onReloadTemplates, selectedId: (_w = template == null ? void 0 : template.id) != null ? _w : null, onPick: pickTemplate, theme }),
953
1076
  /* @__PURE__ */ jsx(SiteScoreSheet, { visible: scoreOpen, onClose: () => setScoreOpen(false), blocked: startBlocked, onCheck: (url) => {
954
1077
  setScoreOpen(false);
955
1078
  onStartProject({
@@ -974,13 +1097,25 @@ ${secrets.note}` : ""}`, [{
974
1097
  }, onClose: () => setGithubOpen(false), theme }),
975
1098
  webServices ? /* @__PURE__ */ jsx(IntegrationsPanel, { visible: integrationsOpen, channelId: activeChannelId, services: webServices, aiBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), onRequest: (text) => askAgent(text), onClose: () => setIntegrationsOpen(false), theme }) : /* @__PURE__ */ jsx(IntegrationsSheet, { visible: integrationsOpen, channelId: activeChannelId, tools: projectTools, aiBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), onRequest: (text) => askAgent(text), onClose: () => setIntegrationsOpen(false), theme })
976
1099
  ] }) : null,
977
- webServices ? /* @__PURE__ */ jsx(CreditsSheet, { visible: creditsOpen, balance: (_s = credits == null ? void 0 : credits.balance) != null ? _s : null, appUrl: projectTools == null ? void 0 : projectTools.appUrl, onRefresh: () => {
1100
+ webServices ? /* @__PURE__ */ jsx(CreditsSheet, { visible: creditsOpen, balance: (_x = credits == null ? void 0 : credits.balance) != null ? _x : null, appUrl: projectTools == null ? void 0 : projectTools.appUrl, onRefresh: () => {
978
1101
  var _a2;
979
1102
  return (_a2 = credits == null ? void 0 : credits.refresh({
980
1103
  fresh: true
981
1104
  })) != null ? _a2 : Promise.resolve(null);
982
1105
  }, onClose: () => setCreditsOpen(false), theme }) : null,
983
- webServices ? /* @__PURE__ */ jsx(ShareSheet, { visible: shareOpen, channelId: activeChannelId, title: siteTitle || (build == null ? void 0 : build.title) || "this project", sharing: webServices.sharing, onChanged: () => setRoleEpoch((n) => n + 1), onClose: () => setShareOpen(false), theme }) : null,
1106
+ /* @__PURE__ */ jsx(DraftsSheet, { visible: draftsOpen, project: projectBuild, drafts, openDraftId: (_y = openDraft == null ? void 0 : openDraft.id) != null ? _y : null, canEdit: roleCan(projectRole, "build"), onOpen: (d) => {
1107
+ setOpenDraft(d);
1108
+ setMode("chat");
1109
+ showToast(d ? `In the draft "${d.name}".` : "Back to the project.");
1110
+ }, onAccepted: () => {
1111
+ showToast("The draft is the project now.");
1112
+ onRefreshProjects == null ? void 0 : onRefreshProjects();
1113
+ }, onClose: () => setDraftsOpen(false), theme }),
1114
+ webServices ? /* @__PURE__ */ jsx(NotesSheet, { visible: notesOpen, channelId: activeChannelId, services: webServices, canEdit: roleCan(projectRole, "updateSettings"), onClose: () => setNotesOpen(false), theme }) : null,
1115
+ webServices ? /* @__PURE__ */ jsx(ShareSheet, { projectLink: (projectTools == null ? void 0 : projectTools.webBuilderUrl) && activeChannelId ? projectShareLink(projectTools.webBuilderUrl, {
1116
+ channelId: activeChannelId,
1117
+ sandboxId: build == null ? void 0 : build.sandboxId
1118
+ }) : null, visible: shareOpen, channelId: activeChannelId, title: siteTitle || (build == null ? void 0 : build.title) || "this project", sharing: webServices.sharing, onChanged: () => setRoleEpoch((n) => n + 1), onClose: () => setShareOpen(false), theme }) : null,
984
1119
  webServices ? /* @__PURE__ */ jsx(CloudSheet, { role: projectRole, visible: cloudOpen, channelId: activeChannelId, data: webServices.data, busy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), onRequest: (text) => {
985
1120
  if (!build || !hostChat || hostChat.busy) return false;
986
1121
  setCloudOpen(false);
@@ -998,7 +1133,33 @@ ${secrets.note}` : ""}`, [{
998
1133
  /* @__PURE__ */ jsx(PublishSheet, { visible: publishOpen, build, publishing, onPublish: onPublish ? publish : void 0, onClose: () => setPublishOpen(false), theme, liveUrl: live, aiBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), tools: publishTools, onDownloadCode: (build == null ? void 0 : build.sandboxId) && !building ? downloadCode : void 0, onExport: hostChat && !building ? exportTo : void 0, onOwnCloudflare: hostChat && !building ? () => askAgent(ownCloudflareTurn(siteTitle || (build == null ? void 0 : build.title) || "")) : void 0, onFixWithAi: hostChat ? (text) => askAgent(text) : void 0, onUnpublished: () => showToast("The site is offline now."), onSiteStatus: (publishTools == null ? void 0 : publishTools.run) && live ? () => {
999
1134
  setPublishOpen(false);
1000
1135
  setTimeout(() => setSiteStatusOpen(true), 300);
1001
- } : void 0, progressText: publishing ? (_t = building == null ? void 0 : building.statusText) != null ? _t : null : null }),
1136
+ } : void 0, progressText: publishing ? (_z = building == null ? void 0 : building.statusText) != null ? _z : null : null, reviewIgnores, appUrl: projectTools == null ? void 0 : projectTools.appUrl, askToPublish: projectRole === "viewer" && (projectTools == null ? void 0 : projectTools.graphql) && activeChannelId ? async (note) => {
1137
+ var _a2, _b2, _c2;
1138
+ const r = await projectTools.graphql.mutate(ADD_COMMENT_MUTATION, {
1139
+ channelId: activeChannelId,
1140
+ input: publishRequestComment(note)
1141
+ });
1142
+ const refused = (_b2 = (_a2 = r.errors) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.message;
1143
+ const answer = (_c2 = r.data) == null ? void 0 : _c2.aiCodeAddComment;
1144
+ if (refused) return {
1145
+ ok: false,
1146
+ message: refused
1147
+ };
1148
+ if (answer && answer.ok === false) return {
1149
+ ok: false,
1150
+ message: answer.error
1151
+ };
1152
+ return {
1153
+ ok: true
1154
+ };
1155
+ } : void 0, onReviewIgnoresChange: webServices && activeChannelId && roleCan(projectRole, "updateSettings") ? (next) => {
1156
+ setReviewIgnores(next);
1157
+ webServices.data.updateSettings(activeChannelId, {
1158
+ reviewIgnores: ignoresPatch(next)
1159
+ }).then((r) => {
1160
+ if (!r.ok) showToast(r.message || "Couldn't save that for the project.");
1161
+ }).catch(() => void 0);
1162
+ } : void 0 }),
1002
1163
  (publishTools == null ? void 0 : publishTools.run) && live ? /* @__PURE__ */ jsx(SiteStatusSheet, { visible: siteStatusOpen, build, projectName: projectNameOfLiveUrl(live), channelId: activeChannelId, run: publishTools.run, graphql: projectTools == null ? void 0 : projectTools.graphql, aiBusy: Boolean(building) || Boolean(hostChat == null ? void 0 : hostChat.busy), onFixWithAi: (text) => {
1003
1164
  if (!build || !hostChat || hostChat.busy) return false;
1004
1165
  askAgent(text);
@@ -1008,16 +1169,15 @@ ${secrets.note}` : ""}`, [{
1008
1169
  setSelectedKey(picked.key === (latest == null ? void 0 : latest.key) ? null : picked.key);
1009
1170
  setVersionsOpen(false);
1010
1171
  }, onClose: () => setVersionsOpen(false), theme }),
1011
- /* @__PURE__ */ jsx(Sheet, { visible: menu !== null, title: (_u = menu == null ? void 0 : menu.title) != null ? _u : "", onClose: () => setMenu(null), theme, children: /* @__PURE__ */ jsx(View, { style: [styles.menuList, {
1172
+ /* @__PURE__ */ jsx(Sheet, { visible: menu !== null, title: (_A = menu == null ? void 0 : menu.title) != null ? _A : "", onClose: () => setMenu(null), theme, children: /* @__PURE__ */ jsx(View, { style: [styles.menuList, {
1012
1173
  paddingBottom: insets.bottom + 8
1013
- }], children: ((_v = menu == null ? void 0 : menu.actions) != null ? _v : []).map((action) => /* @__PURE__ */ jsx(Tap, { onPress: () => chooseMenu(action), accessibilityRole: "button", style: [styles.menuRow, {
1174
+ }], children: ((_B = menu == null ? void 0 : menu.actions) != null ? _B : []).map((action) => /* @__PURE__ */ jsx(Tap, { onPress: () => chooseMenu(action), accessibilityRole: "button", style: [styles.menuRow, {
1014
1175
  borderBottomColor: theme.border
1015
1176
  }], pressedStyle: DIM, children: /* @__PURE__ */ jsx(Text, { style: [styles.menuLabel, {
1016
1177
  color: action.destructive ? theme.crit : theme.ink
1017
1178
  }], children: action.label }) }, action.label)) }) }),
1018
1179
  /* @__PURE__ */ jsx(Toast, { message: toast, action: toastAction, theme, bottom: insets.bottom + 80 })
1019
- ] });
1020
- return /* @__PURE__ */ jsx(PreviewAccessProvider, { access: previewAccess, channelId: activeChannelId, children: page });
1180
+ ] }) });
1021
1181
  }
1022
1182
  const styles = StyleSheet.create({
1023
1183
  codeBar: {