@@ -14,7 +14,7 @@ type PlanMigrationAlertData = {
1414 variant : 'scheduled' | 'completed' ;
1515 from : string ;
1616 to : string ;
17- date : number ;
17+ date ? : number ;
1818} ;
1919
2020const getPeriodDuration = ( subscription : CloudSubscriptionModel ) => {
@@ -53,7 +53,7 @@ const getPlanMigrationAlertData = (
5353 variant : 'scheduled' ,
5454 from : migration . originPlanName ,
5555 to : targetPlanName ,
56- date : migration . scheduledAt ,
56+ date : subscription . currentPeriodEnd ?? undefined ,
5757 } ;
5858 }
5959
@@ -89,20 +89,45 @@ export const PlanMigrationAlert: FC<Props> = ({ subscription }) => {
8989 return null ;
9090 }
9191
92- const params = {
92+ const baseParams = {
9393 from : migrationAlert . from ,
9494 to : migrationAlert . to ,
95- date : formatDate ( migrationAlert . date , { dateStyle : 'long' } ) ,
9695 b : < b /> ,
9796 } ;
9897
98+ const getScheduledContent = ( ) => {
99+ if ( migrationAlert . date ) {
100+ return (
101+ < T
102+ keyName = "billing_plan_migration_alert_scheduled"
103+ params = { {
104+ ...baseParams ,
105+ date : formatDate ( migrationAlert . date , { dateStyle : 'long' } ) ,
106+ } }
107+ />
108+ ) ;
109+ }
110+ return (
111+ < T
112+ keyName = "billing_plan_migration_alert_scheduled_no_date"
113+ params = { baseParams }
114+ />
115+ ) ;
116+ } ;
117+
99118 return (
100119 < Box display = "flex" mb = { 1 } >
101120 < Alert severity = "info" data-cy = "billing-plan-migration-alert" >
102121 { migrationAlert . variant === 'scheduled' ? (
103- < T keyName = "billing_plan_migration_alert_scheduled" params = { params } />
122+ getScheduledContent ( )
104123 ) : (
105- < T keyName = "billing_plan_migration_alert_completed" params = { params } />
124+ < T
125+ keyName = "billing_plan_migration_alert_completed"
126+ params = { {
127+ ...baseParams ,
128+ date : formatDate ( migrationAlert . date ! , { dateStyle : 'long' } ) ,
129+ } }
130+ />
106131 ) }
107132 </ Alert >
108133 </ Box >
0 commit comments