(
filters: AnyPartialFilterType,
aggregationLabel: groupsModelType['values']['aggregationLabel'],
cohortsById: cohortsModelType['values']['cohortsById'],
mathDefinitions: mathsLogicType['values']['mathDefinitions']
)
| 211 | } |
| 212 | |
| 213 | export function summarizeInsightFilters( |
| 214 | filters: AnyPartialFilterType, |
| 215 | aggregationLabel: groupsModelType['values']['aggregationLabel'], |
| 216 | cohortsById: cohortsModelType['values']['cohortsById'], |
| 217 | mathDefinitions: mathsLogicType['values']['mathDefinitions'] |
| 218 | ): string { |
| 219 | const localFilters = toLocalFilters(filters) |
| 220 | |
| 221 | if (isRetentionFilter(filters)) { |
| 222 | const areTargetAndReturningIdentical = |
| 223 | filters.returning_entity?.id === filters.target_entity?.id && |
| 224 | filters.returning_entity?.type === filters.target_entity?.type |
| 225 | return ( |
| 226 | `Retention of ${aggregationLabel(filters.aggregation_group_type_index, true).plural}` + |
| 227 | ` based on doing ${getDisplayNameFromEntityFilter((filters.target_entity || {}) as EntityFilter)}` + |
| 228 | ` ${retentionOptions[filters.retention_type || RETENTION_FIRST_TIME]} and returning with ` + |
| 229 | (areTargetAndReturningIdentical |
| 230 | ? 'the same event' |
| 231 | : getDisplayNameFromEntityFilter((filters.returning_entity || {}) as EntityFilter)) |
| 232 | ) |
| 233 | } else if (isPathsFilter(filters)) { |
| 234 | // Sync format with PathsSummary in InsightDetails |
| 235 | let summary = `User paths based on ${humanizePathsEventTypes(filters).join(' and ')}` |
| 236 | if (filters.start_point) { |
| 237 | summary += ` starting at ${filters.start_point}` |
| 238 | } |
| 239 | if (filters.end_point) { |
| 240 | summary += `${filters.start_point ? ' and' : ''} ending at ${filters.end_point}` |
| 241 | } |
| 242 | return summary |
| 243 | } else if (isLifecycleFilter(filters)) { |
| 244 | return `User lifecycle based on ${getDisplayNameFromEntityFilter(localFilters[0])}` |
| 245 | } else if (isFunnelsFilter(filters)) { |
| 246 | let summary = '' |
| 247 | const linkSymbol = |
| 248 | filters.funnel_order_type === StepOrderValue.STRICT |
| 249 | ? '⇉' |
| 250 | : filters.funnel_order_type === StepOrderValue.UNORDERED |
| 251 | ? '&' |
| 252 | : '→' |
| 253 | summary = `${localFilters.map((filter) => getDisplayNameFromEntityFilter(filter)).join(` ${linkSymbol} `)} ${ |
| 254 | aggregationLabel(filters.aggregation_group_type_index, true).singular |
| 255 | } conversion` |
| 256 | if (filters.funnel_viz_type === FunnelVizType.TimeToConvert) { |
| 257 | summary += ' time' |
| 258 | } else if (filters.funnel_viz_type === FunnelVizType.Trends) { |
| 259 | summary += ' trend' |
| 260 | } else { |
| 261 | // Steps are the default viz type |
| 262 | summary += ' rate' |
| 263 | } |
| 264 | if (filters.breakdown_type) { |
| 265 | summary += ` by ${summarizeBreakdown(filters, aggregationLabel, cohortsById)}` |
| 266 | } |
| 267 | return summary |
| 268 | } else if (isStickinessFilter(filters)) { |
| 269 | return capitalizeFirstLetter( |
| 270 | localFilters |
no test coverage detected
searching dependent graphs…