ソースを参照

Merge pull request #30520 from overleaf/ii-flexible-group-licensing-upgrade-message

[web] Plan upgrade error message when subscription is manually collected

GitOrigin-RevId: 76bda80c81a5f934cbddfb6f24d29c4dd3d6da56
Jessica Lawshe 6 ヶ月 前
コミット
a116175698

+ 3 - 2
services/web/app/src/Features/Subscription/SubscriptionGroupController.mjs

@@ -181,7 +181,7 @@ async function addSeatsToGroupSubscription(req, res) {
 
     if (error instanceof HasNoAdditionalLicenseWhenManuallyCollectedError) {
       return res.redirect(
-        '/user/subscription/group/manually-collected-subscription'
+        '/user/subscription/group/manually-collected-subscription?error_type=no-additional-license'
       )
     }
 
@@ -375,7 +375,7 @@ async function subscriptionUpgradePage(req, res) {
 
     if (error instanceof ManuallyCollectedError) {
       return res.redirect(
-        '/user/subscription/group/manually-collected-subscription'
+        '/user/subscription/group/manually-collected-subscription?error_type=plan-upgrade'
       )
     }
 
@@ -437,6 +437,7 @@ async function manuallyCollectedSubscription(req, res) {
 
     res.render('subscriptions/manually-collected-subscription', {
       groupName: subscription.teamName,
+      errorType: req.query.error_type,
     })
   } catch (error) {
     logger.err(

+ 1 - 0
services/web/app/views/subscriptions/manually-collected-subscription.pug

@@ -6,6 +6,7 @@ block entrypointVar
 block append meta
 	meta(name='ol-user' data-type='json' content=user)
 	meta(name='ol-groupName' data-type='string' content=groupName)
+	meta(name='ol-errorType' data-type='string' content=errorType)
 
 block content
 	main#manually-collected-subscription-root.content.content-alt

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

@@ -934,6 +934,7 @@
   "issued_on": "",
   "it_looks_like_that_didnt_work_you_can_try_again_or_get_in_touch": "",
   "it_looks_like_your_account_is_billed_manually_purchasing_additional_license_or_upgrading_subscription": "",
+  "it_looks_like_your_account_is_billed_manually_upgrading_subscription": "",
   "it_looks_like_your_payment_details_are_missing_please_update_your_billing_information": "",
   "italics": "",
   "join_beta_program": "",

+ 19 - 13
services/web/frontend/js/features/group-management/components/manually-collected-subscription.tsx

@@ -1,15 +1,11 @@
 import { Trans, useTranslation } from 'react-i18next'
 import OLNotification from '@/shared/components/ol/ol-notification'
 import Card from '@/features/group-management/components/card'
-import useWaitForI18n from '@/shared/hooks/use-wait-for-i18n'
+import getMeta from '@/utils/meta'
 
 function ManuallyCollectedSubscription() {
   const { t } = useTranslation()
-  const { isReady } = useWaitForI18n()
-
-  if (!isReady) {
-    return null
-  }
+  const errorType = getMeta('ol-errorType')
 
   return (
     <Card>
@@ -17,13 +13,23 @@ function ManuallyCollectedSubscription() {
         type="error"
         title={t('account_billed_manually')}
         content={
-          <Trans
-            i18nKey="it_looks_like_your_account_is_billed_manually_purchasing_additional_license_or_upgrading_subscription"
-            components={[
-              // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-              <a href="/contact" rel="noreferrer noopener" />,
-            ]}
-          />
+          errorType === 'plan-upgrade' ? (
+            <Trans
+              i18nKey="it_looks_like_your_account_is_billed_manually_upgrading_subscription"
+              components={[
+                // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
+                <a href="/contact" rel="noreferrer noopener" />,
+              ]}
+            />
+          ) : (
+            <Trans
+              i18nKey="it_looks_like_your_account_is_billed_manually_purchasing_additional_license_or_upgrading_subscription"
+              components={[
+                // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
+                <a href="/contact" rel="noreferrer noopener" />,
+              ]}
+            />
+          )
         }
         className="m-0"
       />

+ 1 - 6
services/web/frontend/js/pages/user/subscription/group-management/manually-collected-subscription.tsx

@@ -1,14 +1,9 @@
 import '../base'
 import { createRoot } from 'react-dom/client'
 import ManuallyCollectedSubscription from '@/features/group-management/components/manually-collected-subscription'
-import { SplitTestProvider } from '@/shared/context/split-test-context'
 
 const element = document.getElementById('manually-collected-subscription-root')
 if (element) {
   const root = createRoot(element)
-  root.render(
-    <SplitTestProvider>
-      <ManuallyCollectedSubscription />
-    </SplitTestProvider>
-  )
+  root.render(<ManuallyCollectedSubscription />)
 }

+ 1 - 0
services/web/frontend/js/utils/meta.ts

@@ -123,6 +123,7 @@ export interface Meta {
   'ol-email': string
   'ol-emailAddressLimit': number
   'ol-error': { name: string } | undefined
+  'ol-errorType': string | undefined
   'ol-expired': boolean
   'ol-features': Features
   'ol-footer': FooterMetadata

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

@@ -1191,6 +1191,7 @@
   "it": "Italian",
   "it_looks_like_that_didnt_work_you_can_try_again_or_get_in_touch": "It looks like that didn’t work. You can try again or <0>get in touch</0> with our Support team for more help.",
   "it_looks_like_your_account_is_billed_manually_purchasing_additional_license_or_upgrading_subscription": "It looks like your account is being billed manually - purchasing additional licenses or upgrading your subscription can only be done by the Support team. Please <0>get in touch</0> for help.",
+  "it_looks_like_your_account_is_billed_manually_upgrading_subscription": "It looks like your account is being billed manually - upgrading your subscription can only be done by the Support team. Please <0>get in touch</0> for help.",
   "it_looks_like_your_payment_details_are_missing_please_update_your_billing_information": "It looks like your payment details are missing. Please <0>update your billing information</0>, or <1>get in touch</1> with our Support team for more help.",
   "italics": "Italics",
   "ja": "Japanese",

+ 2 - 2
services/web/test/unit/src/Subscription/SubscriptionGroupController.test.mjs

@@ -532,7 +532,7 @@ describe('SubscriptionGroupController', function () {
         const res = {
           redirect: url => {
             url.should.equal(
-              '/user/subscription/group/manually-collected-subscription'
+              '/user/subscription/group/manually-collected-subscription?error_type=no-additional-license'
             )
             resolve()
           },
@@ -872,7 +872,7 @@ describe('SubscriptionGroupController', function () {
         const res = {
           redirect: url => {
             url.should.equal(
-              '/user/subscription/group/manually-collected-subscription'
+              '/user/subscription/group/manually-collected-subscription?error_type=plan-upgrade'
             )
             resolve()
           },