Sfoglia il codice sorgente

feat: updating content and adding new variant for groups (#33289)

GitOrigin-RevId: afecbd92c6a9f224226f3918d94396e2927f104a
Jimmy Domagala-Tang 3 mesi fa
parent
commit
cf0f4cb339

+ 6 - 2
services/web/frontend/extracted-translations.json

@@ -1969,6 +1969,7 @@
   "thanks_for_subscribing_you_help_sl": "",
   "thanks_settings_updated": "",
   "the_add_on_will_remain_active_until": "",
+  "the_ai_assistant_isnt_currently_available_on_your_plan": "",
   "the_code_editor_color_scheme": "",
   "the_code_editor_color_scheme_dark_mode": "",
   "the_code_editor_color_scheme_light_mode": "",
@@ -2431,6 +2432,7 @@
   "your_git_access_info_bullet_4": "",
   "your_git_access_info_bullet_5": "",
   "your_git_access_tokens": "",
+  "your_limit_will_reset_in_time_or_speak_to_admin": "",
   "your_message_to_collaborators": "",
   "your_name_and_email_address_will_be_visible_to_project_editors": "",
   "your_name_and_email_address_will_be_visible_to_the_project_owner_and_other_editors": "",
@@ -2464,11 +2466,13 @@
   "youre_signed_in_using_your_organization_email": "",
   "youve_added_more_licenses": "",
   "youve_added_x_more_licenses_to_your_subscription_invite_people": "",
-  "youve_hit_your_overleaf_ai_limit": "",
+  "youve_hit_your_daily_ai_limit": "",
   "youve_lost_collaboration_access": "",
   "youve_paused_your_subscription": "",
-  "youve_reached_the_ai_fair_usage": "",
+  "youve_reached_the_fair_usage": "",
   "youve_reached_the_fair_usage_limit_on_your_plan_you_can_start_chatting_again_in_time": "",
+  "youve_reached_your_ai_usage_limit": "",
+  "youve_reached_your_daily_ai_limit": "",
   "youve_unlinked_all_users": "",
   "youve_upgraded_your_plan": "",
   "youve_upgraded_your_subscription": "",

+ 88 - 3
services/web/frontend/js/shared/components/ai-paywall-notification.tsx

@@ -28,6 +28,10 @@ function AiPaywallNotification({
   const { t } = useTranslation()
   const features = useUserFeaturesContext()
   const inQuotaRollout = useFeatureFlag('plans-2026-phase-1')
+  const user = getMeta('ol-user')
+
+  const isCommons = user.hasInstitutionLicence
+  const isGroupUser = user.isMemberOfGroupSubscription
 
   if (!getMeta('ol-showAiFeatures')) {
     return null
@@ -78,7 +82,7 @@ function AiPaywallNotification({
         time: formatSecondsToHoursAndMinutes(t, secondsTillReset),
       }
     )
-    const assistMessage = t('youve_reached_the_ai_fair_usage')
+    const assistMessage = t('youve_reached_the_fair_usage')
     return (
       <Notification
         type="info"
@@ -99,6 +103,25 @@ function AiPaywallNotification({
       />
     )
   }
+
+  if (isGroupUser) {
+    return (
+      <GroupsPaywall
+        secondsTillReset={secondsTillReset}
+        featureLocation={featureLocation}
+      />
+    )
+  }
+
+  if (isCommons) {
+    return (
+      <CommonsPaywall
+        secondsTillReset={secondsTillReset}
+        featureLocation={featureLocation}
+      />
+    )
+  }
+
   const message = t('upgrade_for_unlimited_access_to_ai', {
     time: formatSecondsToHoursAndMinutes(t, secondsTillReset),
   })
@@ -106,7 +129,7 @@ function AiPaywallNotification({
     <>
       <Notification
         type="info"
-        title={t('youve_hit_your_overleaf_ai_limit')}
+        title={t('youve_hit_your_daily_ai_limit')}
         content={message}
         isDismissible={false}
         customIcon={null}
@@ -124,6 +147,68 @@ function AiPaywallNotification({
   )
 }
 
+function GroupsPaywall({
+  secondsTillReset,
+  featureLocation,
+}: {
+  secondsTillReset: number
+  featureLocation: aiFeatureLocations
+}) {
+  const { t } = useTranslation()
+
+  const message = t('your_limit_will_reset_in_time_or_speak_to_admin', {
+    time: formatSecondsToHoursAndMinutes(t, secondsTillReset),
+  })
+
+  const title =
+    featureLocation === 'workbench'
+      ? t('youve_reached_your_daily_ai_limit')
+      : t('youve_hit_your_daily_ai_limit')
+
+  return (
+    <>
+      <Notification
+        type="info"
+        title={title}
+        content={message}
+        isDismissible={false}
+        customIcon={null}
+      />
+    </>
+  )
+}
+
+function CommonsPaywall({
+  secondsTillReset,
+  featureLocation,
+}: {
+  secondsTillReset: number
+  featureLocation: aiFeatureLocations
+}) {
+  const { t } = useTranslation()
+
+  // workbench isnt available on commons plans, so dont show it here and let upgrade-notification handle it
+  if (featureLocation === 'workbench') {
+    return null
+  }
+
+  const message = t('this_will_reset_in', {
+    time: formatSecondsToHoursAndMinutes(t, secondsTillReset),
+  })
+
+  return (
+    <>
+      <Notification
+        type="info"
+        title={t('youve_reached_your_ai_usage_limit')}
+        content={message}
+        isDismissible={false}
+        customIcon={null}
+      />
+    </>
+  )
+}
+
 function FairUseLimit({
   secondsTillReset,
   featureLocation,
@@ -136,7 +221,7 @@ function FairUseLimit({
   const title =
     featureLocation === 'workbench'
       ? t('usage_limit_reached')
-      : t('youve_reached_the_ai_fair_usage')
+      : t('youve_reached_the_fair_usage')
 
   const workbenchMessage = t(
     'youve_reached_the_fair_usage_limit_on_your_plan_you_can_start_chatting_again_in_time',

+ 7 - 3
services/web/locales/en.json

@@ -2576,6 +2576,7 @@
   "thanks_for_subscribing_you_help_sl": "Thank you for subscribing to the __planName__ plan. It’s support from people like yourself that allows __appName__ to continue to grow and improve.",
   "thanks_settings_updated": "Thanks, your settings have been updated.",
   "the_add_on_will_remain_active_until": "The add-on will remain active until the end of the current billing period.",
+  "the_ai_assistant_isnt_currently_available_on_your_plan": "The AI Assistant isn’t currently available on your organization’s plan.",
   "the_code_editor_color_scheme": "The code editor color scheme",
   "the_code_editor_color_scheme_dark_mode": "The code editor color scheme for dark mode",
   "the_code_editor_color_scheme_light_mode": "The code editor color scheme for light mode",
@@ -2845,7 +2846,7 @@
   "upgrade": "Upgrade",
   "upgrade_cc_btn": "Upgrade now, pay after 7 days",
   "upgrade_for_more_compile_time": "Upgrade to get more compile time",
-  "upgrade_for_unlimited_access_to_ai": "Upgrade for unlimited access to all AI features or check back in __time__",
+  "upgrade_for_unlimited_access_to_ai": "Upgrade to keep using AI features, or wait __time__ for your limit to reset.",
   "upgrade_my_plan": "Upgrade my plan",
   "upgrade_now": "Upgrade now",
   "upgrade_plan": "Upgrade plan",
@@ -3096,6 +3097,7 @@
   "your_git_access_info_bullet_4": "You won’t be able to view the full token after the first time you generate it. Please copy it and keep it safe",
   "your_git_access_info_bullet_5": "Previously generated tokens will be shown here.",
   "your_git_access_tokens": "Your Git authentication tokens",
+  "your_limit_will_reset_in_time_or_speak_to_admin": "Your limit will reset in __time__. Or speak to your group admin about upgrading.",
   "your_message_to_collaborators": "Send a message to your collaborators",
   "your_name_and_email_address_will_be_visible_to_project_editors": "Your name and email address will be visible to project editors.",
   "your_name_and_email_address_will_be_visible_to_the_project_owner_and_other_editors": "Your name and email address will be visible to the project owner and other editors.",
@@ -3135,11 +3137,13 @@
   "youve_added_more_licenses": "You’ve added more license(s)!",
   "youve_added_x_more_licenses_to_your_subscription_invite_people": "You’ve added __users__ more license(s) to your subscription. <0>Invite people</0>.",
   "youve_already_used_your_free_trial": "You’ve already used your free trial. Upgrade to continue using premium features.",
-  "youve_hit_your_overleaf_ai_limit": "You’ve hit your Overleaf AI limit",
+  "youve_hit_your_daily_ai_limit": "You’ve hit your daily AI limit",
   "youve_lost_collaboration_access": "You’ve lost collaboration access",
   "youve_paused_your_subscription": "Your <0>__planName__</0> subscription is paused until <0>__reactivationDate__</0>, then it’ll automatically unpause. You can unpause early at any time.",
-  "youve_reached_the_ai_fair_usage": "You’ve reached the AI fair usage limit on your plan",
+  "youve_reached_the_fair_usage": "You’ve reached the fair usage limit on your plan",
   "youve_reached_the_fair_usage_limit_on_your_plan_you_can_start_chatting_again_in_time": "You’ve reached the fair usage limit on your plan. You can start chatting again in __time__.",
+  "youve_reached_your_ai_usage_limit": "You’ve reached your AI usage limit",
+  "youve_reached_your_daily_ai_limit": "You’ve reached the daily AI limit",
   "youve_unlinked_all_users": "You’ve unlinked all users",
   "youve_upgraded_your_plan": "You’ve upgraded your plan!",
   "youve_upgraded_your_subscription": "You’ve upgraded your subscription",