Skip to Content
Housr AppFeaturesPerks Feature

Perks Feature

Perk browsing, search, categories, redemption, and code-based perks.

Location

  • Feature module: src/features/perks/
  • Routes: src/app/(tabs)/promotions/(tabs)/perks.tsx, src/app/(tabs)/promotions/(perks)/, src/app/perk-info/[id].tsx

API Functions

Defined in src/features/perks/api/index.ts:

FunctionMethodEndpointDescription
getScreens(screen, city?)GETscreens/{screen}Server-driven UI screen data
getPerkList(category, limit, page, city, logic?)GETperksPaginated perk listing
searchPerks(query, city?)GETperks/searchSearch perks
getViewedPerks(sortBy?)GETperks/viewedUser’s viewed perks
getSearchHistory()GETperks/search/historySearch history
saveSearchHistory(query)POSTperks/search/historySave search term
redeemPerk(perkId)POSTperks/{id}/redeemRedeem a perk (returns code)
savePerkViewed(perkId)POSTperks/{id}/viewedMark perk as viewed
redeemCodePerk(code)POSTperks/redeem/{code}Redeem a code-based perk

All use apiV2.

Server-Driven UI

The perks screen uses the server-driven UI engine (src/features/screens/). The API returns a screen configuration via getScreens('perks'), and the rendering engine displays widgets defined in the response. This allows the backend to control the perks home layout without app updates.

Components

Perk Cards (components/perk-cards/)

ComponentDescription
PerkCardStandard perk card
PerkFeaturedCardFeatured/highlighted perk
PerkHeroCardHero-sized perk card
PerkMiniCardCompact perk card
PerkSpotlightCardSpotlight perk
PerkSpotlightMiniCardMini spotlight perk

All cards have Storybook stories for visual testing.

Perk Info (components/perk-info/)

ComponentDescription
PerkInfoContentPerk detail content
PerkInfoHeaderPerk detail header
PerkInfoImageContentImage content section
PerkRedemptionContentRedemption instructions
PerkExpiryExpiry date display
PerkRibbonPromotional ribbon
OtherPerksRelated perks section

Perk Redeem (components/perk-redeem/)

ComponentDescription
PerkRedeemSuccessRedemption success state

Search (components/search/)

ComponentDescription
PerkSearchSearch interface
PerkSearchResultsResults display
PerkResultCardSearch result card
RecentPerkSearchesRecent searches list
PerkHistoryTermSingle history item
EmptySearchResultsNo results state
SearchTitleSearch section title

Widgets (components/widgets/)

ComponentDescription
PerkHeroHero section widget
PerkSpotlightSpotlight section
PerkSpotlightMiniMini spotlight
PerkStackStacked cards widget
PerkClusterClustered cards widget

Other Components

ComponentDescription
PerksMain perks screen
ScreenRendererRenders server-driven UI screens
PerkListPerk list by category
PerksHeaderPerks section header
PerkLabelCategory/type label
PerkCodeRedemption code display
PerkCardButtonCard action button
QrCodeQR code display for redemption
TabsCategory tabs
TabButtonIndividual tab button
PlusButtonAdd/redeem code button
EmptyPerksNo perks state

Placeholders

Comprehensive loading skeletons for every card/widget variant in components/placeholders/.

Routes

RouteDescription
(tabs)/promotions/(tabs)/perks.tsxPerks home (server-driven)
(tabs)/promotions/(perks)/perk-search.tsxPerk search screen
(tabs)/promotions/(perks)/perk-redeem.tsxPerk redemption screen
perk-info/[id].tsxPerk detail page (outside tabs)

Utilities

  • utils/constants.ts — Perk category constants
  • utils/colors.ts — Perk-specific color utilities
  • utils/helpers.ts — General perk helpers
Last updated on