diff --git a/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee b/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee index 530f41e2c0..7cebfdf535 100644 --- a/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee +++ b/services/web/app/coffee/Features/Subscription/SubscriptionController.coffee @@ -57,6 +57,7 @@ module.exports = SubscriptionController = plan_code: req.query.planCode currency: currency plan:plan + showStudentPlan: req.query.ssp recurlyConfig: JSON.stringify currency: currency subdomain: Settings.apis.recurly.subdomain diff --git a/services/web/app/coffee/infrastructure/GeoIpLookup.coffee b/services/web/app/coffee/infrastructure/GeoIpLookup.coffee index 54b8c89731..a49627d0cb 100644 --- a/services/web/app/coffee/infrastructure/GeoIpLookup.coffee +++ b/services/web/app/coffee/infrastructure/GeoIpLookup.coffee @@ -6,13 +6,20 @@ logger = require("logger-sharelatex") currencyMappings = { "GB":"GBP" "US":"USD" + "CH":"CHF" + "NZ":"NZD" + "AU":"AUD" + "DK":"DKK" + "NO":"NOK" + "CA":"CAD" + "SE":"SEK" } # Countries which would likely prefer Euro's -EuroCountries = ["AT", "BE", "BG", "HR", "CY", "CZ", -"DK", "EE", "FI", "FR", "DE", "EL", "HU", "IE", +EuroCountries = ["AT", "BE", "BG", "HR", "CY", "CZ", +"EE", "FI", "FR", "DE", "EL", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", -"RO", "SK", "SI", "ES", "SE"] +"RO", "SK", "SI", "ES"] _.each EuroCountries, (country)-> currencyMappings[country] = "EUR" diff --git a/services/web/app/views/project/editor/dropbox.jade b/services/web/app/views/project/editor/dropbox.jade index 7cc425ccef..5aa2e1b44b 100644 --- a/services/web/app/views/project/editor/dropbox.jade +++ b/services/web/app/views/project/editor/dropbox.jade @@ -25,8 +25,8 @@ script(type="text/ng-template", id="dropboxModalTemplate") strong Dropbox/sharelatex/{{ project.name }} div.text-center(ng-hide="dbState.hasDropboxFeature") p #{translate("need_to_upgrade_for_dropbox")} - p - a.btn.btn-info(ng-click="startFreeTrial('dropbox')") #{translate("start_free_trial")} + p(ng-controller="FreeTrialModalController") + a.btn(ng-click="startFreeTrial('dropbox')", ng-class="buttonClass") #{translate("start_free_trial")} p.small(ng-show="startedFreeTrial") | #{translate("refresh_page_after_starting_free_trial")} diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index ef67ee81b4..6d59fd0584 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -99,7 +99,7 @@ div.full-size.pdf(ng-controller="PdfController") p a.btn.btn-info( href - ng-click="startFreeTrial('compile-timeout')" + ng-click="hello('compile-timeout')" ) #{translate("start_free_trial")} diff --git a/services/web/app/views/project/editor/share.jade b/services/web/app/views/project/editor/share.jade index 7f48a3ebdd..83e4c52f38 100644 --- a/services/web/app/views/project/editor/share.jade +++ b/services/web/app/views/project/editor/share.jade @@ -68,8 +68,8 @@ script(type='text/ng-template', id='shareProjectModalTemplate') ) #{translate("share")} div.text-center(ng-hide="canAddCollaborators") p #{translate("need_to_upgrade_for_more_collabs")}. - p - a.btn.btn-info(href, ng-click="startFreeTrial('projectMembers')") #{translate("start_free_trial")} + p(ng-controller="FreeTrialModalController") + a.btn(href, ng-click="startFreeTrial('projectMembers')", ng-class="buttonClass") #{translate("start_free_trial")} p.small(ng-show="startedFreeTrial") | #{translate("refresh_page_after_starting_free_trial")}. diff --git a/services/web/app/views/project/editor/track-changes.jade b/services/web/app/views/project/editor/track-changes.jade index aad08a0576..10f4070dee 100644 --- a/services/web/app/views/project/editor/track-changes.jade +++ b/services/web/app/views/project/editor/track-changes.jade @@ -2,9 +2,10 @@ div#trackChanges(ng-show="ui.view == 'track-changes'") .upgrade-prompt(ng-show="!project.features.versioning") .message(ng-show="project.owner._id == user.id") p #{translate("need_to_upgrade_for_history")} - p - a.btn.btn-info( + p(ng-controller="FreeTrialModalController") + a.btn( href + ng-class="buttonClass" ng-click="startFreeTrial('track-changes')" ) #{translate("start_free_trial")} p.small(ng-show="startedFreeTrial") #{translate("refresh_page_after_starting_free_trial")} diff --git a/services/web/app/views/subscriptions/new.jade b/services/web/app/views/subscriptions/new.jade index d954f32f2b..78ad380d59 100644 --- a/services/web/app/views/subscriptions/new.jade +++ b/services/web/app/views/subscriptions/new.jade @@ -34,6 +34,12 @@ block content .col-md-3.col-md-pull-6 + if showStudentPlan == 'true' + a.btn-primary.btn.plansPageStudentLink( + href, + ng-click="switchToStudent()" + ) #{translate("half_price_student")} + .card.card-first .paymentPageFeatures .page-header @@ -80,7 +86,7 @@ block content Recurly.buildSubscriptionForm(recurlySubscriptionFormConfig); window.ab = [ - {step:1, bucket:"eu-eu", testName:"multi_currency"}, - {step:1, bucket:"eu-usd", testName:"multi_currency"} + {step:1, bucket:"red", testName:"button_color"}, + {step:1, bucket:"blue", testName:"button_color"} ] diff --git a/services/web/app/views/subscriptions/successful_subscription.jade b/services/web/app/views/subscriptions/successful_subscription.jade index a9c4699b10..7047e7c8ac 100644 --- a/services/web/app/views/subscriptions/successful_subscription.jade +++ b/services/web/app/views/subscriptions/successful_subscription.jade @@ -35,11 +35,9 @@ block content script(type="text/javascript"). window.ab = [ - {step:2, bucket:"eu-eu", testName:"multi_currency"}, - {step:2, bucket:"eu-usd", testName:"multi_currency"}, - - {step:1, bucket:"eu-eu", testName:"multi_currency_editor"}, - {step:1, bucket:"eu-usd", testName:"multi_currency_editor"} - + {step:1, bucket:"student_control", testName:"editor_plan"}, + {step:1, bucket:"collab_test", testName:"editor_plan"}, + {step:2, bucket:"blue", testName:"button_color"}, + {step:2, bucket:"red", testName:"button_color"} ] \ No newline at end of file diff --git a/services/web/app/views/view_templates/bonus_templates.jade b/services/web/app/views/view_templates/bonus_templates.jade index e96f387137..a75c0ad284 100644 --- a/services/web/app/views/view_templates/bonus_templates.jade +++ b/services/web/app/views/view_templates/bonus_templates.jade @@ -28,7 +28,7 @@ script(type="text/ng-template", id="BonusLinkToUsModal") div.text-center(ng-hide="dbState.hasDropboxFeature") p You need to upgrade your account to link to dropbox. p - a.btn.btn-info(ng-click="startFreeTrial('dropbox')") Start Free Trial + a.btn(ng-click="startFreeTrial('dropbox')", ng-class="buttonClass") Start Free Trial p.small(ng-show="startedFreeTrial") | Please refresh this page after starting your free trial. diff --git a/services/web/config/settings.defaults.coffee b/services/web/config/settings.defaults.coffee index 07ae5b6357..1ed03e4269 100644 --- a/services/web/config/settings.defaults.coffee +++ b/services/web/config/settings.defaults.coffee @@ -99,7 +99,7 @@ module.exports = apiKey: "" subdomain: "" geoIpLookup: - url: "https://freegeoip.net/json/" + url: "http://localhost:8080/json" templates: user_id: process.env.TEMPLATES_USER_ID or "5395eb7aad1f29a88756c7f2" diff --git a/services/web/public/coffee/analytics/AbTestingManager.coffee b/services/web/public/coffee/analytics/AbTestingManager.coffee index 01c8127195..2c01a88a6c 100644 --- a/services/web/public/coffee/analytics/AbTestingManager.coffee +++ b/services/web/public/coffee/analytics/AbTestingManager.coffee @@ -2,8 +2,23 @@ define [ "base" "libs/md5" ], (App) -> - + oldKeys = [ + "sl_abt_multi_currency_editor_eu-eu" + "sl_abt_multi_currency_eu-eu" + "sl_abt_multi_currency_editor_eu-usd" + "sl_abt_multi_currency_eu-usd" + "sl_abt_trial_len_14d" + "sl_abt_trial_len_7d" + "sl_abt_trial_len_30d" + "sl_utt" + "sl_utt_trial_len" + "sl_utt_multi_currency" + ] + App.factory "abTestManager", ($http, ipCookie) -> + + _.each oldKeys, (oldKey)-> + ipCookie.remove(oldKey) _buildCookieKey = (testName, bucket)-> key = "sl_abt_#{testName}_#{bucket}" diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index 75bdf68cae..03658f9f07 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -27,6 +27,7 @@ define [ "directives/rightClick" "filters/formatDate" "main/event-tracking" + "main/account-upgrade" ], ( App FileTreeManager @@ -38,7 +39,8 @@ define [ PdfManager BinaryFilesManager ) -> - App.controller "IdeController", ($scope, $timeout, ide, abTestManager) -> + + App.controller "IdeController", ($scope, $timeout, ide) -> # Don't freak out if we're already in an apply callback $scope.$originalApply = $scope.$apply $scope.$apply = (fn = () ->) -> @@ -64,11 +66,7 @@ define [ $scope.chat = {} - $scope.startFreeTrial = (source) -> - ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source) - window.open("/user/subscription/new?planCode=student_free_trial_7_days") - $scope.startedFreeTrial = true - + window._ide = ide ide.project_id = $scope.project_id = window.project_id diff --git a/services/web/public/coffee/main/account-upgrade.coffee b/services/web/public/coffee/main/account-upgrade.coffee new file mode 100644 index 0000000000..df3f6e9724 --- /dev/null +++ b/services/web/public/coffee/main/account-upgrade.coffee @@ -0,0 +1,27 @@ +define [ + "base" +], (App) -> + App.controller "FreeTrialModalController", ($scope, abTestManager)-> + + buttonColorBuckets = [ + { bucketName:"red", btnClass:"primary"} + { bucketName:"blue", btnClass:"info"} + ] + + buttonColorBucket = abTestManager.getABTestBucket "button_color", buttonColorBuckets + abTestManager.processTestWithStep("button_color", buttonColorBucket.bucketName, 0) + $scope.buttonClass = "btn-#{buttonColorBucket.btnClass}" + + + $scope.startFreeTrial = (source) -> + + testBuckets = [ + { bucketName:"student_control", planName:"student"} + { bucketName:"collab_test", planName:"collaborator"} + ] + + editorPlanBucket = abTestManager.getABTestBucket "editor_plan", testBuckets + abTestManager.processTestWithStep("editor_plan", editorPlanBucket.bucketName, 0) + ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source) + window.open("/user/subscription/new?planCode=#{editorPlanBucket.planName}_free_trial_7_days&ssp=#{editorPlanBucket.planName == 'collaborator'}") + $scope.startedFreeTrial = true \ No newline at end of file diff --git a/services/web/public/coffee/main/new-subscription.coffee b/services/web/public/coffee/main/new-subscription.coffee index 6d7d542817..f607cd3435 100644 --- a/services/web/public/coffee/main/new-subscription.coffee +++ b/services/web/public/coffee/main/new-subscription.coffee @@ -7,16 +7,8 @@ define [ $scope.currencyCode = MultiCurrencyPricing.currencyCode $scope.plans = MultiCurrencyPricing.plans - - if MultiCurrencyPricing.currencyCode != "USD" - currencyBuckets = [ - { bucketName:"eu-eu", currency:MultiCurrencyPricing.currencyCode} - { bucketName:"eu-usd", currency:"USD"} - ] - multiCurrencyBucket = abTestManager.getABTestBucket "multi_currency", currencyBuckets - $scope.currencyCode = multiCurrencyBucket.currency - abTestManager.processTestWithStep("multi_currency_editor", multiCurrencyBucket.bucketName, 0) - - $scope.changeCurrency = (newCurrency)-> - window.location = "/user/subscription/new?planCode=#{window.plan_code}¤cy=#{newCurrency}" \ No newline at end of file + window.location = "/user/subscription/new?planCode=#{window.plan_code}¤cy=#{newCurrency}" + + $scope.switchToStudent = ()-> + window.location = "/user/subscription/new?planCode=student¤cy=#{$scope.currencyCode}" \ No newline at end of file diff --git a/services/web/public/coffee/main/plans.coffee b/services/web/public/coffee/main/plans.coffee index d94869e4d3..4f21c4b5a8 100644 --- a/services/web/public/coffee/main/plans.coffee +++ b/services/web/public/coffee/main/plans.coffee @@ -46,29 +46,111 @@ define [ professional: monthly: "£24" annual: "£288" + + SEK: + symbol: "kr" + student: + monthly: "60 kr" + annual: "600 kr" + collaborator: + monthly: "110 kr" + annual: "1320 kr" + professional: + monthly: "220 kr" + annual: "2640 kr" + CAD: + symbol: "$" + student: + monthly: "$9" + annual: "$90" + collaborator: + monthly: "$17" + annual: "$204" + professional: + monthly: "$34" + annual: "$408" + + NOK: + symbol: "kr" + student: + monthly: "60 kr" + annual: "600 kr" + collaborator: + monthly: "110 kr" + annual: "1320 kr" + professional: + monthly: "220 kr" + annual: "2640 kr" + + DKK: + symbol: "kr" + student: + monthly: "50 kr" + annual: "500 kr" + collaborator: + monthly: "90 kr" + annual: "1080 kr" + professional: + monthly: "180 kr" + annual: "2160 kr" + + AUD: + symbol: "$" + student: + monthly: "$10" + annual: "$100" + collaborator: + monthly: "$18" + annual: "$216" + professional: + monthly: "$35" + annual: "$420" + + NZD: + symbol: "$" + student: + monthly: "$10" + annual: "$100" + collaborator: + monthly: "$18" + annual: "$216" + professional: + monthly: "$35" + annual: "$420" + + CHF: + symbol: "Fr" + student: + monthly: "Fr 8" + annual: "Fr 80" + collaborator: + monthly: "Fr 15" + annual: "Fr 180" + professional: + monthly: "Fr 30" + annual: "Fr 360" + + SGD: + symbol: "$" + student: + monthly: "$12" + annual: "$120" + collaborator: + monthly: "$20" + annual: "$240" + professional: + monthly: "$40" + annual: "$480" } App.controller "PlansController", ($scope, $modal, event_tracking, abTestManager, MultiCurrencyPricing, $http) -> - $scope.plans = MultiCurrencyPricing.plans $scope.currencyCode = MultiCurrencyPricing.currencyCode - - - if MultiCurrencyPricing.currencyCode != "USD" - currencyBuckets = [ - { bucketName:"eu-eu", currency:MultiCurrencyPricing.currencyCode} - { bucketName:"eu-usd", currency:"USD"} - ] - multiCurrencyBucket = abTestManager.getABTestBucket "multi_currency", currencyBuckets - $scope.currencyCode = multiCurrencyBucket.currency - - - $scope.trial_len = 7 $scope.planQueryString = '_free_trial_7_days' @@ -76,14 +158,10 @@ define [ view: "monthly" - $scope.changeCurreny = (newCurrency)-> $scope.currencyCode = newCurrency $scope.signUpNowClicked = (plan, annual)-> - if multiCurrencyBucket? - abTestManager.processTestWithStep("multi_currency", multiCurrencyBucket.bucketName, 0) - if $scope.ui.view == "annual" plan = "#{plan}_annual" diff --git a/services/web/public/stylesheets/app/plans.less b/services/web/public/stylesheets/app/plans.less index 9324393bda..777a4400c3 100644 --- a/services/web/public/stylesheets/app/plans.less +++ b/services/web/public/stylesheets/app/plans.less @@ -91,6 +91,11 @@ } } +.plansPageStudentLink { + margin-left: 20px; + margin-top: 20px; +} +