Merge pull request #35478 from overleaf/oa-paywall-ctas

[web] Paywall CTAs

GitOrigin-RevId: 26703fe008926db67473a43ef64addca0e23accd
This commit is contained in:
Olzhas Askar
2026-09-17 11:30:50 +00:00
committed by Copybot
parent 76e004b3e2
commit d29eefaa64
25 changed files with 132 additions and 24 deletions
@@ -0,0 +1,42 @@
import { render, screen, fireEvent } from '@testing-library/react'
import sinon from 'sinon'
import { SplitTestProvider } from '@/shared/context/split-test-context'
import { OwnerPaywallPrompt } from '@/features/history/components/change-list/owner-paywall-prompt'
function renderPrompt() {
return render(
<SplitTestProvider>
<OwnerPaywallPrompt />
</SplitTestProvider>
)
}
describe('<OwnerPaywallPrompt/>', function () {
let openStub: sinon.SinonStub
beforeEach(function () {
// StartFreeTrialButton opens the plans page in a new tab on click
openStub = sinon.stub(window, 'open')
})
afterEach(function () {
openStub.restore()
window.metaAttributesCache.delete('ol-splitTestVariants')
})
it('shows the "Start free trial" CTA and free-trial refresh message', function () {
window.metaAttributesCache.set('ol-splitTestVariants', {})
renderPrompt()
fireEvent.click(screen.getByRole('button', { name: 'Start free trial' }))
screen.getByText('Please refresh this page after starting your free trial.')
})
it('shows the "Subscribe now" CTA and subscribe refresh message when paywall-cta-trial-ineligible is enabled', function () {
window.metaAttributesCache.set('ol-splitTestVariants', {
'paywall-cta-trial-ineligible': 'enabled',
})
renderPrompt()
fireEvent.click(screen.getByRole('button', { name: 'Subscribe now' }))
screen.getByText('Please refresh this page after subscribing.')
})
})
@@ -0,0 +1,34 @@
import { render, screen } from '@testing-library/react'
import { SplitTestProvider } from '@/shared/context/split-test-context'
import { CompileTimeWarningUpgradePromptInner } from '@/features/pdf-preview/components/compile-time-warning-upgrade-prompt-inner'
function renderPrompt() {
return render(
<SplitTestProvider>
<CompileTimeWarningUpgradePromptInner
handleDismissWarning={() => {}}
segmentation={{}}
/>
</SplitTestProvider>
)
}
describe('<CompileTimeWarningUpgradePromptInner/>', function () {
afterEach(function () {
window.metaAttributesCache.delete('ol-splitTestVariants')
})
it('shows the "Start free trial" CTA by default', function () {
window.metaAttributesCache.set('ol-splitTestVariants', {})
renderPrompt()
screen.getByRole('button', { name: 'Start free trial' })
})
it('shows the "Subscribe now" CTA when paywall-cta-trial-ineligible is enabled', function () {
window.metaAttributesCache.set('ol-splitTestVariants', {
'paywall-cta-trial-ineligible': 'enabled',
})
renderPrompt()
screen.getByRole('button', { name: 'Subscribe now' })
})
})