refactor(core): keep plan prices, cloud quotas and public URLs in one contract (WS-A)
Prices, quotas and site URLs were copied by hand into the edge functions, admin, desktop and the landing site, and the copies disagreed (Payple billed 9,900/29,900 KRW, admin labels said 12,900/24,900 KRW and $9.9/$19.9, the site said 2,900/8,900 KRW). - packages/core/src/plan-catalog.ts is the single source for PLAN_PRICE_KRW (Free 0 / Pro 2,900 / Pro+ 8,900 a month) and PLAN_QUOTA. - packages/core/src/web-urls.ts is the single source for the public origin, the /app web-app base path, SITE_URLS and billingUrl(). - Deno cannot bundle packages/core, so scripts/ci/sync-core-contract.mjs generates _shared/core-contract.generated.ts; `npm run contract:check` fails on drift (same pattern as version:sync). - Payple checkout, renewal and webhook amount checks now bill the catalog price, so existing subscribers move to the new price at their next renewal. quota.ts, team-contract.ts and the tests read the generated values. - Admin MRR/ARR is computed in KRW from the catalog; license labels, the release link and desktop PREMIUM_LLM limits derive from core; the site imports prices and quotas directly. Policy: docs/REFACTOR_POLICY.md Wave 3, W3-1 and W3-2.
This commit is contained in:
parent
e689683b72
commit
88f24d84a1
21 changed files with 568 additions and 152 deletions
|
|
@ -22,11 +22,12 @@ export default async function AdminOverviewPage(): Promise<React.ReactElement> {
|
|||
}
|
||||
}
|
||||
|
||||
const krw = new Intl.NumberFormat('ko-KR', { style: 'currency', currency: 'KRW', maximumFractionDigits: 0 })
|
||||
const revenueCards = revenue
|
||||
? [
|
||||
{
|
||||
title: 'Annual Recurring Revenue',
|
||||
value: `$${revenue.arrUsd.toLocaleString()}`,
|
||||
value: krw.format(revenue.arrKrw),
|
||||
subtext: 'Active subscriptions × 12 months',
|
||||
color: 'green' as const,
|
||||
badge: 'ARR',
|
||||
|
|
@ -34,7 +35,7 @@ export default async function AdminOverviewPage(): Promise<React.ReactElement> {
|
|||
},
|
||||
{
|
||||
title: 'Monthly Recurring Revenue',
|
||||
value: `$${revenue.mrrUsd.toLocaleString()}`,
|
||||
value: krw.format(revenue.mrrKrw),
|
||||
subtext: `Pro ${revenue.tierBreakdown.pro.toLocaleString()} · Pro+ ${revenue.tierBreakdown.pro_plus.toLocaleString()}`,
|
||||
color: 'blue' as const,
|
||||
badge: 'MRR',
|
||||
|
|
@ -208,7 +209,7 @@ export default async function AdminOverviewPage(): Promise<React.ReactElement> {
|
|||
>
|
||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', mb: 2 }}>
|
||||
<StatRing color={card.color} size={46}>
|
||||
<Typography sx={{ fontFamily: FONT_MONO, fontSize: '13px', fontWeight: 500 }}>$</Typography>
|
||||
<Typography sx={{ fontFamily: FONT_MONO, fontSize: '13px', fontWeight: 500 }}>₩</Typography>
|
||||
</StatRing>
|
||||
<Box component="span" sx={statusBadgeSx(card.badgeColor)}>
|
||||
{card.badge}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import { Box, Typography, Button } from '@mui/material'
|
||||
import { DoubleBezelCard, TactileBadge } from '@d3ro/ui/components/ds'
|
||||
import { SITE_URLS } from '@d3ro/core/web-urls'
|
||||
import { C, FONT_SANS, FONT_MONO, panelSx, tableSx, statusBadgeSx } from '@/lib/console-theme'
|
||||
import { requireManager } from '@/lib/admin-guard'
|
||||
import { fetchReleaseHub, type ReleaseAssetPlatform, type ReleaseHub } from '@/lib/forgejo-releases'
|
||||
|
|
@ -107,7 +108,7 @@ function HeaderBar({ feedLive, repoHtmlUrl }: { feedLive: boolean; repoHtmlUrl:
|
|||
Forgejo Releases ↗
|
||||
</Button>
|
||||
<Button
|
||||
href="https://d3ro.chanpaca.net/download.html"
|
||||
href={SITE_URLS.download}
|
||||
target="_blank"
|
||||
variant="outlined"
|
||||
sx={{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue