Added trial info on member subscription
refs https://github.com/TryGhost/Team/issues/1724 - shows free trial info in member detail page for subscription
This commit is contained in:
parent
43d41e8b0e
commit
63fc06da28
@ -145,11 +145,19 @@
|
||||
<div class="gh-membertier-subscription" data-test-subscription={{index}}>
|
||||
<div>
|
||||
<div>
|
||||
<span class="gh-cp-membertier-pricelabel">{{sub.price.nickname}}</span>
|
||||
{{#if sub.trialUntil}}
|
||||
<span class="gh-cp-membertier-pricelabel">Free Trial</span>
|
||||
{{else}}
|
||||
<span class="gh-cp-membertier-pricelabel">{{sub.price.nickname}}</span>
|
||||
{{/if}}
|
||||
|
||||
–
|
||||
{{#if (eq sub.status "canceled")}}
|
||||
<span class="gh-cp-membertier-renewal">Ended {{sub.validUntil}}</span>
|
||||
<span class="gh-badge archived" data-test-text="member-subscription-status">Cancelled</span>
|
||||
{{else if sub.trialUntil}}
|
||||
<span class="gh-cp-membertier-renewal">Ends {{sub.trialUntil}}</span>
|
||||
<span class="gh-badge active" data-test-text="member-subscription-status">Active</span>
|
||||
{{else if sub.cancel_at_period_end}}
|
||||
<span class="gh-cp-membertier-renewal">Has access until {{sub.validUntil}}</span>
|
||||
<span class="gh-badge archived" data-test-text="member-subscription-status">Cancelled</span>
|
||||
|
@ -71,7 +71,7 @@ export default class extends Component {
|
||||
let subscriptionData = subscriptions.filter((sub) => {
|
||||
return !!sub.price;
|
||||
}).map((sub) => {
|
||||
return {
|
||||
const data = {
|
||||
...sub,
|
||||
startDate: sub.start_date ? moment(sub.start_date).format('D MMM YYYY') : '-',
|
||||
validUntil: sub.current_period_end ? moment(sub.current_period_end).format('D MMM YYYY') : '-',
|
||||
@ -83,6 +83,13 @@ export default class extends Component {
|
||||
},
|
||||
isComplimentary: !sub.id
|
||||
};
|
||||
if (this.feature.get('freeTrial') && sub.trial_end_at) {
|
||||
const inTrialMode = moment(sub.trial_end_at).isAfter(new Date(), 'day');
|
||||
if (inTrialMode) {
|
||||
data.trialUntil = moment(sub.trial_end_at).format('D MMM YYYY');
|
||||
}
|
||||
}
|
||||
return data;
|
||||
});
|
||||
return tiers.map((tier) => {
|
||||
let tierSubscriptions = subscriptionData.filter((subscription) => {
|
||||
|
Loading…
Reference in New Issue
Block a user