Просмотр исходного кода

Merge pull request #17369 from overleaf/jdt-rm-old-wf-prj-list-ad

removing old writefull ad from project list and removing uneeded spli…

GitOrigin-RevId: 84722949c4972ba0b7c8e0bf6d2884608e26a613
Jimmy Domagala-Tang 2 лет назад
Родитель
Сommit
5701a1cccd

+ 0 - 6
services/web/app/src/Features/Project/ProjectListController.js

@@ -357,12 +357,6 @@ async function projectListPage(req, res, next) {
     }
     }
   }
   }
 
 
-  await SplitTestHandler.promises.getAssignment(
-    req,
-    res,
-    'writefull-oauth-promotion'
-  )
-
   let showInrGeoBanner = false
   let showInrGeoBanner = false
   let showBrlGeoBanner = false
   let showBrlGeoBanner = false
   let recommendedCurrency
   let recommendedCurrency

+ 11 - 45
services/web/frontend/js/features/project-list/components/notifications/user-notifications.tsx

@@ -4,7 +4,6 @@ import Institution from './groups/institution'
 import ConfirmEmail from './groups/confirm-email'
 import ConfirmEmail from './groups/confirm-email'
 import ReconfirmationInfo from './groups/affiliation/reconfirmation-info'
 import ReconfirmationInfo from './groups/affiliation/reconfirmation-info'
 import GroupsAndEnterpriseBanner from './groups-and-enterprise-banner'
 import GroupsAndEnterpriseBanner from './groups-and-enterprise-banner'
-import WritefullPromoBanner from './writefull-promo-banner'
 import WritefullPremiumPromoBanner from './writefull-premium-promo-banner'
 import WritefullPremiumPromoBanner from './writefull-premium-promo-banner'
 import GroupSsoSetupSuccess from './groups/group-sso-setup-success'
 import GroupSsoSetupSuccess from './groups/group-sso-setup-success'
 import INRBanner from './ads/inr-banner'
 import INRBanner from './ads/inr-banner'
@@ -13,14 +12,8 @@ import importOverleafModules from '../../../../../macros/import-overleaf-module.
 import customLocalStorage from '../../../../infrastructure/local-storage'
 import customLocalStorage from '../../../../infrastructure/local-storage'
 import { sendMB } from '../../../../infrastructure/event-tracking'
 import { sendMB } from '../../../../infrastructure/event-tracking'
 import classNames from 'classnames'
 import classNames from 'classnames'
-import { isSplitTestEnabled } from '@/utils/splitTestUtils'
 import BRLBanner from './ads/brl-banner'
 import BRLBanner from './ads/brl-banner'
 
 
-const isChromium = () =>
-  (window.navigator as any).userAgentData?.brands?.some(
-    (item: { brand: string }) => item.brand === 'Chromium'
-  )
-
 type Subscription = {
 type Subscription = {
   groupId: string
   groupId: string
   groupName: string
   groupName: string
@@ -45,9 +38,6 @@ function UserNotifications() {
   )
   )
   const showInrGeoBanner = getMeta('ol-showInrGeoBanner', false)
   const showInrGeoBanner = getMeta('ol-showInrGeoBanner', false)
   const showBrlGeoBanner = getMeta('ol-showBrlGeoBanner', false)
   const showBrlGeoBanner = getMeta('ol-showBrlGeoBanner', false)
-  const writefullOauthPromotionSplitTestEnabled = isSplitTestEnabled(
-    'writefull-oauth-promotion'
-  )
   const user = getMeta('ol-user')
   const user = getMeta('ol-user')
 
 
   // Temporary workaround to prevent also showing groups/enterprise banner
   // Temporary workaround to prevent also showing groups/enterprise banner
@@ -60,20 +50,14 @@ function UserNotifications() {
     }
     }
 
 
     const show =
     const show =
