blob: 59b2fe57c2c1e1ce0cc98f9c1bb4c50585e6a378 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/**
* Common functions for search results content.
*/
import { isDefinedNonNullNonEmpty } from "../../../foundation/json-parsing/server-data";
import { attributeAsBooleanOrFalse, attributeAsString } from "../../../foundation/media/attributes";
// region Editorial Content
/**
* Returns the headline / tagline for Editorial Search Results
* @param resultData Data to determine tagline for.
*/
export function editorialSearchResultTagline(objectGraph, resultData) {
// Flag to disable showing specific headings, e.g. "App of the Day" that may be unnatural in search result
const showLabelInSearch = attributeAsBooleanOrFalse(resultData, "showLabelInSearch");
if (!showLabelInSearch) {
return null;
}
// <rdar://problem/40468686> LOC: AOTD & GOTD badges in Search result for the Editorial Item Card AOTD & GOTD stories do not show up correctly for JA-JP and TH-TH
// Always use alternative label, if one is provided.
const alternateLabel = attributeAsString(resultData, "alternateLabel");
if (isDefinedNonNullNonEmpty(alternateLabel)) {
return alternateLabel; // No newline flattening needed for alternativeLabel
}
// Otherwise, fallback to franchise label, if any.
const label = attributeAsString(resultData, "label");
if (isDefinedNonNullNonEmpty(label)) {
return label.replace(/\n/g, " ");
}
return null;
}
// endregion
//# sourceMappingURL=search-content-common.js.map
|