feat(loyalty): implement loyalty and rewards program for subscribers (#387)#464
Open
activatedkc wants to merge 5 commits into
Open
feat(loyalty): implement loyalty and rewards program for subscribers (#387)#464activatedkc wants to merge 5 commits into
activatedkc wants to merge 5 commits into
Conversation
Owner
|
@Cyberking99 merge conflicts |
- New types: LoyaltyConfig, LoyaltyTierConfig, PointTransaction, PointTxType, RewardsRedemption - 11 new StorageKey variants for on-chain loyalty state: LoyaltyConfig, LoyaltyPoints, LifetimePoints, TotalSpent, MemberSince, Streak, LastChargeAt, PointsExpiration, PointTxCount, PointTx, RedemptionCount, Redemption
…ption - New loyalty.rs module: accumulate_points, redeem_points, streak tracking, tier calculation, referral bonuses, points expiry - Integrated accumulate_points into charge_subscription flow - 11 public contract functions for loyalty management - Points capped at 10M to prevent inflation - Streak bonus awarded every 10 consecutive charges - Auto-expiry check on balance reads - Redemption converts points to discount (100 pts = 1%, max 50%)
…dges/refs to screen - New types: PointTxType, LoyaltyConfig, StreakInfo, ReferralInfo - loyaltyStore: contract integration stubs, streak tracking, referral bonuses, gamification triggers - LoyaltyDashboardScreen: streak card, referral share, badges modal, points expiry UI, tier comparison table - gamificationService: 8 new loyalty achievements and badges (point milestones, streak milestones, referral milestones) - Gamification triggers wired into accumulatePoints and earnReferralBonus flows
713c666 to
7e78c8e
Compare
|
@activatedkc Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
Author
|
Fixed @Smartdevs17 |
Owner
|
Still merge conflicts |
Contributor
Author
|
Resolved @Smartdevs17 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements issue #387 — a full loyalty and rewards program with on-chain points, tiered benefits, streaks, referral bonuses, and gamification badges.
Changes
Commit 1: Types (contracts/types/src/lib.rs)
LoyaltyConfig,LoyaltyTierConfig,PointTransaction,PointTxType,RewardsRedemptionStorageKeyvariants:LoyaltyConfig,LoyaltyPoints,LifetimePoints,TotalSpent,MemberSince,Streak,LastChargeAt,PointsExpiration,PointTxCount,PointTx,RedemptionCount,RedemptionCommit 2: Smart Contract (contracts/subscription/src/loyalty.rs + lib.rs)
loyalty.rsmodule: points accumulation, streak tracking, tier calculation, referral bonuses, points redemption, expiryaccumulate_pointsintegrated intocharge_subscription(called after successful payment)initialize_loyalty,update_loyalty_config,get_loyalty_config,get_points,get_lifetime_points,get_streak,get_loyalty_status,redeem_loyalty_points,earn_referral_bonus,expire_points,get_point_transactions,get_redemptionCommit 3: Frontend (types, store, screen, gamification)
PointTxType,LoyaltyConfig,StreakInfo,ReferralInfoloyaltyStore.ts: contract integration stubs, streak tracking, referral bonuses, gamification triggersLoyaltyDashboardScreen.tsx: added streak card (fire icon, progress bar), referral share button, badges modal, tier comparison tablegamificationService.ts: 8 new loyalty achievements and badges (point milestones, streak milestones, referral milestones)accumulatePointsandearnReferralBonusflowsEdge Cases Handled
Closes #387