@getnori/rewards
v0.2.3
Published
Nori Rewards SDK: points badges, reward toasts and earning history for Nori viewers.
Readme
@getnori/rewards
Show viewers what they earn for watching: a points badge, a "+10 points" toast when a view is rewarded, and their earning history.
npm install @getnori/core @getnori/rewardsimport { NoriFeed } from "@getnori/feed";
import { PointsBadge, RewardToasts } from "@getnori/rewards";
<View style={{ flex: 1 }}>
<NoriFeed client={nori} />
<PointsBadge client={nori} style={{ position: "absolute", top: 56, right: 16 }} />
<RewardToasts client={nori} />
</View>- Rewards are decided on the server, from the views
@getnori/feedreports and your reward rules (points per view, minimum watch, daily cap). The SDK only displays the decisions. - Points are paid in your loyalty currency. Nori sends each reward to your
backend by signed webhook; your loyalty system holds the balance. The badge
shows what the viewer earned through Nori (
client.rewards()), not their loyalty balance. RewardToastsalso tells the viewer once per session when they reach the daily cap (showDailyCapNotice).
Hooks for your own UI: useRewards(client) returns { summary, loading, error, refresh }
(totals, today's progress, history) and updates the moment a view is rewarded;
useRewardDecisions(client, fn) calls fn for every server decision.
