diff --git a/services/web/app/src/Features/Project/ProjectListController.js b/services/web/app/src/Features/Project/ProjectListController.js index 99ae52984a..e6235b17aa 100644 --- a/services/web/app/src/Features/Project/ProjectListController.js +++ b/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 showBrlGeoBanner = false let recommendedCurrency diff --git a/services/web/frontend/js/features/project-list/components/notifications/user-notifications.tsx b/services/web/frontend/js/features/project-list/components/notifications/user-notifications.tsx index 4d02a01faf..d8ea25250e 100644 --- a/services/web/frontend/js/features/project-list/components/notifications/user-notifications.tsx +++ b/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 ReconfirmationInfo from './groups/affiliation/reconfirmation-info' import GroupsAndEnterpriseBanner from './groups-and-enterprise-banner' -import WritefullPromoBanner from './writefull-promo-banner' import WritefullPremiumPromoBanner from './writefull-premium-promo-banner' import GroupSsoSetupSuccess from './groups/group-sso-setup-success' import INRBanner from './ads/inr-banner' @@ -13,14 +12,8 @@ import importOverleafModules from '../../../../../macros/import-overleaf-module. import customLocalStorage from '../../../../infrastructure/local-storage' import { sendMB } from '../../../../infrastructure/event-tracking' import classNames from 'classnames' -import { isSplitTestEnabled } from '@/utils/splitTestUtils' import BRLBanner from './ads/brl-banner' -const isChromium = () => - (window.navigator as any).userAgentData?.brands?.some( - (item: { brand: string }) => item.brand === 'Chromium' - ) - type Subscription = { groupId: string groupName: string @@ -45,9 +38,6 @@ function UserNotifications() { ) const showInrGeoBanner = getMeta('ol-showInrGeoBanner', false) const showBrlGeoBanner = getMeta('ol-showBrlGeoBanner', false) - const writefullOauthPromotionSplitTestEnabled = isSplitTestEnabled( - 'writefull-oauth-promotion' - ) const user = getMeta('ol-user') // Temporary workaround to prevent also showing groups/enterprise banner @@ -60,20 +50,14 @@ function UserNotifications() { } 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) { sendMB('promo-prompt', { location: 'dashboard-banner', 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 hasWritefullExtensionAlreadyInstalled = - window.writefull?.type === 'extension' - const usesWritefullIntegration = - writefullOauthPromotionSplitTestEnabled || user?.writefull?.enabled - const writefullBannerVariant = - hasWritefullExtensionAlreadyInstalled || usesWritefullIntegration - ? 'plans-page' - : 'chrome-store' - return (
{!showWritefull && !dismissedWritefull && } {showInrGeoBanner && } + + { + setDismissedWritefull(true) + }} + /> {showBrlGeoBanner && } - {writefullBannerVariant === 'plans-page' ? ( - { - setDismissedWritefull(true) - }} - /> - ) : ( - { - setDismissedWritefull(true) - }} - /> - )}
) diff --git a/services/web/frontend/js/features/project-list/components/notifications/writefull-promo-banner.tsx b/services/web/frontend/js/features/project-list/components/notifications/writefull-promo-banner.tsx deleted file mode 100644 index b44cbe1a5b..0000000000 --- a/services/web/frontend/js/features/project-list/components/notifications/writefull-promo-banner.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import { memo, useCallback } from 'react' -import Notification from './notification' -import { sendMB } from '../../../../infrastructure/event-tracking' -import customLocalStorage from '../../../../infrastructure/local-storage' -import getMeta from '@/utils/meta' - -const eventSegmentation = { - location: 'dashboard-banner', - page: '/project', - name: 'writefull', -} - -function WritefullPromoBanner({ - show, - setShow, - onDismiss, -}: { - show: boolean - setShow: (value: boolean) => void - onDismiss: () => void -}) { - const newNotificationStyle = getMeta( - 'ol-newNotificationStyle', - false - ) as boolean - const handleOpenLink = useCallback(() => { - sendMB('promo-click', eventSegmentation) - }, []) - - const handleClose = useCallback(() => { - customLocalStorage.setItem('has_dismissed_writefull_promo_banner', true) - setShow(false) - sendMB('promo-dismiss', eventSegmentation) - onDismiss() - }, [setShow, onDismiss]) - - if (!show) { - return null - } - - return ( - - Get 10% off Writefull premium—AI-based language feedback and - TeXGPT to help you write great papers faster. Use code:{' '} - OVERLEAF10 - - } - action={ - - - Get Writefull for Overleaf - - } - /> - ) -} - -export default memo(WritefullPromoBanner) diff --git a/services/web/test/frontend/features/project-list/components/notifications.test.tsx b/services/web/test/frontend/features/project-list/components/notifications.test.tsx index b88f220b1e..b8454b210d 100644 --- a/services/web/test/frontend/features/project-list/components/notifications.test.tsx +++ b/services/web/test/frontend/features/project-list/components/notifications.test.tsx @@ -977,23 +977,19 @@ describe('', function () { 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 () { - window.metaAttributesCache.set('ol-splitTestVariants', { - 'writefull-oauth-promotion': 'default', - }) window.metaAttributesCache.set('ol-user', { - writefull: { enabled: false }, + writefull: { enabled: true }, }) }) - - it('shows the older banner', function () { + it('shows the banner', function () { renderWithinProjectListProvider(UserNotifications) const ctaLink = screen.getByRole('link', { - name: 'Get Writefull for Overleaf', + name: 'Get Writefull Premium', }) 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('', function () { it("doesn't show the banner if it has been dismissed", function () { localStorage.setItem( 'has_dismissed_writefull_promo_banner', - new Date(Date.now() - 1000) + new Date(Date.now() - 500) ) renderWithinProjectListProvider(UserNotifications) 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 () { - window.metaAttributesCache.set('ol-splitTestVariants', { - 'writefull-oauth-promotion': 'enabled', + window.metaAttributesCache.set('ol-user', { + writefull: { enabled: false }, }) }) - 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 - }) - }) - - 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 }) }) })