Kaynağa Gözat

[web] Fix /user/subscription/plans#ai-assist redirects (#34124)

* [web] Redirect missing AI add-on purchase to subscription dashboard

The two error paths in `previewAddonPurchase` redirected to
`/user/subscription/plans#ai-assist`, but the `#ai-assist` anchor was
removed when the AI Assist add-on was retired, so users land at the top
of the plans page with no context. Align both with the other error
branches in the same function and the `plans-2026-phase-1` enabled
branch, which already redirect to
`/user/subscription?redirect-reason=ai-assist-unavailable` — the
subscription dashboard shows the matching warning alert
(`redirect-alerts.tsx`).

Update the acceptance test to match the new redirect target.

Closes #34074

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* [web] Update ai-assist-unavailable warning to reflect bundled AI features

The previous copy said "AI Assist isn't available to you due to your
current subscription type", which read as a hard block. Now that the AI
Assist add-on has been retired and AI features are included with every
paid plan, the warning should point users to the pricing page instead of
implying their plan can't access AI at all.

Keep the existing translation key for now — a follow-up can rename it
once #33624 (AI page CTA destination) is resolved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* [web] Link the ai-assist-unavailable warning to the pricing page

* [web] Rename key `ai_assist_unavailable_due_to_subscription_type` -> `ai_assist_unavailable`

* [web] Update french and german translations

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
GitOrigin-RevId: ae1319fa5b857d8f292de77c82ef0bda1c7ad144
Antoine Clausse 2 ay önce
ebeveyn
işleme
b07d141397

+ 6 - 2
services/web/app/src/Features/Subscription/SubscriptionController.mjs

@@ -598,7 +598,9 @@ async function previewAddonPurchase(req, res) {
       err instanceof Error &&
       err.constructor.name === 'PaymentServiceResourceNotFoundError'
     ) {
-      return res.redirect('/user/subscription/plans#ai-assist')
+      return res.redirect(
+        '/user/subscription?redirect-reason=ai-assist-unavailable'
+      )
     }
     throw err
   }
@@ -624,7 +626,9 @@ async function previewAddonPurchase(req, res) {
       err instanceof Error &&
       err.constructor.name === 'PaymentServiceResourceNotFoundError'
     ) {
-      return res.redirect('/user/subscription/plans#ai-assist')
+      return res.redirect(
+        '/user/subscription?redirect-reason=ai-assist-unavailable'
+      )
     }
     throw err
   }

+ 1 - 1
services/web/frontend/extracted-translations.json

@@ -121,7 +121,7 @@
   "ai_assist_in_overleaf_is_included_via_writefull_groups": "",
   "ai_assist_in_overleaf_is_included_via_writefull_individual": "",
   "ai_assist_subscriber_can_now_write_smarter": "",
-  "ai_assist_unavailable_due_to_subscription_type": "",
+  "ai_assist_unavailable": "",
   "ai_assistance": "",
   "ai_assistant": "",
   "ai_can_make_mistakes": "",

+ 10 - 2
services/web/frontend/js/features/subscription/components/dashboard/redirect-alerts.tsx

@@ -1,4 +1,4 @@
-import { useTranslation } from 'react-i18next'
+import { Trans, useTranslation } from 'react-i18next'
 import OLNotification from '@/shared/components/ol/ol-notification'
 
 function RedirectAlerts() {
@@ -16,7 +16,15 @@ function RedirectAlerts() {
   } else if (redirectReason === 'double-buy') {
     warning = t('good_news_you_already_purchased_this_add_on')
   } else if (redirectReason === 'ai-assist-unavailable') {
-    warning = t('ai_assist_unavailable_due_to_subscription_type')
+    warning = (
+      <Trans
+        i18nKey="ai_assist_unavailable"
+        components={[
+          // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
+          <a href="/user/subscription/plans" />,
+        ]}
+      />
+    )
   } else if (redirectReason === 'subscription-paused') {
     warning = t('no_add_on_purchase_while_paused')
   } else {

+ 1 - 1
services/web/locales/de.json

@@ -135,7 +135,7 @@
   "ai_assist_description": "AI Assist kombiniert KI-Tools von Overleaf und Writefull, damit du schneller, intelligenter und sicherer schreiben kannst.",
   "ai_assist_in_overleaf_is_included_via_writefull_groups": "AI Assist in Overleaf ist Teil des Writefull-Abonnements deiner Gruppe oder Organisation. Um Änderungen vorzunehmen, musst du dich an den Administrator deines Abonnements wenden.",
   "ai_assist_in_overleaf_is_included_via_writefull_individual": "AI Assist in Overleaf ist Teil deines Writefull-Abonnements. Du kannst deinen Zugriff auf AI Assist in deinen Writefull-Abonnementeinstellungen kündigen oder verwalten.",
-  "ai_assist_unavailable_due_to_subscription_type": "Es tut uns leid – anscheinend ist AI Assist aufgrund deines aktuellen Abonnementtyps noch nicht für dich verfügbar.",
+  "ai_assist_unavailable": "KI-Funktionen sind jetzt in jedem kostenpflichtigen Plan enthalten. Auf der <0>Preisseite</0> erfahren Sie, was die einzelnen Pläne beinhalten.",
   "ai_can_make_mistakes": "KI kann Fehler machen. Überprüfe Korrekturen, bevor du sie anwendest.",
   "ai_features": "KI-Funktionen",
   "ai_feedback_please_provide_more_detail": "Bitte gib mehr Details dazu an, was nicht gestimmt hat (optional)",

+ 1 - 1
services/web/locales/en.json

@@ -154,7 +154,7 @@
   "ai_assist_in_overleaf_is_included_via_writefull_groups": "AI Assist in Overleaf is included as part of your group or organization’s Writefull subscription. To make changes you’ll need to speak to your subscription admin",
   "ai_assist_in_overleaf_is_included_via_writefull_individual": "AI Assist in Overleaf is included as part of your Writefull subscription. You can cancel or manage your access to AI Assist in your Writefull subscription settings.",
   "ai_assist_subscriber_can_now_write_smarter": "AI Assist subscribers can now write smarter, find citations, and generate LaTeX from prompts and images.",
-  "ai_assist_unavailable_due_to_subscription_type": "We’re sorry—it looks like AI Assist isn’t available to you just yet due to your current subscription type.",
+  "ai_assist_unavailable": "AI features are now included in every paid plan. See the <0>pricing page</0> for what each plan includes.",
   "ai_assistance": "AI assistance",
   "ai_assistant": "AI Assistant",
   "ai_assistant_explanation": "A LaTeX-fluent AI Assistant built into your editor.",

+ 1 - 0
services/web/locales/fr.json

@@ -87,6 +87,7 @@
   "aggregate_changed": "Modification de",
   "aggregate_to": "en",
   "agree_with_the_terms": "J’accepte les conditions d’utilisation d’Overleaf",
+  "ai_assist_unavailable": "Les fonctionnalités d’IA sont désormais incluses dans les offres payantes. Consultez la <0>page des offres et prix</0> pour en savoir plus.",
   "ai_can_make_mistakes": "Une IA peut commettre des erreurs. Examinez les corrections avant de les appliquer.",
   "ai_feedback_tell_us_what_was_wrong_so_we_can_improve": "Dites-nous ce qui n’allait pas afin que nous puissions nous améliorer.",
   "ai_feedback_the_answer_was_too_long": "La réponse était trop longue",