2018-11-05 05:06:39 -05:00
|
|
|
define(['base'], App =>
|
|
|
|
App.controller('LeftHandMenuPromoController', function(
|
|
|
|
$scope,
|
2020-02-03 09:11:36 -05:00
|
|
|
UserAffiliationsDataService,
|
|
|
|
eventTracking
|
2018-11-05 05:06:39 -05:00
|
|
|
) {
|
|
|
|
$scope.hasProjects = window.data.projects.length > 0
|
|
|
|
$scope.userHasNoSubscription = window.userHasNoSubscription
|
|
|
|
|
2020-02-03 09:11:36 -05:00
|
|
|
$scope.upgradeSubscription = function() {
|
|
|
|
eventTracking.send('subscription-funnel', 'project-page', 'upgrade')
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.share = function() {
|
|
|
|
eventTracking.send('subscription-funnel', 'project-page', 'sharing')
|
|
|
|
}
|
|
|
|
|
2018-11-05 05:06:39 -05:00
|
|
|
const _userHasNoAffiliation = function() {
|
|
|
|
$scope.userEmails = []
|
|
|
|
$scope.userAffiliations = []
|
|
|
|
return UserAffiliationsDataService.getUserEmails().then(function(emails) {
|
|
|
|
$scope.userEmails = emails
|
2019-01-24 06:47:35 -05:00
|
|
|
$scope.userAffiliations = emails
|
|
|
|
.filter(email => email.affiliation)
|
|
|
|
.map(email => email.affiliation)
|
|
|
|
$scope.userOnPayingUniversity = $scope.userAffiliations.some(
|
2020-02-20 11:07:54 -05:00
|
|
|
affiliation => affiliation.licence && affiliation.licence !== 'free'
|
2019-01-24 06:47:35 -05:00
|
|
|
)
|
2018-11-05 05:06:39 -05:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-01-24 06:47:35 -05:00
|
|
|
_userHasNoAffiliation()
|
2018-11-05 05:06:39 -05:00
|
|
|
}))
|