From 50c9de6178ba3ce3fcc4e61ca21b59d37be9ab46 Mon Sep 17 00:00:00 2001 From: Mathias Jakobsen Date: Fri, 2 May 2025 10:27:30 +0100 Subject: [PATCH] Merge pull request #25262 from overleaf/mj-project-search-signup-date-promo [web] Only show full-project-search promotion to older users GitOrigin-RevId: 086d904d2f78c2eba30e1db37ac8eb3c606f118f --- .../components/full-project-search-button.tsx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/components/full-project-search-button.tsx b/services/web/frontend/js/features/source-editor/components/full-project-search-button.tsx index 6244067fc3..e4e77c5859 100644 --- a/services/web/frontend/js/features/source-editor/components/full-project-search-button.tsx +++ b/services/web/frontend/js/features/source-editor/components/full-project-search-button.tsx @@ -11,6 +11,9 @@ import { Overlay, Popover } from 'react-bootstrap-5' import Close from '@/shared/components/close' import useTutorial from '@/shared/hooks/promotions/use-tutorial' import { useEditorContext } from '@/shared/context/editor-context' +import getMeta from '@/utils/meta' + +const PROMOTION_SIGNUP_CUT_OFF_DATE = new Date('2025-04-22T00:00:00Z') export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => { const view = useCodeMirrorViewContext() @@ -29,6 +32,17 @@ export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => { name: 'full-project-search-promotion', }) + let isEligibleForPromotion = true + const signUpDateString = getMeta('ol-user')?.signUpDate + if (!signUpDateString) { + isEligibleForPromotion = false + } else { + const signupDate = new Date(signUpDateString) + if (signupDate > PROMOTION_SIGNUP_CUT_OFF_DATE) { + isEligibleForPromotion = false + } + } + const openFullProjectSearch = useCallback(() => { setProjectSearchIsOpen(true) closeSearchPanel(view) @@ -46,10 +60,15 @@ export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => { location: 'search-form', }) openFullProjectSearch() - if (!hasCompletedTutorial) { + if (!hasCompletedTutorial && isEligibleForPromotion) { completeTutorial({ action: 'complete', event: 'promo-click' }) } - }, [completeTutorial, openFullProjectSearch, hasCompletedTutorial]) + }, [ + completeTutorial, + openFullProjectSearch, + hasCompletedTutorial, + isEligibleForPromotion, + ]) return ( <> @@ -65,7 +84,7 @@ export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => { /> - {!hasCompletedTutorial && ( + {!hasCompletedTutorial && isEligibleForPromotion && (