Skip to content

Commit ebc17a5

Browse files
Sync public snapshot from freebuff-private
Source: CodebuffAI/freebuff-private@259af22fd7b810c1683a2b72105c33d75b2b2020
1 parent 83ba7be commit ebc17a5

3 files changed

Lines changed: 34 additions & 2 deletions

File tree

bun.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/src/constants/freebuff-subscriptions.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,31 @@ export const FREEBUFF_SUBSCRIPTION_TIER_IDS = [
118118
export type FreebuffSubscriptionTierId =
119119
(typeof FREEBUFF_SUBSCRIPTION_TIER_IDS)[number]
120120

121+
export const FREEBUFF_SUBSCRIPTION_BILLING_INTERVALS = [
122+
'monthly',
123+
'yearly',
124+
] as const
125+
export type FreebuffSubscriptionBillingInterval =
126+
(typeof FREEBUFF_SUBSCRIPTION_BILLING_INTERVALS)[number]
127+
128+
export function isFreebuffSubscriptionBillingInterval(
129+
value: unknown,
130+
): value is FreebuffSubscriptionBillingInterval {
131+
return (
132+
typeof value === 'string' &&
133+
FREEBUFF_SUBSCRIPTION_BILLING_INTERVALS.includes(
134+
value as FreebuffSubscriptionBillingInterval,
135+
)
136+
)
137+
}
138+
121139
export interface FreebuffSubscriptionTier {
122140
id: FreebuffSubscriptionTierId
123141
displayName: string
124142
/** Every period after the first, in USD. */
125143
priceUsd: number
144+
/** Annual charge in USD. Usage allowances still refresh monthly. */
145+
yearlyPriceUsd: number
126146
/**
127147
* First billing period, in USD.
128148
*
@@ -199,6 +219,7 @@ export const FREEBUFF_SUBSCRIPTION_TIERS: readonly FreebuffSubscriptionTier[] =
199219
id: 'starter',
200220
displayName: 'Starter',
201221
priceUsd: 8,
222+
yearlyPriceUsd: 75,
202223
introPriceUsd: 5,
203224
dailySessions: 3,
204225
fiveDaySessions: 10,
@@ -213,6 +234,7 @@ export const FREEBUFF_SUBSCRIPTION_TIERS: readonly FreebuffSubscriptionTier[] =
213234
id: 'plus',
214235
displayName: 'Plus',
215236
priceUsd: 25,
237+
yearlyPriceUsd: 235,
216238
introPriceUsd: 19,
217239
dailySessions: 7,
218240
fiveDaySessions: 26,
@@ -224,6 +246,7 @@ export const FREEBUFF_SUBSCRIPTION_TIERS: readonly FreebuffSubscriptionTier[] =
224246
id: 'pro',
225247
displayName: 'Pro',
226248
priceUsd: 60,
249+
yearlyPriceUsd: 560,
227250
introPriceUsd: 45,
228251
dailySessions: 11,
229252
fiveDaySessions: 66,

common/src/types/freebuff-session.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export interface FreebuffSubscriptionTierOffer {
7171
id: string
7272
displayName: string
7373
priceUsd: number
74+
yearlyPriceUsd?: number
7475
/** What this caller would actually be charged for the first period —
7576
* `introPriceUsd` only while the account has never used its intro. */
7677
firstPeriodPriceUsd: number
@@ -89,6 +90,10 @@ export interface FreebuffSubscriptionTierOffer {
8990
/** True when it is below. A downgrade is SCHEDULED for the next renewal
9091
* rather than applied now, so clients must not word it as immediate. */
9192
downgrade: boolean
93+
/** Whether the monthly Stripe price is configured. Optional on old servers. */
94+
purchasable?: boolean
95+
/** Annual checkout remains unavailable until its Stripe price is configured. */
96+
yearlyPurchasable?: boolean
9297
}
9398

9499
/**
@@ -317,6 +322,12 @@ export interface FreebuffPriceChange {
317322
export interface FreebuffSubscriptionInfo {
318323
/** The caller's tier id, or null when they have no live subscription. */
319324
tierId: string | null
325+
/** Entitlement origin. Optional for compatibility with older servers. */
326+
source?: 'stripe' | 'grant'
327+
/** Billing cadence for the live plan. Absent on legacy server payloads. */
328+
billingInterval?: 'monthly' | 'yearly'
329+
/** Stripe paid-through/renewal instant, distinct from monthly usage reset. */
330+
renewsAt?: string
320331
/** Present only while subscribed. */
321332
usage?: FreebuffSubscriptionUsage
322333
/** Raw Stripe status, so a client can surface a failed payment. */

0 commit comments

Comments
 (0)