Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sdk-weekly-rotation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@audius/sdk': minor
---

Add `users.getWeeklyRotation`, a hand-written client for `GET /v1/users/{id}/weekly-rotation` — a personalized weekly track mix that is stable for the ISO week. This method has not appeared in a published release before; it was briefly named `getDiscoverWeekly` on `main` only.
2 changes: 1 addition & 1 deletion packages/common/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export * from './tan-query/lineups/useProfileReposts'
export * from './tan-query/lineups/useProfileTracks'
export * from './tan-query/lineups/useTrending'
export * from './tan-query/lineups/useTrendingUnderground'
export * from './tan-query/lineups/useDiscoverWeekly'
export * from './tan-query/lineups/useWeeklyRotation'
export * from './tan-query/lineups/useTrendingWinners'
export * from './tan-query/lineups/useTrackPageLineup'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ const DEFAULT_LIMIT = 30
// failure or an empty response doesn't stick for the whole session.
const STALE_TIME_MS = 30 * 60 * 1000

export type UseDiscoverWeeklyArgs = {
export type UseWeeklyRotationArgs = {
limit?: number
}

export const getDiscoverWeeklyQueryKey = ({
export const getWeeklyRotationQueryKey = ({
userId,
limit = DEFAULT_LIMIT
}: UseDiscoverWeeklyArgs & { userId: ID | null | undefined }) =>
[QUERY_KEYS.discoverWeekly, userId, { limit }] as unknown as QueryKey<
}: UseWeeklyRotationArgs & { userId: ID | null | undefined }) =>
[QUERY_KEYS.weeklyRotation, userId, { limit }] as unknown as QueryKey<
LineupData[]
>

/**
* The current user's Discover Weekly mix: tracks they haven't heard, weighted
* The current user's Weekly Rotation mix: tracks they haven't heard, weighted
* toward artists they don't already follow.
*
* Deliberately a plain `useQuery` rather than an infinite one — the mix is a
Expand All @@ -43,19 +43,19 @@ export const getDiscoverWeeklyQueryKey = ({
* empty result stayed hidden until the app restarted. A bounded staleTime keeps
* the request count low while still letting a bad result heal.
*/
export const useDiscoverWeekly = (
{ limit = DEFAULT_LIMIT }: UseDiscoverWeeklyArgs = {},
export const useWeeklyRotation = (
{ limit = DEFAULT_LIMIT }: UseWeeklyRotationArgs = {},
options?: QueryOptions
) => {
const { audiusSdk } = useQueryContext()
const { data: currentUserId } = useCurrentUserId()
const queryClient = useQueryClient()

const query = useQuery({
queryKey: getDiscoverWeeklyQueryKey({ userId: currentUserId, limit }),
queryKey: getWeeklyRotationQueryKey({ userId: currentUserId, limit }),
queryFn: async () => {
const sdk = await audiusSdk()
const { data = [] } = await sdk.users.getDiscoverWeekly({
const { data = [] } = await sdk.users.getWeeklyRotation({
id: Id.parse(currentUserId),
limit,
userId: OptionalId.parse(currentUserId)
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/api/tan-query/queryKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const QUERY_KEYS = {
trending: 'trending',
suggestedArtists: 'suggestedArtists',
suggestedFollows: 'suggestedFollows',
discoverWeekly: 'discoverWeekly',
weeklyRotation: 'weeklyRotation',
topArtistsInGenre: 'topArtistsInGenre',
audioTransactions: 'audioTransactions',
audioTransactionsCount: 'audioTransactionsCount',
Expand Down
12 changes: 6 additions & 6 deletions packages/common/src/messages/explore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ export const exploreMessages = {
feelingLucky: 'Feeling Lucky?',
imFeelingLucky: "I'm Feeling Lucky",
recentlyPlayed: 'Recently Played',
discoverWeekly: 'Your Discover Weekly',
discoverWeeklySubtitle: 'Updated every Monday',
discoverWeeklyBadge: 'New',
discoverWeeklyPitch:
weeklyRotation: 'Your Weekly Rotation',
weeklyRotationSubtitle: 'Updated every Monday',
weeklyRotationBadge: 'New',
weeklyRotationPitch:
'A fresh mix of tracks picked just for you. Updated every Monday.',
discoverWeeklyCta: 'Listen Now',
discoverWeeklyTrackCount: (count: number) =>
weeklyRotationCta: 'Listen Now',
weeklyRotationTrackCount: (count: number) =>
`${count} ${count === 1 ? 'track' : 'tracks'}`,
undergroundTrending: 'Underground Trending',
verified: 'Verified'
Expand Down
44 changes: 22 additions & 22 deletions packages/common/src/models/Analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,11 @@ export enum Name {
EXPLORE_SECTION_VIEW = 'Explore: Section View',
EXPLORE_SECTION_CLICK = 'Explore: Section Click',

// Discover Weekly
DISCOVER_WEEKLY_BANNER_VIEW = 'Discover Weekly: Banner View',
DISCOVER_WEEKLY_BANNER_CLICK = 'Discover Weekly: Banner Click',
DISCOVER_WEEKLY_PAGE_VIEW = 'Discover Weekly: Page View',
DISCOVER_WEEKLY_PLAY_ALL = 'Discover Weekly: Play All',
// Weekly Rotation
WEEKLY_ROTATION_BANNER_VIEW = 'Weekly Rotation: Banner View',
WEEKLY_ROTATION_BANNER_CLICK = 'Weekly Rotation: Banner Click',
WEEKLY_ROTATION_PAGE_VIEW = 'Weekly Rotation: Page View',
WEEKLY_ROTATION_PLAY_ALL = 'Weekly Rotation: Play All',

// Errors
ERROR_PAGE = 'Error Page',
Expand Down Expand Up @@ -1318,7 +1318,7 @@ export type ExploreSectionName =
| 'Recommended Tracks'
| 'Artist Coin Tracks'
| 'Recently Played'
| 'Discover Weekly'
| 'Weekly Rotation'
| 'Quick Search'
| 'Featured Playlists'
| 'Fan Clubs'
Expand Down Expand Up @@ -1356,33 +1356,33 @@ type ExploreSectionClick = {

/**
* Surface the banner was rendered on. The mix is reachable from more than one
* place, so every Discover Weekly event carries this -- otherwise there's no
* place, so every Weekly Rotation event carries this -- otherwise there's no
* way to tell which entry point is actually driving listens.
*/
export type DiscoverWeeklySurface = 'explore' | 'feed'
export type WeeklyRotationSurface = 'explore' | 'feed'

type DiscoverWeeklyBannerView = {
eventName: Name.DISCOVER_WEEKLY_BANNER_VIEW
surface: DiscoverWeeklySurface
type WeeklyRotationBannerView = {
eventName: Name.WEEKLY_ROTATION_BANNER_VIEW
surface: WeeklyRotationSurface
source: 'web' | 'mobile'
trackCount: number
}

type DiscoverWeeklyBannerClick = {
eventName: Name.DISCOVER_WEEKLY_BANNER_CLICK
surface: DiscoverWeeklySurface
type WeeklyRotationBannerClick = {
eventName: Name.WEEKLY_ROTATION_BANNER_CLICK
surface: WeeklyRotationSurface
source: 'web' | 'mobile'
trackCount: number
}

type DiscoverWeeklyPageView = {
eventName: Name.DISCOVER_WEEKLY_PAGE_VIEW
type WeeklyRotationPageView = {
eventName: Name.WEEKLY_ROTATION_PAGE_VIEW
source: 'web' | 'mobile'
trackCount: number
}

type DiscoverWeeklyPlayAll = {
eventName: Name.DISCOVER_WEEKLY_PLAY_ALL
type WeeklyRotationPlayAll = {
eventName: Name.WEEKLY_ROTATION_PLAY_ALL
source: 'web' | 'mobile'
trackCount: number
}
Expand Down Expand Up @@ -2762,10 +2762,10 @@ export type AllTrackingEvents =
| SearchResultSelect
| ExploreSectionView
| ExploreSectionClick
| DiscoverWeeklyBannerView
| DiscoverWeeklyBannerClick
| DiscoverWeeklyPageView
| DiscoverWeeklyPlayAll
| WeeklyRotationBannerView
| WeeklyRotationBannerClick
| WeeklyRotationPageView
| WeeklyRotationPlayAll
| ErrorPage
| NotFoundPage
| PageView
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/services/remote-config/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export enum FeatureFlags {
LAUNCHPAD_VERIFICATION = 'launchpad_verification',
FAN_CLUB_TEXT_POST_POSTING = 'fan_club_text_post_posting',
QUEUE_NEW_FEATURE_BADGE = 'queue_new_feature_badge',
DISCOVER_WEEKLY = 'discover_weekly'
WEEKLY_ROTATION = 'weekly_rotation'
}

type FlagDefaults = Record<FeatureFlags, boolean>
Expand All @@ -28,7 +28,7 @@ export const environmentFlagDefaults: Record<
> = {
development: {
[FeatureFlags.FAN_CLUB_TEXT_POST_POSTING]: true,
[FeatureFlags.DISCOVER_WEEKLY]: true
[FeatureFlags.WEEKLY_ROTATION]: true
},
production: {}
}
Expand All @@ -52,5 +52,5 @@ export const flagDefaults: FlagDefaults = {
[FeatureFlags.LAUNCHPAD_VERIFICATION]: true,
[FeatureFlags.FAN_CLUB_TEXT_POST_POSTING]: false,
[FeatureFlags.QUEUE_NEW_FEATURE_BADGE]: false,
[FeatureFlags.DISCOVER_WEEKLY]: false
[FeatureFlags.WEEKLY_ROTATION]: false
}
6 changes: 3 additions & 3 deletions packages/common/src/utils/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const TRENDING_PLAYLISTS_PAGE_LEGACY = '/trending/playlists'
export const EXPLORE_PAGE = '/explore'
export const TRENDING_PLAYLISTS_PAGE = '/explore/playlists'
export const TRENDING_UNDERGROUND_PAGE = '/explore/underground'
export const DISCOVER_WEEKLY_PAGE = '/explore/discover-weekly'
export const WEEKLY_ROTATION_PAGE = '/explore/weekly-rotation'
export const CONTESTS_PAGE = '/contests'

// DEPRECATED - use /library instead.
Expand Down Expand Up @@ -302,7 +302,7 @@ export const orderedRoutes = [
TRENDING_GENRES,
TRENDING_PAGE,
EXPLORE_PAGE,
DISCOVER_WEEKLY_PAGE,
WEEKLY_ROTATION_PAGE,
CONTESTS_PAGE,
EMPTY_PAGE,
SEARCH_PAGE,
Expand Down Expand Up @@ -357,7 +357,7 @@ export const staticRoutes = new Set([
FEED_PAGE,
TRENDING_PAGE,
EXPLORE_PAGE,
DISCOVER_WEEKLY_PAGE,
WEEKLY_ROTATION_PAGE,
CONTESTS_PAGE,
HOST_REMIX_CONTEST_ROOT_PAGE,
TRENDING_PLAYLISTS_PAGE,
Expand Down
8 changes: 4 additions & 4 deletions packages/mobile/src/screens/app-screen/AppTabScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
} from 'app/screens/coin-details-screen'
import { CoinRedeemScreen } from 'app/screens/coin-redeem-screen'
import { CollectionScreen } from 'app/screens/collection-screen/CollectionScreen'
import { DiscoverWeeklyScreen } from 'app/screens/discover-weekly-screen'
import { EditProfileScreen } from 'app/screens/edit-profile-screen'
import { ProfileScreen } from 'app/screens/profile-screen'
import { RewardsScreen } from 'app/screens/rewards-screen'
Expand Down Expand Up @@ -67,6 +66,7 @@ import {
CoinLeaderboardScreen
} from 'app/screens/user-list-screen'
import { WalletScreen } from 'app/screens/wallet-screen'
import { WeeklyRotationScreen } from 'app/screens/weekly-rotation-screen'

import { ContestFollowersScreen, ContestScreen } from '../contest-screen'
import { ContestsScreen } from '../contests-screen'
Expand Down Expand Up @@ -111,7 +111,7 @@ export type AppTabScreenParamList = {
SettingsScreen: undefined
AboutScreen: undefined
ListeningHistoryScreen: undefined
DiscoverWeeklyScreen: undefined
WeeklyRotationScreen: undefined
AccountSettingsScreen: undefined
ChangeEmail: undefined
ChangePassword: undefined
Expand Down Expand Up @@ -320,8 +320,8 @@ export const AppTabScreen = ({ baseScreen, Stack }: AppTabScreenProps) => {
component={FanClubsExploreScreen}
/>
<Stack.Screen
name='DiscoverWeeklyScreen'
component={DiscoverWeeklyScreen}
name='WeeklyRotationScreen'
component={WeeklyRotationScreen}
/>
<Stack.Screen name='FanClubSort' component={FanClubSortScreen} />

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useSearchCategory } from 'app/screens/search-screen/searchState'

import { ArtistSpotlight } from './ArtistSpotlight'
import { BestSellingAlbums } from './BestSellingAlbums'
import { DiscoverWeekly } from './DiscoverWeekly'
import { WeeklyRotation } from './WeeklyRotation'
import { FeaturedPlaylists } from './FeaturedPlaylists'
import { FeaturedRemixContests } from './FeaturedRemixContests'
import { FeelingLucky } from './FeelingLucky'
Expand All @@ -32,7 +32,7 @@ export const ExploreContent = () => {
return (
<Flex gap='2xl' pt='s' pb={150} ph='l'>
{showTrackContent && showUserContextualContent && (
<DiscoverWeekly surface='explore' />
<WeeklyRotation surface='explore' />
)}
{showPlaylistContent && <FeaturedPlaylists />}
{showTrackContent && <TrendingGenres />}
Expand Down
Loading
Loading