@artsy/cohesion
Advanced tools
Comparing version 1.33.1 to 1.33.2
@@ -0,1 +1,13 @@ | ||
# v1.33.2 (Wed Aug 26 2020) | ||
#### 🐛 Bug Fix | ||
- FollowedGene / UnfollowedGene [#98](https://github.com/artsy/cohesion/pull/98) ([@eessex](https://github.com/eessex)) | ||
#### Authors: 1 | ||
- Eve Essex ([@eessex](https://github.com/eessex)) | ||
--- | ||
# v1.33.1 (Wed Aug 26 2020) | ||
@@ -2,0 +14,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { AuthContextModule, FollowedArtist, OwnerType, UnfollowedArtist } from "../../Schema"; | ||
export interface FollowedArtistArgs { | ||
import { AuthContextModule, FollowedArtist, FollowedGene, OwnerType, UnfollowedArtist, UnfollowedGene } from "../../Schema"; | ||
export interface FollowedArgs { | ||
contextModule: AuthContextModule; | ||
@@ -17,5 +17,5 @@ contextOwnerId?: string; | ||
* contextModule: ContextModule.artistSeriesRail | ||
* contextOwnerType: OwnerType.artist, | ||
* contextOwnerId: "5359794d2a1e86c3741001f8", | ||
* contextOwnerSlug: "andy-warhol", | ||
* contextOwnerType: OwnerType.artist, | ||
* ownerId: "5359794d1a1e86c3740001f7", | ||
@@ -26,3 +26,3 @@ * ownerSlug: "sturtevant", | ||
*/ | ||
export declare const followedArtist: (args: FollowedArtistArgs) => FollowedArtist; | ||
export declare const followedArtist: (args: FollowedArgs) => FollowedArtist; | ||
/** | ||
@@ -35,5 +35,5 @@ * A user unfollows an artist | ||
* contextModule: ContextModule.artistSeriesRail | ||
* contextOwnerType: OwnerType.artist, | ||
* contextOwnerId: "5359794d2a1e86c3741001f8", | ||
* contextOwnerSlug: "andy-warhol", | ||
* contextOwnerType: OwnerType.artist, | ||
* OwnerId: "5359794d1a1e86c3740001f7", | ||
@@ -44,2 +44,34 @@ * OwnerSlug: "sturtevant", | ||
*/ | ||
export declare const unfollowedArtist: (args: FollowedArtistArgs) => UnfollowedArtist; | ||
export declare const unfollowedArtist: (args: FollowedArgs) => UnfollowedArtist; | ||
/** | ||
* A user follows a gene | ||
* | ||
* @example | ||
* ``` | ||
* followedGene({ | ||
* contextModule: ContextModule.intextTooltip, | ||
* contextOwnerId: "5359794d2a1e86c3741001f8", | ||
* contextOwnerSlug: "artsy-editorial-future-of-art", | ||
* contextOwnerType: OwnerType.article, | ||
* ownerId: "5359794d1a1e86c3740001f7", | ||
* ownerSlug: "surrealism", | ||
* }) | ||
* ``` | ||
*/ | ||
export declare const followedGene: (args: FollowedArgs) => FollowedGene; | ||
/** | ||
* A user unfollows a gene | ||
* | ||
* @example | ||
* ``` | ||
* unfollowedGene({ | ||
* contextModule: ContextModule.intextTooltip, | ||
* contextOwnerId: "5359794d2a1e86c3741001f8", | ||
* contextOwnerSlug: "artsy-editorial-future-of-art", | ||
* contextOwnerType: OwnerType.article, | ||
* ownerId: "5359794d1a1e86c3740001f7", | ||
* ownerSlug: "surrealism", | ||
* }) | ||
* ``` | ||
*/ | ||
export declare const unfollowedGene: (args: FollowedArgs) => UnfollowedGene; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.unfollowedArtist = exports.followedArtist = void 0; | ||
exports.unfollowedGene = exports.followedGene = exports.unfollowedArtist = exports.followedArtist = void 0; | ||
@@ -18,5 +18,5 @@ var _Schema = require("../../Schema"); | ||
* contextModule: ContextModule.artistSeriesRail | ||
* contextOwnerType: OwnerType.artist, | ||
* contextOwnerId: "5359794d2a1e86c3741001f8", | ||
* contextOwnerSlug: "andy-warhol", | ||
* contextOwnerType: OwnerType.artist, | ||
* ownerId: "5359794d1a1e86c3740001f7", | ||
@@ -28,3 +28,3 @@ * ownerSlug: "sturtevant", | ||
const followedArtist = args => { | ||
return followArtist(args); | ||
return follow(args, _Schema.OwnerType.artist); | ||
}; | ||
@@ -38,5 +38,5 @@ /** | ||
* contextModule: ContextModule.artistSeriesRail | ||
* contextOwnerType: OwnerType.artist, | ||
* contextOwnerId: "5359794d2a1e86c3741001f8", | ||
* contextOwnerSlug: "andy-warhol", | ||
* contextOwnerType: OwnerType.artist, | ||
* OwnerId: "5359794d1a1e86c3740001f7", | ||
@@ -52,8 +52,52 @@ * OwnerSlug: "sturtevant", | ||
const unfollowedArtist = args => { | ||
return followArtist(args, true); | ||
return follow(args, _Schema.OwnerType.artist, true); | ||
}; | ||
/** | ||
* A user follows a gene | ||
* | ||
* @example | ||
* ``` | ||
* followedGene({ | ||
* contextModule: ContextModule.intextTooltip, | ||
* contextOwnerId: "5359794d2a1e86c3741001f8", | ||
* contextOwnerSlug: "artsy-editorial-future-of-art", | ||
* contextOwnerType: OwnerType.article, | ||
* ownerId: "5359794d1a1e86c3740001f7", | ||
* ownerSlug: "surrealism", | ||
* }) | ||
* ``` | ||
*/ | ||
exports.unfollowedArtist = unfollowedArtist; | ||
const followArtist = ({ | ||
const followedGene = args => { | ||
return follow(args, _Schema.OwnerType.gene); | ||
}; | ||
/** | ||
* A user unfollows a gene | ||
* | ||
* @example | ||
* ``` | ||
* unfollowedGene({ | ||
* contextModule: ContextModule.intextTooltip, | ||
* contextOwnerId: "5359794d2a1e86c3741001f8", | ||
* contextOwnerSlug: "artsy-editorial-future-of-art", | ||
* contextOwnerType: OwnerType.article, | ||
* ownerId: "5359794d1a1e86c3740001f7", | ||
* ownerSlug: "surrealism", | ||
* }) | ||
* ``` | ||
*/ | ||
exports.followedGene = followedGene; | ||
const unfollowedGene = args => { | ||
return follow(args, _Schema.OwnerType.gene, true); | ||
}; | ||
exports.unfollowedGene = unfollowedGene; | ||
const follow = ({ | ||
contextModule, | ||
@@ -65,9 +109,16 @@ contextOwnerId, | ||
ownerSlug | ||
}, isUnfollow) => { | ||
}, ownerType, isUnfollow) => { | ||
let action; | ||
if (isUnfollow) { | ||
action = _Schema.ActionType.unfollowedArtist; | ||
} else { | ||
action = _Schema.ActionType.followedArtist; | ||
switch (ownerType) { | ||
case _Schema.OwnerType.artist: | ||
{ | ||
action = isUnfollow ? _Schema.ActionType.unfollowedArtist : _Schema.ActionType.followedArtist; | ||
break; | ||
} | ||
case _Schema.OwnerType.gene: | ||
{ | ||
action = isUnfollow ? _Schema.ActionType.unfollowedGene : _Schema.ActionType.followedGene; | ||
} | ||
} | ||
@@ -83,4 +134,4 @@ | ||
owner_slug: ownerSlug, | ||
owner_type: _Schema.OwnerType.artist | ||
owner_type: ownerType | ||
}; | ||
}; |
import { AuthImpression, CreatedAccount, ResetYourPassword, SuccessfullyLoggedIn } from "./Authentication"; | ||
import { ClickedArtistGroup, ClickedArtistSeriesGroup, ClickedArtworkGroup, ClickedAuctionGroup, ClickedCollectionGroup, ClickedFairGroup, ClickedMainArtworkGrid } from "./Click"; | ||
import { FocusedOnConversationMessageInput, SentConversationMessage } from "./Conversations"; | ||
import { FollowedArtist, FollowedGene, UnfollowedArtist, UnfollowedGene } from "./SavesAndFollows"; | ||
import { TappedArtistGroup, TappedArtistSeriesGroup, TappedArtworkGroup, TappedAuctionGroup, TappedCollectionGroup, TappedConsign, TappedExploreGroup, TappedFairGroup, TappedMainArtworkGrid, TappedPromoSpace, TappedTabBar, TappedViewingRoomGroup } from "./Tap"; | ||
import { TimeOnPage } from "./System"; | ||
import { FollowedArtist, UnfollowedArtist } from "./SavesAndFollows"; | ||
/** | ||
@@ -12,3 +12,3 @@ * Master list of valid schemas for analytics actions | ||
*/ | ||
export declare type Event = AuthImpression | CreatedAccount | ClickedArtistGroup | ClickedArtistSeriesGroup | ClickedArtworkGroup | ClickedAuctionGroup | ClickedCollectionGroup | ClickedFairGroup | ClickedMainArtworkGrid | FocusedOnConversationMessageInput | FollowedArtist | ResetYourPassword | SentConversationMessage | SuccessfullyLoggedIn | TappedArtistGroup | TappedArtistSeriesGroup | TappedArtworkGroup | TappedAuctionGroup | TappedCollectionGroup | TappedExploreGroup | TappedFairGroup | TappedConsign | TappedMainArtworkGrid | TappedPromoSpace | TappedTabBar | TappedViewingRoomGroup | TimeOnPage | UnfollowedArtist; | ||
export declare type Event = AuthImpression | CreatedAccount | ClickedArtistGroup | ClickedArtistSeriesGroup | ClickedArtworkGroup | ClickedAuctionGroup | ClickedCollectionGroup | ClickedFairGroup | ClickedMainArtworkGrid | FocusedOnConversationMessageInput | FollowedArtist | FollowedGene | ResetYourPassword | SentConversationMessage | SuccessfullyLoggedIn | TappedArtistGroup | TappedArtistSeriesGroup | TappedArtworkGroup | TappedAuctionGroup | TappedCollectionGroup | TappedExploreGroup | TappedFairGroup | TappedConsign | TappedMainArtworkGrid | TappedPromoSpace | TappedTabBar | TappedViewingRoomGroup | TimeOnPage | UnfollowedArtist | UnfollowedGene; | ||
/** | ||
@@ -65,2 +65,6 @@ * The top-level actions an Event describes. | ||
/** | ||
* Corresponds to {@link FollowedGene} | ||
*/ | ||
followedGene = "followedGene", | ||
/** | ||
* Corresponds to {@link ResetYourPassword} | ||
@@ -132,3 +136,7 @@ */ | ||
*/ | ||
unfollowedArtist = "unfollowedArtist" | ||
unfollowedArtist = "unfollowedArtist", | ||
/** | ||
* Corresponds to {@link UnfollowedArtist} | ||
*/ | ||
unfollowedGene = "unfollowedGene" | ||
} |
@@ -34,2 +34,3 @@ "use strict"; | ||
ActionType["followedArtist"] = "followedArtist"; | ||
ActionType["followedGene"] = "followedGene"; | ||
ActionType["resetYourPassword"] = "resetYourPassword"; | ||
@@ -52,2 +53,3 @@ ActionType["successfullyLoggedIn"] = "successfullyLoggedIn"; | ||
ActionType["unfollowedArtist"] = "unfollowedArtist"; | ||
ActionType["unfollowedGene"] = "unfollowedGene"; | ||
})(ActionType || (exports.ActionType = ActionType = {})); |
@@ -8,2 +8,11 @@ import { ActionType } from "."; | ||
*/ | ||
export interface FollowedEntity { | ||
context_module: AuthContextModule; | ||
context_owner_id?: string; | ||
context_owner_slug?: string; | ||
context_owner_type: OwnerType; | ||
owner_id: string; | ||
owner_slug: string; | ||
owner_type: OwnerType.artist | OwnerType.gene; | ||
} | ||
/** | ||
@@ -19,22 +28,37 @@ * A user has followed an artist. | ||
* context_module: "featuredArtists" | ||
* context_owner_type: "artistSeries" | ||
* context_owner_id: "5359794d1a1e86c3740001f7" | ||
* context_owner_slug: "alex-katz-departure" | ||
* owner_type: "artist" | ||
* context_owner_type: "artistSeries" | ||
* owner_id: "5359794d1a1e86c3740001f7" | ||
* owner_slug: "alex-katz" | ||
* owner_type: "artist" | ||
* } | ||
* ``` | ||
*/ | ||
export interface FollowedArtist { | ||
export interface FollowedArtist extends FollowedEntity { | ||
action: ActionType.followedArtist; | ||
context_module: AuthContextModule; | ||
context_owner_type: OwnerType; | ||
context_owner_id?: string; | ||
context_owner_slug?: string; | ||
owner_type: OwnerType.artist; | ||
owner_id: string; | ||
owner_slug: string; | ||
} | ||
/** | ||
* A user has followed a gene. | ||
* | ||
* This schema describes events sent to Segment from [[followedGene]] | ||
* | ||
* @example | ||
* ``` | ||
* { | ||
* action: "followedGene", | ||
* context_module: "intextTooltip" | ||
* context_owner_id: "5359794d1a1e86c3740001f7" | ||
* context_owner_slug: "artsy-editorial-future-of-art" | ||
* context_owner_type: "article" | ||
* owner_id: "5359794d1a1e86c3740001f7" | ||
* owner_slug: "surrealism" | ||
* owner_type: "gene" | ||
* } | ||
* ``` | ||
*/ | ||
export interface FollowedGene extends FollowedEntity { | ||
action: ActionType.followedGene; | ||
} | ||
/** | ||
* A user has unfollowed an artist. | ||
@@ -49,20 +73,35 @@ * | ||
* context_module: "featuredArtists" | ||
* context_owner_type: "artistSeries" | ||
* context_owner_id: "5359794d1a1e86c3740001f7" | ||
* context_owner_slug: "alex-katz-departure" | ||
* owner_type: "artist" | ||
* context_owner_type: "artistSeries" | ||
* owner_id: "5359794d1a1e86c3740001f7" | ||
* owner_slug: "alex-katz" | ||
* owner_type: "artist" | ||
* } | ||
* ``` | ||
*/ | ||
export interface UnfollowedArtist { | ||
export interface UnfollowedArtist extends FollowedEntity { | ||
action: ActionType.unfollowedArtist; | ||
context_module: AuthContextModule; | ||
context_owner_type: OwnerType; | ||
context_owner_id?: string; | ||
context_owner_slug?: string; | ||
owner_type: OwnerType.artist; | ||
owner_id: string; | ||
owner_slug: string; | ||
} | ||
/** | ||
* A user has unfollowed a gene. | ||
* | ||
* This schema describes events sent to Segment from [[unfollowedGene]] | ||
* | ||
* @example | ||
* ``` | ||
* { | ||
* action: "unfollowedGene", | ||
* context_module: "intextTooltip" | ||
* context_owner_id: "5359794d1a1e86c3740001f7" | ||
* context_owner_slug: "artsy-editorial-future-of-art" | ||
* context_owner_type: "article" | ||
* owner_id: "5359794d1a1e86c3740001f7" | ||
* owner_slug: "surrealism" | ||
* owner_type: "gene" | ||
* } | ||
* ``` | ||
*/ | ||
export interface UnfollowedGene extends FollowedEntity { | ||
action: ActionType.unfollowedGene; | ||
} |
{ | ||
"name": "@artsy/cohesion", | ||
"version": "1.33.1", | ||
"version": "1.33.2", | ||
"description": "Analytics schema and library helpers", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127179
3021