diff --git a/services/web/app/src/Features/Referal/ReferalController.js b/services/web/app/src/Features/Referal/ReferalController.js index 28160fa482..d0b0f64912 100644 --- a/services/web/app/src/Features/Referal/ReferalController.js +++ b/services/web/app/src/Features/Referal/ReferalController.js @@ -4,19 +4,14 @@ const SessionManager = require('../Authentication/SessionManager') module.exports = { bonus(req, res, next) { const userId = SessionManager.getLoggedInUserId(req.session) - ReferalHandler.getReferedUsers( - userId, - (err, { referedUsers, referedUserCount }) => { - if (err) { - next(err) - } else { - res.render('referal/bonus', { - title: 'bonus_please_recommend_us', - refered_users: referedUsers, - refered_user_count: referedUserCount, - }) - } + ReferalHandler.getReferedUsers(userId, (err, { referedUserCount }) => { + if (err) { + next(err) + } else { + res.render('referal/bonus', { + refered_user_count: referedUserCount, + }) } - ) + }) }, } diff --git a/services/web/app/src/infrastructure/ExpressLocals.js b/services/web/app/src/infrastructure/ExpressLocals.js index 17f375598d..4ef57eca62 100644 --- a/services/web/app/src/infrastructure/ExpressLocals.js +++ b/services/web/app/src/infrastructure/ExpressLocals.js @@ -256,30 +256,6 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) { next() }) - webRouter.use(function (req, res, next) { - res.locals.buildReferalUrl = function (referalMedium) { - let url = Settings.siteUrl - const currentUser = SessionManager.getSessionUser(req.session) - if ( - currentUser != null && - (currentUser != null ? currentUser.referal_id : undefined) != null - ) { - url += `?r=${currentUser.referal_id}&rm=${referalMedium}&rs=b` // Referal source = bonus - } - return url - } - res.locals.getReferalId = function () { - const currentUser = SessionManager.getSessionUser(req.session) - if ( - currentUser != null && - (currentUser != null ? currentUser.referal_id : undefined) != null - ) { - return currentUser.referal_id - } - } - next() - }) - webRouter.use(function (req, res, next) { res.locals.csrfToken = req != null ? req.csrfToken() : undefined next() diff --git a/services/web/app/views/layout/fat-footer-website-redesign.pug b/services/web/app/views/layout/fat-footer-website-redesign.pug index c368210591..0c845f153f 100644 --- a/services/web/app/views/layout/fat-footer-website-redesign.pug +++ b/services/web/app/views/layout/fat-footer-website-redesign.pug @@ -62,8 +62,6 @@ footer.fat-footer.hidden-print.website-redesign-fat-footer if user li a(href="/beta/participate") #{translate('join_beta_program')} - li - a(href="/user/bonus") #{translate('refer_a_friend')} .footer-section h2.footer-section-heading #{translate('help')} diff --git a/services/web/app/views/layout/fat-footer.pug b/services/web/app/views/layout/fat-footer.pug index 989116780f..1dc02a5056 100644 --- a/services/web/app/views/layout/fat-footer.pug +++ b/services/web/app/views/layout/fat-footer.pug @@ -62,8 +62,6 @@ footer.fat-footer.hidden-print if user li a(href="/beta/participate") #{translate('join_beta_program')} - li - a(href="/user/bonus") #{translate('refer_a_friend')} .footer-section h2.footer-section-heading #{translate('help')} diff --git a/services/web/app/views/referal/bonus.pug b/services/web/app/views/referal/bonus.pug index 61601d1e8e..d32b58fda6 100644 --- a/services/web/app/views/referal/bonus.pug +++ b/services/web/app/views/referal/bonus.pug @@ -1,4 +1,4 @@ -extends ../layout +extends ../layout-marketing block content .content.content-alt @@ -6,164 +6,38 @@ block content .row .col-md-8.col-md-offset-2 .card - .container-fluid(ng-controller="BonusLinksController") - .row - .col-md-12 - .page-header - h1 #{translate("help_us_spread_word")}. - - + .container-fluid .row .col-md-10.col-md-offset-1 - h2 #{translate("share_sl_to_get_rewards")} - - .row - .col-md-8.col-md-offset-2.bonus-banner - .bonus-top - - .row - .col-md-8.col-md-offset-2.bonus-banner - .title - a(href='https://twitter.com/share?text='+encodeURIComponent(translate("bonus_twitter_share_text"))+'&url='+encodeURIComponent(buildReferalUrl("t"))+'&counturl='+settings.social.twitter.counturl, target="_blank").twitter - i.fa.fa-fw.fa-2x.fa-twitter(aria-hidden="true") - | - | Tweet - - .row - .col-md-8.col-md-offset-2.bonus-banner - .title - a(href='#').facebook - i.fa.fa-fw.fa-2x.fa-facebook-square(aria-hidden="true") - | - | #{translate("post_on_facebook")} - - .row - .col-md-8.col-md-offset-2.bonus-banner - .title - a(href='mailto:?subject='+encodeURIComponent(translate("bonus_email_share_header"))+'&body='+encodeURIComponent(translate("bonus_email_share_body")+' ')+encodeURIComponent(buildReferalUrl("e")), title='Share by Email').email - i.fa.fa-fw.fa-2x.fa-envelope-open-o(aria-hidden="true") - | - | #{translate("email_us_to_your_friends")} - - .row - .col-md-8.col-md-offset-2.bonus-banner - .title - a(href='#link-modal', data-toggle="modal", ng-click="openLinkToUsModal()").link - i.fa.fa-fw.fa-2x.fa-globe(aria-hidden="true") - | - | #{translate("link_to_us")} - - .row - .col-md-10.col-md-offset-1.bonus-banner - h2.direct-link #{translate("direct_link")} - pre.text-centered #{buildReferalUrl("d")} - - .row.ab-bonus - .col-md-10.col-md-offset-1.bonus-banner - p.thanks !{translate("sl_gives_you_free_stuff_see_progress_below")} - .row.ab-bonus - .col-md-10.col-md-offset-1.bonus-banner(style="position: relative; height: 30px; margin-top: 20px;") - - for (var i = 0; i <= 10; i++) { - if (refered_user_count == i) - .number(style="left: "+i+"0%").active #{i} + p.thanks The Overleaf Bonus Program has been discontinued. + p.thanks Please contact us if you have any questions. + + if (refered_user_count > 0) + .row.ab-bonus + .col-md-10.col-md-offset-1.bonus-banner(style="position: relative; height: 30px; margin-top: 20px;") + - for (var i = 0; i <= 10; i++) { + if (refered_user_count == i) + .number(style="left: "+i+"0%").active #{i} + else + .number(style="left: "+i+"0%") #{i} + - } + + .row.ab-bonus + .col-md-10.col-md-offset-1.bonus-banner + .progress + .progress-bar.progress-bar-info(style="width: "+refered_user_count+"0%") + + .row.ab-bonus + .col-md-10.col-md-offset-1.bonus-banner(style="position: relative; height: 110px;") + .perk(style="left: 10%;", class = refered_user_count >= 1 ? "active" : "") #{translate("one_free_collab")} + .perk(style="left: 30%;", class = refered_user_count >= 3 ? "active" : "") #{translate("three_free_collab")} + .perk(style="left: 60%;", class = refered_user_count >= 6 ? "active" : "") #{translate("free_dropbox_and_history")} + #{translate("three_free_collab")} + .perk(style="left: 90%;", class = refered_user_count >= 9 ? "active" : "") #{translate("free_dropbox_and_history")} + #{translate("unlimited_collabs")} + .row   + + .row.ab-bonus + .col-md-10.col-md-offset-1.bonus-banner.bonus-status + if (refered_user_count == 1) + p.thanks You’ve introduced 1 person to #{settings.appName}. else - .number(style="left: "+i+"0%") #{i} - - } - - .row.ab-bonus - .col-md-10.col-md-offset-1.bonus-banner - .progress - if (refered_user_count == 0) - div(style="text-align: center; padding: 4px;") #{translate("spread_the_word_and_fill_bar")} - .progress-bar.progress-bar-info(style="width: "+refered_user_count+"0%") - - .row.ab-bonus - .col-md-10.col-md-offset-1.bonus-banner(style="position: relative; height: 110px;") - .perk(style="left: 10%;", class = refered_user_count >= 1 ? "active" : "") #{translate("one_free_collab")} - .perk(style="left: 30%;", class = refered_user_count >= 3 ? "active" : "") #{translate("three_free_collab")} - .perk(style="left: 60%;", class = refered_user_count >= 6 ? "active" : "") #{translate("free_dropbox_and_history")} + #{translate("three_free_collab")} - .perk(style="left: 90%;", class = refered_user_count >= 9 ? "active" : "") #{translate("free_dropbox_and_history")} + #{translate("unlimited_collabs")} - .row   - - .row.ab-bonus - .col-md-10.col-md-offset-1.bonus-banner.bonus-status - if (refered_user_count == 0) - p.thanks !{translate("you_not_introed_anyone_to_sl")} - else if (refered_user_count == 1) - p.thanks !{translate("you_introed_small_number", {numberOfPeople: refered_user_count}, ['strong'])} - else - p.thanks !{translate("you_introed_high_number", {numberOfPeople: refered_user_count}, ['strong'])} - - script(type="text/ng-template", id="BonusLinkToUsModal") - .modal-header - button.close( - type="button" - data-dismiss="modal" - ng-click="cancel()" - aria-label="Close" - ) - span(aria-hidden="true") × - h3 #{translate("link_to_sl")} - .modal-body.modal-body-share.link-modal - - p #{translate("can_link_to_sl_with_html")} - p - textarea.col-md-12(readonly=true) - #{translate("bonus_share_link_text")} - - p #{translate("thanks")}! - - - .modal-footer() - button.btn.btn-secondary( - ng-click="cancel()", - ) - span #{translate("close")} - - -block append foot-scripts - script(type="text/javascript", nonce=scriptNonce). - $(document).ready(function () { - $.ajax({dataType: "script", cache: true, url: "//connect.facebook.net/en_US/all.js"}).done(function () { - window.fbAsyncInit = function() { - FB.init({appId: '#{settings.social.facebook.appId}', xfbml: true}); - } - }); - }); - - function postToFeed() { - // calling the API ... - var obj = { - method: 'feed', - redirect_uri: '#{settings.social.facebook.redirectUri}', - link: '!{buildReferalUrl("fb")}', - picture: '#{settings.social.facebook.picture}', - name: '#{translate("bonus_facebook_name").replace(/\'/g, "\\x27")}', - caption: '#{translate("bonus_facebook_caption").replace(/\'/g, "\\x27")}', - description: '#{translate("bonus_facebook_description").replace(/\'/g, "\\x27")}' - }; - - if (typeof FB !== "undefined" && FB !== null) { - FB.ui(obj); - } - } - - script(type="text/javascript", nonce=scriptNonce, src='//platform.twitter.com/widgets.js') - - script(type="text/javascript", nonce=scriptNonce). - $(function() { - $(".twitter").click(function() { - ga('send', 'event', 'referal-button', 'clicked', "twitter") - }); - $(".email").click(function() { - ga('send', 'event', 'referal-button', 'clicked', "email") - }); - $(".facebook").click(function(e) { - ga('send', 'event', 'referal-button', 'clicked', "facebook") - postToFeed() - e.preventDefault() - }); - $(".link").click(function() { - ga('send', 'event', 'referal-button', 'clicked', "direct-link") - }); - }); + p.thanks You’ve introduced #{refered_user_count} people to #{settings.appName}. diff --git a/services/web/frontend/js/main.js b/services/web/frontend/js/main.js index 8bd5e71eb4..f2e3ae2233 100644 --- a/services/web/frontend/js/main.js +++ b/services/web/frontend/js/main.js @@ -10,7 +10,6 @@ */ import './main/token-access' // used in project/token/access import './main/event' // used in various controllers -import './main/bonus' // used in referal/bonus import './main/system-messages' // used in project/editor import './main/annual-upgrade' // used in subscriptions/upgradeToAnnual import './main/subscription/team-invite-controller' // used in subscriptions/team/invite diff --git a/services/web/frontend/js/main/bonus.js b/services/web/frontend/js/main/bonus.js deleted file mode 100644 index 6f1f4d9dc3..0000000000 --- a/services/web/frontend/js/main/bonus.js +++ /dev/null @@ -1,30 +0,0 @@ -/* eslint-disable - no-return-assign, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ -import App from '../base' -App.controller('BonusLinksController', [ - '$scope', - '$modal', - function ($scope, $modal) { - $scope.openLinkToUsModal = () => - $modal.open({ - templateUrl: 'BonusLinkToUsModal', - controller: 'BonusModalController', - }) - }, -]) - -export default App.controller('BonusModalController', [ - '$scope', - '$modalInstance', - function ($scope, $modalInstance) { - $scope.cancel = () => $modalInstance.dismiss() - }, -]) diff --git a/services/web/locales/en.json b/services/web/locales/en.json index 9428bfc7b4..b195a81f52 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -165,14 +165,6 @@ "blank_project": "Blank Project", "blocked_filename": "This file name is blocked.", "blog": "Blog", - "bonus_email_share_body": "Hey, I have been using the online LaTeX editor __appName__ recently and thought you might like to check it out.", - "bonus_email_share_header": "Online LaTeX editor you may like", - "bonus_facebook_caption": "Free Unlimited Projects and Compiles", - "bonus_facebook_description": "__appName__ is a free online LaTeX Editor. Real time collaboration like Google Docs, with Dropbox, history and auto-complete.", - "bonus_facebook_name": "__appName__ - Online LaTeX Editor", - "bonus_please_recommend_us": "Bonus - Please recommend us", - "bonus_share_link_text": "Online LaTeX Editor __appName__", - "bonus_twitter_share_text": "I’m using __appName__, the free online collaborative LaTeX editor - it’s awesome and easy to use!", "brl_discount_offer_plans_page_banner": "__flag__ Great news! We’ve applied a 50% discount to premium plans on this page for our users in Brazil. Check out the new lower prices.", "browser": "Browser", "built_in": "Built-In", @@ -186,7 +178,6 @@ "can_link_institution_email_acct_to_institution_acct": "You can now link your __email__ __appName__ account to your __institutionName__ institutional account.", "can_link_institution_email_by_clicking": "You can link your __email__ __appName__ account to your __institutionName__ account by clicking __clickText__.", "can_link_institution_email_to_login": "You can link your __email__ __appName__ account to your __institutionName__ account, which will allow you to log in to __appName__ through your institution and will reconfirm your institutional email address.", - "can_link_to_sl_with_html": "You can link to __appName__ with the following HTML:", "can_link_your_institution_acct_2": "You can now <0>link your <0>__appName__ account to your <0>__institutionName__ institutional account.", "can_now_relink_dropbox": "You can now <0>relink your Dropbox account.", "cancel": "Cancel", @@ -409,7 +400,6 @@ "dictionary": "Dictionary", "did_you_know_institution_providing_professional": "Did you know that __institutionName__ is providing <0>free __appName__ Professional features to everyone at __institutionName__?", "did_you_know_that_overleaf_offers": "Did you know that __appName__ offers group and organization-wide subscription options? Request information or a quote.", - "direct_link": "Direct Link", "disable_single_sign_on": "Disable single sign-on", "disable_sso": "Disable SSO", "disable_stop_on_first_error": "Disable “Stop on first error”", @@ -509,7 +499,6 @@ "email_or_password_wrong_try_again_or_reset": "Your email or password is incorrect. Please try again, or <0>set or reset your password.", "email_required": "Email required", "email_sent": "Email Sent", - "email_us_to_your_friends": "Email us to your friends", "emails": "Emails", "emails_and_affiliations_explanation": "Add additional email addresses to your account to access any upgrades your university or institution has, to make it easier for collaborators to find you, and to make sure you can recover your account.", "emails_and_affiliations_title": "Emails and Affiliations", @@ -761,7 +750,6 @@ "help": "Help", "help_articles_matching": "Help articles matching your subject", "help_improve_overleaf_fill_out_this_survey": "If you would like to help us improve Overleaf, please take a moment to fill out <0>this survey.", - "help_us_spread_word": "Help us spread the word about __appName__", "hide_configuration": "Hide configuration", "hide_deleted_user": "Hide deleted users", "hide_document_preamble": "Hide document preamble", @@ -1006,8 +994,6 @@ "link_to_github": "Link to your GitHub account", "link_to_github_description": "You need to authorise __appName__ to access your GitHub account to allow us to sync your projects.", "link_to_mendeley": "Link to Mendeley", - "link_to_sl": "Link to __appName__", - "link_to_us": "Link to us from your website", "link_to_zotero": "Link to Zotero", "link_your_accounts": "Link your accounts", "linked_accounts": "linked accounts", @@ -1361,7 +1347,6 @@ "popular_tags": "Popular Tags", "portal_add_affiliation_to_join": "It looks like you are already logged in to __appName__. If you have a __portalTitle__ email you can add it now.", "position": "Position", - "post_on_facebook": "Post on Facebook", "postal_code": "Postal Code", "powerful_latex_editor": "Powerful LaTeX editor", "powerful_latex_editor_and_realtime_collaboration": "Powerful LaTeX editor & real-time collaboration", @@ -1472,7 +1457,6 @@ "redirect_url": "Redirect URL", "redirecting": "Redirecting", "reduce_costs_group_licenses": "You can cut down on paperwork and reduce costs with our discounted group licenses.", - "refer_a_friend": "Refer a friend", "reference_error_relink_hint": "If this error persists, try re-linking your account here:", "reference_managers": "Reference managers", "reference_search": "Advanced reference search", @@ -1676,7 +1660,6 @@ "setup_another_account_under_a_personal_email_address": "Set up another Overleaf account under a personal email address.", "share": "Share", "share_project": "Share Project", - "share_sl_to_get_rewards": "Share __appName__ with your friends and colleagues and unlock the rewards below", "share_with_your_collabs": "Share with your collaborators", "shared_with_you": "Shared with you", "sharelatex_beta_program": "__appName__ Beta Program", @@ -1706,7 +1689,6 @@ "sitewide_option_available_info": "Users are automatically upgraded when they register or add their email address to Overleaf (domain-based enrollment or SSO).", "skip": "Skip", "skip_to_content": "Skip to content", - "sl_gives_you_free_stuff_see_progress_below": "When someone starts using __appName__ after your recommendation we’ll give you some free stuff to say thanks! Check your progress below.", "something_not_right": "Something’s not right", "something_went_wrong": "Something went wrong", "something_went_wrong_canceling_your_subscription": "Something went wrong canceling your subscription. Please contact support.", @@ -1726,7 +1708,6 @@ "sort_by_x": "Sort by __x__", "source": "Source", "spell_check": "Spell check", - "spread_the_word_and_fill_bar": "Spread the word and fill this bar up", "sso": "SSO", "sso_account_already_linked": "Account already linked to another __appName__ user", "sso_active": "SSO active", @@ -2204,10 +2185,7 @@ "you_have_been_invited_to_transfer_management_of_your_account": "You have been invited to transfer management of your account.", "you_have_been_invited_to_transfer_management_of_your_account_to": "You have been invited to transfer management of your account to __groupName__.", "you_have_been_removed_from_this_project_and_will_be_redirected_to_project_dashboard": "You have been removed from this project, and will no longer have access to it. You will be redirected to your project dashboard momentarily.", - "you_introed_high_number": " You’ve introduced <0>__numberOfPeople__ people to __appName__. Good job!", - "you_introed_small_number": " You’ve introduced <0>__numberOfPeople__ person to __appName__. Good job, but can you get some more?", "you_need_to_configure_your_sso_settings": "You need to configure and test your SSO settings before enabling SSO", - "you_not_introed_anyone_to_sl": "You’ve not introduced anyone to __appName__ yet. Get sharing!", "you_plus_1": "You + 1", "you_plus_10": "You + 10", "you_plus_6": "You + 6",