feat: add store review prompts for desktop and mobile (#4909)
This commit is contained in:
@@ -11,9 +11,11 @@
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./export.js"
|
||||
"types": "./dist/export.d.ts",
|
||||
"import": "./dist/export.js"
|
||||
}
|
||||
},
|
||||
"types": "./dist/export.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"test": "vitest",
|
||||
|
||||
@@ -29,6 +29,7 @@ export const isWindows11 = detectingWindows11()
|
||||
// Custom APIs for renderer
|
||||
const api = {
|
||||
canWindowBlur: process.platform === "darwin" || (process.platform === "win32" && isWindows11),
|
||||
isWindowsStore: Boolean((process as typeof process & { windowsStore?: boolean }).windowsStore),
|
||||
}
|
||||
|
||||
// Use `contextBridge` APIs to expose Electron APIs to
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import type { ElectronAPI } from "@electron-toolkit/preload"
|
||||
declare global {
|
||||
interface Window {
|
||||
electron?: ElectronAPI
|
||||
api?: { canWindowBlur: boolean }
|
||||
api?: { canWindowBlur: boolean; isWindowsStore: boolean }
|
||||
platform: NodeJS.Platform
|
||||
}
|
||||
export const APP_NAME = "Folo"
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
export const ReviewPromptModalContent = ({
|
||||
dismiss,
|
||||
onNegative,
|
||||
onPositive,
|
||||
}: {
|
||||
dismiss: () => void
|
||||
onNegative: () => void
|
||||
onPositive: () => void
|
||||
}) => {
|
||||
const { t } = useTranslation("settings")
|
||||
|
||||
return (
|
||||
<div className="flex min-w-80 max-w-md flex-col gap-4">
|
||||
<p className="text-sm leading-relaxed text-text-secondary">{t("reviewPrompt.description")}</p>
|
||||
|
||||
<div className="flex items-center justify-end gap-3">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
onNegative()
|
||||
dismiss()
|
||||
}}
|
||||
>
|
||||
{t("reviewPrompt.notReally")}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
onClick={() => {
|
||||
onPositive()
|
||||
dismiss()
|
||||
}}
|
||||
>
|
||||
{t("reviewPrompt.loveIt")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
let triggerReviewPromptDebug: (() => void) | null = null
|
||||
let resetReviewPromptDebug: (() => void) | null = null
|
||||
|
||||
export const setDesktopReviewPromptDebugAction = (callback: (() => void) | null) => {
|
||||
triggerReviewPromptDebug = callback
|
||||
}
|
||||
|
||||
export const openDesktopReviewPromptDebug = () => {
|
||||
triggerReviewPromptDebug?.()
|
||||
}
|
||||
|
||||
export const setDesktopReviewPromptResetAction = (callback: (() => void) | null) => {
|
||||
resetReviewPromptDebug = callback
|
||||
}
|
||||
|
||||
export const resetDesktopReviewPromptDebug = () => {
|
||||
resetReviewPromptDebug?.()
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
import { sheetStackAtom } from "@follow/components/ui/sheet/context.js"
|
||||
import { UserRole } from "@follow/constants"
|
||||
import {
|
||||
getReviewPromptEligibility,
|
||||
recordReviewPromptActiveDay,
|
||||
recordReviewPromptEntryOpen,
|
||||
recordReviewPromptPaidConversion,
|
||||
recordReviewPromptSubscriptionAdded,
|
||||
syncReviewPromptSubscriptionCount,
|
||||
} from "@follow/shared/review-prompt"
|
||||
import { useAllFeedSubscription, useAllListSubscription } from "@follow/store/subscription/hooks"
|
||||
import { useUserRole } from "@follow/store/user/hooks"
|
||||
import { tracker, TrackerMapper, trackManager } from "@follow/tracker"
|
||||
import { useAtomValue } from "jotai"
|
||||
import { useEffect, useMemo, useRef } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useLocation } from "react-router"
|
||||
|
||||
import { useIsInMASReview } from "~/atoms/server-configs"
|
||||
import { useHasModal, useModalStack } from "~/components/ui/modal/stacked/hooks"
|
||||
|
||||
import { DebugRegistry } from "../debug/registry"
|
||||
import { setDesktopReviewPromptDebugAction, setDesktopReviewPromptResetAction } from "./debug"
|
||||
import { ReviewPromptModalContent } from "./ReviewPromptModalContent"
|
||||
import { useDesktopReviewPromptState } from "./use-review-prompt-state"
|
||||
import {
|
||||
clearDesktopReviewPromptState,
|
||||
getDesktopReviewDebugTarget,
|
||||
openDesktopFeedbackEmail,
|
||||
openDesktopStoreReview,
|
||||
persistDesktopReviewOutcome,
|
||||
readDesktopReviewPromptState,
|
||||
REVIEW_PROMPT_QUIET_WINDOW_MS,
|
||||
} from "./utils"
|
||||
|
||||
const isPaidRole = (role: ReturnType<typeof useUserRole>) =>
|
||||
role === UserRole.Pro || role === UserRole.Plus
|
||||
|
||||
export const ReviewPromptProvider = () => {
|
||||
const { t } = useTranslation("settings")
|
||||
const location = useLocation()
|
||||
const { present } = useModalStack()
|
||||
const hasModal = useHasModal()
|
||||
const sheetStack = useAtomValue(sheetStackAtom)
|
||||
const feedSubscriptions = useAllFeedSubscription()
|
||||
const listSubscriptions = useAllListSubscription()
|
||||
const role = useUserRole()
|
||||
const isInMASReview = useIsInMASReview()
|
||||
|
||||
const {
|
||||
distribution,
|
||||
getLatestReviewState,
|
||||
platform,
|
||||
rateTarget,
|
||||
reviewState,
|
||||
storageKey,
|
||||
updateReviewState,
|
||||
userId,
|
||||
} = useDesktopReviewPromptState()
|
||||
|
||||
const hasAttemptedInSessionRef = useRef(false)
|
||||
const lastActionRef = useRef<"positive" | "negative" | null>(null)
|
||||
const roleRef = useRef(role)
|
||||
const subscriptionCountRef = useRef(feedSubscriptions.length + listSubscriptions.length)
|
||||
|
||||
subscriptionCountRef.current = feedSubscriptions.length + listSubscriptions.length
|
||||
|
||||
useEffect(() => {
|
||||
hasAttemptedInSessionRef.current = false
|
||||
}, [storageKey])
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId) {
|
||||
return
|
||||
}
|
||||
|
||||
const recordActiveDay = () => {
|
||||
updateReviewState((state) => recordReviewPromptActiveDay(state, new Date()))
|
||||
}
|
||||
|
||||
recordActiveDay()
|
||||
|
||||
const onVisibilityChange = () => {
|
||||
if (!document.hidden) {
|
||||
recordActiveDay()
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("focus", recordActiveDay)
|
||||
document.addEventListener("visibilitychange", onVisibilityChange)
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("focus", recordActiveDay)
|
||||
document.removeEventListener("visibilitychange", onVisibilityChange)
|
||||
}
|
||||
}, [updateReviewState, userId])
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId) {
|
||||
roleRef.current = role
|
||||
return
|
||||
}
|
||||
|
||||
if (isPaidRole(role) && !isPaidRole(roleRef.current)) {
|
||||
updateReviewState((state) => recordReviewPromptPaidConversion(state, new Date()))
|
||||
}
|
||||
|
||||
roleRef.current = role
|
||||
}, [role, updateReviewState, userId])
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId) {
|
||||
return
|
||||
}
|
||||
|
||||
updateReviewState((state) =>
|
||||
syncReviewPromptSubscriptionCount(state, subscriptionCountRef.current),
|
||||
)
|
||||
}, [feedSubscriptions.length, listSubscriptions.length, updateReviewState, userId])
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId) {
|
||||
return
|
||||
}
|
||||
|
||||
return trackManager.setTrackFn((code) => {
|
||||
switch (code) {
|
||||
case TrackerMapper.NavigateEntry: {
|
||||
updateReviewState((state) => recordReviewPromptEntryOpen(state))
|
||||
break
|
||||
}
|
||||
case TrackerMapper.Subscribe: {
|
||||
updateReviewState((state) =>
|
||||
recordReviewPromptSubscriptionAdded(state, subscriptionCountRef.current),
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.resolve()
|
||||
})
|
||||
}, [updateReviewState, userId])
|
||||
|
||||
const isRouteBlocked = useMemo(
|
||||
() => location.pathname.startsWith("/settings/plan"),
|
||||
[location.pathname],
|
||||
)
|
||||
const isInQuietWindow = !hasModal && sheetStack.length === 0 && !isRouteBlocked
|
||||
const isPlatformSupported = distribution !== "unsupported" && !isInMASReview
|
||||
const presentReviewPrompt = useMemo(
|
||||
() =>
|
||||
({
|
||||
score,
|
||||
source,
|
||||
target = rateTarget,
|
||||
}: {
|
||||
score?: number
|
||||
source: "auto" | "manual"
|
||||
target?: ReturnType<typeof getDesktopReviewDebugTarget>
|
||||
}) => {
|
||||
if (!target) {
|
||||
return
|
||||
}
|
||||
|
||||
lastActionRef.current = null
|
||||
tracker.reviewPromptShown({ distribution, platform, score, source })
|
||||
|
||||
present({
|
||||
canClose: true,
|
||||
clickOutsideToDismiss: true,
|
||||
id: "review-prompt-modal",
|
||||
onClose: () => {
|
||||
if (lastActionRef.current) {
|
||||
lastActionRef.current = null
|
||||
return
|
||||
}
|
||||
|
||||
persistDesktopReviewOutcome({
|
||||
appVersion: APP_VERSION,
|
||||
distribution,
|
||||
outcome: "dismissed",
|
||||
platform,
|
||||
source,
|
||||
state: readDesktopReviewPromptState(storageKey),
|
||||
storageKey,
|
||||
})
|
||||
},
|
||||
title: t("reviewPrompt.title"),
|
||||
content: ({ dismiss }) => (
|
||||
<ReviewPromptModalContent
|
||||
dismiss={dismiss}
|
||||
onNegative={() => {
|
||||
lastActionRef.current = "negative"
|
||||
persistDesktopReviewOutcome({
|
||||
appVersion: APP_VERSION,
|
||||
distribution,
|
||||
outcome: "negative_feedback",
|
||||
platform,
|
||||
source,
|
||||
state: readDesktopReviewPromptState(storageKey),
|
||||
storageKey,
|
||||
})
|
||||
void openDesktopFeedbackEmail({ distribution, userId })
|
||||
}}
|
||||
onPositive={() => {
|
||||
lastActionRef.current = "positive"
|
||||
persistDesktopReviewOutcome({
|
||||
appVersion: APP_VERSION,
|
||||
distribution,
|
||||
outcome: "positive_store_redirect",
|
||||
platform,
|
||||
score,
|
||||
source,
|
||||
state: readDesktopReviewPromptState(storageKey),
|
||||
storageKey,
|
||||
})
|
||||
void openDesktopStoreReview(target)
|
||||
}}
|
||||
/>
|
||||
),
|
||||
})
|
||||
},
|
||||
[distribution, platform, present, rateTarget, storageKey, t, userId],
|
||||
)
|
||||
const eligibility = useMemo(
|
||||
() =>
|
||||
getReviewPromptEligibility({
|
||||
appVersion: APP_VERSION,
|
||||
isLoggedIn: !!userId,
|
||||
isInQuietWindow,
|
||||
isPaidUser: isPaidRole(role),
|
||||
isPlatformSupported,
|
||||
now: new Date(),
|
||||
state: reviewState,
|
||||
}),
|
||||
[isInQuietWindow, isPlatformSupported, reviewState, role, userId],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (!storageKey) {
|
||||
setDesktopReviewPromptDebugAction(null)
|
||||
setDesktopReviewPromptResetAction(null)
|
||||
return
|
||||
}
|
||||
|
||||
setDesktopReviewPromptDebugAction(() => {
|
||||
presentReviewPrompt({
|
||||
source: "manual",
|
||||
score: undefined,
|
||||
target: getDesktopReviewDebugTarget(),
|
||||
})
|
||||
})
|
||||
setDesktopReviewPromptResetAction(() => {
|
||||
clearDesktopReviewPromptState(storageKey)
|
||||
hasAttemptedInSessionRef.current = false
|
||||
updateReviewState(() => readDesktopReviewPromptState(storageKey))
|
||||
})
|
||||
|
||||
return () => {
|
||||
setDesktopReviewPromptDebugAction(null)
|
||||
setDesktopReviewPromptResetAction(null)
|
||||
}
|
||||
}, [presentReviewPrompt, storageKey, updateReviewState])
|
||||
|
||||
useEffect(() => {
|
||||
const removeTrigger = DebugRegistry.add("Review Prompt", () => {
|
||||
presentReviewPrompt({
|
||||
source: "manual",
|
||||
score: undefined,
|
||||
target: getDesktopReviewDebugTarget(),
|
||||
})
|
||||
})
|
||||
const removeReset = DebugRegistry.add("Reset Review Prompt State", () => {
|
||||
if (!storageKey) {
|
||||
return
|
||||
}
|
||||
clearDesktopReviewPromptState(storageKey)
|
||||
hasAttemptedInSessionRef.current = false
|
||||
updateReviewState(() => readDesktopReviewPromptState(storageKey))
|
||||
})
|
||||
|
||||
return () => {
|
||||
removeTrigger()
|
||||
removeReset()
|
||||
}
|
||||
}, [presentReviewPrompt, storageKey, updateReviewState])
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId || hasAttemptedInSessionRef.current || !eligibility.allowed || !rateTarget) {
|
||||
return
|
||||
}
|
||||
|
||||
const timeoutId = window.setTimeout(() => {
|
||||
if (hasAttemptedInSessionRef.current) {
|
||||
return
|
||||
}
|
||||
|
||||
const latestState = readDesktopReviewPromptState(storageKey)
|
||||
const latestEligibility = getReviewPromptEligibility({
|
||||
appVersion: APP_VERSION,
|
||||
isLoggedIn: !!userId,
|
||||
isInQuietWindow: !hasModal && sheetStack.length === 0 && !isRouteBlocked,
|
||||
isPaidUser: isPaidRole(roleRef.current),
|
||||
isPlatformSupported: distribution !== "unsupported" && !isInMASReview,
|
||||
now: new Date(),
|
||||
state: latestState,
|
||||
})
|
||||
|
||||
if (!latestEligibility.allowed) {
|
||||
return
|
||||
}
|
||||
|
||||
hasAttemptedInSessionRef.current = true
|
||||
lastActionRef.current = null
|
||||
|
||||
tracker.reviewPromptEligible({
|
||||
distribution,
|
||||
platform,
|
||||
score: latestEligibility.score,
|
||||
source: "auto",
|
||||
})
|
||||
presentReviewPrompt({ source: "auto", score: latestEligibility.score })
|
||||
}, REVIEW_PROMPT_QUIET_WINDOW_MS)
|
||||
|
||||
return () => {
|
||||
window.clearTimeout(timeoutId)
|
||||
}
|
||||
}, [
|
||||
distribution,
|
||||
eligibility.allowed,
|
||||
getLatestReviewState,
|
||||
hasModal,
|
||||
isInMASReview,
|
||||
isRouteBlocked,
|
||||
platform,
|
||||
presentReviewPrompt,
|
||||
rateTarget,
|
||||
sheetStack.length,
|
||||
storageKey,
|
||||
userId,
|
||||
])
|
||||
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import type { ReviewPromptState } from "@follow/shared/review-prompt"
|
||||
import { normalizeReviewPromptState } from "@follow/shared/review-prompt"
|
||||
import { useWhoami } from "@follow/store/user/hooks"
|
||||
import { useCallback, useEffect, useMemo, useState } from "react"
|
||||
|
||||
import type { DesktopReviewDistribution } from "./utils"
|
||||
import {
|
||||
getDesktopReviewDistribution,
|
||||
getDesktopReviewPlatform,
|
||||
getDesktopReviewRateTarget,
|
||||
getDesktopReviewStorageKey,
|
||||
readDesktopReviewPromptState,
|
||||
writeDesktopReviewPromptState,
|
||||
} from "./utils"
|
||||
|
||||
export const useDesktopReviewPromptState = () => {
|
||||
const user = useWhoami()
|
||||
const distribution = getDesktopReviewDistribution()
|
||||
const platform = getDesktopReviewPlatform()
|
||||
const rateTarget = getDesktopReviewRateTarget()
|
||||
|
||||
const storageKey = useMemo(() => {
|
||||
if (!user?.id) {
|
||||
return null
|
||||
}
|
||||
|
||||
return getDesktopReviewStorageKey(user.id, distribution)
|
||||
}, [distribution, user?.id])
|
||||
|
||||
const [reviewState, setReviewState] = useState(() => readDesktopReviewPromptState(storageKey))
|
||||
|
||||
useEffect(() => {
|
||||
setReviewState(readDesktopReviewPromptState(storageKey))
|
||||
}, [storageKey])
|
||||
|
||||
const getLatestReviewState = useCallback(
|
||||
() => readDesktopReviewPromptState(storageKey),
|
||||
[storageKey],
|
||||
)
|
||||
|
||||
const updateReviewState = useCallback(
|
||||
(updater: (state: ReviewPromptState) => ReviewPromptState) => {
|
||||
const nextState = normalizeReviewPromptState(updater(getLatestReviewState()))
|
||||
writeDesktopReviewPromptState(storageKey, nextState)
|
||||
setReviewState(nextState)
|
||||
return nextState
|
||||
},
|
||||
[getLatestReviewState, storageKey],
|
||||
)
|
||||
|
||||
return {
|
||||
distribution: distribution as DesktopReviewDistribution,
|
||||
getLatestReviewState,
|
||||
platform,
|
||||
rateTarget,
|
||||
reviewState,
|
||||
storageKey,
|
||||
updateReviewState,
|
||||
userId: user?.id ?? null,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
import type { ReviewPromptOutcome, ReviewPromptState } from "@follow/shared/review-prompt"
|
||||
import {
|
||||
createReviewPromptState,
|
||||
normalizeReviewPromptState,
|
||||
recordReviewPromptOutcome,
|
||||
} from "@follow/shared/review-prompt"
|
||||
import { tracker } from "@follow/tracker"
|
||||
import { getStorageNS } from "@follow/utils/ns"
|
||||
|
||||
import { ipcServices } from "~/lib/client"
|
||||
|
||||
export const REVIEW_PROMPT_QUIET_WINDOW_MS = 5000
|
||||
|
||||
export type DesktopReviewDistribution = "mas" | "microsoft_store" | "unsupported"
|
||||
export type DesktopReviewRateTarget = "mas" | "microsoft_store" | null
|
||||
|
||||
const APPLE_REVIEW_URL =
|
||||
"https://apps.apple.com/us/app/folo-follow-everything/id6739802604?action=write-review"
|
||||
const MICROSOFT_PRODUCT_ID = "9NVFZPV0V0HT"
|
||||
const MICROSOFT_REVIEW_URI = `ms-windows-store://review/?ProductId=${MICROSOFT_PRODUCT_ID}`
|
||||
const MICROSOFT_REVIEW_URL = "https://apps.microsoft.com/detail/9nvfzpv0v0ht?mode=direct"
|
||||
const SUPPORT_EMAIL = "support@folo.is"
|
||||
const REVIEW_PROMPT_STORAGE_PREFIX = getStorageNS("review-prompt")
|
||||
|
||||
export const getDesktopReviewPlatform = () =>
|
||||
window.platform === "win32" ? "windows" : window.platform === "darwin" ? "macos" : "desktop"
|
||||
|
||||
export const getDesktopReviewDistribution = (): DesktopReviewDistribution => {
|
||||
if (typeof process !== "undefined" && process.mas) {
|
||||
return "mas"
|
||||
}
|
||||
|
||||
if (window.api?.isWindowsStore) {
|
||||
return "microsoft_store"
|
||||
}
|
||||
|
||||
return "unsupported"
|
||||
}
|
||||
|
||||
export const getDesktopReviewRateTarget = (): DesktopReviewRateTarget => {
|
||||
if (window.platform === "darwin") {
|
||||
return "mas"
|
||||
}
|
||||
|
||||
if (window.platform === "win32") {
|
||||
return "microsoft_store"
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export const getDesktopReviewDebugTarget = (): DesktopReviewRateTarget => {
|
||||
const defaultTarget = getDesktopReviewRateTarget()
|
||||
if (defaultTarget) {
|
||||
return defaultTarget
|
||||
}
|
||||
|
||||
return /Windows/i.test(window.navigator.userAgent) ? "microsoft_store" : "mas"
|
||||
}
|
||||
|
||||
export const getDesktopReviewStorageKey = (
|
||||
userId: string,
|
||||
distribution: DesktopReviewDistribution,
|
||||
) => `${REVIEW_PROMPT_STORAGE_PREFIX}:${distribution}:${userId}`
|
||||
|
||||
const openExternal = async (url: string) => {
|
||||
if (ipcServices?.app.openExternal) {
|
||||
await ipcServices.app.openExternal(url)
|
||||
return
|
||||
}
|
||||
|
||||
window.open(url, "_blank", "noopener,noreferrer")
|
||||
}
|
||||
|
||||
export const openDesktopStoreReview = async (target: DesktopReviewRateTarget) => {
|
||||
switch (target) {
|
||||
case "mas": {
|
||||
await openExternal(APPLE_REVIEW_URL)
|
||||
return
|
||||
}
|
||||
case "microsoft_store": {
|
||||
try {
|
||||
await openExternal(MICROSOFT_REVIEW_URI)
|
||||
} catch {
|
||||
await openExternal(MICROSOFT_REVIEW_URL)
|
||||
}
|
||||
return
|
||||
}
|
||||
default: {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const openDesktopFeedbackEmail = async ({
|
||||
distribution,
|
||||
userId,
|
||||
}: {
|
||||
distribution: DesktopReviewDistribution
|
||||
userId: string | null
|
||||
}) => {
|
||||
const subject = "Folo feedback"
|
||||
const body = [
|
||||
"Hi Folo team,",
|
||||
"",
|
||||
"Here is my feedback:",
|
||||
"",
|
||||
`Platform: ${getDesktopReviewPlatform()}`,
|
||||
`Distribution: ${distribution}`,
|
||||
`Version: ${APP_VERSION}`,
|
||||
`User ID: ${userId ?? "anonymous"}`,
|
||||
].join("\n")
|
||||
|
||||
await openExternal(
|
||||
`mailto:${SUPPORT_EMAIL}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`,
|
||||
)
|
||||
}
|
||||
|
||||
export const readDesktopReviewPromptState = (storageKey: string | null): ReviewPromptState => {
|
||||
if (!storageKey) {
|
||||
return createReviewPromptState()
|
||||
}
|
||||
|
||||
try {
|
||||
const raw = window.localStorage.getItem(storageKey)
|
||||
if (!raw) {
|
||||
return createReviewPromptState()
|
||||
}
|
||||
return normalizeReviewPromptState(JSON.parse(raw) as Partial<ReviewPromptState>)
|
||||
} catch {
|
||||
return createReviewPromptState()
|
||||
}
|
||||
}
|
||||
|
||||
export const writeDesktopReviewPromptState = (
|
||||
storageKey: string | null,
|
||||
state: ReviewPromptState,
|
||||
) => {
|
||||
if (!storageKey) {
|
||||
return
|
||||
}
|
||||
|
||||
window.localStorage.setItem(storageKey, JSON.stringify(state))
|
||||
}
|
||||
|
||||
export const clearDesktopReviewPromptState = (storageKey: string | null) => {
|
||||
if (!storageKey) {
|
||||
return
|
||||
}
|
||||
|
||||
window.localStorage.removeItem(storageKey)
|
||||
}
|
||||
|
||||
export const trackDesktopReviewOutcome = ({
|
||||
distribution,
|
||||
outcome,
|
||||
platform,
|
||||
score,
|
||||
source,
|
||||
}: {
|
||||
distribution: DesktopReviewDistribution
|
||||
outcome: ReviewPromptOutcome
|
||||
platform: string
|
||||
score?: number
|
||||
source: "auto" | "manual"
|
||||
}) => {
|
||||
switch (outcome) {
|
||||
case "dismissed": {
|
||||
tracker.reviewPromptDismissed({ distribution, platform, source })
|
||||
return
|
||||
}
|
||||
case "negative_feedback": {
|
||||
tracker.reviewPromptNegative({ distribution, platform, source })
|
||||
tracker.reviewPromptFeedbackOpened({ distribution, platform, source })
|
||||
return
|
||||
}
|
||||
case "positive_store_redirect": {
|
||||
tracker.reviewPromptPositive({ distribution, platform, source })
|
||||
tracker.reviewPromptStoreOpened({ distribution, platform, source })
|
||||
return
|
||||
}
|
||||
case "native_request": {
|
||||
tracker.reviewPromptNativeRequested({ distribution, platform, score, source })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const persistDesktopReviewOutcome = ({
|
||||
appVersion,
|
||||
distribution,
|
||||
outcome,
|
||||
platform,
|
||||
score,
|
||||
source,
|
||||
state,
|
||||
storageKey,
|
||||
}: {
|
||||
appVersion: string
|
||||
distribution: DesktopReviewDistribution
|
||||
outcome: ReviewPromptOutcome
|
||||
platform: string
|
||||
score?: number
|
||||
source: "auto" | "manual"
|
||||
state: ReviewPromptState
|
||||
storageKey: string | null
|
||||
}) => {
|
||||
const nextState = recordReviewPromptOutcome(state, outcome, new Date(), appVersion)
|
||||
writeDesktopReviewPromptState(storageKey, nextState)
|
||||
trackDesktopReviewOutcome({ distribution, outcome, platform, score, source })
|
||||
return nextState
|
||||
}
|
||||
@@ -17,12 +17,20 @@ import { ipcServices } from "~/lib/client"
|
||||
import { getNewIssueUrl } from "~/lib/issues"
|
||||
import { EnvironmentDebugModalContent } from "~/modules/app/EnvironmentIndicator"
|
||||
import { AppTipModalContent } from "~/modules/app-tip"
|
||||
import { useDesktopReviewPromptState } from "~/modules/review-prompt/use-review-prompt-state"
|
||||
import {
|
||||
openDesktopFeedbackEmail,
|
||||
openDesktopStoreReview,
|
||||
persistDesktopReviewOutcome,
|
||||
readDesktopReviewPromptState,
|
||||
} from "~/modules/review-prompt/utils"
|
||||
|
||||
export const SettingAbout = () => {
|
||||
const { t } = useTranslation("settings")
|
||||
const [isCheckingUpdate, setIsCheckingUpdate] = useState(false)
|
||||
const { present } = useModalStack()
|
||||
const currentEnvironment = getCurrentEnvironment().join("\n")
|
||||
const { distribution, platform, rateTarget, storageKey, userId } = useDesktopReviewPromptState()
|
||||
const { data: appVersion } = useQuery({
|
||||
queryKey: ["appVersion"],
|
||||
queryFn: () => ipcServices?.app.getAppVersion(),
|
||||
@@ -116,6 +124,36 @@ export const SettingAbout = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleRateFolo = async () => {
|
||||
if (!rateTarget) {
|
||||
return
|
||||
}
|
||||
|
||||
persistDesktopReviewOutcome({
|
||||
appVersion: APP_VERSION,
|
||||
distribution,
|
||||
outcome: "positive_store_redirect",
|
||||
platform,
|
||||
source: "manual",
|
||||
state: readDesktopReviewPromptState(storageKey),
|
||||
storageKey,
|
||||
})
|
||||
await openDesktopStoreReview(rateTarget)
|
||||
}
|
||||
|
||||
const handleSendFeedback = async () => {
|
||||
persistDesktopReviewOutcome({
|
||||
appVersion: APP_VERSION,
|
||||
distribution,
|
||||
outcome: "negative_feedback",
|
||||
platform,
|
||||
source: "manual",
|
||||
state: readDesktopReviewPromptState(storageKey),
|
||||
storageKey,
|
||||
})
|
||||
await openDesktopFeedbackEmail({ distribution, userId })
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mx-auto mt-6 max-w-3xl space-y-8">
|
||||
{/* Header Section */}
|
||||
@@ -214,6 +252,34 @@ export const SettingAbout = () => {
|
||||
</div>
|
||||
<i className="i-mingcute-sparkles-2-line text-base text-text-tertiary transition-all group-hover:-translate-y-0.5 group-hover:translate-x-0.5 group-hover:text-accent" />
|
||||
</button>
|
||||
{rateTarget && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
void handleRateFolo()
|
||||
}}
|
||||
className="group flex w-full items-center justify-between rounded-lg p-3 text-left transition-all hover:bg-fill-secondary hover:shadow-sm"
|
||||
>
|
||||
<div>
|
||||
<div className="text-sm font-medium">{t("about.rateFolo")}</div>
|
||||
<div className="text-xs text-text-tertiary">{t("about.rateFoloDescription")}</div>
|
||||
</div>
|
||||
<i className="i-mgc-star-cute-re text-base text-text-tertiary transition-all group-hover:-translate-y-0.5 group-hover:translate-x-0.5 group-hover:text-accent" />
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
void handleSendFeedback()
|
||||
}}
|
||||
className="group flex w-full items-center justify-between rounded-lg p-3 text-left transition-all hover:bg-fill-secondary hover:shadow-sm"
|
||||
>
|
||||
<div>
|
||||
<div className="text-sm font-medium">{t("about.sendFeedback")}</div>
|
||||
<div className="text-xs text-text-tertiary">{t("about.sendFeedbackDescription")}</div>
|
||||
</div>
|
||||
<i className="i-mgc-mail-cute-re text-base text-text-tertiary transition-all group-hover:-translate-y-0.5 group-hover:translate-x-0.5 group-hover:text-accent" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Legal Section */}
|
||||
|
||||
@@ -17,6 +17,7 @@ import { ModalStackProvider } from "~/components/ui/modal"
|
||||
import { jotaiStore } from "~/lib/jotai"
|
||||
import { persistConfig, queryClient } from "~/lib/query-client"
|
||||
import { FollowCommandManager } from "~/modules/command/command-manager"
|
||||
import { ReviewPromptProvider } from "~/modules/review-prompt/provider"
|
||||
|
||||
import { HotkeyProvider } from "./hotkey-provider"
|
||||
import { I18nProvider } from "./i18n-provider"
|
||||
@@ -51,6 +52,7 @@ export const RootProviders: FC<PropsWithChildren> = ({ children }) => (
|
||||
<StableRouterProvider />
|
||||
<SettingSync />
|
||||
<FollowCommandManager />
|
||||
<ReviewPromptProvider />
|
||||
|
||||
{import.meta.env.DEV && <Devtools />}
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
"expo-splash-screen": "31.0.13",
|
||||
"expo-sqlite": "16.0.10",
|
||||
"expo-status-bar": "3.0.9",
|
||||
"expo-store-review": "~9.0.9",
|
||||
"expo-symbols": "1.0.8",
|
||||
"expo-system-ui": "6.0.9",
|
||||
"expo-task-manager": "14.0.9",
|
||||
|
||||
@@ -13,6 +13,7 @@ import { useMessaging, useUpdateMessagingToken } from "./hooks/useMessaging"
|
||||
import { useOnboarding } from "./hooks/useOnboarding"
|
||||
import { useUnreadCountBadge } from "./hooks/useUnreadCountBadge"
|
||||
import { DebugButton, EnvProfileIndicator } from "./modules/debug"
|
||||
import { ReviewPromptProvider } from "./modules/review-prompt/provider"
|
||||
|
||||
export function App({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
@@ -62,5 +63,5 @@ const SideEffect = () => {
|
||||
usePrefetchActions()
|
||||
useUpdateMessagingToken()
|
||||
useMessaging()
|
||||
return null
|
||||
return <ReviewPromptProvider />
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import { atom } from "jotai"
|
||||
|
||||
export const dialogCountAtom = atom(0)
|
||||
@@ -20,6 +20,8 @@ import type { ImageProps } from "react-native-svg"
|
||||
import { useColor } from "react-native-uikit-colors"
|
||||
|
||||
import { Text } from "@/src/components/ui/typography/Text"
|
||||
import { dialogCountAtom } from "@/src/lib/dialog-state"
|
||||
import { jotaiStore } from "@/src/lib/jotai"
|
||||
|
||||
import { FullWindowOverlay } from "../components/common/FullWindowOverlay"
|
||||
import { Overlay } from "../components/ui/overlay/Overlay"
|
||||
@@ -220,10 +222,12 @@ class DialogStatic {
|
||||
</NavigationInstanceContext>,
|
||||
)
|
||||
this.currentStackedDialogs.add(props.id)
|
||||
jotaiStore.set(dialogCountAtom, this.currentStackedDialogs.size)
|
||||
return siblings
|
||||
}
|
||||
destroy(id: string, siblings: RootSiblings) {
|
||||
this.currentStackedDialogs.delete(id)
|
||||
jotaiStore.set(dialogCountAtom, this.currentStackedDialogs.size)
|
||||
siblings.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
let triggerReviewPromptDebug: (() => Promise<void>) | null = null
|
||||
let resetReviewPromptDebug: (() => void) | null = null
|
||||
|
||||
export const setMobileReviewPromptDebugAction = (callback: (() => Promise<void>) | null) => {
|
||||
triggerReviewPromptDebug = callback
|
||||
}
|
||||
|
||||
export const openMobileReviewPromptDebug = async () => {
|
||||
await triggerReviewPromptDebug?.()
|
||||
}
|
||||
|
||||
export const setMobileReviewPromptResetAction = (callback: (() => void) | null) => {
|
||||
resetReviewPromptDebug = callback
|
||||
}
|
||||
|
||||
export const resetMobileReviewPromptDebug = () => {
|
||||
resetReviewPromptDebug?.()
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
import { UserRole } from "@follow/constants"
|
||||
import {
|
||||
getReviewPromptEligibility,
|
||||
recordReviewPromptActiveDay,
|
||||
recordReviewPromptEntryOpen,
|
||||
recordReviewPromptPaidConversion,
|
||||
recordReviewPromptSubscriptionAdded,
|
||||
syncReviewPromptSubscriptionCount,
|
||||
} from "@follow/shared/review-prompt"
|
||||
import { useAllFeedSubscription, useAllListSubscription } from "@follow/store/subscription/hooks"
|
||||
import { useUserRole } from "@follow/store/user/hooks"
|
||||
import { tracker, TrackerMapper, trackManager } from "@follow/tracker"
|
||||
import { nativeApplicationVersion } from "expo-application"
|
||||
import { useAtomValue } from "jotai"
|
||||
import { useEffect, useMemo, useRef, useState } from "react"
|
||||
import type { AppStateStatus } from "react-native"
|
||||
import { AppState, InteractionManager } from "react-native"
|
||||
|
||||
import { dialogCountAtom } from "@/src/lib/dialog-state"
|
||||
import { Navigation } from "@/src/lib/navigation/Navigation"
|
||||
import { PlanScreen } from "@/src/modules/settings/routes/Plan"
|
||||
import { LoginScreen } from "@/src/screens/(modal)/LoginScreen"
|
||||
import { OnboardingScreen } from "@/src/screens/OnboardingScreen"
|
||||
|
||||
import { setMobileReviewPromptDebugAction, setMobileReviewPromptResetAction } from "./debug"
|
||||
import { useMobileReviewPromptState } from "./use-review-prompt-state"
|
||||
import {
|
||||
clearMobileReviewPromptState,
|
||||
isMobileNativeReviewAvailable,
|
||||
readMobileReviewPromptState,
|
||||
requestMobileNativeReview,
|
||||
REVIEW_PROMPT_QUIET_WINDOW_MS,
|
||||
writeMobileReviewPromptState,
|
||||
} from "./utils"
|
||||
|
||||
const { routesAtom } = Navigation.rootNavigation.__dangerous_getCtxValue()
|
||||
|
||||
export const ReviewPromptProvider = () => {
|
||||
const { currentState } = AppState
|
||||
const role = useUserRole()
|
||||
const routes = useAtomValue(routesAtom)
|
||||
const dialogCount = useAtomValue(dialogCountAtom)
|
||||
const feedSubscriptions = useAllFeedSubscription()
|
||||
const listSubscriptions = useAllListSubscription()
|
||||
|
||||
const {
|
||||
distribution,
|
||||
getLatestReviewState,
|
||||
platform,
|
||||
reviewState,
|
||||
storageKey,
|
||||
updateReviewState,
|
||||
userId,
|
||||
} = useMobileReviewPromptState()
|
||||
|
||||
const [appState, setAppState] = useState(currentState)
|
||||
const hasAttemptedInSessionRef = useRef(false)
|
||||
const isHandlingPromptRef = useRef(false)
|
||||
const roleRef = useRef(role)
|
||||
const subscriptionCountRef = useRef(feedSubscriptions.length + listSubscriptions.length)
|
||||
const appStateRef = useRef(appState)
|
||||
const dialogCountRef = useRef(dialogCount)
|
||||
const routesRef = useRef(routes)
|
||||
|
||||
subscriptionCountRef.current = feedSubscriptions.length + listSubscriptions.length
|
||||
appStateRef.current = appState
|
||||
dialogCountRef.current = dialogCount
|
||||
routesRef.current = routes
|
||||
|
||||
useEffect(() => {
|
||||
hasAttemptedInSessionRef.current = false
|
||||
isHandlingPromptRef.current = false
|
||||
}, [storageKey])
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId) {
|
||||
return
|
||||
}
|
||||
|
||||
const recordActiveDay = () => {
|
||||
updateReviewState((state) => recordReviewPromptActiveDay(state, new Date()))
|
||||
}
|
||||
|
||||
const handleAppStateChange = (nextAppState: AppStateStatus) => {
|
||||
setAppState(nextAppState)
|
||||
if (nextAppState === "active") {
|
||||
recordActiveDay()
|
||||
}
|
||||
}
|
||||
|
||||
recordActiveDay()
|
||||
|
||||
// React Native AppState subscriptions are cleaned up with subscription.remove().
|
||||
// eslint-disable-next-line @eslint-react/web-api/no-leaked-event-listener
|
||||
const subscription = AppState.addEventListener("change", handleAppStateChange)
|
||||
|
||||
return () => {
|
||||
subscription.remove()
|
||||
}
|
||||
}, [updateReviewState, userId])
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId) {
|
||||
roleRef.current = role
|
||||
return
|
||||
}
|
||||
|
||||
const wasPaidUser = roleRef.current === UserRole.Pro || roleRef.current === UserRole.Plus
|
||||
const isPaidUser = role === UserRole.Pro || role === UserRole.Plus
|
||||
if (isPaidUser && !wasPaidUser) {
|
||||
updateReviewState((state) => recordReviewPromptPaidConversion(state, new Date()))
|
||||
}
|
||||
|
||||
roleRef.current = role
|
||||
}, [role, updateReviewState, userId])
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId) {
|
||||
return
|
||||
}
|
||||
|
||||
updateReviewState((state) =>
|
||||
syncReviewPromptSubscriptionCount(state, subscriptionCountRef.current),
|
||||
)
|
||||
}, [feedSubscriptions.length, listSubscriptions.length, updateReviewState, userId])
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId) {
|
||||
return
|
||||
}
|
||||
|
||||
return trackManager.setTrackFn((code) => {
|
||||
switch (code) {
|
||||
case TrackerMapper.NavigateEntry: {
|
||||
updateReviewState((state) => recordReviewPromptEntryOpen(state))
|
||||
break
|
||||
}
|
||||
case TrackerMapper.Subscribe: {
|
||||
updateReviewState((state) =>
|
||||
recordReviewPromptSubscriptionAdded(state, subscriptionCountRef.current),
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.resolve()
|
||||
})
|
||||
}, [updateReviewState, userId])
|
||||
|
||||
const activeRoute = routes.at(-1) ?? null
|
||||
const hasPresentedRoute = routes.some((route) => route.type !== "push")
|
||||
const isBlockedRoute =
|
||||
activeRoute?.Component === LoginScreen ||
|
||||
activeRoute?.Component === OnboardingScreen ||
|
||||
activeRoute?.Component === PlanScreen
|
||||
|
||||
const isPaidUser = role === UserRole.Pro || role === UserRole.Plus
|
||||
const isInQuietWindow =
|
||||
appState === "active" && !hasPresentedRoute && dialogCount === 0 && !isBlockedRoute
|
||||
const isPlatformSupported = distribution !== "unsupported"
|
||||
|
||||
useEffect(() => {
|
||||
if (!storageKey) {
|
||||
setMobileReviewPromptDebugAction(null)
|
||||
setMobileReviewPromptResetAction(null)
|
||||
return
|
||||
}
|
||||
|
||||
setMobileReviewPromptDebugAction(async () => {
|
||||
const latestState = readMobileReviewPromptState(storageKey)
|
||||
if (!(await isMobileNativeReviewAvailable(distribution))) {
|
||||
return
|
||||
}
|
||||
|
||||
tracker.reviewPromptShown({ distribution, platform, source: "manual" })
|
||||
const nextState = await requestMobileNativeReview({
|
||||
appVersion: nativeApplicationVersion ?? "unknown",
|
||||
distribution,
|
||||
platform,
|
||||
source: "manual",
|
||||
state: latestState,
|
||||
storageKey,
|
||||
trackPositive: true,
|
||||
})
|
||||
writeMobileReviewPromptState(storageKey, nextState)
|
||||
updateReviewState(() => nextState)
|
||||
})
|
||||
setMobileReviewPromptResetAction(() => {
|
||||
clearMobileReviewPromptState(storageKey)
|
||||
hasAttemptedInSessionRef.current = false
|
||||
isHandlingPromptRef.current = false
|
||||
updateReviewState(() => readMobileReviewPromptState(storageKey))
|
||||
})
|
||||
|
||||
return () => {
|
||||
setMobileReviewPromptDebugAction(null)
|
||||
setMobileReviewPromptResetAction(null)
|
||||
}
|
||||
}, [distribution, platform, storageKey, updateReviewState])
|
||||
|
||||
const eligibility = useMemo(
|
||||
() =>
|
||||
getReviewPromptEligibility({
|
||||
appVersion: nativeApplicationVersion ?? "unknown",
|
||||
isLoggedIn: !!userId,
|
||||
isInQuietWindow,
|
||||
isPaidUser,
|
||||
isPlatformSupported,
|
||||
now: new Date(),
|
||||
state: reviewState,
|
||||
}),
|
||||
[isInQuietWindow, isPaidUser, isPlatformSupported, reviewState, userId],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
!userId ||
|
||||
hasAttemptedInSessionRef.current ||
|
||||
isHandlingPromptRef.current ||
|
||||
!eligibility.allowed
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const timeoutId = setTimeout(() => {
|
||||
if (hasAttemptedInSessionRef.current || isHandlingPromptRef.current) {
|
||||
return
|
||||
}
|
||||
|
||||
isHandlingPromptRef.current = true
|
||||
|
||||
void InteractionManager.runAfterInteractions(async () => {
|
||||
const latestState = getLatestReviewState()
|
||||
const latestEligibility = getReviewPromptEligibility({
|
||||
appVersion: nativeApplicationVersion ?? "unknown",
|
||||
isLoggedIn: !!userId,
|
||||
isInQuietWindow:
|
||||
appStateRef.current === "active" &&
|
||||
!routesRef.current.some((route) => route.type !== "push") &&
|
||||
dialogCountRef.current === 0 &&
|
||||
!isBlockedRoute,
|
||||
isPaidUser: roleRef.current === UserRole.Pro || roleRef.current === UserRole.Plus,
|
||||
isPlatformSupported: distribution !== "unsupported",
|
||||
now: new Date(),
|
||||
state: latestState,
|
||||
})
|
||||
|
||||
if (!latestEligibility.allowed) {
|
||||
isHandlingPromptRef.current = false
|
||||
return
|
||||
}
|
||||
|
||||
const nativeAvailable = await isMobileNativeReviewAvailable(distribution)
|
||||
if (!nativeAvailable) {
|
||||
isHandlingPromptRef.current = false
|
||||
return
|
||||
}
|
||||
|
||||
tracker.reviewPromptEligible({
|
||||
distribution,
|
||||
platform,
|
||||
score: latestEligibility.score,
|
||||
source: "auto",
|
||||
})
|
||||
tracker.reviewPromptShown({
|
||||
distribution,
|
||||
platform,
|
||||
score: latestEligibility.score,
|
||||
source: "auto",
|
||||
})
|
||||
|
||||
const nextState = await requestMobileNativeReview({
|
||||
appVersion: nativeApplicationVersion ?? "unknown",
|
||||
distribution,
|
||||
platform,
|
||||
score: latestEligibility.score,
|
||||
source: "auto",
|
||||
state: latestState,
|
||||
storageKey,
|
||||
})
|
||||
|
||||
updateReviewState(() => nextState)
|
||||
hasAttemptedInSessionRef.current = true
|
||||
isHandlingPromptRef.current = false
|
||||
})
|
||||
}, REVIEW_PROMPT_QUIET_WINDOW_MS)
|
||||
|
||||
return () => {
|
||||
clearTimeout(timeoutId)
|
||||
}
|
||||
}, [
|
||||
dialogCount,
|
||||
distribution,
|
||||
eligibility.allowed,
|
||||
getLatestReviewState,
|
||||
isBlockedRoute,
|
||||
platform,
|
||||
routes,
|
||||
storageKey,
|
||||
updateReviewState,
|
||||
userId,
|
||||
])
|
||||
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import type { ReviewPromptState } from "@follow/shared/review-prompt"
|
||||
import { normalizeReviewPromptState } from "@follow/shared/review-prompt"
|
||||
import { useWhoami } from "@follow/store/user/hooks"
|
||||
import { useCallback, useEffect, useMemo, useState } from "react"
|
||||
|
||||
import {
|
||||
getMobileReviewDistribution,
|
||||
getMobileReviewPlatform,
|
||||
getMobileReviewRateTarget,
|
||||
getMobileReviewStorageKey,
|
||||
readMobileReviewPromptState,
|
||||
writeMobileReviewPromptState,
|
||||
} from "./utils"
|
||||
|
||||
export const useMobileReviewPromptState = () => {
|
||||
const user = useWhoami()
|
||||
const distribution = getMobileReviewDistribution()
|
||||
const platform = getMobileReviewPlatform()
|
||||
const rateTarget = getMobileReviewRateTarget()
|
||||
|
||||
const storageKey = useMemo(() => {
|
||||
if (!user?.id) {
|
||||
return null
|
||||
}
|
||||
|
||||
return getMobileReviewStorageKey(user.id, distribution)
|
||||
}, [distribution, user?.id])
|
||||
|
||||
const [reviewState, setReviewState] = useState(() => readMobileReviewPromptState(storageKey))
|
||||
|
||||
useEffect(() => {
|
||||
setReviewState(readMobileReviewPromptState(storageKey))
|
||||
}, [storageKey])
|
||||
|
||||
const getLatestReviewState = useCallback(
|
||||
() => readMobileReviewPromptState(storageKey),
|
||||
[storageKey],
|
||||
)
|
||||
|
||||
const updateReviewState = useCallback(
|
||||
(updater: (state: ReviewPromptState) => ReviewPromptState) => {
|
||||
const nextState = normalizeReviewPromptState(updater(getLatestReviewState()))
|
||||
writeMobileReviewPromptState(storageKey, nextState)
|
||||
setReviewState(nextState)
|
||||
return nextState
|
||||
},
|
||||
[getLatestReviewState, storageKey],
|
||||
)
|
||||
|
||||
return {
|
||||
distribution,
|
||||
getLatestReviewState,
|
||||
platform,
|
||||
rateTarget,
|
||||
reviewState,
|
||||
storageKey,
|
||||
updateReviewState,
|
||||
userId: user?.id ?? null,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
import type { ReviewPromptState } from "@follow/shared/review-prompt"
|
||||
import { normalizeReviewPromptState, recordReviewPromptOutcome } from "@follow/shared/review-prompt"
|
||||
import { tracker } from "@follow/tracker"
|
||||
import { nativeApplicationVersion, nativeBuildVersion } from "expo-application"
|
||||
import * as StoreReview from "expo-store-review"
|
||||
import { Linking } from "react-native"
|
||||
|
||||
import { kv } from "@/src/lib/kv"
|
||||
import { isAndroidApkInstall } from "@/src/lib/payment"
|
||||
import { isAndroid, isIOS } from "@/src/lib/platform"
|
||||
|
||||
export const REVIEW_PROMPT_QUIET_WINDOW_MS = 5000
|
||||
|
||||
export type MobileReviewDistribution = "ios_app_store" | "google_play" | "unsupported"
|
||||
export type MobileReviewRateTarget = "ios_app_store" | "google_play" | null
|
||||
|
||||
const APPLE_REVIEW_URL =
|
||||
"https://apps.apple.com/us/app/folo-follow-everything/id6739802604?action=write-review"
|
||||
const GOOGLE_PLAY_REVIEW_URI = "market://details?id=is.follow&showAllReviews=true"
|
||||
const GOOGLE_PLAY_REVIEW_URL = "https://play.google.com/store/apps/details?id=is.follow"
|
||||
const SUPPORT_EMAIL = "support@folo.is"
|
||||
const REVIEW_PROMPT_STORAGE_PREFIX = "follow-rn-review-prompt"
|
||||
|
||||
export const getMobileReviewPlatform = () => (isIOS ? "ios" : isAndroid ? "android" : "mobile")
|
||||
|
||||
export const getMobileReviewDistribution = (): MobileReviewDistribution => {
|
||||
if (isIOS) {
|
||||
return "ios_app_store"
|
||||
}
|
||||
|
||||
if (isAndroid && !isAndroidApkInstall()) {
|
||||
return "google_play"
|
||||
}
|
||||
|
||||
return "unsupported"
|
||||
}
|
||||
|
||||
export const getMobileReviewRateTarget = (): MobileReviewRateTarget => {
|
||||
if (isIOS) {
|
||||
return "ios_app_store"
|
||||
}
|
||||
|
||||
if (isAndroid) {
|
||||
return "google_play"
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export const getMobileReviewStorageKey = (userId: string, distribution: MobileReviewDistribution) =>
|
||||
`${REVIEW_PROMPT_STORAGE_PREFIX}:${distribution}:${userId}`
|
||||
|
||||
export const readMobileReviewPromptState = (storageKey: string | null): ReviewPromptState => {
|
||||
if (!storageKey) {
|
||||
return normalizeReviewPromptState(null)
|
||||
}
|
||||
|
||||
try {
|
||||
const raw = kv.getSync(storageKey)
|
||||
if (!raw) {
|
||||
return normalizeReviewPromptState(null)
|
||||
}
|
||||
return normalizeReviewPromptState(JSON.parse(raw) as Partial<ReviewPromptState>)
|
||||
} catch {
|
||||
return normalizeReviewPromptState(null)
|
||||
}
|
||||
}
|
||||
|
||||
export const writeMobileReviewPromptState = (
|
||||
storageKey: string | null,
|
||||
state: ReviewPromptState,
|
||||
) => {
|
||||
if (!storageKey) {
|
||||
return
|
||||
}
|
||||
|
||||
kv.setSync(storageKey, JSON.stringify(state))
|
||||
}
|
||||
|
||||
export const clearMobileReviewPromptState = (storageKey: string | null) => {
|
||||
if (!storageKey) {
|
||||
return
|
||||
}
|
||||
|
||||
kv.delete(storageKey)
|
||||
}
|
||||
|
||||
const openStoreUrl = async (target: MobileReviewRateTarget) => {
|
||||
switch (target) {
|
||||
case "ios_app_store": {
|
||||
await Linking.openURL(APPLE_REVIEW_URL)
|
||||
return
|
||||
}
|
||||
case "google_play": {
|
||||
try {
|
||||
await Linking.openURL(GOOGLE_PLAY_REVIEW_URI)
|
||||
} catch {
|
||||
await Linking.openURL(GOOGLE_PLAY_REVIEW_URL)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const openMobileFeedbackEmail = async ({
|
||||
distribution,
|
||||
userId,
|
||||
}: {
|
||||
distribution: MobileReviewDistribution
|
||||
userId: string | null
|
||||
}) => {
|
||||
const subject = "Folo feedback"
|
||||
const body = [
|
||||
"Hi Folo team,",
|
||||
"",
|
||||
"Here is my feedback:",
|
||||
"",
|
||||
`Platform: ${getMobileReviewPlatform()}`,
|
||||
`Distribution: ${distribution}`,
|
||||
`Version: ${nativeApplicationVersion ?? "unknown"}`,
|
||||
`Build: ${nativeBuildVersion ?? "unknown"}`,
|
||||
`User ID: ${userId ?? "anonymous"}`,
|
||||
].join("\n")
|
||||
|
||||
await Linking.openURL(
|
||||
`mailto:${SUPPORT_EMAIL}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`,
|
||||
)
|
||||
}
|
||||
|
||||
export const isMobileNativeReviewAvailable = async (distribution: MobileReviewDistribution) => {
|
||||
if (distribution === "unsupported") {
|
||||
return false
|
||||
}
|
||||
|
||||
try {
|
||||
return await StoreReview.isAvailableAsync()
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export const requestMobileNativeReview = async ({
|
||||
appVersion,
|
||||
distribution,
|
||||
platform,
|
||||
score,
|
||||
source,
|
||||
state,
|
||||
storageKey,
|
||||
trackPositive = false,
|
||||
}: {
|
||||
appVersion: string
|
||||
distribution: MobileReviewDistribution
|
||||
platform: string
|
||||
score?: number
|
||||
source: "auto" | "manual"
|
||||
state: ReviewPromptState
|
||||
storageKey: string | null
|
||||
trackPositive?: boolean
|
||||
}) => {
|
||||
const nextState = recordReviewPromptOutcome(state, "native_request", new Date(), appVersion)
|
||||
writeMobileReviewPromptState(storageKey, nextState)
|
||||
|
||||
if (trackPositive) {
|
||||
tracker.reviewPromptPositive({ distribution, platform, source })
|
||||
}
|
||||
tracker.reviewPromptNativeRequested({ distribution, platform, score, source })
|
||||
await StoreReview.requestReview()
|
||||
return nextState
|
||||
}
|
||||
|
||||
export const openMobileStoreReview = async ({
|
||||
appVersion,
|
||||
distribution,
|
||||
platform,
|
||||
source,
|
||||
state,
|
||||
storageKey,
|
||||
target,
|
||||
}: {
|
||||
appVersion: string
|
||||
distribution: MobileReviewDistribution
|
||||
platform: string
|
||||
source: "auto" | "manual"
|
||||
state: ReviewPromptState
|
||||
storageKey: string | null
|
||||
target: MobileReviewRateTarget
|
||||
}) => {
|
||||
if (!target) {
|
||||
return null
|
||||
}
|
||||
|
||||
const nextState = recordReviewPromptOutcome(
|
||||
state,
|
||||
"positive_store_redirect",
|
||||
new Date(),
|
||||
appVersion,
|
||||
)
|
||||
writeMobileReviewPromptState(storageKey, nextState)
|
||||
|
||||
tracker.reviewPromptPositive({ distribution, platform, source })
|
||||
tracker.reviewPromptStoreOpened({ distribution, platform, source })
|
||||
await openStoreUrl(target)
|
||||
|
||||
return nextState
|
||||
}
|
||||
|
||||
export const persistMobileNegativeFeedback = ({
|
||||
appVersion,
|
||||
distribution,
|
||||
platform,
|
||||
source,
|
||||
state,
|
||||
storageKey,
|
||||
}: {
|
||||
appVersion: string
|
||||
distribution: MobileReviewDistribution
|
||||
platform: string
|
||||
source: "auto" | "manual"
|
||||
state: ReviewPromptState
|
||||
storageKey: string | null
|
||||
}) => {
|
||||
const nextState = recordReviewPromptOutcome(state, "negative_feedback", new Date(), appVersion)
|
||||
writeMobileReviewPromptState(storageKey, nextState)
|
||||
|
||||
tracker.reviewPromptNegative({ distribution, platform, source })
|
||||
tracker.reviewPromptFeedbackOpened({ distribution, platform, source })
|
||||
|
||||
return nextState
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
import {
|
||||
GroupedInsetListBaseCell,
|
||||
GroupedInsetListCard,
|
||||
GroupedInsetListCell,
|
||||
GroupedInsetListNavigationLink,
|
||||
GroupedInsetListNavigationLinkIcon,
|
||||
GroupedInsetListSectionHeader,
|
||||
@@ -19,6 +20,15 @@ import { Text } from "@/src/components/ui/typography/Text"
|
||||
import { DiscordCuteFiIcon } from "@/src/icons/discord_cute_fi"
|
||||
import { GithubCuteFiIcon } from "@/src/icons/github_cute_fi"
|
||||
import { SocialXCuteReIcon } from "@/src/icons/social_x_cute_re"
|
||||
import { useMobileReviewPromptState } from "@/src/modules/review-prompt/use-review-prompt-state"
|
||||
import {
|
||||
isMobileNativeReviewAvailable,
|
||||
openMobileFeedbackEmail,
|
||||
openMobileStoreReview,
|
||||
persistMobileNegativeFeedback,
|
||||
readMobileReviewPromptState,
|
||||
requestMobileNativeReview,
|
||||
} from "@/src/modules/review-prompt/utils"
|
||||
|
||||
const links = [
|
||||
{
|
||||
@@ -47,6 +57,47 @@ export const AboutScreen = () => {
|
||||
const { t } = useTranslation("settings")
|
||||
const buildId = nativeBuildVersion
|
||||
const appVersion = nativeApplicationVersion
|
||||
const { distribution, platform, rateTarget, storageKey, userId } = useMobileReviewPromptState()
|
||||
|
||||
const handleRateFolo = async () => {
|
||||
const latestState = readMobileReviewPromptState(storageKey)
|
||||
|
||||
if (await isMobileNativeReviewAvailable(distribution)) {
|
||||
await requestMobileNativeReview({
|
||||
appVersion: appVersion ?? "unknown",
|
||||
distribution,
|
||||
platform,
|
||||
source: "manual",
|
||||
state: latestState,
|
||||
storageKey,
|
||||
trackPositive: true,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await openMobileStoreReview({
|
||||
appVersion: appVersion ?? "unknown",
|
||||
distribution,
|
||||
platform,
|
||||
source: "manual",
|
||||
state: latestState,
|
||||
storageKey,
|
||||
target: rateTarget,
|
||||
})
|
||||
}
|
||||
|
||||
const handleSendFeedback = async () => {
|
||||
persistMobileNegativeFeedback({
|
||||
appVersion: appVersion ?? "unknown",
|
||||
distribution,
|
||||
platform,
|
||||
source: "manual",
|
||||
state: readMobileReviewPromptState(storageKey),
|
||||
storageKey,
|
||||
})
|
||||
await openMobileFeedbackEmail({ distribution, userId })
|
||||
}
|
||||
|
||||
return (
|
||||
<SafeNavigationScrollView
|
||||
Header={<NavigationBlurEffectHeaderView title={t("titles.about")} />}
|
||||
@@ -112,6 +163,24 @@ export const AboutScreen = () => {
|
||||
</GroupedInsetListBaseCell>
|
||||
</GroupedInsetListCard>
|
||||
|
||||
<GroupedInsetListSectionHeader label={t("about.support")} />
|
||||
<GroupedInsetListCard>
|
||||
<GroupedInsetListCell
|
||||
label={t("about.rateFolo")}
|
||||
description={t("about.rateFoloDescription")}
|
||||
onPress={() => {
|
||||
void handleRateFolo()
|
||||
}}
|
||||
/>
|
||||
<GroupedInsetListCell
|
||||
label={t("about.sendFeedback")}
|
||||
description={t("about.sendFeedbackDescription")}
|
||||
onPress={() => {
|
||||
void handleSendFeedback()
|
||||
}}
|
||||
/>
|
||||
</GroupedInsetListCard>
|
||||
|
||||
<GroupedInsetListSectionHeader label={t("about.socialMedia")} />
|
||||
<GroupedInsetListCard>
|
||||
{links.map((link) => (
|
||||
|
||||
@@ -31,6 +31,10 @@ import type { NavigationControllerView } from "@/src/lib/navigation/types"
|
||||
import { setEnvProfile, useEnvProfile } from "@/src/lib/proxy-env"
|
||||
import { toast } from "@/src/lib/toast"
|
||||
import { showUpgradeRequiredDialog } from "@/src/modules/dialogs/UpgradeRequiredDialog"
|
||||
import {
|
||||
openMobileReviewPromptDebug,
|
||||
resetMobileReviewPromptDebug,
|
||||
} from "@/src/modules/review-prompt/debug"
|
||||
|
||||
import { ProfileScreen } from "../(modal)/ProfileScreen"
|
||||
import { MarkdownScreen } from "./(debug)/markdown"
|
||||
@@ -184,6 +188,19 @@ export const DebugScreen: NavigationControllerView = () => {
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Trigger Review Prompt",
|
||||
onPress: async () => {
|
||||
await openMobileReviewPromptDebug()
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Reset Review Prompt State",
|
||||
onPress: () => {
|
||||
resetMobileReviewPromptDebug()
|
||||
Alert.alert("Review prompt state reset")
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -16,9 +16,14 @@
|
||||
"about.noUpdateAvailable": "You're on the latest version",
|
||||
"about.privacyPolicy": "Privacy Policy",
|
||||
"about.projectLicense": "{{appName}} is licensed under the GNU Affero General Public License version 3 with additional exceptions.",
|
||||
"about.rateFolo": "Rate Folo",
|
||||
"about.rateFoloDescription": "Leave a rating to support the product.",
|
||||
"about.resources": "Resources & Contributions",
|
||||
"about.sendFeedback": "Send Feedback",
|
||||
"about.sendFeedbackDescription": "Tell us what you would like improved.",
|
||||
"about.sidebar_title": "About",
|
||||
"about.socialMedia": "Social Media",
|
||||
"about.support": "Support",
|
||||
"about.termsOfService": "Terms of Service",
|
||||
"about.updateAvailable": "Update available!",
|
||||
"about.updateCheckFailed": "Failed to check for updates",
|
||||
@@ -683,6 +688,10 @@
|
||||
"referral.pro_status.preview": "Your Pro Preview Status: Expires {{dateString}} ({{daysLeft}} days left)",
|
||||
"referral.pro_status.trial": "Your Current Tier: Free",
|
||||
"referral.pro_status.user": "Your Pro Preview Status: Active",
|
||||
"reviewPrompt.description": "If Folo has been helpful, leaving a rating really helps. If not, tell us what we can improve.",
|
||||
"reviewPrompt.loveIt": "Yes, I like it",
|
||||
"reviewPrompt.notReally": "Not really",
|
||||
"reviewPrompt.title": "Enjoying Folo?",
|
||||
"rsshub.addModal.access_key_label": "Access Key (Optional)",
|
||||
"rsshub.addModal.add": "Add",
|
||||
"rsshub.addModal.base_url_label": "Base URL",
|
||||
|
||||
@@ -16,9 +16,14 @@
|
||||
"about.noUpdateAvailable": "Vous avez la dernière version",
|
||||
"about.privacyPolicy": "Politique de confidentialité",
|
||||
"about.projectLicense": "{{appName}} est sous licence GNU General Public License version 3 avec des exceptions supplémentaires.",
|
||||
"about.rateFolo": "Noter Folo",
|
||||
"about.rateFoloDescription": "Laissez une note pour soutenir le produit.",
|
||||
"about.resources": "Ressources & Contributions",
|
||||
"about.sendFeedback": "Envoyer un retour",
|
||||
"about.sendFeedbackDescription": "Dites-nous ce qui pourrait être amélioré.",
|
||||
"about.sidebar_title": "À propos",
|
||||
"about.socialMedia": "Réseaux sociaux",
|
||||
"about.support": "Support",
|
||||
"about.termsOfService": "Conditions d'utilisation",
|
||||
"about.updateAvailable": "Mise à jour disponible !",
|
||||
"about.updateCheckFailed": "Échec de la vérification des mises à jour",
|
||||
@@ -683,6 +688,10 @@
|
||||
"referral.pro_status.preview": "Votre statut Aperçu Pro : Expire le {{dateString}} ({{daysLeft}} jours restants)",
|
||||
"referral.pro_status.trial": "Votre niveau actuel : Gratuit",
|
||||
"referral.pro_status.user": "Votre statut Aperçu Pro : Actif",
|
||||
"reviewPrompt.description": "Si Folo vous aide, une note dans le store nous aide beaucoup. Sinon, dites-nous ce que nous devons améliorer.",
|
||||
"reviewPrompt.loveIt": "Oui, j'aime bien",
|
||||
"reviewPrompt.notReally": "Pas vraiment",
|
||||
"reviewPrompt.title": "Vous aimez Folo ?",
|
||||
"rsshub.addModal.access_key_label": "Clé d'accès (Optionnel)",
|
||||
"rsshub.addModal.add": "Ajouter",
|
||||
"rsshub.addModal.base_url_label": "URL de base",
|
||||
|
||||
@@ -16,9 +16,14 @@
|
||||
"about.noUpdateAvailable": "最新版を使用しています",
|
||||
"about.privacyPolicy": "プライバシーポリシー",
|
||||
"about.projectLicense": "{{appName}} は GNU Affero General Public License バージョン3に追加の例外条項を加えたライセンスで提供されています。",
|
||||
"about.rateFolo": "Folo を評価",
|
||||
"about.rateFoloDescription": "評価を残してプロダクトを応援してください。",
|
||||
"about.resources": "リソースと貢献",
|
||||
"about.sendFeedback": "フィードバックを送る",
|
||||
"about.sendFeedbackDescription": "改善してほしい点を教えてください。",
|
||||
"about.sidebar_title": "About",
|
||||
"about.socialMedia": "ソーシャルメディア",
|
||||
"about.support": "サポート",
|
||||
"about.termsOfService": "利用規約",
|
||||
"about.updateAvailable": "アップデートがあります!",
|
||||
"about.updateCheckFailed": "アップデートの確認に失敗しました",
|
||||
@@ -683,6 +688,10 @@
|
||||
"referral.pro_status.preview": "あなたの Pro Preview ステータス: {{dateString}} まで有効 (残り {{daysLeft}} 日)",
|
||||
"referral.pro_status.trial": "あなたの現在のティア: 無料",
|
||||
"referral.pro_status.user": "あなたの Pro Preview ステータス: アクティブ",
|
||||
"reviewPrompt.description": "Folo が役に立っているなら、ストアでの評価をお願いします。まだ不満があれば、改善点を教えてください。",
|
||||
"reviewPrompt.loveIt": "気に入っています",
|
||||
"reviewPrompt.notReally": "まだ微妙です",
|
||||
"reviewPrompt.title": "Folo を気に入っていますか?",
|
||||
"rsshub.addModal.access_key_label": "アクセスキー (オプション)",
|
||||
"rsshub.addModal.add": "追加",
|
||||
"rsshub.addModal.base_url_label": "Base URL",
|
||||
|
||||
@@ -16,9 +16,14 @@
|
||||
"about.noUpdateAvailable": "已是最新版本",
|
||||
"about.privacyPolicy": "隐私政策",
|
||||
"about.projectLicense": "{{appName}} 采用 GNU Affero 通用公共许可证第3版授权,并附有额外的例外条款。",
|
||||
"about.rateFolo": "给 Folo 评分",
|
||||
"about.rateFoloDescription": "留下评分,支持产品继续发展。",
|
||||
"about.resources": "资源与贡献",
|
||||
"about.sendFeedback": "发送反馈",
|
||||
"about.sendFeedbackDescription": "告诉我们哪些地方还可以改进。",
|
||||
"about.sidebar_title": "关于",
|
||||
"about.socialMedia": "社交媒体",
|
||||
"about.support": "支持与反馈",
|
||||
"about.termsOfService": "服务条款",
|
||||
"about.updateAvailable": "有可用更新!",
|
||||
"about.updateCheckFailed": "检查更新失败",
|
||||
@@ -683,6 +688,10 @@
|
||||
"referral.pro_status.preview": "你的专业版试用状态:将于 {{dateString}} 到期(剩余 {{daysLeft}} 天)",
|
||||
"referral.pro_status.trial": "当前等级:免费版",
|
||||
"referral.pro_status.user": "你的专业版试用状态:活跃中",
|
||||
"reviewPrompt.description": "如果 Folo 对你有帮助,欢迎给我们一个评分;如果还不够好,也欢迎告诉我们哪里需要改进。",
|
||||
"reviewPrompt.loveIt": "喜欢",
|
||||
"reviewPrompt.notReally": "还不太满意",
|
||||
"reviewPrompt.title": "你喜欢 Folo 吗?",
|
||||
"rsshub.addModal.access_key_label": "访问密钥(可选)",
|
||||
"rsshub.addModal.add": "添加",
|
||||
"rsshub.addModal.base_url_label": "根 URL",
|
||||
|
||||
@@ -16,9 +16,14 @@
|
||||
"about.noUpdateAvailable": "已是最新版本",
|
||||
"about.privacyPolicy": "隱私政策",
|
||||
"about.projectLicense": "{{appName}} 採用 GNU Affero 通用公共授權條款第3版授權,並附有額外的例外條款。",
|
||||
"about.rateFolo": "為 Folo 評分",
|
||||
"about.rateFoloDescription": "留下評分,支持產品持續發展。",
|
||||
"about.resources": "資源與貢獻",
|
||||
"about.sendFeedback": "傳送回饋",
|
||||
"about.sendFeedbackDescription": "告訴我們哪些地方還可以改進。",
|
||||
"about.sidebar_title": "關於",
|
||||
"about.socialMedia": "社群媒體",
|
||||
"about.support": "支援與回饋",
|
||||
"about.termsOfService": "服務條款",
|
||||
"about.updateAvailable": "有可用更新!",
|
||||
"about.updateCheckFailed": "檢查更新失敗",
|
||||
@@ -683,6 +688,10 @@
|
||||
"referral.pro_status.preview": "你的專業版預覽狀態:將於 {{dateString}} 到期(剩餘 {{daysLeft}} 天)",
|
||||
"referral.pro_status.trial": "你目前的方案:免費",
|
||||
"referral.pro_status.user": "你的專業版預覽狀態:啟用中",
|
||||
"reviewPrompt.description": "如果 Folo 對你有幫助,歡迎到商店留下評分;如果還不夠好,也歡迎告訴我們哪裡需要改進。",
|
||||
"reviewPrompt.loveIt": "喜歡",
|
||||
"reviewPrompt.notReally": "還不太滿意",
|
||||
"reviewPrompt.title": "你喜歡 Folo 嗎?",
|
||||
"rsshub.addModal.access_key_label": "存取金鑰(選填)",
|
||||
"rsshub.addModal.add": "新增",
|
||||
"rsshub.addModal.base_url_label": "基礎 URL",
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
import { describe, expect, it } from "vitest"
|
||||
|
||||
import {
|
||||
createReviewPromptState,
|
||||
getReviewPromptEligibility,
|
||||
getReviewPromptScore,
|
||||
recordReviewPromptActiveDay,
|
||||
recordReviewPromptEntryOpen,
|
||||
recordReviewPromptOutcome,
|
||||
recordReviewPromptSubscriptionAdded,
|
||||
syncReviewPromptSubscriptionCount,
|
||||
} from "./review-prompt"
|
||||
|
||||
describe("review prompt scoring", () => {
|
||||
it("allows auto prompt with 2 active days, 3 entry opens, and 1 subscription add", () => {
|
||||
const now = new Date("2026-03-11T00:00:00.000Z")
|
||||
let state = createReviewPromptState()
|
||||
|
||||
state = recordReviewPromptActiveDay(state, new Date("2026-03-10T00:00:00.000Z"), "2026-03-10")
|
||||
state = recordReviewPromptActiveDay(state, now, "2026-03-11")
|
||||
state = recordReviewPromptEntryOpen(state)
|
||||
state = recordReviewPromptEntryOpen(state)
|
||||
state = recordReviewPromptEntryOpen(state)
|
||||
state = recordReviewPromptSubscriptionAdded(state, 1)
|
||||
|
||||
expect(getReviewPromptScore(state, false)).toBe(3)
|
||||
expect(
|
||||
getReviewPromptEligibility({
|
||||
appVersion: "1.0.0",
|
||||
isLoggedIn: true,
|
||||
isInQuietWindow: true,
|
||||
isPaidUser: false,
|
||||
isPlatformSupported: true,
|
||||
now,
|
||||
state,
|
||||
}).allowed,
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it("adds an extra point when entry open count reaches 5", () => {
|
||||
let state = createReviewPromptState()
|
||||
|
||||
for (let index = 0; index < 5; index += 1) {
|
||||
state = recordReviewPromptEntryOpen(state)
|
||||
}
|
||||
|
||||
expect(getReviewPromptScore(state, false)).toBe(2)
|
||||
})
|
||||
|
||||
it("does not allow auto prompt with only 2 active days and 3 entry opens", () => {
|
||||
const now = new Date("2026-03-11T00:00:00.000Z")
|
||||
let state = createReviewPromptState()
|
||||
|
||||
state = recordReviewPromptActiveDay(state, new Date("2026-03-10T00:00:00.000Z"), "2026-03-10")
|
||||
state = recordReviewPromptActiveDay(state, now, "2026-03-11")
|
||||
state = recordReviewPromptEntryOpen(state)
|
||||
state = recordReviewPromptEntryOpen(state)
|
||||
state = recordReviewPromptEntryOpen(state)
|
||||
|
||||
const result = getReviewPromptEligibility({
|
||||
appVersion: "1.0.0",
|
||||
isLoggedIn: true,
|
||||
isInQuietWindow: true,
|
||||
isPaidUser: false,
|
||||
isPlatformSupported: true,
|
||||
now,
|
||||
state,
|
||||
})
|
||||
|
||||
expect(result.allowed).toBe(false)
|
||||
expect(result.blockedBy).toBe("score_too_low")
|
||||
})
|
||||
|
||||
it("allows paid users even when other signals are low", () => {
|
||||
const result = getReviewPromptEligibility({
|
||||
appVersion: "1.0.0",
|
||||
isLoggedIn: true,
|
||||
isInQuietWindow: true,
|
||||
isPaidUser: true,
|
||||
isPlatformSupported: true,
|
||||
now: new Date("2026-03-11T00:00:00.000Z"),
|
||||
state: createReviewPromptState(),
|
||||
})
|
||||
|
||||
expect(result.allowed).toBe(true)
|
||||
expect(result.score).toBe(3)
|
||||
})
|
||||
})
|
||||
|
||||
describe("review prompt cooldowns", () => {
|
||||
it("blocks the same version after dismissal", () => {
|
||||
const now = new Date("2026-03-11T00:00:00.000Z")
|
||||
const state = recordReviewPromptOutcome(createReviewPromptState(), "dismissed", now, "1.0.0")
|
||||
|
||||
const result = getReviewPromptEligibility({
|
||||
appVersion: "1.0.0",
|
||||
isLoggedIn: true,
|
||||
isInQuietWindow: true,
|
||||
isPaidUser: true,
|
||||
isPlatformSupported: true,
|
||||
now,
|
||||
state,
|
||||
})
|
||||
|
||||
expect(result.allowed).toBe(false)
|
||||
expect(result.blockedBy).toBe("already_prompted_in_version")
|
||||
})
|
||||
|
||||
it("keeps negative feedback in cooldown on later versions", () => {
|
||||
const state = recordReviewPromptOutcome(
|
||||
createReviewPromptState(),
|
||||
"negative_feedback",
|
||||
new Date("2026-03-01T00:00:00.000Z"),
|
||||
"1.0.0",
|
||||
)
|
||||
|
||||
const result = getReviewPromptEligibility({
|
||||
appVersion: "1.0.1",
|
||||
isLoggedIn: true,
|
||||
isInQuietWindow: true,
|
||||
isPaidUser: true,
|
||||
isPlatformSupported: true,
|
||||
now: new Date("2026-03-11T00:00:00.000Z"),
|
||||
state,
|
||||
})
|
||||
|
||||
expect(result.allowed).toBe(false)
|
||||
expect(result.blockedBy).toBe("cooldown_active")
|
||||
})
|
||||
|
||||
it("permanently disables auto prompt after native request", () => {
|
||||
const state = recordReviewPromptOutcome(
|
||||
createReviewPromptState(),
|
||||
"native_request",
|
||||
new Date("2026-03-01T00:00:00.000Z"),
|
||||
"1.0.0",
|
||||
)
|
||||
|
||||
const result = getReviewPromptEligibility({
|
||||
appVersion: "1.0.1",
|
||||
isLoggedIn: true,
|
||||
isInQuietWindow: true,
|
||||
isPaidUser: true,
|
||||
isPlatformSupported: true,
|
||||
now: new Date("2026-03-11T00:00:00.000Z"),
|
||||
state,
|
||||
})
|
||||
|
||||
expect(result.allowed).toBe(false)
|
||||
expect(result.blockedBy).toBe("auto_prompt_disabled")
|
||||
})
|
||||
|
||||
it("syncs subscription count without affecting other signals", () => {
|
||||
const state = syncReviewPromptSubscriptionCount(createReviewPromptState(), 5)
|
||||
|
||||
expect(state.lastKnownSubscriptionCount).toBe(5)
|
||||
expect(state.subscriptionAddCount).toBe(0)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,249 @@
|
||||
const DAY_IN_MS = 24 * 60 * 60 * 1000
|
||||
|
||||
export type ReviewPromptOutcome =
|
||||
| "dismissed"
|
||||
| "negative_feedback"
|
||||
| "positive_store_redirect"
|
||||
| "native_request"
|
||||
|
||||
export interface ReviewPromptState {
|
||||
firstSeenAt: string | null
|
||||
lastActiveDate: string | null
|
||||
activeDaysCount: number
|
||||
entryOpenCount: number
|
||||
subscriptionAddCount: number
|
||||
lastKnownSubscriptionCount: number
|
||||
paidConversionAt: string | null
|
||||
lastPromptAt: string | null
|
||||
lastPromptVersion: string | null
|
||||
lastOutcome: ReviewPromptOutcome | null
|
||||
autoPromptDisabled: boolean
|
||||
}
|
||||
|
||||
export interface ReviewPromptEligibilityInput {
|
||||
appVersion: string
|
||||
isLoggedIn: boolean
|
||||
isInQuietWindow: boolean
|
||||
isPaidUser: boolean
|
||||
isPlatformSupported: boolean
|
||||
now: Date
|
||||
state: ReviewPromptState
|
||||
}
|
||||
|
||||
export interface ReviewPromptEligibilityResult {
|
||||
allowed: boolean
|
||||
blockedBy: string | null
|
||||
cooldownUntil: string | null
|
||||
score: number
|
||||
}
|
||||
|
||||
export const getReviewPromptDayKey = (date: Date) => {
|
||||
const year = date.getFullYear()
|
||||
const month = `${date.getMonth() + 1}`.padStart(2, "0")
|
||||
const day = `${date.getDate()}`.padStart(2, "0")
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
export const createReviewPromptState = (): ReviewPromptState => ({
|
||||
firstSeenAt: null,
|
||||
lastActiveDate: null,
|
||||
activeDaysCount: 0,
|
||||
entryOpenCount: 0,
|
||||
subscriptionAddCount: 0,
|
||||
lastKnownSubscriptionCount: 0,
|
||||
paidConversionAt: null,
|
||||
lastPromptAt: null,
|
||||
lastPromptVersion: null,
|
||||
lastOutcome: null,
|
||||
autoPromptDisabled: false,
|
||||
})
|
||||
|
||||
export const normalizeReviewPromptState = (
|
||||
value: Partial<ReviewPromptState> | null | undefined,
|
||||
): ReviewPromptState => ({
|
||||
...createReviewPromptState(),
|
||||
...value,
|
||||
})
|
||||
|
||||
export const recordReviewPromptActiveDay = (
|
||||
state: ReviewPromptState,
|
||||
now: Date,
|
||||
dayKey = getReviewPromptDayKey(now),
|
||||
): ReviewPromptState => {
|
||||
const nextState = normalizeReviewPromptState(state)
|
||||
|
||||
if (!nextState.firstSeenAt) {
|
||||
nextState.firstSeenAt = now.toISOString()
|
||||
}
|
||||
|
||||
if (nextState.lastActiveDate !== dayKey) {
|
||||
nextState.activeDaysCount += 1
|
||||
nextState.lastActiveDate = dayKey
|
||||
}
|
||||
|
||||
return nextState
|
||||
}
|
||||
|
||||
export const recordReviewPromptEntryOpen = (state: ReviewPromptState): ReviewPromptState => ({
|
||||
...normalizeReviewPromptState(state),
|
||||
entryOpenCount: normalizeReviewPromptState(state).entryOpenCount + 1,
|
||||
})
|
||||
|
||||
export const recordReviewPromptSubscriptionAdded = (
|
||||
state: ReviewPromptState,
|
||||
lastKnownSubscriptionCount?: number,
|
||||
): ReviewPromptState => ({
|
||||
...normalizeReviewPromptState(state),
|
||||
subscriptionAddCount: normalizeReviewPromptState(state).subscriptionAddCount + 1,
|
||||
lastKnownSubscriptionCount:
|
||||
typeof lastKnownSubscriptionCount === "number"
|
||||
? lastKnownSubscriptionCount
|
||||
: normalizeReviewPromptState(state).lastKnownSubscriptionCount,
|
||||
})
|
||||
|
||||
export const syncReviewPromptSubscriptionCount = (
|
||||
state: ReviewPromptState,
|
||||
lastKnownSubscriptionCount: number,
|
||||
): ReviewPromptState => ({
|
||||
...normalizeReviewPromptState(state),
|
||||
lastKnownSubscriptionCount,
|
||||
})
|
||||
|
||||
export const recordReviewPromptPaidConversion = (
|
||||
state: ReviewPromptState,
|
||||
now: Date,
|
||||
): ReviewPromptState => {
|
||||
const nextState = normalizeReviewPromptState(state)
|
||||
|
||||
if (!nextState.paidConversionAt) {
|
||||
nextState.paidConversionAt = now.toISOString()
|
||||
}
|
||||
|
||||
return nextState
|
||||
}
|
||||
|
||||
export const recordReviewPromptOutcome = (
|
||||
state: ReviewPromptState,
|
||||
outcome: ReviewPromptOutcome,
|
||||
now: Date,
|
||||
appVersion: string,
|
||||
): ReviewPromptState => ({
|
||||
...normalizeReviewPromptState(state),
|
||||
autoPromptDisabled:
|
||||
outcome === "native_request" || outcome === "positive_store_redirect"
|
||||
? true
|
||||
: normalizeReviewPromptState(state).autoPromptDisabled,
|
||||
lastOutcome: outcome,
|
||||
lastPromptAt: now.toISOString(),
|
||||
lastPromptVersion: appVersion,
|
||||
})
|
||||
|
||||
export const getReviewPromptScore = (state: ReviewPromptState, isPaidUser: boolean) => {
|
||||
const nextState = normalizeReviewPromptState(state)
|
||||
|
||||
let score = 0
|
||||
|
||||
if (nextState.activeDaysCount >= 2) {
|
||||
score += 1
|
||||
}
|
||||
|
||||
if (nextState.entryOpenCount >= 3) {
|
||||
score += 1
|
||||
}
|
||||
|
||||
if (nextState.entryOpenCount >= 5) {
|
||||
score += 1
|
||||
}
|
||||
|
||||
if (nextState.subscriptionAddCount >= 1) {
|
||||
score += 1
|
||||
}
|
||||
|
||||
if (nextState.lastKnownSubscriptionCount >= 3) {
|
||||
score += 1
|
||||
}
|
||||
|
||||
if (nextState.lastKnownSubscriptionCount >= 5) {
|
||||
score += 1
|
||||
}
|
||||
|
||||
if (isPaidUser) {
|
||||
score += 3
|
||||
}
|
||||
|
||||
return score
|
||||
}
|
||||
|
||||
const getCooldownDays = (outcome: ReviewPromptOutcome | null) => {
|
||||
switch (outcome) {
|
||||
case "dismissed": {
|
||||
return 120
|
||||
}
|
||||
case "negative_feedback": {
|
||||
return 180
|
||||
}
|
||||
default: {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const getReviewPromptCooldownUntil = (state: ReviewPromptState) => {
|
||||
const nextState = normalizeReviewPromptState(state)
|
||||
const cooldownDays = getCooldownDays(nextState.lastOutcome)
|
||||
|
||||
if (!cooldownDays || !nextState.lastPromptAt) {
|
||||
return null
|
||||
}
|
||||
|
||||
const lastPromptAt = new Date(nextState.lastPromptAt)
|
||||
if (Number.isNaN(lastPromptAt.getTime())) {
|
||||
return null
|
||||
}
|
||||
|
||||
return new Date(lastPromptAt.getTime() + cooldownDays * DAY_IN_MS)
|
||||
}
|
||||
|
||||
export const getReviewPromptEligibility = (
|
||||
input: ReviewPromptEligibilityInput,
|
||||
): ReviewPromptEligibilityResult => {
|
||||
const { appVersion, isLoggedIn, isInQuietWindow, isPaidUser, isPlatformSupported, now } = input
|
||||
const state = normalizeReviewPromptState(input.state)
|
||||
const score = getReviewPromptScore(state, isPaidUser)
|
||||
|
||||
if (!isLoggedIn) {
|
||||
return { allowed: false, blockedBy: "logged_out", cooldownUntil: null, score }
|
||||
}
|
||||
|
||||
if (!isPlatformSupported) {
|
||||
return { allowed: false, blockedBy: "unsupported_platform", cooldownUntil: null, score }
|
||||
}
|
||||
|
||||
if (!isInQuietWindow) {
|
||||
return { allowed: false, blockedBy: "not_quiet", cooldownUntil: null, score }
|
||||
}
|
||||
|
||||
if (state.autoPromptDisabled) {
|
||||
return { allowed: false, blockedBy: "auto_prompt_disabled", cooldownUntil: null, score }
|
||||
}
|
||||
|
||||
if (state.lastPromptVersion === appVersion) {
|
||||
return { allowed: false, blockedBy: "already_prompted_in_version", cooldownUntil: null, score }
|
||||
}
|
||||
|
||||
const cooldownUntil = getReviewPromptCooldownUntil(state)
|
||||
if (cooldownUntil && cooldownUntil.getTime() > now.getTime()) {
|
||||
return {
|
||||
allowed: false,
|
||||
blockedBy: "cooldown_active",
|
||||
cooldownUntil: cooldownUntil.toISOString(),
|
||||
score,
|
||||
}
|
||||
}
|
||||
|
||||
if (score < 3) {
|
||||
return { allowed: false, blockedBy: "score_too_low", cooldownUntil: null, score }
|
||||
}
|
||||
|
||||
return { allowed: true, blockedBy: null, cooldownUntil: null, score }
|
||||
}
|
||||
@@ -17,6 +17,14 @@ export enum TrackerMapper {
|
||||
FeedClaimed = 2012,
|
||||
DailyRewardClaimed = 2013,
|
||||
SubscribeModalOpened = 2015,
|
||||
ReviewPromptEligible = 2016,
|
||||
ReviewPromptShown = 2017,
|
||||
ReviewPromptDismissed = 2018,
|
||||
ReviewPromptPositive = 2019,
|
||||
ReviewPromptNegative = 2020,
|
||||
ReviewPromptFeedbackOpened = 2021,
|
||||
ReviewPromptStoreOpened = 2022,
|
||||
ReviewPromptNativeRequested = 2023,
|
||||
|
||||
// https://docs.google.com/spreadsheets/d/1XlUxTxiXWIQDHFYa2eoPBeuosR1t2h8VFIjXEOqmjhY/edit?gid=0#gid=0
|
||||
Register = 3000,
|
||||
|
||||
@@ -22,6 +22,7 @@ export {
|
||||
type TrackerAdapter,
|
||||
type TrackPayload,
|
||||
} from "./adapters"
|
||||
export { TrackerMapper } from "./enums"
|
||||
export { TrackerManager, type TrackerManagerConfig } from "./manager"
|
||||
export { improvedTrackManager, trackManager } from "./track-manager"
|
||||
export { type AllTrackers, TrackerPoints } from "./tracker-points"
|
||||
|
||||
@@ -105,6 +105,73 @@ export class TrackerPoints {
|
||||
this.track(TrackerMapper.Subscribe, props)
|
||||
}
|
||||
|
||||
reviewPromptEligible(props: {
|
||||
source: "auto" | "manual"
|
||||
platform: string
|
||||
distribution: string
|
||||
score?: number
|
||||
}) {
|
||||
this.track(TrackerMapper.ReviewPromptEligible, props)
|
||||
}
|
||||
|
||||
reviewPromptShown(props: {
|
||||
source: "auto" | "manual"
|
||||
platform: string
|
||||
distribution: string
|
||||
score?: number
|
||||
}) {
|
||||
this.track(TrackerMapper.ReviewPromptShown, props)
|
||||
}
|
||||
|
||||
reviewPromptDismissed(props: {
|
||||
source: "auto" | "manual"
|
||||
platform: string
|
||||
distribution: string
|
||||
}) {
|
||||
this.track(TrackerMapper.ReviewPromptDismissed, props)
|
||||
}
|
||||
|
||||
reviewPromptPositive(props: {
|
||||
source: "auto" | "manual"
|
||||
platform: string
|
||||
distribution: string
|
||||
}) {
|
||||
this.track(TrackerMapper.ReviewPromptPositive, props)
|
||||
}
|
||||
|
||||
reviewPromptNegative(props: {
|
||||
source: "auto" | "manual"
|
||||
platform: string
|
||||
distribution: string
|
||||
}) {
|
||||
this.track(TrackerMapper.ReviewPromptNegative, props)
|
||||
}
|
||||
|
||||
reviewPromptFeedbackOpened(props: {
|
||||
source: "auto" | "manual"
|
||||
platform: string
|
||||
distribution: string
|
||||
}) {
|
||||
this.track(TrackerMapper.ReviewPromptFeedbackOpened, props)
|
||||
}
|
||||
|
||||
reviewPromptStoreOpened(props: {
|
||||
source: "auto" | "manual"
|
||||
platform: string
|
||||
distribution: string
|
||||
}) {
|
||||
this.track(TrackerMapper.ReviewPromptStoreOpened, props)
|
||||
}
|
||||
|
||||
reviewPromptNativeRequested(props: {
|
||||
source: "auto" | "manual"
|
||||
platform: string
|
||||
distribution: string
|
||||
score?: number
|
||||
}) {
|
||||
this.track(TrackerMapper.ReviewPromptNativeRequested, props)
|
||||
}
|
||||
|
||||
aiChatMessageSent() {
|
||||
this.track(TrackerMapper.AIChatMessageSent)
|
||||
}
|
||||
|
||||
Generated
+73
-10
@@ -189,7 +189,7 @@ importers:
|
||||
dependencies:
|
||||
'@follow-app/client-sdk':
|
||||
specifier: 'catalog:'
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)(next@16.0.11(@babel/core@7.29.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.58.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(hono@4.12.1)(kysely@0.28.11)(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
commander:
|
||||
specifier: 14.0.1
|
||||
version: 14.0.1
|
||||
@@ -382,7 +382,7 @@ importers:
|
||||
version: 4.3.0
|
||||
'@follow-app/client-sdk':
|
||||
specifier: 'catalog:'
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)(next@16.0.11(@babel/core@7.29.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.58.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(hono@4.12.1)(kysely@0.28.11)(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
'@follow-app/readability':
|
||||
specifier: workspace:*
|
||||
version: link:../../../../packages/readability
|
||||
@@ -1256,6 +1256,9 @@ importers:
|
||||
expo-status-bar:
|
||||
specifier: 3.0.9
|
||||
version: 3.0.9(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0)
|
||||
expo-store-review:
|
||||
specifier: ~9.0.9
|
||||
version: 9.0.9(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))
|
||||
expo-symbols:
|
||||
specifier: 1.0.8
|
||||
version: 1.0.8(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))
|
||||
@@ -1459,7 +1462,7 @@ importers:
|
||||
version: 6.2.1
|
||||
'@follow-app/client-sdk':
|
||||
specifier: 'catalog:'
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)(next@16.0.11(@babel/core@7.29.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.58.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(hono@4.12.1)(kysely@0.28.11)(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
'@follow/tracker':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/internal/tracker
|
||||
@@ -1966,7 +1969,7 @@ importers:
|
||||
dependencies:
|
||||
'@follow-app/client-sdk':
|
||||
specifier: 'catalog:'
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)(next@16.0.11(@babel/core@7.29.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.58.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(hono@4.12.1)(kysely@0.28.11)(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
'@follow/configs':
|
||||
specifier: workspace:*
|
||||
version: link:../../configs
|
||||
@@ -2050,7 +2053,7 @@ importers:
|
||||
dependencies:
|
||||
'@follow-app/client-sdk':
|
||||
specifier: 'catalog:'
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)(next@16.0.11(@babel/core@7.29.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.58.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(hono@4.12.1)(kysely@0.28.11)(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
'@follow/constants':
|
||||
specifier: workspace:*
|
||||
version: link:../constants
|
||||
@@ -2111,7 +2114,7 @@ importers:
|
||||
dependencies:
|
||||
'@follow-app/client-sdk':
|
||||
specifier: 'catalog:'
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)(next@16.0.11(@babel/core@7.29.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.58.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(hono@4.12.1)(kysely@0.28.11)(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
'@follow/configs':
|
||||
specifier: workspace:*
|
||||
version: link:../../configs
|
||||
@@ -2160,7 +2163,7 @@ importers:
|
||||
devDependencies:
|
||||
'@follow-app/client-sdk':
|
||||
specifier: 'catalog:'
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)(next@16.0.11(@babel/core@7.29.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.58.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
version: 0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(hono@4.12.1)(kysely@0.28.11)(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
'@follow/configs':
|
||||
specifier: workspace:*
|
||||
version: link:../../configs
|
||||
@@ -11060,6 +11063,12 @@ packages:
|
||||
react: 19.1.0
|
||||
react-native: '*'
|
||||
|
||||
expo-store-review@9.0.9:
|
||||
resolution: {integrity: sha512-99vS7edXlKzPcdjrzVlMQWc4zOyq4khQfFjhNqJgpGP+AgRn4U0LaZkHIrVjmzolryD3rcHJSiUQH9Vi0sD0MQ==}
|
||||
peerDependencies:
|
||||
expo: '*'
|
||||
react-native: '*'
|
||||
|
||||
expo-structured-headers@5.0.0:
|
||||
resolution: {integrity: sha512-RmrBtnSphk5REmZGV+lcdgdpxyzio5rJw8CXviHE6qH5pKQQ83fhMEcigvrkBdsn2Efw2EODp4Yxl1/fqMvOZw==}
|
||||
|
||||
@@ -21387,6 +21396,55 @@ snapshots:
|
||||
- svelte
|
||||
- vue
|
||||
|
||||
'@follow-app/client-sdk@0.3.92(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(hono@4.12.1)(kysely@0.28.11)(pg@8.16.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)':
|
||||
dependencies:
|
||||
'@folo-services/constants': 0.1.53
|
||||
'@folo-services/drizzle': 0.1.44(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)
|
||||
'@folo-services/exceptions': 0.1.28
|
||||
'@folo-services/shared': 0.0.44(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)(pg@8.16.3)
|
||||
better-auth: 1.3.28(better-sqlite3@12.6.2)(next@16.0.11(@babel/core@7.29.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.58.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||
zod: 4.1.12
|
||||
transitivePeerDependencies:
|
||||
- '@aws-sdk/client-rds-data'
|
||||
- '@cloudflare/workers-types'
|
||||
- '@electric-sql/pglite'
|
||||
- '@libsql/client'
|
||||
- '@libsql/client-wasm'
|
||||
- '@lynx-js/react'
|
||||
- '@neondatabase/serverless'
|
||||
- '@op-engineering/op-sqlite'
|
||||
- '@opentelemetry/api'
|
||||
- '@planetscale/database'
|
||||
- '@prisma/client'
|
||||
- '@sveltejs/kit'
|
||||
- '@tidbcloud/serverless'
|
||||
- '@types/better-sqlite3'
|
||||
- '@types/pg'
|
||||
- '@types/sql.js'
|
||||
- '@upstash/redis'
|
||||
- '@vercel/postgres'
|
||||
- '@xata.io/client'
|
||||
- better-sqlite3
|
||||
- bun-types
|
||||
- expo-sqlite
|
||||
- gel
|
||||
- hono
|
||||
- knex
|
||||
- kysely
|
||||
- mysql2
|
||||
- next
|
||||
- pg
|
||||
- pg-native
|
||||
- postgres
|
||||
- prisma
|
||||
- react
|
||||
- react-dom
|
||||
- solid-js
|
||||
- sql.js
|
||||
- sqlite3
|
||||
- svelte
|
||||
- vue
|
||||
|
||||
'@folo-services/ai-tools@0.2.65(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)(pg@8.16.3)':
|
||||
dependencies:
|
||||
'@ai-sdk/openai': 2.0.63(zod@4.1.12)
|
||||
@@ -21436,7 +21494,7 @@ snapshots:
|
||||
'@folo-services/exceptions': 0.1.28
|
||||
'@hono/zod-openapi': 1.1.4(hono@4.12.1)(zod@4.1.12)
|
||||
drizzle-orm: 0.45.1(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(kysely@0.28.11)(pg@8.16.3)
|
||||
drizzle-zod: 0.8.3(drizzle-orm@0.45.1(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(kysely@0.28.11)(pg@8.16.3))(zod@4.1.12)
|
||||
drizzle-zod: 0.8.3(drizzle-orm@0.45.1(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(kysely@0.28.11)(pg@8.16.3))(zod@4.1.12)
|
||||
nanoid: 5.1.6
|
||||
pg: 8.16.3
|
||||
zod: 4.1.12
|
||||
@@ -21480,7 +21538,7 @@ snapshots:
|
||||
'@folo-services/drizzle': 0.1.44(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(hono@4.12.1)(kysely@0.28.11)
|
||||
'@hono/zod-openapi': 1.1.4(hono@4.12.1)(zod@4.1.12)
|
||||
drizzle-orm: 0.45.1(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(kysely@0.28.11)(pg@8.16.3)
|
||||
drizzle-zod: 0.8.3(drizzle-orm@0.45.1(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(kysely@0.28.11)(pg@8.16.3))(zod@4.1.12)
|
||||
drizzle-zod: 0.8.3(drizzle-orm@0.45.1(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(kysely@0.28.11)(pg@8.16.3))(zod@4.1.12)
|
||||
zod: 4.1.12
|
||||
transitivePeerDependencies:
|
||||
- '@aws-sdk/client-rds-data'
|
||||
@@ -27428,7 +27486,7 @@ snapshots:
|
||||
kysely: 0.28.11
|
||||
pg: 8.16.3
|
||||
|
||||
drizzle-zod@0.8.3(drizzle-orm@0.45.1(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(kysely@0.28.11)(pg@8.16.3))(zod@4.1.12):
|
||||
drizzle-zod@0.8.3(drizzle-orm@0.45.1(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(kysely@0.28.11)(pg@8.16.3))(zod@4.1.12):
|
||||
dependencies:
|
||||
drizzle-orm: 0.45.1(@opentelemetry/api@1.9.0)(better-sqlite3@12.6.2)(expo-sqlite@16.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(kysely@0.28.11)(pg@8.16.3)
|
||||
zod: 4.1.12
|
||||
@@ -29071,6 +29129,11 @@ snapshots:
|
||||
react-native: 0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0)
|
||||
react-native-is-edge-to-edge: 1.2.1(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0)
|
||||
|
||||
expo-store-review@9.0.9(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0)):
|
||||
dependencies:
|
||||
expo: 54.0.33(@babel/core@7.29.0)(@expo/metro-runtime@6.1.2)(bufferutil@4.1.0)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0))(react@19.1.0)
|
||||
react-native: 0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0)
|
||||
|
||||
expo-structured-headers@5.0.0: {}
|
||||
|
||||
expo-symbols@1.0.8(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(bufferutil@4.1.0)(react@19.1.0)):
|
||||
|
||||
Reference in New Issue
Block a user