Sfoglia il codice sorgente

Merge pull request #21741 from overleaf/jdt-assist-paywall-routing

Direct users to the correct assistant add-on checkout

GitOrigin-RevId: 884d6e68458bc8f27ce79a4849f580a9ec0997fb
Jimmy Domagala-Tang 1 anno fa
parent
commit
d93299d47d

+ 1 - 0
services/web/app/src/Features/Project/ProjectController.js

@@ -729,6 +729,7 @@ const _ProjectController = {
           referal_id: user.referal_id,
           signUpDate: user.signUpDate,
           allowedFreeTrial,
+          hasRecurlySubscription: subscription?.recurlySubscription_id != null,
           featureSwitches: user.featureSwitches,
           features: user.features,
           featureUsage,

+ 0 - 10
services/web/frontend/js/features/subscription/components/dashboard/free-plan.tsx

@@ -1,6 +1,4 @@
 import { useTranslation, Trans } from 'react-i18next'
-import { isSplitTestEnabled } from '@/utils/splitTestUtils'
-import { AI_STANDALONE_PLAN_CODE } from '../../data/add-on-codes'
 
 function FreePlan() {
   const { t } = useTranslation()
@@ -28,14 +26,6 @@ function FreePlan() {
       <a className="btn btn-primary me-1" href="/user/subscription/plans">
         {t('upgrade_now')}
       </a>
-      {isSplitTestEnabled('ai-add-on') && (
-        <a
-          className="btn btn-secondary"
-          href={`/user/subscription/new?planCode=${AI_STANDALONE_PLAN_CODE}`}
-        >
-          {t('buy_overleaf_assist')}
-        </a>
-      )}
     </>
   )
 }

+ 0 - 6
services/web/frontend/js/features/subscription/components/dashboard/states/active/active.tsx

@@ -15,8 +15,6 @@ import { ConfirmChangePlanModal } from './change-plan/modals/confirm-change-plan
 import { KeepCurrentPlanModal } from './change-plan/modals/keep-current-plan-modal'
 import { ChangeToGroupModal } from './change-plan/modals/change-to-group-modal'
 import OLButton from '@/features/ui/components/ol/ol-button'
-import { BuyAiAddOnButton } from './change-plan/buy-ai-add-on-button'
-import { isSplitTestEnabled } from '@/utils/splitTestUtils'
 
 export function ActiveSubscription({
   subscription,
@@ -29,8 +27,6 @@ export function ActiveSubscription({
 
   if (showCancellation) return <CancelSubscription />
 
-  const aiAddOnAvailable = isSplitTestEnabled('ai-add-on')
-
   return (
     <>
       <p>
@@ -149,8 +145,6 @@ export function ActiveSubscription({
       <ConfirmChangePlanModal />
       <KeepCurrentPlanModal />
       <ChangeToGroupModal />
-      {/* to be removed once we have purchasing options ready  */}
-      {aiAddOnAvailable && <BuyAiAddOnButton />}
     </>
   )
 }

+ 0 - 12
services/web/frontend/js/features/subscription/components/dashboard/states/active/change-plan/buy-ai-add-on-button.tsx

@@ -1,12 +0,0 @@
-import { Button } from 'react-bootstrap'
-import { postJSON } from '@/infrastructure/fetch-json'
-import { AI_ADD_ON_CODE } from '../../../../../data/add-on-codes'
-
-export function BuyAiAddOnButton() {
-  const addAiAddon = async () => {
-    await postJSON(`/user/subscription/addon/${AI_ADD_ON_CODE}/add`)
-    location.reload()
-  }
-
-  return <Button onClick={addAiAddon}>Purchase AI subscription </Button>
-}

+ 1 - 0
services/web/types/user.ts

@@ -37,6 +37,7 @@ export type User = {
   isAdmin?: boolean
   email: string
   allowedFreeTrial?: boolean
+  hasRecurlySubscription?: boolean
   first_name?: string
   last_name?: string
   alphaProgram?: boolean