diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js
index 8330ef1c12..69ac1f3e45 100644
--- a/services/web/app/src/Features/Project/ProjectController.js
+++ b/services/web/app/src/Features/Project/ProjectController.js
@@ -1115,7 +1115,8 @@ const ProjectController = {
)
// Persistent upgrade prompts
- const showHeaderUpgradePrompt =
+ // in header & in share project modal
+ const showUpgradePrompt =
Features.hasFeature('saas') &&
userId &&
!subscription &&
@@ -1194,7 +1195,7 @@ const ProjectController = {
showStopOnFirstError,
detachRole,
metadata: { viewport: false },
- showHeaderUpgradePrompt,
+ showUpgradePrompt,
})
timer.done()
}
diff --git a/services/web/app/views/project/editor/meta.pug b/services/web/app/views/project/editor/meta.pug
index ef6b6243e0..625239dd2c 100644
--- a/services/web/app/views/project/editor/meta.pug
+++ b/services/web/app/views/project/editor/meta.pug
@@ -27,7 +27,7 @@ meta(name="ol-debugPdfDetach" data-type="boolean" content=debugPdfDetach)
meta(name="ol-showNewSourceEditorOption" data-type="boolean" content=showNewSourceEditorOption)
meta(name="ol-showSymbolPalette" data-type="boolean" content=showSymbolPalette)
meta(name="ol-detachRole" data-type="string" content=detachRole)
-meta(name="ol-showHeaderUpgradePrompt" data-type="boolean" content=showHeaderUpgradePrompt)
+meta(name="ol-showUpgradePrompt" data-type="boolean" content=showUpgradePrompt)
meta(name="ol-showStopOnFirstError" data-type="boolean" content=showStopOnFirstError)
- var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {})
diff --git a/services/web/frontend/js/features/editor-navigation-toolbar/components/toolbar-header.js b/services/web/frontend/js/features/editor-navigation-toolbar/components/toolbar-header.js
index ed40bebfd7..2ed6990433 100644
--- a/services/web/frontend/js/features/editor-navigation-toolbar/components/toolbar-header.js
+++ b/services/web/frontend/js/features/editor-navigation-toolbar/components/toolbar-header.js
@@ -65,7 +65,7 @@ const ToolbarHeader = React.memo(function ToolbarHeader({
pdfViewIsOpen={pdfViewIsOpen}
/>
)}
- {window.showHeaderUpgradePrompt && }
+ {window.showUpgradePrompt && }
', function () {
fetchMock.get('/user/contacts', { contacts })
window.metaAttributesCache = new Map()
window.metaAttributesCache.set('ol-user', { allowedFreeTrial: true })
+ window.metaAttributesCache.set('ol-showUpgradePrompt', true)
})
afterEach(function () {
@@ -833,4 +834,68 @@ describe('', 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(, {
+ 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(, {
+ 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 }
+ )
+ })
})
diff --git a/services/web/test/unit/src/Project/ProjectControllerTests.js b/services/web/test/unit/src/Project/ProjectControllerTests.js
index fc0da6030d..f537c31a27 100644
--- a/services/web/test/unit/src/Project/ProjectControllerTests.js
+++ b/services/web/test/unit/src/Project/ProjectControllerTests.js
@@ -1412,7 +1412,7 @@ describe('ProjectController', function () {
})
})
- describe('persistent upgrade prompt', function () {
+ describe('upgrade prompt (on header and share project modal)', function () {
beforeEach(function () {
// default to saas enabled
this.Features.hasFeature.withArgs('saas').returns(true)
@@ -1424,14 +1424,14 @@ describe('ProjectController', function () {
it('should not show without the saas feature', function (done) {
this.Features.hasFeature.withArgs('saas').returns(false)
this.res.render = (pageName, opts) => {
- expect(opts.showHeaderUpgradePrompt).to.equal(false)
+ expect(opts.showUpgradePrompt).to.equal(false)
done()
}
this.ProjectController.loadEditor(this.req, this.res)
})
it('should show for a user without a subscription or only non-paid affiliations', function (done) {
this.res.render = (pageName, opts) => {
- expect(opts.showHeaderUpgradePrompt).to.equal(true)
+ expect(opts.showUpgradePrompt).to.equal(true)
done()
}
this.ProjectController.loadEditor(this.req, this.res)
@@ -1441,7 +1441,7 @@ describe('ProjectController', function () {
.stub()
.callsArgWith(1, null, {})
this.res.render = (pageName, opts) => {
- expect(opts.showHeaderUpgradePrompt).to.equal(false)
+ expect(opts.showUpgradePrompt).to.equal(false)
done()
}
this.ProjectController.loadEditor(this.req, this.res)
@@ -1451,7 +1451,7 @@ describe('ProjectController', function () {
.stub()
.callsArgWith(1, null, true)
this.res.render = (pageName, opts) => {
- expect(opts.showHeaderUpgradePrompt).to.equal(false)
+ expect(opts.showUpgradePrompt).to.equal(false)
done()
}
this.ProjectController.loadEditor(this.req, this.res)
@@ -1461,7 +1461,7 @@ describe('ProjectController', function () {
.stub()
.callsArgWith(1, null, true)
this.res.render = (pageName, opts) => {
- expect(opts.showHeaderUpgradePrompt).to.equal(false)
+ expect(opts.showUpgradePrompt).to.equal(false)
done()
}
this.ProjectController.loadEditor(this.req, this.res)