import { i18n } from '@kbn/i18n' ; import { AlertActionParams } from '../types' ; export interface InjectActionParamsOpts { ruleId : string ; spaceId : string | undefined ; actionTypeId : string ; actionParams : AlertActionParams ; } export function injectActionParams ( { ruleId , spaceId , actionTypeId , actionParams , } ) { if ( actionTypeId === '.email' ) { const spacePrefix = spaceId && spaceId . length > 0 && spaceId !== 'default' ? `/s/${ spaceId }` : '' ; return { ... actionParams , kibanaFooterLink : { path : `${ spacePrefix }/app/management/insightsAndAlerting/triggersActions/rule/${ ruleId }` , text : i18n . translate ( 'xpack.alerting.injectActionParams.email.kibanaFooterLinkText' , { defaultMessage : 'View rule in Kibana' , } ) , } , } ; } return actionParams ; }