mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
5d22b788c8
refs #10318 * Updated settings model with new settings * Removed parseSubscriptionSettings from settings service * Updated members-utils to use new settings * Updated labs controller to use new settings * Fixed dependency for member-settings-form * Updated members-lab-setting component to use new settings * Updated disconnect modal to use new settings * Updated members portal modal to use new settings * Removed Direct from settings * Renamed members_allow_signup -> members_allow_free_signup * Allowed for null fromAddress
55 lines
1.9 KiB
JavaScript
55 lines
1.9 KiB
JavaScript
import Component from '@ember/component';
|
|
import moment from 'moment';
|
|
import {computed} from '@ember/object';
|
|
import {gt} from '@ember/object/computed';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default Component.extend({
|
|
membersUtils: service(),
|
|
feature: service(),
|
|
config: service(),
|
|
mediaQueries: service(),
|
|
|
|
// Allowed actions
|
|
setProperty: () => {},
|
|
|
|
hasMultipleSubscriptions: gt('member.stripe', 1),
|
|
|
|
canShowStripeInfo: computed('member.isNew', 'membersUtils.isStripeEnabled', function () {
|
|
let stripeEnabled = this.membersUtils.isStripeEnabled;
|
|
|
|
if (this.member.get('isNew') || !stripeEnabled) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}),
|
|
|
|
subscriptions: computed('member.stripe', function () {
|
|
let subscriptions = this.member.get('stripe');
|
|
if (subscriptions && subscriptions.length > 0) {
|
|
return subscriptions.map((subscription) => {
|
|
return {
|
|
id: subscription.id,
|
|
customer: subscription.customer,
|
|
name: subscription.name || '',
|
|
email: subscription.email || '',
|
|
status: subscription.status,
|
|
startDate: subscription.start_date ? moment(subscription.start_date).format('MMM DD YYYY') : '-',
|
|
plan: subscription.plan,
|
|
amount: parseInt(subscription.plan.amount) ? (subscription.plan.amount / 100) : 0,
|
|
cancelAtPeriodEnd: subscription.cancel_at_period_end,
|
|
validUntil: subscription.current_period_end ? moment(subscription.current_period_end).format('MMM DD YYYY') : '-'
|
|
};
|
|
}).reverse();
|
|
}
|
|
return null;
|
|
}),
|
|
|
|
actions: {
|
|
setProperty(property, value) {
|
|
this.setProperty(property, value);
|
|
}
|
|
}
|
|
});
|