2014-07-08 07:02:26 -04:00
|
|
|
define [
|
|
|
|
"base"
|
2014-09-04 14:03:04 -04:00
|
|
|
"libs/recurly-3.0.5"
|
|
|
|
], (App, recurly) ->
|
2014-09-05 10:47:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
App.factory "MultiCurrencyPricing", () ->
|
|
|
|
|
2014-10-13 09:10:15 -04:00
|
|
|
currencyCode = window.recomendedCurrency
|
2014-07-21 06:33:10 -04:00
|
|
|
|
2014-10-13 11:13:31 -04:00
|
|
|
return {
|
|
|
|
currencyCode:currencyCode
|
|
|
|
plans:
|
|
|
|
USD:
|
|
|
|
symbol: "$"
|
|
|
|
student:
|
|
|
|
monthly: "$8"
|
|
|
|
annual: "$80"
|
|
|
|
collaborator:
|
|
|
|
monthly: "$15"
|
|
|
|
annual: "$180"
|
|
|
|
professional:
|
|
|
|
monthly: "$30"
|
|
|
|
annual: "$360"
|
|
|
|
|
|
|
|
EUR:
|
|
|
|
symbol: "€"
|
|
|
|
student:
|
|
|
|
monthly: "€7"
|
|
|
|
annual: "€70"
|
|
|
|
collaborator:
|
2014-10-15 11:21:45 -04:00
|
|
|
monthly: "€14"
|
|
|
|
annual: "€168"
|
2014-10-13 11:13:31 -04:00
|
|
|
professional:
|
2014-10-15 11:21:45 -04:00
|
|
|
monthly: "€28"
|
|
|
|
annual: "€336"
|
2014-10-13 11:13:31 -04:00
|
|
|
|
|
|
|
GBP:
|
|
|
|
symbol: "£"
|
|
|
|
student:
|
|
|
|
monthly: "£6"
|
|
|
|
annual: "£60"
|
|
|
|
collaborator:
|
2014-10-15 11:21:45 -04:00
|
|
|
monthly: "£12"
|
|
|
|
annual: "£144"
|
2014-10-13 11:13:31 -04:00
|
|
|
professional:
|
2014-10-15 11:21:45 -04:00
|
|
|
monthly: "£24"
|
|
|
|
annual: "£288"
|
2014-10-13 11:13:31 -04:00
|
|
|
}
|
2014-09-05 10:47:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-13 09:10:15 -04:00
|
|
|
App.controller "PlansController", ($scope, $modal, event_tracking, abTestManager, MultiCurrencyPricing, $http) ->
|
2014-09-05 10:47:08 -04:00
|
|
|
|
2014-10-15 11:21:45 -04:00
|
|
|
|
|
|
|
$scope.plans = MultiCurrencyPricing.plans
|
|
|
|
$scope.currencyCode = MultiCurrencyPricing.currencyCode
|
|
|
|
|
|
|
|
|
2014-09-05 10:47:08 -04:00
|
|
|
buckets = [
|
2014-09-26 06:33:34 -04:00
|
|
|
{ bucketName:"7d", queryString: "_free_trial_7_days", trial_len:7 }
|
2014-09-05 10:47:08 -04:00
|
|
|
{ bucketName:"14d", queryString: "_free_trial_14_days", trial_len:14 }
|
|
|
|
]
|
2014-10-15 11:21:45 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2014-09-05 10:47:08 -04:00
|
|
|
bucket = abTestManager.getABTestBucket "trial_len", buckets
|
|
|
|
|
|
|
|
$scope.trial_len = bucket.trial_len
|
|
|
|
$scope.planQueryString = bucket.queryString
|
|
|
|
|
|
|
|
$scope.ui =
|
|
|
|
view: "monthly"
|
|
|
|
|
2014-10-15 11:21:45 -04:00
|
|
|
|
2014-09-04 14:03:04 -04:00
|
|
|
|
|
|
|
$scope.changeCurreny = (newCurrency)->
|
|
|
|
$scope.currencyCode = newCurrency
|
|
|
|
|
2014-07-21 06:33:10 -04:00
|
|
|
$scope.signUpNowClicked = (plan, annual)->
|
2014-10-15 11:21:45 -04:00
|
|
|
if multiCurrencyBucket?
|
|
|
|
abTestManager.processTestWithStep("multi_currency", multiCurrencyBucket.bucketName, 0)
|
|
|
|
|
2014-07-21 06:33:10 -04:00
|
|
|
if $scope.ui.view == "annual"
|
|
|
|
plan = "#{plan}_annual"
|
2014-09-02 06:07:21 -04:00
|
|
|
else
|
|
|
|
abTestManager.processTestWithStep("trial_len", bucket.bucketName, 0)
|
2014-07-21 06:33:10 -04:00
|
|
|
event_tracking.send 'subscription-funnel', 'sign_up_now_button', plan
|
|
|
|
|
|
|
|
$scope.switchToMonthly = ->
|
|
|
|
$scope.ui.view = "monthly"
|
|
|
|
event_tracking.send 'subscription-funnel', 'plans-page', 'monthly-prices'
|
|
|
|
|
|
|
|
$scope.switchToStudent = ->
|
|
|
|
$scope.ui.view = "student"
|
|
|
|
event_tracking.send 'subscription-funnel', 'plans-page', 'student-prices'
|
|
|
|
|
|
|
|
$scope.switchToAnnual = ->
|
|
|
|
$scope.ui.view = "annual"
|
|
|
|
event_tracking.send 'subscription-funnel', 'plans-page', 'student-prices'
|
2014-07-25 07:32:26 -04:00
|
|
|
|
|
|
|
$scope.openGroupPlanModal = () ->
|
|
|
|
$modal.open {
|
|
|
|
templateUrl: "groupPlanModalTemplate"
|
|
|
|
}
|