supermemory/apps/web/lib/connector-notify.ts
MaheshtheDev 29c43984fe feat(web): pause Google Drive connect with a notify-me fallback (#1602)
![image.png](https://app.graphite.com/user-attachments/assets/6d7dd2cf-575b-450c-b7bb-c24b8ec834b9.png)

Google is not approving new authorizations while it re-reviews our app, so
every path that starts a new Google connection now shows a PAUSED badge and a
"Notify me" button instead of Connect.

- Existing connections are untouched: sync, file picking and history still work.
- Notify me fires a connector_paused_clicked PostHog event and remembers the
choice in localStorage, so we can pull who to email when the review clears.
- One list in lib/connector-availability.ts drives every surface; removing the
two entries turns Google back on.
2026-08-27 20:20:13 +00:00

44 lines
1.3 KiB
TypeScript

"use client"
import { useCallback, useEffect, useState } from "react"
import { toast } from "sonner"
import { analytics } from "@/lib/analytics"
import { connectorPause } from "@/lib/connector-availability"
const key = (provider: string) => `connector_notify:${provider}`
// Per-browser only. The PostHog event is the record of truth for who to email.
export function useConnectorNotify() {
const [requested, setRequested] = useState<Record<string, boolean>>({})
useEffect(() => {
try {
const seen: Record<string, boolean> = {}
for (let i = 0; i < localStorage.length; i++) {
const k = localStorage.key(i)
if (k?.startsWith("connector_notify:")) {
seen[k.slice("connector_notify:".length)] = true
}
}
setRequested(seen)
} catch {}
}, [])
const isRequested = useCallback(
(provider: string) => requested[provider] === true,
[requested],
)
const request = useCallback((provider: string) => {
const pause = connectorPause(provider)
if (!pause) return
analytics.connectorPausedClicked({ provider, reason: pause.reason })
try {
localStorage.setItem(key(provider), "1")
} catch {}
setRequested((prev) => ({ ...prev, [provider]: true }))
toast.success(`We'll email you when ${pause.label} is back.`)
}, [])
return { isRequested, request }
}