diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index 47cc292062..f9dd6358e8 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -38,6 +38,7 @@ const UserController = require('../User/UserController') const AnalyticsManager = require('../Analytics/AnalyticsManager') const Modules = require('../../infrastructure/Modules') const SplitTestHandler = require('../SplitTests/SplitTestHandler') +const SplitTestV2Handler = require('../SplitTests/SplitTestV2Handler') const { getNewLogsUIVariantForUser } = require('../Helpers/NewLogsUI') const _ssoAvailable = (affiliation, session, linkedInstitutionIds) => { @@ -725,23 +726,36 @@ const ProjectController = { } ) }, + sharingModalSplitTest(cb) { + SplitTestV2Handler.assignInLocalsContext( + res, + userId, + 'project-share-modal-paywall', + err => { + cb(err, null) + } + ) + }, }, - (err, results) => { + ( + err, + { + project, + user, + subscription, + isTokenMember, + brandVariation, + pdfCachingFeatureFlag, + } + ) => { if (err != null) { OError.tag(err, 'error getting details for project page') return next(err) } - const { project } = results - const { user } = results - const { subscription } = results - const { brandVariation } = results - const { pdfCachingFeatureFlag } = results - const anonRequestToken = TokenAccessHandler.getRequestToken( req, projectId ) - const { isTokenMember } = results const allowedImageNames = ProjectHelper.getAllowedImagesForUser( sessionUser ) diff --git a/services/web/app/src/Features/SplitTests/SplitTestV2Handler.js b/services/web/app/src/Features/SplitTests/SplitTestV2Handler.js index 8526746e5a..6d32618809 100644 --- a/services/web/app/src/Features/SplitTests/SplitTestV2Handler.js +++ b/services/web/app/src/Features/SplitTests/SplitTestV2Handler.js @@ -81,6 +81,14 @@ async function getAssignment(userId, splitTestName, options) { } } +async function assignInLocalsContext(res, userId, splitTestName, options) { + const assignment = await getAssignment(userId, splitTestName, options) + if (!res.locals.splitTestVariants) { + res.locals.splitTestVariants = {} + } + res.locals.splitTestVariants[splitTestName] = assignment.variant +} + async function _getAssignmentMetadata(userId, splitTest) { const currentVersion = splitTest.getCurrentVersion() const phase = currentVersion.phase @@ -171,7 +179,9 @@ async function _getUser(id) { module.exports = { getAssignment: callbackify(getAssignment), + assignInLocalsContext: callbackify(assignInLocalsContext), promises: { getAssignment, + assignInLocalsContext, }, } diff --git a/services/web/app/views/layout.pug b/services/web/app/views/layout.pug index aa73207736..3b602f385b 100644 --- a/services/web/app/views/layout.pug +++ b/services/web/app/views/layout.pug @@ -85,6 +85,7 @@ html( }) //- Expose some settings globally to the frontend meta(name="ol-ExposedSettings" data-type="json" content=ExposedSettings) + meta(name="ol-splitTestVariants" data-type="json" content=splitTestVariants || {}) if (typeof(settings.algolia) != "undefined") meta(name="ol-algolia" data-type="json" content={ diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index b68ef99f1b..bc5208ce6e 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -199,6 +199,7 @@ "navigate_log_source": "", "navigation": "", "need_to_upgrade_for_more_collabs": "", + "need_to_upgrade_for_more_collabs_variant": "", "new_file": "", "new_folder": "", "new_name": "", diff --git a/services/web/frontend/js/features/share-project-modal/components/add-collaborators-upgrade-content-default.js b/services/web/frontend/js/features/share-project-modal/components/add-collaborators-upgrade-content-default.js new file mode 100644 index 0000000000..cc7727202b --- /dev/null +++ b/services/web/frontend/js/features/share-project-modal/components/add-collaborators-upgrade-content-default.js @@ -0,0 +1,49 @@ +import Icon from '../../../shared/components/icon' +import { Trans, useTranslation } from 'react-i18next' + +export default function AddCollaboratorsUpgradeContentDefault() { + const { t } = useTranslation() + + return ( + <> +
+
+
-
{user.allowedFreeTrial ? (
diff --git a/services/web/frontend/js/features/share-project-modal/components/link-sharing.js b/services/web/frontend/js/features/share-project-modal/components/link-sharing.js
index c20fa81214..5f77f88051 100644
--- a/services/web/frontend/js/features/share-project-modal/components/link-sharing.js
+++ b/services/web/frontend/js/features/share-project-modal/components/link-sharing.js
@@ -7,6 +7,7 @@ import { useShareProjectContext } from './share-project-modal'
import { setProjectAccessLevel } from '../utils/api'
import CopyLink from '../../../shared/components/copy-link'
import { useProjectContext } from '../../../shared/context/project-context'
+import * as eventTracking from '../../../infrastructure/event-tracking'
export default function LinkSharing() {
const [inflight, setInflight] = useState(false)
@@ -75,7 +76,10 @@ function PrivateSharing({ setAccessLevel, inflight }) {
type="button"
bsStyle="link"
className="btn-inline-link"
- onClick={() => setAccessLevel('tokenBased')}
+ onClick={() => {
+ setAccessLevel('tokenBased')
+ eventTracking.sendMB('link-sharing-click')
+ }}
disabled={inflight}
>
+
+