Selaa lähdekoodia

[web] Update change plan flow for group-pricing-2025 (#22532)

GitOrigin-RevId: 23f6f5972b1d13b457c7c5e88f508b7cf022469a
Kristina 1 vuosi sitten
vanhempi
sitoutus
d488791474

+ 1 - 0
services/web/app/src/Features/Subscription/SubscriptionController.js

@@ -236,6 +236,7 @@ async function userSubscriptionPage(req, res) {
     res,
     res,
     'bootstrap-5-subscription'
     'bootstrap-5-subscription'
   )
   )
+  await SplitTestHandler.promises.getAssignment(req, res, 'group-pricing-2025')
 
 
   const results =
   const results =
     await SubscriptionViewModelBuilder.promises.buildUsersSubscriptionViewModel(
     await SubscriptionViewModelBuilder.promises.buildUsersSubscriptionViewModel(

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

@@ -830,6 +830,7 @@
   "lets_fix_your_errors": "",
   "lets_fix_your_errors": "",
   "library": "",
   "library": "",
   "license_for_educational_purposes": "",
   "license_for_educational_purposes": "",
+  "license_for_educational_purposes_2025": "",
   "limited_offer": "",
   "limited_offer": "",
   "limited_to_n_editors": "",
   "limited_to_n_editors": "",
   "limited_to_n_editors_per_project": "",
   "limited_to_n_editors_per_project": "",

+ 46 - 16
services/web/frontend/js/features/subscription/components/dashboard/states/active/change-plan/modals/change-to-group-modal.tsx

@@ -25,6 +25,7 @@ import OLButton from '@/features/ui/components/ol/ol-button'
 import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
 import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
 import OLNotification from '@/features/ui/components/ol/ol-notification'
 import OLNotification from '@/features/ui/components/ol/ol-notification'
 import { bsVersion } from '@/features/utils/bootstrap-5'
 import { bsVersion } from '@/features/utils/bootstrap-5'
+import { useFeatureFlag } from '@/shared/context/split-test-context'
 
 
 const educationalPercentDiscount = 40
 const educationalPercentDiscount = 40
 const groupSizeForEducationalDiscount = 10
 const groupSizeForEducationalDiscount = 10
@@ -46,10 +47,16 @@ function GroupPlanCollaboratorCount({ planCode }: { planCode: string }) {
   return null
   return null
 }
 }
 
 
-function EducationDiscountAppliedOrNot({ groupSize }: { groupSize: string }) {
+function EducationDiscountAppliedOrNot({
+  groupSize,
+  showGroupPricing2025,
+}: {
+  groupSize: string
+  showGroupPricing2025: boolean
+}) {
   const { t } = useTranslation()
   const { t } = useTranslation()
   const size = parseInt(groupSize)
   const size = parseInt(groupSize)
-  if (size >= groupSizeForEducationalDiscount) {
+  if (size >= groupSizeForEducationalDiscount || showGroupPricing2025) {
     return (
     return (
       <p className="applied">
       <p className="applied">
         {t('educational_percent_discount_applied', {
         {t('educational_percent_discount_applied', {
@@ -145,6 +152,7 @@ export function ChangeToGroupModal() {
   const [error, setError] = useState(false)
   const [error, setError] = useState(false)
   const [inflight, setInflight] = useState(false)
   const [inflight, setInflight] = useState(false)
   const location = useLocation()
   const location = useLocation()
+  const showGroupPricing2025 = useFeatureFlag('group-pricing-2025')
 
 
   async function upgrade() {
   async function upgrade() {
     setError(false)
     setError(false)
@@ -196,11 +204,13 @@ export function ChangeToGroupModal() {
           <OLModalTitle className="lh-sm">
           <OLModalTitle className="lh-sm">
             {t('customize_your_group_subscription')}
             {t('customize_your_group_subscription')}
             <br />
             <br />
-            <span className="h5">
-              {t('save_x_percent_or_more', {
-                percent: '30',
-              })}
-            </span>
+            {!showGroupPricing2025 && (
+              <span className="h5">
+                {t('save_x_percent_or_more', {
+                  percent: '30',
+                })}
+              </span>
+            )}
           </OLModalTitle>
           </OLModalTitle>
         </OLModalHeader>
         </OLModalHeader>
 
 
@@ -276,14 +286,16 @@ export function ChangeToGroupModal() {
                     </OLFormSelect>
                     </OLFormSelect>
                   </OLFormGroup>
                   </OLFormGroup>
 
 
-                  <OLFormGroup>
-                    <strong>
-                      {t('percent_discount_for_groups', {
-                        percent: educationalPercentDiscount,
-                        size: groupSizeForEducationalDiscount,
-                      })}
-                    </strong>
-                  </OLFormGroup>
+                  {!showGroupPricing2025 && (
+                    <OLFormGroup>
+                      <strong>
+                        {t('percent_discount_for_groups', {
+                          percent: educationalPercentDiscount,
+                          size: groupSizeForEducationalDiscount,
+                        })}
+                      </strong>
+                    </OLFormGroup>
+                  )}
 
 
                   <OLFormCheckbox
                   <OLFormCheckbox
                     id="usage"
                     id="usage"
@@ -297,7 +309,24 @@ export function ChangeToGroupModal() {
                         setGroupPlanToChangeToUsage('enterprise')
                         setGroupPlanToChangeToUsage('enterprise')
                       }
                       }
                     }}
                     }}
-                    label={t('license_for_educational_purposes')}
+                    label={
+                      showGroupPricing2025 ? (
+                        <Trans
+                          i18nKey="license_for_educational_purposes_2025"
+                          values={{ percent: educationalPercentDiscount }}
+                          shouldUnescape
+                          tOptions={{ interpolation: { escapeValue: true } }}
+                          components={[
+                            /* eslint-disable-next-line react/jsx-key */
+                            <strong />,
+                            /* eslint-disable-next-line react/jsx-key */
+                            <br />,
+                          ]}
+                        />
+                      ) : (
+                        t('license_for_educational_purposes')
+                      )
+                    }
                   />
                   />
                 </form>
                 </form>
               </div>
               </div>
@@ -306,6 +335,7 @@ export function ChangeToGroupModal() {
               {groupPlanToChangeToUsage === 'educational' && (
               {groupPlanToChangeToUsage === 'educational' && (
                 <EducationDiscountAppliedOrNot
                 <EducationDiscountAppliedOrNot
                   groupSize={groupPlanToChangeToSize}
                   groupSize={groupPlanToChangeToSize}
+                  showGroupPricing2025={showGroupPricing2025}
                 />
                 />
               )}
               )}
             </div>
             </div>

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

@@ -1171,7 +1171,7 @@
   "library": "Library",
   "library": "Library",
   "license": "License",
   "license": "License",
   "license_for_educational_purposes": "This license is for educational purposes (applies to students or faculty using __appName__ for teaching)",
   "license_for_educational_purposes": "This license is for educational purposes (applies to students or faculty using __appName__ for teaching)",
-  "limited_offer": "Limited offer",
+  "license_for_educational_purposes_2025": "<0>__percent__% educational discount</0><1/>I confirm this subscription is for educational purposes (applies to students or faculty using __appName__ for teaching)",
   "limited_to_n_editors": "Limited to __count__ editor",
   "limited_to_n_editors": "Limited to __count__ editor",
   "limited_to_n_editors_per_project": "Limited to __count__ editor per project",
   "limited_to_n_editors_per_project": "Limited to __count__ editor per project",
   "limited_to_n_editors_per_project_plural": "Limited to __count__ editors per project",
   "limited_to_n_editors_per_project_plural": "Limited to __count__ editors per project",