File tree Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class SubscriptionStore {
15
15
public planResponse : SubscriptionInfo [ ] = [ ] ;
16
16
public addOnsResponse : SubscriptionInfo [ ] = [ ] ;
17
17
public activeSubscriptions : SubscriptionInfo [ ] = [ ] ;
18
+ public canceledPlans : SubscriptionInfo [ ] = [ ] ;
18
19
public isPending = false ;
19
20
public isInitialised = false ;
20
21
@@ -50,6 +51,11 @@ class SubscriptionStore {
50
51
this . activeSubscriptions = response . results . filter ( ( sub ) =>
51
52
ACTIVE_STRIPE_STATUSES . includes ( sub . status )
52
53
) ;
54
+ this . canceledPlans = response . results . filter (
55
+ ( sub ) =>
56
+ sub . items [ 0 ] ?. price . product . metadata ?. product_type == 'plan' &&
57
+ sub . status === 'canceled'
58
+ ) ;
53
59
// get any active plan subscriptions for the user
54
60
this . planResponse = this . activeSubscriptions . filter (
55
61
( sub ) => sub . items [ 0 ] ?. price . product . metadata ?. product_type == 'plan'
Original file line number Diff line number Diff line change @@ -35,8 +35,9 @@ export interface AssetWithUsage {
35
35
36
36
export interface UsageResponse {
37
37
current_month_start : string ;
38
+ current_month_end : string ;
38
39
current_year_start : string ;
39
- billing_period_end : string | null ;
40
+ current_year_end : string ;
40
41
total_submission_count : {
41
42
current_month : number ;
42
43
current_year : number ;
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ const loadUsage = async (
57
57
usage . total_nlp_usage [ `mt_characters_current_${ trackingPeriod } ` ] ,
58
58
currentMonthStart : usage . current_month_start ,
59
59
currentYearStart : usage . current_year_start ,
60
- billingPeriodEnd : usage . billing_period_end ,
60
+ billingPeriodEnd : usage [ `current_ ${ trackingPeriod } _end` ] ,
61
61
trackingPeriod,
62
62
lastUpdated,
63
63
} ;
Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ export const YourPlan = () => {
51
51
let date ;
52
52
if ( subscriptions . planResponse . length ) {
53
53
date = subscriptions . planResponse [ 0 ] . start_date ;
54
+ } else if ( subscriptions . canceledPlans . length ) {
55
+ date =
56
+ subscriptions . canceledPlans [ subscriptions . canceledPlans . length - 1 ]
57
+ . ended_at ;
54
58
} else {
55
59
date = session . currentAccount . date_joined ;
56
60
}
You can’t perform that action at this time.
0 commit comments