- requestAiConsent now redirects to /settings/general?highlight=aiConsent instead of opening the modal when called outside the settings page - Settings page highlights the consent section and scrolls to it - Adds consent.ai.settingsBanner i18n key (fr/en) - Keeps inline modal on /settings/general so the grant button still works
25 lines
756 B
TypeScript
25 lines
756 B
TypeScript
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime'
|
|
|
|
/**
|
|
* Redirects the user to General Settings with the AI consent section highlighted.
|
|
* Call this when an AI feature is blocked because the user has not granted consent.
|
|
*/
|
|
export function redirectToAiConsentSettings(
|
|
router: AppRouterInstance | ReturnType<typeof import('next/navigation').useRouter>,
|
|
options?: { replace?: boolean }
|
|
) {
|
|
const url = '/settings/general?highlight=aiConsent'
|
|
if (options?.replace) {
|
|
router.replace(url)
|
|
} else {
|
|
router.push(url)
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Returns the settings URL that highlights the AI consent section.
|
|
*/
|
|
export function getAiConsentSettingsUrl() {
|
|
return '/settings/general?highlight=aiConsent'
|
|
}
|