plans.coffee 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. define [
  2. "base"
  3. "libs/recurly-3.0.5"
  4. ], (App, recurly) ->
  5. App.factory "MultiCurrencyPricing", () ->
  6. currencyCode = window.recomendedCurrency
  7. return {
  8. currencyCode:currencyCode
  9. heron:
  10. USD:
  11. student:
  12. monthly: "$6"
  13. annual: "$60"
  14. collaborator:
  15. monthly: "$12"
  16. annual: "$144"
  17. EUR:
  18. student:
  19. monthly: "€5"
  20. annual: "€50"
  21. collaborator:
  22. monthly: "€11"
  23. annual: "€132"
  24. GBP:
  25. student:
  26. monthly: "£5"
  27. annual: "£50"
  28. collaborator:
  29. monthly: "£10"
  30. annual: "£120"
  31. SEK:
  32. student:
  33. monthly: "45 kr"
  34. annual: "450 kr"
  35. collaborator:
  36. monthly: "90 kr"
  37. annual: "1080 kr"
  38. CAD:
  39. student:
  40. monthly: "$7"
  41. annual: "$70"
  42. collaborator:
  43. monthly: "$14"
  44. annual: "$168"
  45. NOK:
  46. student:
  47. monthly: "45 kr"
  48. annual: "450 kr"
  49. collaborator:
  50. monthly: "90 kr"
  51. annual: "1080 kr"
  52. DKK:
  53. student:
  54. monthly: "40 kr"
  55. annual: "400 kr"
  56. collaborator:
  57. monthly: "70 kr"
  58. annual: "840 kr"
  59. AUD:
  60. student:
  61. monthly: "$8"
  62. annual: "$80"
  63. collaborator:
  64. monthly: "$15"
  65. annual: "$180"
  66. NZD:
  67. student:
  68. monthly: "$8"
  69. annual: "$80"
  70. collaborator:
  71. monthly: "$15"
  72. annual: "$180"
  73. CHF:
  74. student:
  75. monthly: "Fr 6"
  76. annual: "Fr 60"
  77. collaborator:
  78. monthly: "Fr 12"
  79. annual: "Fr 144"
  80. SGD:
  81. student:
  82. monthly: "$8"
  83. annual: "$80"
  84. collaborator:
  85. monthly: "$16"
  86. annual: "$192"
  87. ibis:
  88. USD:
  89. student:
  90. monthly: "$10"
  91. annual: "$100"
  92. collaborator:
  93. monthly: "$18"
  94. annual: "$216"
  95. EUR:
  96. student:
  97. monthly: "€9"
  98. annual: "€90"
  99. collaborator:
  100. monthly: "€17"
  101. annual: "€204"
  102. GBP:
  103. student:
  104. monthly: "£7"
  105. annual: "£70"
  106. collaborator:
  107. monthly: "£14"
  108. annual: "£168"
  109. SEK:
  110. student:
  111. monthly: "75 kr"
  112. annual: "750 kr"
  113. collaborator:
  114. monthly: "140 kr"
  115. annual: "1680 kr"
  116. CAD:
  117. student:
  118. monthly: "$12"
  119. annual: "$120"
  120. collaborator:
  121. monthly: "$22"
  122. annual: "$264"
  123. NOK:
  124. student:
  125. monthly: "75 kr"
  126. annual: "750 kr"
  127. collaborator:
  128. monthly: "140 kr"
  129. annual: "1680 kr"
  130. DKK:
  131. student:
  132. monthly: "68 kr"
  133. annual: "680 kr"
  134. collaborator:
  135. monthly: "110 kr"
  136. annual: "1320 kr"
  137. AUD:
  138. student:
  139. monthly: "$13"
  140. annual: "$130"
  141. collaborator:
  142. monthly: "$22"
  143. annual: "$264"
  144. NZD:
  145. student:
  146. monthly: "$14"
  147. annual: "$140"
  148. collaborator:
  149. monthly: "$22"
  150. annual: "$264"
  151. CHF:
  152. student:
  153. monthly: "Fr 10"
  154. annual: "Fr 100"
  155. collaborator:
  156. monthly: "Fr 18"
  157. annual: "Fr 216"
  158. SGD:
  159. student:
  160. monthly: "$14"
  161. annual: "$140"
  162. collaborator:
  163. monthly: "$25"
  164. annual: "$300"
  165. plans:
  166. USD:
  167. symbol: "$"
  168. student:
  169. monthly: "$8"
  170. annual: "$80"
  171. collaborator:
  172. monthly: "$15"
  173. annual: "$180"
  174. professional:
  175. monthly: "$30"
  176. annual: "$360"
  177. EUR:
  178. symbol: "€"
  179. student:
  180. monthly: "€7"
  181. annual: "€70"
  182. collaborator:
  183. monthly: "€14"
  184. annual: "€168"
  185. professional:
  186. monthly: "€28"
  187. annual: "€336"
  188. GBP:
  189. symbol: "£"
  190. student:
  191. monthly: "£6"
  192. annual: "£60"
  193. collaborator:
  194. monthly: "£12"
  195. annual: "£144"
  196. professional:
  197. monthly: "£24"
  198. annual: "£288"
  199. SEK:
  200. symbol: "kr"
  201. student:
  202. monthly: "60 kr"
  203. annual: "600 kr"
  204. collaborator:
  205. monthly: "110 kr"
  206. annual: "1320 kr"
  207. professional:
  208. monthly: "220 kr"
  209. annual: "2640 kr"
  210. CAD:
  211. symbol: "$"
  212. student:
  213. monthly: "$9"
  214. annual: "$90"
  215. collaborator:
  216. monthly: "$17"
  217. annual: "$204"
  218. professional:
  219. monthly: "$34"
  220. annual: "$408"
  221. NOK:
  222. symbol: "kr"
  223. student:
  224. monthly: "60 kr"
  225. annual: "600 kr"
  226. collaborator:
  227. monthly: "110 kr"
  228. annual: "1320 kr"
  229. professional:
  230. monthly: "220 kr"
  231. annual: "2640 kr"
  232. DKK:
  233. symbol: "kr"
  234. student:
  235. monthly: "50 kr"
  236. annual: "500 kr"
  237. collaborator:
  238. monthly: "90 kr"
  239. annual: "1080 kr"
  240. professional:
  241. monthly: "180 kr"
  242. annual: "2160 kr"
  243. AUD:
  244. symbol: "$"
  245. student:
  246. monthly: "$10"
  247. annual: "$100"
  248. collaborator:
  249. monthly: "$18"
  250. annual: "$216"
  251. professional:
  252. monthly: "$35"
  253. annual: "$420"
  254. NZD:
  255. symbol: "$"
  256. student:
  257. monthly: "$10"
  258. annual: "$100"
  259. collaborator:
  260. monthly: "$18"
  261. annual: "$216"
  262. professional:
  263. monthly: "$35"
  264. annual: "$420"
  265. CHF:
  266. symbol: "Fr"
  267. student:
  268. monthly: "Fr 8"
  269. annual: "Fr 80"
  270. collaborator:
  271. monthly: "Fr 15"
  272. annual: "Fr 180"
  273. professional:
  274. monthly: "Fr 30"
  275. annual: "Fr 360"
  276. SGD:
  277. symbol: "$"
  278. student:
  279. monthly: "$12"
  280. annual: "$120"
  281. collaborator:
  282. monthly: "$20"
  283. annual: "$240"
  284. professional:
  285. monthly: "$40"
  286. annual: "$480"
  287. }
  288. App.controller "PlansController", ($scope, $modal, event_tracking, abTestManager, MultiCurrencyPricing, $http, sixpack) ->
  289. $scope.showPlans = false
  290. $scope.plansVariant = 'default'
  291. $scope.shouldABTestPlans = window.shouldABTestPlans
  292. if $scope.shouldABTestPlans
  293. sixpack.participate 'plans-1610', ['default', 'heron', 'ibis'], (chosenVariation, rawResponse)->
  294. $scope.plansVariant = chosenVariation
  295. event_tracking.sendMB 'plans-page', {plans_variant: chosenVariation}
  296. if chosenVariation in ['heron', 'ibis']
  297. # overwrite student plans with alternative
  298. for currency, _v of $scope.plans
  299. $scope.plans[currency]['student'] = MultiCurrencyPricing[chosenVariation][currency]['student']
  300. $scope.plans[currency]['collaborator'] = MultiCurrencyPricing[chosenVariation][currency]['collaborator']
  301. $scope.showPlans = true
  302. else
  303. $scope.showPlans = true
  304. $scope.plans = MultiCurrencyPricing.plans
  305. $scope.currencyCode = MultiCurrencyPricing.currencyCode
  306. $scope.trial_len = 7
  307. $scope.planQueryString = '_free_trial_7_days'
  308. $scope.ui =
  309. view: "monthly"
  310. $scope.changeCurreny = (newCurrency)->
  311. $scope.currencyCode = newCurrency
  312. # because ternary logic in angular bindings is hard
  313. $scope.getCollaboratorPlanCode = () ->
  314. view = $scope.ui.view
  315. variant = $scope.plansVariant
  316. if view == "annual"
  317. if variant == "default"
  318. return "collaborator-annual"
  319. else
  320. return "collaborator-annual_#{variant}"
  321. else
  322. if variant == "default"
  323. return "collaborator#{$scope.planQueryString}"
  324. else
  325. return "collaborator_#{variant}"
  326. $scope.signUpNowClicked = (plan, annual)->
  327. event_tracking.sendMB 'plans-page-start-trial', {plan}
  328. if $scope.ui.view == "annual"
  329. plan = "#{plan}_annual"
  330. event_tracking.send 'subscription-funnel', 'sign_up_now_button', plan
  331. $scope.switchToMonthly = ->
  332. $scope.ui.view = "monthly"
  333. event_tracking.send 'subscription-funnel', 'plans-page', 'monthly-prices'
  334. $scope.switchToStudent = ->
  335. $scope.ui.view = "student"
  336. event_tracking.send 'subscription-funnel', 'plans-page', 'student-prices'
  337. $scope.switchToAnnual = ->
  338. $scope.ui.view = "annual"
  339. event_tracking.send 'subscription-funnel', 'plans-page', 'student-prices'
  340. $scope.openGroupPlanModal = () ->
  341. $modal.open {
  342. templateUrl: "groupPlanModalTemplate"
  343. }