Merge pull request #34185 from overleaf/worktree-mg-error-assist-paywall

Show paywall from gutter when user hits suggestion limit

GitOrigin-RevId: 36c09e3d93ac38e1e675aa8ffb419e928094d68e
This commit is contained in:
Malik Glossop
2026-06-04 12:45:07 +02:00
committed by Copybot
parent d25b032e16
commit b8fc478e1f
@@ -20,11 +20,7 @@ export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
const { hasSuggestionsLeft } = useEditorContext()
const selectLogNewLogs = useCallback(
(
id: string,
suggestFix: boolean,
showPaywallIfOutOfSuggestions: boolean
) => {
(id: string, suggestFix: boolean) => {
window.setTimeout(() => {
const logEntry = document.querySelector(
`.log-entry[data-log-entry-id="${id}"]`
@@ -50,7 +46,7 @@ export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
'button[data-action="suggest-fix"]'
)
?.click()
} else if (showPaywallIfOutOfSuggestions) {
} else {
window.dispatchEvent(
new CustomEvent('aiAssist:showPaywall', {
detail: { origin: 'suggest-fix' },
@@ -74,21 +70,16 @@ export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
const handleViewCompileLogEntryEvent = useCallback(
(event: Event) => {
const { id, suggestFix, showPaywallIfOutOfSuggestions } = (
const { id, suggestFix } = (
event as CustomEvent<{
id: string
suggestFix?: boolean
showPaywallIfOutOfSuggestions?: boolean
}>
).detail
openLogs()
selectLogNewLogs(
id,
Boolean(suggestFix),
Boolean(showPaywallIfOutOfSuggestions)
)
selectLogNewLogs(id, Boolean(suggestFix))
},
[openLogs, selectLogNewLogs]
)