mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #5641 from overleaf/jpa-survey-notification-2
[web] implement institutional leavers survey logic in frontend only GitOrigin-RevId: e1002ee6f75ba3865c955eefa8482af0c72bb825
This commit is contained in:
parent
9f45f786cf
commit
0ee93793e3
3 changed files with 55 additions and 0 deletions
|
@ -158,6 +158,19 @@ form.row(
|
|||
div(ng-class="{'alert alert-info': reconfirmationRemoveEmail === userEmail.email}")
|
||||
+reconfirmAffiliationNotification('/user/settings')
|
||||
|
||||
tr(ng-if="showInstitutionalLeaversSurvey")
|
||||
td(colspan="3")
|
||||
div.alert.alert-info
|
||||
button.close.pull-right(ng-click="dismissInstitutionalLeaversSurvey()")
|
||||
span(aria-hidden="true") ×
|
||||
span.sr-only #{translate("close")}
|
||||
strong #{translate('limited_offer')}:
|
||||
|
|
||||
| #{translate('institutional_leavers_survey_notification')}
|
||||
|
|
||||
a.btn-inline-link(href="https://docs.google.com/forms/d/e/1FAIpQLSfYdeeoY5p1d31r5iUx1jw0O-Gd66vcsBi_Ntu3lJRMjV2EJA/viewform")
|
||||
strong #{translate('take_short_survey')}
|
||||
|
||||
tr.affiliations-table-highlighted-row(
|
||||
ng-if="!ui.showAddEmailUI && !ui.isMakingRequest"
|
||||
)
|
||||
|
|
|
@ -22,6 +22,24 @@ export default App.controller(
|
|||
$scope.reconfirmationRemoveEmail = getMeta('ol-reconfirmationRemoveEmail')
|
||||
$scope.reconfirmedViaSAML = getMeta('ol-reconfirmedViaSAML')
|
||||
|
||||
$scope.showInstitutionalLeaversSurvey = false
|
||||
$scope.dismissInstitutionalLeaversSurvey = () => {
|
||||
try {
|
||||
localStorage.setItem('hideInstitutionalLeaversSurvey', true)
|
||||
} catch (e) {}
|
||||
$scope.showInstitutionalLeaversSurvey = false
|
||||
}
|
||||
function maybeShowInstitutionalLeaversSurvey() {
|
||||
if (localStorage.getItem('hideInstitutionalLeaversSurvey')) return
|
||||
if (
|
||||
localStorage.getItem('showInstitutionalLeaversSurveyUntil') > Date.now()
|
||||
) {
|
||||
$scope.showInstitutionalLeaversSurvey = true
|
||||
}
|
||||
}
|
||||
maybeShowInstitutionalLeaversSurvey()
|
||||
|
||||
const ONE_WEEK_IN_MS = 7 * 24 * 60 * 60 * 1000
|
||||
const LOCAL_AND_DOMAIN_REGEX = /([^@]+)@(.+)/
|
||||
const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\ ".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA -Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
|
||||
|
@ -202,6 +220,28 @@ export default App.controller(
|
|||
return _monitorRequest(
|
||||
UserAffiliationsDataService.removeUserEmail(userEmail.email)
|
||||
)
|
||||
.then(() => {
|
||||
if (
|
||||
userEmail.emailHasInstitutionLicence ||
|
||||
(userEmail.affiliation && userEmail.affiliation.pastReconfirmDate)
|
||||
) {
|
||||
const stillHasLicenseAccess = $scope.userEmails.some(
|
||||
ue => ue.emailHasInstitutionLicence
|
||||
)
|
||||
if (!stillHasLicenseAccess) {
|
||||
try {
|
||||
localStorage.setItem(
|
||||
'showInstitutionalLeaversSurveyUntil',
|
||||
Date.now() + ONE_WEEK_IN_MS
|
||||
)
|
||||
maybeShowInstitutionalLeaversSurvey()
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
$scope.userEmails.push(userEmail)
|
||||
})
|
||||
}
|
||||
|
||||
$scope.resendConfirmationEmail = function (userEmail) {
|
||||
|
|
|
@ -1508,6 +1508,8 @@
|
|||
"skip_to_content": "Skip to content",
|
||||
"logging_out": "Logging out",
|
||||
"share_thoughts_on_gallery": "Share your thoughts on the Overleaf Template Gallery!",
|
||||
"institutional_leavers_survey_notification": "Provide some quick feedback to receive a 25% discount on an annual subscription!",
|
||||
"limited_offer": "Limited offer",
|
||||
"take_short_survey": "Take a short survey",
|
||||
"official": "Official",
|
||||
"template_approved_by_publisher": "This template has been approved by the publisher",
|
||||
|
|
Loading…
Reference in a new issue