summaryrefslogtreecommitdiff
path: root/node_modules/@jet-app/app-store/tmp/src/common/room/room-request.js
blob: ba0337bd385ba6f84ed3825bcc7c6156dc675362 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { Request, defaultAdditionalPlatformsForClient } from "../../foundation/media/data-fetching";
import { shouldFetchCustomAttributes } from "../product-page/product-page-variants";
import { shouldUsePrerenderedIconArtwork } from "../content/content";
import { setPreviewPlatform } from "../preview-platform";
export function createRoomRequest(objectGraph, roomId) {
    const mediaApiRequest = new Request(objectGraph)
        .withIdOfType(roomId, "rooms")
        .includingAgeRestrictions()
        .includingMacOSCompatibleIOSAppsWhenSupported(true);
    if (objectGraph.client.isWeb) {
        mediaApiRequest.includingAdditionalPlatforms(defaultAdditionalPlatformsForClient(objectGraph));
        setPreviewPlatform(objectGraph, mediaApiRequest);
    }
    return mediaApiRequest;
}
export function prepareRoomRequest(objectGraph, request) {
    return request
        .includingAdditionalPlatforms(defaultAdditionalPlatformsForClient(objectGraph))
        .includingAttributes(defaultAttributesForRoomRequest(objectGraph))
        .usingCustomAttributes(shouldFetchCustomAttributes(objectGraph))
        .includingAgeRestrictions()
        .includingMacOSCompatibleIOSAppsWhenSupported(true);
}
export function defaultAttributesForRoomRequest(objectGraph) {
    const attributes = [
        "editorialArtwork",
        "editorialVideo",
        "isAppleWatchSupported",
        "requiredCapabilities",
    ];
    if (objectGraph.appleSilicon.isSupportEnabled) {
        attributes.push("macRequiredCapabilities");
    }
    if (objectGraph.client.isMac) {
        attributes.push("hasMacIPAPackage");
    }
    if (objectGraph.client.isVision) {
        attributes.push("compatibilityControllerRequirement");
    }
    if (objectGraph.bag.enableUpdatedAgeRatings) {
        attributes.push("ageRating");
    }
    if (shouldUsePrerenderedIconArtwork(objectGraph)) {
        attributes.push("iconArtwork");
    }
    return attributes;
}
//# sourceMappingURL=room-request.js.map