|
|
@@ -18,14 +18,13 @@ import _ from 'lodash'
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
*/
|
|
|
import App from '../base'
|
|
|
-import getMeta from '../utils/meta'
|
|
|
const SUBSCRIPTION_URL = '/user/subscription/update'
|
|
|
|
|
|
const ensureRecurlyIsSetup = _.once(() => {
|
|
|
if (typeof recurly === 'undefined' || !recurly) {
|
|
|
return false
|
|
|
}
|
|
|
- recurly.configure(getMeta('ol-recurlyApiKey'))
|
|
|
+ recurly.configure(window.recurlyApiKey)
|
|
|
return true
|
|
|
})
|
|
|
|
|
|
@@ -107,8 +106,7 @@ App.controller('ChangePlanFormController', function(
|
|
|
$scope.$watch('plan', function(plan) {
|
|
|
if (!plan) return
|
|
|
const planCode = plan.planCode
|
|
|
- const subscription = getMeta('ol-subscription')
|
|
|
- const { currency, taxRate } = subscription.recurly
|
|
|
+ const { currency, taxRate } = window.subscription.recurly
|
|
|
$scope.price = '...' // Placeholder while we talk to recurly
|
|
|
RecurlyPricing.loadDisplayPriceWithTax(planCode, currency, taxRate).then(
|
|
|
price => {
|
|
|
@@ -175,11 +173,10 @@ App.controller('GroupMembershipController', function($scope, $modal) {
|
|
|
|
|
|
App.controller('RecurlySubscriptionController', function($scope) {
|
|
|
const recurlyIsSetup = ensureRecurlyIsSetup()
|
|
|
- const subscription = getMeta('ol-subscription')
|
|
|
- $scope.showChangePlanButton = recurlyIsSetup && !subscription.groupPlan
|
|
|
+ $scope.showChangePlanButton = recurlyIsSetup && !window.subscription.groupPlan
|
|
|
if (
|
|
|
- subscription.recurly.account.has_past_due_invoice &&
|
|
|
- subscription.recurly.account.has_past_due_invoice._ === 'true'
|
|
|
+ window.subscription.recurly.account.has_past_due_invoice &&
|
|
|
+ window.subscription.recurly.account.has_past_due_invoice._ === 'true'
|
|
|
) {
|
|
|
$scope.showChangePlanButton = false
|
|
|
}
|
|
|
@@ -208,7 +205,7 @@ App.controller('RecurlyCancellationController', function(
|
|
|
$http
|
|
|
) {
|
|
|
if (!ensureRecurlyIsSetup()) return
|
|
|
- const subscription = getMeta('ol-subscription')
|
|
|
+ const subscription = window.subscription
|
|
|
const sevenDaysTime = new Date()
|
|
|
sevenDaysTime.setDate(sevenDaysTime.getDate() + 7)
|
|
|
const freeTrialEndDate = new Date(subscription.recurly.trial_ends_at)
|
|
|
@@ -229,7 +226,7 @@ App.controller('RecurlyCancellationController', function(
|
|
|
$scope.showBasicCancel = true
|
|
|
}
|
|
|
|
|
|
- const { currency, taxRate } = subscription.recurly
|
|
|
+ const { currency, taxRate } = window.subscription.recurly
|
|
|
$scope.studentPrice = '...' // Placeholder while we talk to recurly
|
|
|
RecurlyPricing.loadDisplayPriceWithTax('student', currency, taxRate).then(
|
|
|
price => {
|