mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Clean up link sharing upgrade prompt test and keep the default variant
GitOrigin-RevId: d34ed081bbc61dfc74a7117c0ba633db4b5a0bad
This commit is contained in:
parent
4a84922a2f
commit
29fbc253fd
6 changed files with 1 additions and 145 deletions
|
@ -996,21 +996,6 @@ const ProjectController = {
|
|||
}
|
||||
)
|
||||
},
|
||||
linkSharingUpgradePromptAssignment(cb) {
|
||||
SplitTestHandler.getAssignment(
|
||||
req,
|
||||
res,
|
||||
'link-sharing-upgrade-prompt',
|
||||
(error, assignment) => {
|
||||
// do not fail editor load if assignment fails
|
||||
if (error) {
|
||||
cb(null, { variant: 'default' })
|
||||
} else {
|
||||
cb(null, assignment)
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
trackPdfDownloadAssignment(cb) {
|
||||
SplitTestHandler.getAssignment(req, res, 'track-pdf-download', () => {
|
||||
// We'll pick up the assignment from the res.locals assignment.
|
||||
|
|
|
@ -496,7 +496,6 @@
|
|||
"please_set_main_file": "",
|
||||
"plus_upgraded_accounts_receive": "",
|
||||
"premium_feature": "",
|
||||
"premium_makes_collab_easier_with_features": "",
|
||||
"premium_plan_label": "",
|
||||
"press_shortcut_to_open_advanced_reference_search": "",
|
||||
"priority_support": "",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { useCallback, useState } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Button, Col, Row } from 'react-bootstrap'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { Trans } from 'react-i18next'
|
||||
import Tooltip from '../../../shared/components/tooltip'
|
||||
import Icon from '../../../shared/components/icon'
|
||||
import { useShareProjectContext } from './share-project-modal'
|
||||
|
@ -10,9 +10,6 @@ import CopyLink from '../../../shared/components/copy-link'
|
|||
import { useProjectContext } from '../../../shared/context/project-context'
|
||||
import * as eventTracking from '../../../infrastructure/event-tracking'
|
||||
import { useUserContext } from '../../../shared/context/user-context'
|
||||
import StartFreeTrialButton from '../../../shared/components/start-free-trial-button'
|
||||
import { useSplitTestContext } from '../../../shared/context/split-test-context'
|
||||
import getMeta from '../../../utils/meta'
|
||||
|
||||
export default function LinkSharing({ canAddCollaborators }) {
|
||||
const [inflight, setInflight] = useState(false)
|
||||
|
@ -129,7 +126,6 @@ function TokenBasedSharing({ setAccessLevel, inflight, canAddCollaborators }) {
|
|||
<span> </span>
|
||||
<LinkSharingInfo />
|
||||
</Col>
|
||||
<LinkSharingUpgradePrompt canAddCollaborators={canAddCollaborators} />
|
||||
<Col xs={12} className="access-token-display-area">
|
||||
<div className="access-token-wrapper">
|
||||
<strong>
|
||||
|
@ -267,46 +263,3 @@ function LinkSharingInfo() {
|
|||
</Tooltip>
|
||||
)
|
||||
}
|
||||
|
||||
function LinkSharingUpgradePrompt({ canAddCollaborators }) {
|
||||
const [startedFreeTrial, setStartedFreeTrial] = useState(false)
|
||||
const { t } = useTranslation()
|
||||
const { splitTestVariants } = useSplitTestContext()
|
||||
const linkSharingUpgradePromptActive =
|
||||
splitTestVariants['link-sharing-upgrade-prompt'] === 'active'
|
||||
const showUpgradePrompt = getMeta('ol-showUpgradePrompt')
|
||||
|
||||
const showLinkSharingUpgradePrompt =
|
||||
linkSharingUpgradePromptActive && showUpgradePrompt && canAddCollaborators
|
||||
|
||||
if (!showLinkSharingUpgradePrompt) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Col xs={12} className="link-sharing-upgrade-prompt">
|
||||
<p>
|
||||
<Trans
|
||||
i18nKey="premium_makes_collab_easier_with_features"
|
||||
components={[<b />, <b />, <b />]} // eslint-disable-line react/jsx-key
|
||||
/>
|
||||
</p>
|
||||
<StartFreeTrialButton
|
||||
buttonProps={{ bsStyle: 'success' }}
|
||||
handleClick={() => setStartedFreeTrial(true)}
|
||||
source="link-sharing"
|
||||
/>
|
||||
</Col>
|
||||
{startedFreeTrial && (
|
||||
<p className="small teaser-refresh-label">
|
||||
{t('refresh_page_after_starting_free_trial')}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
LinkSharingUpgradePrompt.propTypes = {
|
||||
canAddCollaborators: PropTypes.bool,
|
||||
}
|
||||
|
|
|
@ -45,22 +45,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
.link-sharing-upgrade-prompt {
|
||||
background-color: @ol-blue-gray-0;
|
||||
margin-top: @margin-sm;
|
||||
padding: @padding-sm 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 3px;
|
||||
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
margin-right: 15px;
|
||||
color: @ol-blue-gray-3;
|
||||
font-size: 14px;
|
||||
line-height: 23px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.public-access-level.public-access-level--notice {
|
||||
|
|
|
@ -1083,7 +1083,6 @@
|
|||
"powerful_latex_editor_and_realtime_collaboration_info": "Spell check, intelligent autocomplete, syntax highlighting, dozens of color themes, vim and emacs bindings, help with LaTeX warnings and error messages, and more. Everyone always has the latest version, and you can see your collaborators’ cursors and changes in real time.",
|
||||
"premium_feature": "Premium feature",
|
||||
"premium_features": "Premium features",
|
||||
"premium_makes_collab_easier_with_features": "<0>Overleaf Premium</0> makes collaboration with others easier with features such as <1>track changes</1> and <2>full document history.</2>",
|
||||
"premium_plan_label": "You’re using <b>Overleaf Premium</b>",
|
||||
"presentation": "Presentation",
|
||||
"press_and_awards": "Press & awards",
|
||||
|
|
|
@ -834,68 +834,4 @@ describe('<ShareProjectModal/>', function () {
|
|||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('displays link sharing upgrade prompt', async function () {
|
||||
window.metaAttributesCache.set('ol-splitTestVariants', {
|
||||
...window.metaAttributesCache.get('ol-splitTestVariants'),
|
||||
'link-sharing-upgrade-prompt': 'active',
|
||||
})
|
||||
|
||||
// render when collaborators can still be added
|
||||
renderWithEditorContext(<ShareProjectModal {...modalProps} />, {
|
||||
scope: {
|
||||
project: {
|
||||
...project,
|
||||
publicAccesLevel: 'tokenBased',
|
||||
features: {
|
||||
collaborators: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await screen.findByText('Link sharing is on')
|
||||
|
||||
// text on share project upgrade prompt
|
||||
await screen.findByText(
|
||||
'makes collaboration with others easier with features such as',
|
||||
{ exact: false }
|
||||
)
|
||||
})
|
||||
|
||||
it('not displaying link sharing upgrade prompt when can not add collaborators', async function () {
|
||||
window.metaAttributesCache.set('ol-splitTestVariants', {
|
||||
...window.metaAttributesCache.get('ol-splitTestVariants'),
|
||||
'link-sharing-upgrade-prompt': 'active',
|
||||
})
|
||||
|
||||
// render when collaborators can still be added
|
||||
renderWithEditorContext(<ShareProjectModal {...modalProps} />, {
|
||||
scope: {
|
||||
project: {
|
||||
...project,
|
||||
publicAccesLevel: 'tokenBased',
|
||||
features: {
|
||||
collaborators: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await screen.findByText('Link sharing is on')
|
||||
|
||||
// text on share project upgrade prompt should not be visible
|
||||
expect(
|
||||
screen.queryByText(
|
||||
'makes collaboration with others easier with features such as',
|
||||
{ exact: false }
|
||||
)
|
||||
).to.be.null
|
||||
|
||||
// show add more collaborators text
|
||||
await screen.findByText(
|
||||
'You need to upgrade your account to add more collaborators',
|
||||
{ exact: false }
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue