diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js
index 4682372fb5..191033e3bd 100644
--- a/services/web/app/src/Features/Project/ProjectController.js
+++ b/services/web/app/src/Features/Project/ProjectController.js
@@ -44,6 +44,7 @@ const TutorialHandler = require('../Tutorial/TutorialHandler')
const UserUpdater = require('../User/UserUpdater')
const { checkUserPermissions } =
require('../Authorization/PermissionsManager').promises
+const UserGetter = require('../User/UserGetter')
/**
* @typedef {import("./types").GetProjectsRequest} GetProjectsRequest
@@ -400,6 +401,8 @@ const _ProjectController = {
brandVariationId: 1,
overleaf: 1,
tokens: 1,
+ tokenAccessReadAndWrite_refs: 1, // used for link sharing analytics
+ collaberator_refs: 1, // used for link sharing analytics
}),
userIsMemberOfGroupSubscription: sessionUser
? LimitationsManager.promises.userIsMemberOfGroupSubscription(
@@ -546,12 +549,24 @@ const _ProjectController = {
logger.error({ err }, 'failed to update split test info in session')
)
if (userId) {
+ const ownerFeatures = await UserGetter.promises.getUserFeatures(
+ project.owner_ref
+ )
+ const projectOpenedSegmentation = {
+ projectId: project._id,
+ // temporary link sharing segmentation:
+ linkSharingWarning: linkSharingChanges?.variant,
+ namedEditors: project.collaberator_refs?.length || 0,
+ tokenEditors: project.tokenAccessReadAndWrite_refs?.length || 0,
+ planLimit: ownerFeatures?.collaborators || 0,
+ }
+ projectOpenedSegmentation.exceedAtLimit =
+ projectOpenedSegmentation.namedEditors >=
+ projectOpenedSegmentation.planLimit
AnalyticsManager.recordEventForUserInBackground(
userId,
'project-opened',
- {
- projectId: project._id,
- }
+ projectOpenedSegmentation
)
User.updateOne(
{ _id: new ObjectId(userId) },
@@ -619,12 +634,6 @@ const _ProjectController = {
? 'project/ide-react-detached'
: 'project/ide-react'
- const assignLink = await SplitTestHandler.promises.getAssignmentForUser(
- project.owner_ref,
- 'link-sharing-warning'
- )
- const linkSharingWarning = assignLink.variant === 'active'
-
res.render(template, {
title: project.name,
priority_title: true,
@@ -698,7 +707,7 @@ const _ProjectController = {
optionalPersonalAccessToken,
hasTrackChangesFeature: Features.hasFeature('track-changes'),
projectTags,
- linkSharingWarning,
+ linkSharingWarning: linkSharingChanges.variant === 'active',
})
timer.done()
} catch (err) {
diff --git a/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/add-collaborators-upgrade.tsx b/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/add-collaborators-upgrade.tsx
index 2ea44180cc..ace42c327a 100644
--- a/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/add-collaborators-upgrade.tsx
+++ b/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/add-collaborators-upgrade.tsx
@@ -4,14 +4,19 @@ import Notification from '@/shared/components/notification'
import { upgradePlan } from '../../../../main/account-upgrade'
import { linkSharingEnforcementDate } from '../../utils/link-sharing'
import { useProjectContext } from '@/shared/context/project-context'
+import { useUserContext } from '@/shared/context/user-context'
+import { sendMB } from '@/infrastructure/event-tracking'
+import StartFreeTrialButton from '@/shared/components/start-free-trial-button'
export default function AddCollaboratorsUpgrade() {
const { t } = useTranslation()
const { features } = useProjectContext()
+ const user = useUserContext()
return (
}
/>
diff --git a/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/collaborators-limit-upgrade.tsx b/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/collaborators-limit-upgrade.tsx
index 6cf9c37f3c..a088fe3ce2 100644
--- a/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/collaborators-limit-upgrade.tsx
+++ b/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/collaborators-limit-upgrade.tsx
@@ -3,10 +3,13 @@ import { useTranslation } from 'react-i18next'
import Notification from '@/shared/components/notification'
import { upgradePlan } from '@/main/account-upgrade'
import { useProjectContext } from '@/shared/context/project-context'
+import { useUserContext } from '@/shared/context/user-context'
+import StartFreeTrialButton from '@/shared/components/start-free-trial-button'
export default function CollaboratorsLimitUpgrade() {
const { t } = useTranslation()
const { features } = useProjectContext()
+ const user = useUserContext()
return (
@@ -22,13 +25,25 @@ export default function CollaboratorsLimitUpgrade() {
}
action={
-
+ user.allowedFreeTrial ? (
+
+ {t('upgrade')}
+
+ ) : (
+
+ )
}
/>
diff --git a/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/editor-over-limit-modal-content.tsx b/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/editor-over-limit-modal-content.tsx
index 6b36f8538e..a67d8ea906 100644
--- a/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/editor-over-limit-modal-content.tsx
+++ b/services/web/frontend/js/features/share-project-modal/components/restricted-link-sharing/editor-over-limit-modal-content.tsx
@@ -1,6 +1,7 @@
import { Button, Modal } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import { linkSharingEnforcementDate } from '../../utils/link-sharing'
+import { sendMB } from '@/infrastructure/event-tracking'
type EditorOverLimitModalContentProps = {
handleHide: () => void
@@ -32,10 +33,25 @@ export default function EditorOverLimitModalContent({
href="/blog/changes-to-project-sharing"
target="_blank"
rel="noreferrer"
+ onClick={() => {
+ sendMB('notification-click', {
+ name: 'link-sharing-collaborator-limit',
+ button: 'learn',
+ })
+ }}
>
{t('learn_more')}
-