Explorar o código

Merge pull request #18927 from overleaf/dp-remove-grammarly-promo

Remove Grammarly advert

GitOrigin-RevId: 6652cfafc47f8a42efc9acc1745a50e4ab8cc208
David %!s(int64=2) %!d(string=hai) anos
pai
achega
c342dc70a5

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

@@ -163,7 +163,6 @@
   "checking_project_github_status": "",
   "checking_project_github_status": "",
   "choose_a_custom_color": "",
   "choose_a_custom_color": "",
   "choose_from_group_members": "",
   "choose_from_group_members": "",
-  "claim_discount": "",
   "clear_cached_files": "",
   "clear_cached_files": "",
   "clear_search": "",
   "clear_search": "",
   "click_here_to_view_sl_in_lng": "",
   "click_here_to_view_sl_in_lng": "",

+ 0 - 107
services/web/frontend/js/features/source-editor/components/grammarly-advert.tsx

@@ -1,107 +0,0 @@
-import { useCallback, useEffect, useState } from 'react'
-import { Button } from 'react-bootstrap'
-import { useTranslation } from 'react-i18next'
-import Notification from '@/shared/components/notification'
-import useRemindMeLater from '@/shared/hooks/use-remind-me-later'
-import GrammarlyLogo from '@/shared/svgs/grammarly-logo'
-import * as eventTracking from '../../../infrastructure/event-tracking'
-import useWaitForGrammarlyCheck from '@/shared/hooks/use-wait-for-grammarly-check'
-import getMeta from '@/utils/meta'
-
-export default function GrammarlyAdvert() {
-  const { isOverleaf } = getMeta('ol-ExposedSettings')
-
-  const [show, setShow] = useState(false)
-  const { t } = useTranslation()
-
-  // grammarly can take some time to load, we should assume its installed and hide until we know for sure
-  const grammarlyInstalled = useWaitForGrammarlyCheck({ initialState: false })
-
-  const { stillDissmissed, remindThemLater, saveDismissed } =
-    useRemindMeLater('grammarly_advert')
-
-  useEffect(() => {
-    const showGrammarlyAdvert = grammarlyInstalled && !stillDissmissed
-
-    if (showGrammarlyAdvert) {
-      eventTracking.sendMB('grammarly-advert-shown')
-      setShow(true)
-    }
-  }, [stillDissmissed, grammarlyInstalled, setShow])
-
-  const handleDismiss = useCallback(() => {
-    setShow(false)
-    saveDismissed()
-    eventTracking.sendMB('grammarly-advert-dismissed')
-  }, [saveDismissed])
-
-  const handleClickClaim = useCallback(() => {
-    eventTracking.sendMB('promo-click', {
-      location: 'notification',
-      name: 'grammarly-advert',
-      type: 'click',
-    })
-
-    saveDismissed()
-    setShow(false)
-
-    window.open(
-      'https://grammarly.go2cloud.org/aff_c?offer_id=373&aff_id=142242'
-    )
-  }, [saveDismissed])
-
-  const handleLater = useCallback(() => {
-    eventTracking.sendMB('promo-click', {
-      location: 'notification',
-      name: 'grammarly-advert',
-      type: 'pause',
-    })
-    setShow(false)
-    remindThemLater()
-  }, [remindThemLater])
-
-  if (!isOverleaf || !show) {
-    return null
-  }
-
-  const actions = (
-    <div>
-      <Button
-        bsStyle={null}
-        className="btn-secondary"
-        onClick={handleClickClaim}
-      >
-        {t('claim_discount')}
-      </Button>
-      <Button className="btn-bg-ghost" bsStyle={null} onClick={handleLater}>
-        {t('maybe_later')}
-      </Button>
-    </div>
-  )
-
-  return (
-    <Notification
-      action={actions}
-      ariaLive="polite"
-      className="editor-notification ol-overlay hidden-xs-container"
-      content={
-        <div>
-          <p>
-            Get 25% off Grammarly Premium with this exclusive offer for Overleaf
-            users.
-          </p>
-        </div>
-      }
-      customIcon={
-        <div>
-          <GrammarlyLogo width="50" height="50" background="#fff" />
-        </div>
-      }
-      isActionBelowContent
-      isDismissible
-      onDismiss={handleDismiss}
-      title="Love Grammarly? Then you're in luck!"
-      type="offer"
-    />
-  )
-}

+ 0 - 2
services/web/frontend/js/features/source-editor/components/source-editor.tsx

@@ -3,7 +3,6 @@ import { FullSizeLoadingSpinner } from '../../../shared/components/loading-spinn
 import withErrorBoundary from '../../../infrastructure/error-boundary'
 import withErrorBoundary from '../../../infrastructure/error-boundary'
 import { ErrorBoundaryFallback } from '../../../shared/components/error-boundary-fallback'
 import { ErrorBoundaryFallback } from '../../../shared/components/error-boundary-fallback'
 import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
 import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
-import GrammarlyAdvert from './grammarly-advert'
 
 
 const editorPromotions = importOverleafModules('editorPromotions') as {
 const editorPromotions = importOverleafModules('editorPromotions') as {
   import: { default: ElementType }
   import: { default: ElementType }
@@ -21,7 +20,6 @@ function SourceEditor() {
       {editorPromotions.map(({ import: { default: Component }, path }) => (
       {editorPromotions.map(({ import: { default: Component }, path }) => (
         <Component key={path} />
         <Component key={path} />
       ))}
       ))}
-      <GrammarlyAdvert />
       <CodeMirrorEditor />
       <CodeMirrorEditor />
     </Suspense>
     </Suspense>
   )
   )

+ 0 - 1
services/web/frontend/stylesheets/app/editor.less

@@ -713,7 +713,6 @@ CodeMirror
   }
   }
 }
 }
 
 
-.grammarly-advert,
 .legacy-editor-warning {
 .legacy-editor-warning {
   width: 500px;
   width: 500px;
 
 

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

@@ -238,7 +238,6 @@
   "choose_from_group_members": "Choose from group members",
   "choose_from_group_members": "Choose from group members",
   "choose_your_plan": "Choose your plan",
   "choose_your_plan": "Choose your plan",
   "city": "City",
   "city": "City",
-  "claim_discount": "Claim discount",
   "clear_cached_files": "Clear cached files",
   "clear_cached_files": "Clear cached files",
   "clear_search": "clear search",
   "clear_search": "clear search",
   "clear_sessions": "Clear Sessions",
   "clear_sessions": "Clear Sessions",