mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 07:39:02 +02:00
Implement new users micro survey for project dashboard page on react and non-react version (#11347)
* Implement new users micro survey for project dashboard page on react and non-react version * Add 'new-users-micro-survey-click' and 'new-users-micro-survey-prompt' new event for the analytics GitOrigin-RevId: 9aabe931987638b38995d404aa90ac4d40b2f3b5
This commit is contained in:
@@ -556,6 +556,26 @@ const ProjectController = {
|
||||
}
|
||||
)
|
||||
},
|
||||
newUsersMicroSurveyAssignment(cb) {
|
||||
SplitTestHandler.getAssignment(
|
||||
req,
|
||||
res,
|
||||
'new-users-micro-survey',
|
||||
(err, assignment) => {
|
||||
if (err) {
|
||||
logger.error(
|
||||
{ err },
|
||||
'failed to get "new-users-micro-survey" split test assignment'
|
||||
)
|
||||
|
||||
const defaultAssignment = { variant: 'default' }
|
||||
cb(null, defaultAssignment)
|
||||
} else {
|
||||
cb(null, assignment)
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
survey(cb) {
|
||||
SurveyHandler.getSurvey(userId, (err, survey) => {
|
||||
if (err) {
|
||||
@@ -578,6 +598,7 @@ const ProjectController = {
|
||||
user,
|
||||
userEmailsData,
|
||||
groupsAndEnterpriseBannerAssignment,
|
||||
newUsersMicroSurveyAssignment,
|
||||
userIsMemberOfGroupSubscription,
|
||||
} = results
|
||||
|
||||
@@ -718,6 +739,16 @@ const ProjectController = {
|
||||
!userIsMemberOfGroupSubscription &&
|
||||
!hasPaidAffiliation
|
||||
|
||||
const SEVEN_DAYS = 1000 * 60 * 60 * 24 * 7
|
||||
|
||||
const isUserLessThanSevenDaysOld =
|
||||
user.signUpDate && Date.now() - user.signUpDate.getTime() < SEVEN_DAYS
|
||||
|
||||
const showNewUsersMicroSurvey =
|
||||
Features.hasFeature('saas') &&
|
||||
newUsersMicroSurveyAssignment.variant === 'enabled' &&
|
||||
isUserLessThanSevenDaysOld
|
||||
|
||||
ProjectController._injectProjectUsers(projects, (error, projects) => {
|
||||
if (error != null) {
|
||||
return next(error)
|
||||
@@ -745,6 +776,7 @@ const ProjectController = {
|
||||
showGroupsAndEnterpriseBanner,
|
||||
groupsAndEnterpriseBannerVariant:
|
||||
groupsAndEnterpriseBannerAssignment.variant,
|
||||
showNewUsersMicroSurvey,
|
||||
}
|
||||
|
||||
const paidUser =
|
||||
|
||||
Reference in New Issue
Block a user