@artsy/cohesion
Version:
Analytics schema
95 lines (82 loc) • 2.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.tappedEntityGroup = void 0;
var _Schema = require("../../Schema");
/**
* A user taps a grouping of entities on iOS
*
* The `action` type is inferred from `destinationScreenOwnerType`
*
* @example
* ```
* tappedEntityGroup({
* contextModule: ContextModule.trendingArtistsRail,
* contextScreenOwnerType: OwnerType.home,
* destinationScreenOwnerType: OwnerType.artist,
* destinationScreenOwnerId: "5359794d1a1e86c3740001f7",
* destinationScreenOwnerSlug: "andy-warhol",
* horizontalSlidePosition: 2,
* moduleHeight: "double",
* type: "thumbnail"
* })
* ```
*/
var tappedEntityGroup = function tappedEntityGroup(_ref) {
var contextModule = _ref.contextModule,
contextScreenOwnerType = _ref.contextScreenOwnerType,
contextScreenOwnerId = _ref.contextScreenOwnerId,
contextScreenOwnerSlug = _ref.contextScreenOwnerSlug,
destinationScreenOwnerType = _ref.destinationScreenOwnerType,
destinationScreenOwnerId = _ref.destinationScreenOwnerId,
destinationScreenOwnerSlug = _ref.destinationScreenOwnerSlug,
horizontalSlidePosition = _ref.horizontalSlidePosition,
moduleHeight = _ref.moduleHeight,
type = _ref.type;
var action;
switch (destinationScreenOwnerType) {
case _Schema.OwnerType.article:
action = _Schema.ActionType.tappedArticleGroup;
break;
case _Schema.OwnerType.articles:
action = _Schema.ActionType.tappedArticleGroup;
break;
case _Schema.OwnerType.artist:
action = _Schema.ActionType.tappedArtistGroup;
break;
case _Schema.OwnerType.artwork:
case _Schema.OwnerType.gene:
case _Schema.OwnerType.worksForYou:
case _Schema.OwnerType.savesAndFollows:
action = _Schema.ActionType.tappedArtworkGroup;
break;
case _Schema.OwnerType.collection:
action = _Schema.ActionType.tappedCollectionGroup;
break;
case _Schema.OwnerType.explore:
action = _Schema.ActionType.tappedExploreGroup;
break;
case _Schema.OwnerType.fair:
action = _Schema.ActionType.tappedFairGroup;
break;
case _Schema.OwnerType.sale:
case _Schema.OwnerType.auctions:
action = _Schema.ActionType.tappedAuctionGroup;
break;
}
return {
action: action,
context_module: contextModule,
context_screen_owner_id: contextScreenOwnerId,
context_screen_owner_slug: contextScreenOwnerSlug,
context_screen_owner_type: contextScreenOwnerType,
destination_screen_owner_id: destinationScreenOwnerId,
destination_screen_owner_slug: destinationScreenOwnerSlug,
destination_screen_owner_type: destinationScreenOwnerType,
horizontal_slide_position: horizontalSlidePosition,
module_height: moduleHeight,
type: type
};
};
exports.tappedEntityGroup = tappedEntityGroup;