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
4 changes: 3 additions & 1 deletion common/src/constants/grant-priorities.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { GrantType } from '@codebuff/common/types/grant'

// Lower = consumed first
export const GRANT_PRIORITIES: Record<GrantType, number> = {
subscription: 10,
free: 20,
referral: 30,
referral_legacy: 30, // Legacy recurring referrals (renews monthly, consumed first)
ad: 40,
referral: 50, // One-time referrals (never expires, preserved longer)
admin: 60,
organization: 70,
purchase: 80,
Expand Down
2 changes: 1 addition & 1 deletion common/src/constants/limits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const MAX_DATE = new Date(86399999999999)
export const BILLING_PERIOD_DAYS = 30
export const SESSION_MAX_AGE_SECONDS = 30 * 24 * 60 * 60 // 30 days
export const SESSION_TIME_WINDOW_MS = 30 * 60 * 1000 // 30 minutes - used for matching sessions created around fingerprint creation
export const CREDITS_REFERRAL_BONUS = 250
export const CREDITS_REFERRAL_BONUS = 500
export const AFFILIATE_USER_REFFERAL_LIMIT = 500

// Default number of free credits granted per cycle
Expand Down
2 changes: 2 additions & 0 deletions common/src/types/grant.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export type GrantType =
| 'free'
| 'referral'
| 'referral_legacy'
| 'subscription'
| 'purchase'
| 'admin'
Expand All @@ -10,6 +11,7 @@ export type GrantType =
export const GrantTypeValues = [
'free',
'referral',
'referral_legacy',
'subscription',
'purchase',
'admin',
Expand Down
Loading
Loading