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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
import { isPreviewPlatform } from "../../api/models/preview-platform";
import { getLocale } from "../locale";
import { landingPageIntentsAreEquivalent, } from "./platform-landing-page-utils";
import { iPadTodayPageController, iPadAppsController, iPadArcadeController, iPadGamesController, iPadSearchLandingController, iPhoneTodayPageController, iPhoneAppsController, iPhoneGamesController, iPhoneArcadeController, iPhoneSearchLandingController, MacDiscoverController, MacArcadeController, MacCreateController, MacWorkController, MacPlayController, MacDevelopController, MacCategoriesController, MacSearchLandingController, TVAppsController, TVArcadeController, TVDiscoverController, TVGamesController, TVSearchLandingController, VisionAppsAndGamesController, VisionArcadeController, VisionSearchLandingController, WatchDiscoverController, WatchSearchLandingController, } from "./platform-landing-page-intent-controllers";
const ARCADE_CONTROLLERS = new Set([
iPadArcadeController,
iPhoneArcadeController,
MacArcadeController,
TVArcadeController,
VisionArcadeController,
]);
export function createLandingPageLinks(objectGraph, platform, intent) {
if (!platform || !isPreviewPlatform(platform)) {
return [];
}
// NOTE: this map cannot be defined at the module level, for risk of creating
// a circular dependency between module-level declarations that will break the build
// tools used by the "web" client
const landingPageControllers = {
ipad: [
iPadTodayPageController,
iPadGamesController,
iPadAppsController,
iPadArcadeController,
iPadSearchLandingController,
],
iphone: [
iPhoneTodayPageController,
iPhoneGamesController,
iPhoneAppsController,
iPhoneArcadeController,
iPhoneSearchLandingController,
],
mac: [
MacDiscoverController,
MacArcadeController,
MacCreateController,
MacWorkController,
MacPlayController,
MacDevelopController,
MacCategoriesController,
MacSearchLandingController,
],
tv: [TVDiscoverController, TVGamesController, TVAppsController, TVArcadeController, TVSearchLandingController],
vision: [VisionAppsAndGamesController, VisionArcadeController, VisionSearchLandingController],
watch: [WatchDiscoverController, WatchSearchLandingController],
};
const locale = getLocale(objectGraph);
const isArcadeEnabled = objectGraph.bag.isArcadeEnabled;
return landingPageControllers[platform]
.filter((landingPageController) => {
// Rejects Arcade controllers if not supported and let's all other controllers pass
const isArcadeController = ARCADE_CONTROLLERS.has(landingPageController);
return isArcadeEnabled || !isArcadeController;
})
.map((controller) => controller.buildAction(locale, objectGraph))
.map((action) => ({
action,
isActive: landingPageIntentsAreEquivalent(intent, action.destination),
}));
}
//# sourceMappingURL=landing-page-links-by-platform.js.map
|