summaryrefslogtreecommitdiff
path: root/node_modules/@jet-app/app-store/tmp/src/common/web-navigation/search-results-platform-selection.js
blob: 00993f8c08a4cf3158292a47662717afc5dca2fa (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
import { allPreviewPlatforms } from "../../api/models/preview-platform";
import { makeCanonicalSearchResultsPageUrl } from "../search/search-page-url";
function replaceDestinationIntent(objectGraph, action, intent, platform) {
    const updatedIntent = {
        ...intent,
        platform,
    };
    action.destination = updatedIntent;
    action.pageUrl = makeCanonicalSearchResultsPageUrl(objectGraph, updatedIntent);
}
/**
 * Replaces each of the "platform selector" actions with one that navigates to the
 * {@linkcode searchResultsPageIntent} in each platform
 *
 * This is necessary because the existing platform selector, which normally takes
 * the user to a platform landing page, instead takes the user to the search results
 * page within the selected platform
 */
export function replacePlatformSelectorDestinationWithSearchResults(objectGraph, webNavigation, searchResultsPageIntent) {
    const isVisionSupported = objectGraph.bag.enableVisionPlatform;
    allPreviewPlatforms
        // Rejects vision if its not supported and let's all other platforms pass
        .filter((platform) => isVisionSupported || platform !== "vision")
        .forEach((platform, index) => {
        replaceDestinationIntent(objectGraph, webNavigation.platforms[index].action, searchResultsPageIntent, platform);
    });
}
//# sourceMappingURL=search-results-platform-selection.js.map