@artsy/cohesion
Version:
Analytics schema
79 lines (69 loc) • 2.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.clickedEntityGroup = void 0;
var _Schema = require("../../Schema");
/**
* A user clicks a grouping of entities on web
*
* The `action` type is inferred from `destinationPageOwnerType`
*
* @example
* ```
* clickedEntityGroup({
* contextModule: ContextModule.trendingArtistsRail,
* contextPageOwnerType: OwnerType.home,
* destinationPageOwnerType: OwnerType.artist,
* destinationPageOwnerId: "5359794d1a1e86c3740001f7",
* destinationPageOwnerSlug: "andy-warhol",
* horizontalSlidePosition: 2,
* type: "thumbnail"
* })
* ```
*/
var clickedEntityGroup = function clickedEntityGroup(_ref) {
var contextModule = _ref.contextModule,
contextPageOwnerType = _ref.contextPageOwnerType,
contextPageOwnerId = _ref.contextPageOwnerId,
contextPageOwnerSlug = _ref.contextPageOwnerSlug,
destinationPageOwnerType = _ref.destinationPageOwnerType,
destinationPageOwnerId = _ref.destinationPageOwnerId,
destinationPageOwnerSlug = _ref.destinationPageOwnerSlug,
horizontalSlidePosition = _ref.horizontalSlidePosition,
type = _ref.type;
var action;
switch (destinationPageOwnerType) {
case _Schema.OwnerType.artist:
action = _Schema.ActionType.clickedArtistGroup;
break;
case _Schema.OwnerType.artwork:
case _Schema.OwnerType.gene:
case _Schema.OwnerType.worksForYou:
action = _Schema.ActionType.clickedArtworkGroup;
break;
case _Schema.OwnerType.collection:
action = _Schema.ActionType.clickedCollectionGroup;
break;
case _Schema.OwnerType.fair:
action = _Schema.ActionType.clickedFairGroup;
break;
case _Schema.OwnerType.sale:
case _Schema.OwnerType.auctions:
action = _Schema.ActionType.clickedAuctionGroup;
break;
}
return {
action: action,
context_module: contextModule,
context_page_owner_id: contextPageOwnerId,
context_page_owner_slug: contextPageOwnerSlug,
context_page_owner_type: contextPageOwnerType,
destination_page_owner_id: destinationPageOwnerId,
destination_page_owner_slug: destinationPageOwnerSlug,
destination_page_owner_type: destinationPageOwnerType,
horizontal_slide_position: horizontalSlidePosition,
type: type
};
};
exports.clickedEntityGroup = clickedEntityGroup;