mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
 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.
44 lines
1.3 KiB
TypeScript
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 }
|
|
}
|