-      user?.writefull?.enabled === true || // show to any users who have writefull enabled regardless of split test
-      (!writefullOauthPromotionSplitTestEnabled && // show old banner to users who are not in the split test, who are on chrome and havent dismissed
-        isChromium() &&
-        getMeta('ol-showWritefullPromoBanner'))
+      user?.writefull?.enabled === true ||
+      window.writefull?.type === 'extension'
 
 
     if (show) {
     if (show) {
       sendMB('promo-prompt', {
       sendMB('promo-prompt', {
         location: 'dashboard-banner',
         location: 'dashboard-banner',
         page: '/project',
         page: '/project',
-        name:
-          user?.writefull?.enabled === true ||
-          writefullOauthPromotionSplitTestEnabled
-            ? 'writefull-premium'
-            : 'writefull',
+        name: 'writefull-premium',
       })
       })
     }
     }
 
 
@@ -81,15 +65,6 @@ function UserNotifications() {
   })
   })
   const [dismissedWritefull, setDismissedWritefull] = useState(false)
   const [dismissedWritefull, setDismissedWritefull] = useState(false)
 
 
-  const hasWritefullExtensionAlreadyInstalled =
-    window.writefull?.type === 'extension'
-  const usesWritefullIntegration =
-    writefullOauthPromotionSplitTestEnabled || user?.writefull?.enabled
-  const writefullBannerVariant =
-    hasWritefullExtensionAlreadyInstalled || usesWritefullIntegration
-      ? 'plans-page'
-      : 'chrome-store'
-
   return (
   return (
     <div
     <div
       className={classNames('user-notifications', {
       className={classNames('user-notifications', {
@@ -112,24 +87,15 @@ function UserNotifications() {
         <ReconfirmationInfo />
         <ReconfirmationInfo />
         {!showWritefull && !dismissedWritefull && <GroupsAndEnterpriseBanner />}
         {!showWritefull && !dismissedWritefull && <GroupsAndEnterpriseBanner />}
         {showInrGeoBanner && <INRBanner />}
         {showInrGeoBanner && <INRBanner />}
+
+        <WritefullPremiumPromoBanner
+          show={showWritefull}
+          setShow={setShowWritefull}
+          onDismiss={() => {
+            setDismissedWritefull(true)
+          }}
+        />
         {showBrlGeoBanner && <BRLBanner />}
         {showBrlGeoBanner && <BRLBanner />}
-        {writefullBannerVariant === 'plans-page' ? (
-          <WritefullPremiumPromoBanner
-            show={showWritefull}
-            setShow={setShowWritefull}
-            onDismiss={() => {
-              setDismissedWritefull(true)
-            }}
-          />
-        ) : (
-          <WritefullPromoBanner
-            show={showWritefull}
-            setShow={setShowWritefull}
-            onDismiss={() => {
-              setDismissedWritefull(true)
-            }}
-          />
-        )}
       </ul>
       </ul>
     </div>
     </div>
   )
   )

Разница между файлами не показана из-за своего большого размера
+ 0 - 66
services/web/frontend/js/features/project-list/components/notifications/writefull-promo-banner.tsx


+ 12 - 60
services/web/test/frontend/features/project-list/components/notifications.test.tsx

@@ -977,23 +977,19 @@ describe('<UserNotifications />', function () {
       window.metaAttributesCache = window.metaAttributesCache || new Map()
       window.metaAttributesCache = window.metaAttributesCache || new Map()
     })
     })
 
 
-    describe('when writefull-oauth-promotion split test is not enabled', function () {
+    describe('when the writefull integration is enabled', function () {
       beforeEach(function () {
       beforeEach(function () {
-        window.metaAttributesCache.set('ol-splitTestVariants', {
-          'writefull-oauth-promotion': 'default',
-        })
         window.metaAttributesCache.set('ol-user', {
         window.metaAttributesCache.set('ol-user', {
-          writefull: { enabled: false },
+          writefull: { enabled: true },
         })
         })
       })
       })
-
-      it('shows the older banner', function () {
+      it('shows the banner', function () {
         renderWithinProjectListProvider(UserNotifications)
         renderWithinProjectListProvider(UserNotifications)
         const ctaLink = screen.getByRole('link', {
         const ctaLink = screen.getByRole('link', {
-          name: 'Get Writefull for Overleaf',
+          name: 'Get Writefull Premium',
         })
         })
         expect(ctaLink.getAttribute('href')).to.equal(
         expect(ctaLink.getAttribute('href')).to.equal(
-          'https://my.writefull.com/overleaf-invite?code=OVERLEAF10'
+          'https://my.writefull.com/overleaf-invite?code=OVERLEAF10&redirect=plans'
         )
         )
       })
       })
 
 
@@ -1010,67 +1006,23 @@ describe('<UserNotifications />', function () {
       it("doesn't show the banner if it has been dismissed", function () {
       it("doesn't show the banner if it has been dismissed", function () {
         localStorage.setItem(
         localStorage.setItem(
           'has_dismissed_writefull_promo_banner',
           'has_dismissed_writefull_promo_banner',
-          new Date(Date.now() - 1000)
+          new Date(Date.now() - 500)
         )
         )
         renderWithinProjectListProvider(UserNotifications)
         renderWithinProjectListProvider(UserNotifications)
         expect(screen.queryByRole('link', { name: /Writefull/ })).to.be.null
         expect(screen.queryByRole('link', { name: /Writefull/ })).to.be.null
       })
       })
     })
     })
 
 
-    describe('when writefull-oauth-promotion split test is enabled', function () {
+    describe('when the writefull integration is not enabled', function () {
       beforeEach(function () {
       beforeEach(function () {
-        window.metaAttributesCache.set('ol-splitTestVariants', {
-          'writefull-oauth-promotion': 'enabled',
-        })
-      })
-
-      describe('when the writefull integration is enabled', function () {
-        beforeEach(function () {
-          window.metaAttributesCache.set('ol-user', {
-            writefull: { enabled: true },
-          })
-        })
-        it('shows the banner', function () {
-          renderWithinProjectListProvider(UserNotifications)
-          const ctaLink = screen.getByRole('link', {
-            name: 'Get Writefull Premium',
-          })
-          expect(ctaLink.getAttribute('href')).to.equal(
-            'https://my.writefull.com/overleaf-invite?code=OVERLEAF10&redirect=plans'
-          )
-        })
-
-        it('dismisses the banner when the close button is clicked', function () {
-          renderWithinProjectListProvider(UserNotifications)
-          screen.getByRole('link', { name: /Writefull/ })
-          const closeButton = screen.getByRole('button', { name: 'Close' })
-          fireEvent.click(closeButton)
-          expect(screen.queryByRole('link', { name: /Writefull/ })).to.be.null
-          expect(localStorage.getItem('has_dismissed_writefull_promo_banner'))
-            .to.exist
-        })
-
-        it("doesn't show the banner if it has been dismissed", function () {
-          localStorage.setItem(
-            'has_dismissed_writefull_promo_banner',
-            new Date(Date.now() - 500)
-          )
-          renderWithinProjectListProvider(UserNotifications)
-          expect(screen.queryByRole('link', { name: /Writefull/ })).to.be.null
+        window.metaAttributesCache.set('ol-user', {
+          writefull: { enabled: false },
         })
         })
       })
       })
 
 
-      describe('when the writefull integration is not enabled', function () {
-        beforeEach(function () {
-          window.metaAttributesCache.set('ol-user', {
-            writefull: { enabled: false },
-          })
-        })
-
-        it("doesn't show the banner", function () {
-          renderWithinProjectListProvider(UserNotifications)
-          expect(screen.queryByRole('link', { name: /Writefull/ })).to.be.null
-        })
+      it("doesn't show the banner", function () {
+        renderWithinProjectListProvider(UserNotifications)
+        expect(screen.queryByRole('link', { name: /Writefull/ })).to.be.null
       })
       })
     })
     })
   })
   })

Некоторые файлы не были показаны из-за большого количества измененных файлов