summaryrefslogtreecommitdiff
path: root/node_modules/@jet-app/app-store/tmp/src/common/editorial-pages/editorial-action-util.js
blob: 9c5092622a3952629dd113a2bb68bd5ae855801b (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
49
50
51
52
53
54
55
56
57
58
import * as lockups from "../lockups/lockups";
import { CollectionShelfDisplayStyle } from "./editorial-page-types";
/**
 * For a given piece of MAPI data create the primary clickAction for the component with this data
 * @param objectGraph
 * @param data
 * @param shelfToken
 */
export function createPrimaryActionForComponentFromData(objectGraph, data, shelfToken, baseClickOptions) {
    const clickOptions = createClickOptionsFromData(objectGraph, data, shelfToken, baseClickOptions);
    const primaryAction = lockups.actionFromData(objectGraph, data, clickOptions, shelfToken.clientIdentifierOverride);
    return primaryAction;
}
function createClickOptionsFromData(objectGraph, data, shelfToken, baseClickOptions) {
    const targetType = clickTargetForCollectionDisplayStyle(objectGraph, shelfToken.collectionDisplayStyle);
    const clickOptions = {
        ...shelfToken.metricsImpressionOptions,
        ...baseClickOptions,
        id: data.id,
        targetType: targetType,
    };
    return clickOptions;
}
export function clickTargetForCollectionDisplayStyle(objectGraph, displayStyle) {
    switch (displayStyle) {
        case CollectionShelfDisplayStyle.Hero:
            return "hero";
        case CollectionShelfDisplayStyle.TextOnly:
            return "textOnly";
        case CollectionShelfDisplayStyle.TextWithArtwork:
            return "textWithArtwork";
        case CollectionShelfDisplayStyle.BrickSmall:
            return "brickSmall";
        case CollectionShelfDisplayStyle.BrickMedium:
            return "brickMedium";
        case CollectionShelfDisplayStyle.BrickLarge:
            return "brickLarge";
        case CollectionShelfDisplayStyle.EditorialLockupMedium:
        case CollectionShelfDisplayStyle.EditorialLockupMediumVariant:
            return "editorialLockupMedium";
        case CollectionShelfDisplayStyle.EditorialLockupLarge:
        case CollectionShelfDisplayStyle.EditorialLockupLargeVariant:
            return "editorialLockupLarge";
        case CollectionShelfDisplayStyle.LockupSmall:
            return "lockupSmall";
        case CollectionShelfDisplayStyle.LockupLarge:
            return "lockupLarge";
        case CollectionShelfDisplayStyle.StorySmall:
            return "storySmall";
        case CollectionShelfDisplayStyle.StoryMedium:
            return "storyMedium";
        case CollectionShelfDisplayStyle.BreakoutLarge:
            return "largeBreakout";
        default:
            return "lockup";
    }
}
//# sourceMappingURL=editorial-action-util.js.map