diff --git a/apps/bear/next.config.ts b/apps/bear/next.config.ts index 405d1b1..8854907 100644 --- a/apps/bear/next.config.ts +++ b/apps/bear/next.config.ts @@ -48,10 +48,6 @@ const nextConfig: NextConfig = { '@lumina/libs', '@lumina/tools', ], - // `/@{username}` is the public channel URL. A folder named `@…` is a - // parallel-route slot in the App Router, so the routes live under - // `channels/[username]` and the public URL is rewritten onto them. - // // The browser calls the API on this site's origin (`/api/v1/…`, `/api/files/…`), and the API // calls are proxied to the gateway, so there is no CORS and the session cookies are this site's // (0018). @@ -61,10 +57,6 @@ const nextConfig: NextConfig = { source: `${API_PROXY_PATH}/:path*`, destination: `${apiInternalUrl()}/:path*`, }, - { - source: '/@:username/:path*', - destination: '/channels/:username/:path*', - }, ]; }, async headers() { @@ -86,12 +78,13 @@ const nextConfig: NextConfig = { }, ]; }, - // One canonical URL per channel: send direct `/channels/…` hits to `/@…`. + // A channel lives at `/channels/username` only (0064). Links people kept or were sent as + // `/@username` (the old address, still in SMS and notifications) move there for good, query kept. async redirects() { return [ { - source: '/channels/:username/:path*', - destination: '/@:username/:path*', + source: '/@:username/:path*', + destination: '/channels/:username/:path*', permanent: true, }, ]; diff --git a/apps/bear/src/app/(main)/channels/[username]/page.tsx b/apps/bear/src/app/(main)/channels/[username]/page.tsx index b418001..edacdf2 100644 --- a/apps/bear/src/app/(main)/channels/[username]/page.tsx +++ b/apps/bear/src/app/(main)/channels/[username]/page.tsx @@ -42,9 +42,9 @@ export async function generateMetadata({ } /** - * A creator's channel, `/@username`. The same server render for every visitor: the header, the - * track record and the first posts; subscribe, follow and the locked posts' gates load in the - * browser. Any other spelling of the username redirects to the one the API stores. + * A creator's channel, `/channels/username`. The same server render for every visitor: the + * header, the track record and the first posts; subscribe, follow and the locked posts' gates + * load in the browser. Any other spelling of the username redirects to the one the API stores. */ export default async function ChannelPage({ params, diff --git a/apps/bear/src/app/(main)/channels/[username]/posts/[id]/page.tsx b/apps/bear/src/app/(main)/channels/[username]/posts/[id]/page.tsx index c6b7946..77b9af3 100644 --- a/apps/bear/src/app/(main)/channels/[username]/posts/[id]/page.tsx +++ b/apps/bear/src/app/(main)/channels/[username]/posts/[id]/page.tsx @@ -58,9 +58,9 @@ export async function generateMetadata({ } /** - * One post, `/@username/posts/[id]`: where every shared link lands. The server renders it as every - * visitor sees it; a subscriber's or the creator's premium post opens in the browser. A deleted - * or unknown post keeps the channel's frame and leads back to the channel. + * One post, `/channels/username/posts/[id]`: where every shared link lands. The server renders it + * as every visitor sees it; a subscriber's or the creator's premium post opens in the browser. A + * deleted or unknown post keeps the channel's frame and leads back to the channel. */ export default async function PostPage({ params }: PostPageProps) { const { username: segment, id } = await params; diff --git a/apps/bear/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/types.ts b/apps/bear/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/types.ts index 8db8fb8..2a98c6a 100644 --- a/apps/bear/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/types.ts +++ b/apps/bear/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/types.ts @@ -5,7 +5,7 @@ export type PostTemplateProps = { channel: PublicCreatorPayload; /** `null`: deleted, unknown, or another channel's. */ post: PostPayload | null; - /** «lumina.ir/@sara_gold», for the guest's login prompt. */ + /** «lumina.ir/channels/sara_gold», for the guest's login prompt. */ channelUrl: string; /** The render's time: the post's time counts from it. */ now: string; diff --git a/apps/bear/src/app/(main)/channels/[username]/templates/channel-template/types.ts b/apps/bear/src/app/(main)/channels/[username]/templates/channel-template/types.ts index 8f8764a..d2c5bbe 100644 --- a/apps/bear/src/app/(main)/channels/[username]/templates/channel-template/types.ts +++ b/apps/bear/src/app/(main)/channels/[username]/templates/channel-template/types.ts @@ -2,7 +2,7 @@ import type { PublicCreatorPayload } from '@lumina/market/features/channel'; export type ChannelTemplateProps = { channel: PublicCreatorPayload; - /** «lumina.ir/@sara_gold». */ + /** «lumina.ir/channels/sara_gold». */ channelUrl: string; /** The render's time: the posts' relative times count from it. */ now: string; diff --git a/apps/bear/src/configs/site.ts b/apps/bear/src/configs/site.ts index 44db08e..ce375cf 100644 --- a/apps/bear/src/configs/site.ts +++ b/apps/bear/src/configs/site.ts @@ -1,6 +1,9 @@ import { clientEnv } from '../env'; -/** A path on this site as people read and type it, without the scheme: «lumina.ir/@sara_gold». */ +/** + * A path on this site as people read and type it, without the scheme: + * «lumina.ir/channels/sara_gold». + */ export function displayUrl(path: string): string { return `${new URL(clientEnv.NEXT_PUBLIC_SITE_URL).host}${path}`; } diff --git a/apps/bull/next.config.ts b/apps/bull/next.config.ts index 405d1b1..8854907 100644 --- a/apps/bull/next.config.ts +++ b/apps/bull/next.config.ts @@ -48,10 +48,6 @@ const nextConfig: NextConfig = { '@lumina/libs', '@lumina/tools', ], - // `/@{username}` is the public channel URL. A folder named `@…` is a - // parallel-route slot in the App Router, so the routes live under - // `channels/[username]` and the public URL is rewritten onto them. - // // The browser calls the API on this site's origin (`/api/v1/…`, `/api/files/…`), and the API // calls are proxied to the gateway, so there is no CORS and the session cookies are this site's // (0018). @@ -61,10 +57,6 @@ const nextConfig: NextConfig = { source: `${API_PROXY_PATH}/:path*`, destination: `${apiInternalUrl()}/:path*`, }, - { - source: '/@:username/:path*', - destination: '/channels/:username/:path*', - }, ]; }, async headers() { @@ -86,12 +78,13 @@ const nextConfig: NextConfig = { }, ]; }, - // One canonical URL per channel: send direct `/channels/…` hits to `/@…`. + // A channel lives at `/channels/username` only (0064). Links people kept or were sent as + // `/@username` (the old address, still in SMS and notifications) move there for good, query kept. async redirects() { return [ { - source: '/channels/:username/:path*', - destination: '/@:username/:path*', + source: '/@:username/:path*', + destination: '/channels/:username/:path*', permanent: true, }, ]; diff --git a/apps/bull/src/app/(main)/channels/[username]/page.tsx b/apps/bull/src/app/(main)/channels/[username]/page.tsx index b418001..edacdf2 100644 --- a/apps/bull/src/app/(main)/channels/[username]/page.tsx +++ b/apps/bull/src/app/(main)/channels/[username]/page.tsx @@ -42,9 +42,9 @@ export async function generateMetadata({ } /** - * A creator's channel, `/@username`. The same server render for every visitor: the header, the - * track record and the first posts; subscribe, follow and the locked posts' gates load in the - * browser. Any other spelling of the username redirects to the one the API stores. + * A creator's channel, `/channels/username`. The same server render for every visitor: the + * header, the track record and the first posts; subscribe, follow and the locked posts' gates + * load in the browser. Any other spelling of the username redirects to the one the API stores. */ export default async function ChannelPage({ params, diff --git a/apps/bull/src/app/(main)/channels/[username]/posts/[id]/page.tsx b/apps/bull/src/app/(main)/channels/[username]/posts/[id]/page.tsx index c6b7946..77b9af3 100644 --- a/apps/bull/src/app/(main)/channels/[username]/posts/[id]/page.tsx +++ b/apps/bull/src/app/(main)/channels/[username]/posts/[id]/page.tsx @@ -58,9 +58,9 @@ export async function generateMetadata({ } /** - * One post, `/@username/posts/[id]`: where every shared link lands. The server renders it as every - * visitor sees it; a subscriber's or the creator's premium post opens in the browser. A deleted - * or unknown post keeps the channel's frame and leads back to the channel. + * One post, `/channels/username/posts/[id]`: where every shared link lands. The server renders it + * as every visitor sees it; a subscriber's or the creator's premium post opens in the browser. A + * deleted or unknown post keeps the channel's frame and leads back to the channel. */ export default async function PostPage({ params }: PostPageProps) { const { username: segment, id } = await params; diff --git a/apps/bull/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/types.ts b/apps/bull/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/types.ts index 8db8fb8..2a98c6a 100644 --- a/apps/bull/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/types.ts +++ b/apps/bull/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/types.ts @@ -5,7 +5,7 @@ export type PostTemplateProps = { channel: PublicCreatorPayload; /** `null`: deleted, unknown, or another channel's. */ post: PostPayload | null; - /** «lumina.ir/@sara_gold», for the guest's login prompt. */ + /** «lumina.ir/channels/sara_gold», for the guest's login prompt. */ channelUrl: string; /** The render's time: the post's time counts from it. */ now: string; diff --git a/apps/bull/src/app/(main)/channels/[username]/templates/channel-template/types.ts b/apps/bull/src/app/(main)/channels/[username]/templates/channel-template/types.ts index 8f8764a..d2c5bbe 100644 --- a/apps/bull/src/app/(main)/channels/[username]/templates/channel-template/types.ts +++ b/apps/bull/src/app/(main)/channels/[username]/templates/channel-template/types.ts @@ -2,7 +2,7 @@ import type { PublicCreatorPayload } from '@lumina/market/features/channel'; export type ChannelTemplateProps = { channel: PublicCreatorPayload; - /** «lumina.ir/@sara_gold». */ + /** «lumina.ir/channels/sara_gold». */ channelUrl: string; /** The render's time: the posts' relative times count from it. */ now: string; diff --git a/apps/bull/src/configs/site.ts b/apps/bull/src/configs/site.ts index 44db08e..ce375cf 100644 --- a/apps/bull/src/configs/site.ts +++ b/apps/bull/src/configs/site.ts @@ -1,6 +1,9 @@ import { clientEnv } from '../env'; -/** A path on this site as people read and type it, without the scheme: «lumina.ir/@sara_gold». */ +/** + * A path on this site as people read and type it, without the scheme: + * «lumina.ir/channels/sara_gold». + */ export function displayUrl(path: string): string { return `${new URL(clientEnv.NEXT_PUBLIC_SITE_URL).host}${path}`; } diff --git a/docs/decisions/0064-channels-at-channels-path.md b/docs/decisions/0064-channels-at-channels-path.md new file mode 100644 index 0000000..7d09d10 --- /dev/null +++ b/docs/decisions/0064-channels-at-channels-path.md @@ -0,0 +1,17 @@ +# 0064 Channels live at /channels/username + +Status: Accepted · Area: architecture · Date: 2026-10-16 · Decided by: user + +## Context +The public channel URL was `/@username`, rewritten onto `channels/[username]` because an `@…` folder is a parallel-route slot, with `/channels/…` redirected back to `/@…`. The user chose to stop handling «@» in the path. + +## Decision +- A channel and its pages live at `/channels/username` (`/posts/[id]`, `/track-record`), the canonical URL. Build links only with `ROUTES.channel`, `ROUTES.post` and `ROUTES.trackRecord`. +- `next.config.ts` in bull and bear permanently redirects `/@:username/:path*` to `/channels/:username/:path*`, keeping the query (`?code=`). This is the only place «@» is read. +- A username segment is never stripped of a leading «@»: `/channels/@user` and `/checkout/@user` are 404. + +## Alternatives +- Keep `/@username` with the rewrite: shorter to type and share, but two spellings of each channel to keep in step. + +## Consequences +Search engines move the old URLs over through the 308. The back end still builds `/@username` links (SMS, notifications, admin invite URLs); they work through the redirect until changed there. Records 0044, 0055 and 0059 still name the old form. diff --git a/docs/decisions/README.md b/docs/decisions/README.md index b7adfc5..4401b07 100644 --- a/docs/decisions/README.md +++ b/docs/decisions/README.md @@ -25,6 +25,7 @@ - 0059 Checkout and the channel save `?code=` into the per-creator checkout draft on arrival; checkout then strips it from the URL. - 0060 Composers send a creator who can't publish to their own channel with the locked dialog; every publish carries a stable `Idempotency-Key`. - 0061 Build the admin panel as `apps/wall-street-plaza` with `platforms/garden-roof`, tagged `scope:admin`; it calls only the back end's `admin-api`, through its own `/api` rewrite. +- 0064 Serve a channel at `/channels/username`, built only through `ROUTES`; both apps 308-redirect `/@username/…` there, and no other code reads «@» in a path. ## Proposed diff --git a/packages/island/src/organisms/post-card/types.ts b/packages/island/src/organisms/post-card/types.ts index ad4d4e3..8bf7992 100644 --- a/packages/island/src/organisms/post-card/types.ts +++ b/packages/island/src/organisms/post-card/types.ts @@ -154,7 +154,7 @@ type PostCardBaseProps = { onCopyLink?: () => void; /** * The post's link as the desktop share popover shows it, without the scheme: - * `lumina.ir/@sara_gold/posts/1042`. Read in the browser; only an open popover shows it. + * `lumina.ir/channels/sara_gold/posts/1042`. Read in the browser; only an open popover shows it. */ shareUrl?: string; /** diff --git a/platforms/market/src/app/navigation/active-tab.ts b/platforms/market/src/app/navigation/active-tab.ts index dd0a670..9ca25ad 100644 --- a/platforms/market/src/app/navigation/active-tab.ts +++ b/platforms/market/src/app/navigation/active-tab.ts @@ -1,7 +1,6 @@ import { ACCOUNT_PATH, CHANNEL_PREFIX, - CHANNEL_ROUTE_PREFIX, DASHBOARD_PATH, NOTIFICATIONS_PATH, SEARCH_PATH, @@ -12,17 +11,12 @@ import type { NavTabName } from './types'; const isUnder = (pathname: string, path: string): boolean => pathname === path || pathname.startsWith(`${path}/`); -/** - * The creator's own channel or a page under it, by its public path or the route it is rewritten - * onto, depending on who reads it. - */ +/** The creator's own channel or a page under it. */ export function isOwnChannelPath( pathname: string, ownUsername: string, ): boolean { - return [CHANNEL_PREFIX, CHANNEL_ROUTE_PREFIX].some((prefix) => - isUnder(pathname, `${prefix}${ownUsername}`), - ); + return isUnder(pathname, `${CHANNEL_PREFIX}${ownUsername}`); } /** diff --git a/platforms/market/src/app/navigation/constants.ts b/platforms/market/src/app/navigation/constants.ts index ff8deda..daf081f 100644 --- a/platforms/market/src/app/navigation/constants.ts +++ b/platforms/market/src/app/navigation/constants.ts @@ -1,8 +1,5 @@ -/** The public channel URL prefix; next.config rewrites `/@username` onto `channels/[username]`. */ -export const CHANNEL_PREFIX = '/@'; - -/** The App Router's own path for a channel, which `/@username` is rewritten onto. */ -export const CHANNEL_ROUTE_PREFIX = '/channels/'; +/** A channel's path prefix: `/channels/username` (0064). */ +export const CHANNEL_PREFIX = '/channels/'; /** * `?locked=post|prediction` on a creator's own channel: a composer they may not use sent them here, diff --git a/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-not-found/ChannelNotFound.tsx b/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-not-found/ChannelNotFound.tsx index 9d8039e..52eae7d 100644 --- a/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-not-found/ChannelNotFound.tsx +++ b/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-not-found/ChannelNotFound.tsx @@ -17,7 +17,7 @@ import type { ChannelNotFoundProps } from './types'; function typedUsername(segment: string | undefined): string { if (!segment) return ''; try { - return decodeURIComponent(segment).replace(/^@/, ''); + return decodeURIComponent(segment); } catch { return segment; } diff --git a/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-not-found/hooks/use-own-address.ts b/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-not-found/hooks/use-own-address.ts index 0d67f0f..612c9d5 100644 --- a/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-not-found/hooks/use-own-address.ts +++ b/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-not-found/hooks/use-own-address.ts @@ -4,26 +4,19 @@ import { useCurrentAccount, useViewerStatus, } from '../../../../../../../../stores/auth'; -import { - CHANNEL_PREFIX, - CHANNEL_ROUTE_PREFIX, -} from '../../../../../../../navigation/constants'; +import { CHANNEL_PREFIX } from '../../../../../../../navigation/constants'; import type { OwnAddress } from '../types'; -/** The username an address names, whichever form the router reports it in. */ +/** The username an address names. */ function usernameIn(pathname: string): string | null { - for (const prefix of [CHANNEL_PREFIX, CHANNEL_ROUTE_PREFIX]) { - if (pathname.startsWith(prefix)) { - const segment = pathname.slice(prefix.length).split('/')[0]; - // A malformed escape names no channel anyone owns. - try { - return decodeURIComponent(segment).toLowerCase(); - } catch { - return null; - } - } + if (!pathname.startsWith(CHANNEL_PREFIX)) return null; + const segment = pathname.slice(CHANNEL_PREFIX.length).split('/')[0]; + // A malformed escape names no channel anyone owns. + try { + return decodeURIComponent(segment).toLowerCase(); + } catch { + return null; } - return null; } /** diff --git a/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-share/types.ts b/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-share/types.ts index 346f247..ca8374b 100644 --- a/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-share/types.ts +++ b/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-share/types.ts @@ -4,7 +4,7 @@ export type ChannelShareProps = { /** The creator's account id: they get the caption sheet, everyone else the link. */ creatorId: string; username: string; - /** «lumina.ir/@sara_gold», shown read-only in the creator's sheet. */ + /** «lumina.ir/channels/sara_gold», shown read-only in the creator's sheet. */ channelUrl: string; /** mobile: share sheets and a bottom sheet. desktop: copying and a popover. */ layout: 'mobile' | 'desktop'; diff --git a/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-unavailable/types.ts b/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-unavailable/types.ts index 3e08ba9..deec98e 100644 --- a/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-unavailable/types.ts +++ b/platforms/market/src/app/screens/(main)/channels/[username]/organisms/channel-unavailable/types.ts @@ -5,7 +5,7 @@ export type ChannelUnavailableProps = { context: 'channel' | 'post'; /** The channel page passes it, so its own creator sees their suspended tab (C6 ۱.۳). */ channel?: PublicCreatorPayload; - /** «lumina.ir/@sara_gold». */ + /** «lumina.ir/channels/sara_gold». */ channelUrl?: string; layout?: 'mobile' | 'desktop'; }; diff --git a/platforms/market/src/app/screens/organisms/page-error/utils.ts b/platforms/market/src/app/screens/organisms/page-error/utils.ts index ecc677b..8f0f025 100644 --- a/platforms/market/src/app/screens/organisms/page-error/utils.ts +++ b/platforms/market/src/app/screens/organisms/page-error/utils.ts @@ -1,8 +1,4 @@ -import { - ACCOUNT_PATH, - CHANNEL_PREFIX, - CHANNEL_ROUTE_PREFIX, -} from '../../../navigation/constants'; +import { ACCOUNT_PATH, CHANNEL_PREFIX } from '../../../navigation/constants'; import { ROUTES } from '../../../navigation/navigation'; import { TAB_BARS } from './constants'; import type { PageBar } from './types'; @@ -12,10 +8,7 @@ export function pageBar(pathname: string): PageBar { if (pathname === ROUTES.landing) return { kind: 'root' }; const tab = TAB_BARS[pathname]; if (tab) return tab; - if ( - pathname.startsWith(CHANNEL_PREFIX) || - pathname.startsWith(CHANNEL_ROUTE_PREFIX) - ) { + if (pathname.startsWith(CHANNEL_PREFIX)) { return { kind: 'pushed', title: 'nav.channel' }; } if (pathname === ACCOUNT_PATH || pathname.startsWith(`${ACCOUNT_PATH}/`)) { diff --git a/platforms/market/src/app/seo/metadata.ts b/platforms/market/src/app/seo/metadata.ts index 0a4c238..45ae14c 100644 --- a/platforms/market/src/app/seo/metadata.ts +++ b/platforms/market/src/app/seo/metadata.ts @@ -14,7 +14,7 @@ function clip(text: string, max: number): string { return `${(space > max / 2 ? cut.slice(0, space) : cut).trimEnd()}…`; } -/** A channel's title, description, canonical `/@username` and profile card. */ +/** A channel's title, description, canonical `/channels/username` and profile card. */ export function channelMetadata({ channel, title, diff --git a/platforms/market/src/features/channel/caches/channel.ts b/platforms/market/src/features/channel/caches/channel.ts index 9665842..7a57752 100644 --- a/platforms/market/src/features/channel/caches/channel.ts +++ b/platforms/market/src/features/channel/caches/channel.ts @@ -7,8 +7,8 @@ import type { PublicCreatorPayload } from '../repositories/channel'; import { getPublicTiers } from './public-tiers'; /** - * The channel at `/@username`, once per render per username: the page and its metadata share one - * request. Pass the username as the API stores it (no «@», lower case). 404 reaches the caller. + * The channel at `/channels/username`, once per render per username: the page and its metadata + * share one request. Pass the username as the API stores it (lower case). 404 reaches the caller. * It carries the public follower count for the header (a failed count is left to the browser) and * whether anything can be bought (J05-1g): an approved creator with a priced tier. Failed tiers * leave the sale open, so checkout decides. diff --git a/platforms/market/src/features/channel/models/share/types.ts b/platforms/market/src/features/channel/models/share/types.ts index ebd3905..823ec63 100644 --- a/platforms/market/src/features/channel/models/share/types.ts +++ b/platforms/market/src/features/channel/models/share/types.ts @@ -1,14 +1,14 @@ export type ShareLinkArgs = { /** What is shared: it picks the copied toast. */ kind: 'channel' | 'post'; - /** A path on this site: `/@sara_gold`, `/@sara_gold/posts/…`. */ + /** A path on this site: `/channels/sara_gold`, `/channels/sara_gold/posts/…`. */ path: string; /** Mobile: the device's share sheet when it has one. Desktop: copy the link. */ native: boolean; }; export type UseChannelShareSheetOptions = { - /** The channel's path on this site: `/@sara_gold`. */ + /** The channel's path on this site: `/channels/sara_gold`. */ path: string; /** Mobile: «اشتراک‌گذاری» hands caption and link to the device's share sheet. */ native: boolean; diff --git a/platforms/market/src/features/channel/models/share/use-display-link.ts b/platforms/market/src/features/channel/models/share/use-display-link.ts index 85c1fe3..2713e7e 100644 --- a/platforms/market/src/features/channel/models/share/use-display-link.ts +++ b/platforms/market/src/features/channel/models/share/use-display-link.ts @@ -5,8 +5,8 @@ const subscribe = () => () => undefined; /** * A path on this site as a share popover shows it, the host and the path without the scheme: - * `lumina.ir/@sara_gold/posts/1042`, the address `useShareLink` copies. Undefined in the server - * render, which can't know the host the visitor uses. + * `lumina.ir/channels/sara_gold/posts/1042`, the address `useShareLink` copies. Undefined in the + * server render, which can't know the host the visitor uses. */ export function useDisplayLink(path: string): string | undefined { const host = useSyncExternalStore( diff --git a/platforms/market/src/features/checkout/constants.ts b/platforms/market/src/features/checkout/constants.ts index c419d5e..27b73fd 100644 --- a/platforms/market/src/features/checkout/constants.ts +++ b/platforms/market/src/features/checkout/constants.ts @@ -20,5 +20,5 @@ export const PAYMENT_POLL_MS = 2_000; */ export const PAYMENT_CONFIRM_TIMEOUT_MS = 30_000; -/** An invite link's query parameter: `/@username?code=REZA-2024` (J06-1b). */ +/** An invite link's query parameter: `/channels/username?code=REZA-2024` (J06-1b). */ export const INVITE_CODE_PARAM = 'code'; diff --git a/platforms/market/src/features/checkout/models/invite-link/use-invite-link.ts b/platforms/market/src/features/checkout/models/invite-link/use-invite-link.ts index 5a99a5a..612f7ba 100644 --- a/platforms/market/src/features/checkout/models/invite-link/use-invite-link.ts +++ b/platforms/market/src/features/checkout/models/invite-link/use-invite-link.ts @@ -9,8 +9,8 @@ import { INVITE_CODE_PARAM } from '../../constants'; import type { InviteLinkModel } from './types'; /** - * A channel opened from an invite link (`/@username?code=…`, J06-1b/1c): the code is kept for - * this creator, across a detour and a guest's login, until a paid subscription to them. It is + * A channel opened from an invite link (`/channels/username?code=…`, J06-1b/1c): the code is kept + * for this creator, across a detour and a guest's login, until a paid subscription to them. It is * never shown or checked here; checkout applies it. Checkout reads its own `?code=` the same way * and then strips it (0059); the channel's link keeps it, as the creator shared it. */ diff --git a/platforms/market/src/features/referral/constants.ts b/platforms/market/src/features/referral/constants.ts index f67632c..738f9b8 100644 --- a/platforms/market/src/features/referral/constants.ts +++ b/platforms/market/src/features/referral/constants.ts @@ -16,5 +16,5 @@ export const CAPACITY_NOTE_MAX_LENGTH = 200; /** How long «درخواست شما تأیید شد» stays on the card after the team's decision (J10-2g). */ export const CAPACITY_APPROVED_SHOW_DAYS = 7; -/** The query parameter the shared channel link carries the code in: `/@username?code=…`. */ +/** The query parameter the shared channel link carries the code in: `/channels/username?code=…`. */ export const REFERRAL_CODE_PARAM = 'code'; diff --git a/platforms/market/src/features/referral/models/invite-code/types.ts b/platforms/market/src/features/referral/models/invite-code/types.ts index eaef86a..7d4c64a 100644 --- a/platforms/market/src/features/referral/models/invite-code/types.ts +++ b/platforms/market/src/features/referral/models/invite-code/types.ts @@ -84,9 +84,9 @@ export type InviteCodePartModel = { /** `null` before approval: the creator has no code yet, so there is no card (J10-1e). */ card: ReferralCardPayload | null; view: InviteCodeView; - /** The shared link with the code: `https://lumina.ir/@user?code=…`. */ + /** The shared link with the code: `https://lumina.ir/channels/user?code=…`. */ link: string; - /** The link as people read it, without the scheme: `lumina.ir/@user?code=…`. */ + /** The link as people read it, without the scheme: `lumina.ir/channels/user?code=…`. */ displayLink: string; /** A request waits for the team: its banner replaces «درخواست افزایش ظرفیت» (J10-2f). */ isRequestPending: boolean; diff --git a/platforms/market/src/features/referral/models/invite-code/use-invite-code-part.ts b/platforms/market/src/features/referral/models/invite-code/use-invite-code-part.ts index 0371710..6680d0c 100644 --- a/platforms/market/src/features/referral/models/invite-code/use-invite-code-part.ts +++ b/platforms/market/src/features/referral/models/invite-code/use-invite-code-part.ts @@ -68,8 +68,8 @@ function outcomeOf( /** * طرح‌های اشتراک › «کد دعوت» (J10-2): the creator's code with copy, its capacity, and the channel - * link that carries it (`/@username?code=…`, from the site's configured address) to share or copy. - * A full code stays shareable and can ask the team for more seats, and shows the team's answer + * link that carries it (`/channels/username?code=…`, from the site's configured address) to share + * or copy. A full code stays shareable and can ask the team for more seats, and shows the team's answer * (2g, 2h); with no priced plan the card is dimmed and frozen (J10-1d); an admin's switch-off * keeps it readable with the reason (2i). The capacity is set by the Lumina team only. Browser only. */ diff --git a/platforms/market/src/features/referral/repositories/referral/types.ts b/platforms/market/src/features/referral/repositories/referral/types.ts index 05ee840..8e090e9 100644 --- a/platforms/market/src/features/referral/repositories/referral/types.ts +++ b/platforms/market/src/features/referral/repositories/referral/types.ts @@ -29,7 +29,7 @@ export type CapacityRequestPayload = { /** What the «کد دعوت» card shows (J10-2). */ export type ReferralCardPayload = { code: string; - /** For the link `/@{username}?code={code}`; `null` when the profile has none. */ + /** For the link `/channels/{username}?code={code}`; `null` when the profile has none. */ username: string | null; used: number; maxUses: number; diff --git a/platforms/market/src/shared/utils/channel-username.ts b/platforms/market/src/shared/utils/channel-username.ts index a6b6fb2..0bd046d 100644 --- a/platforms/market/src/shared/utils/channel-username.ts +++ b/platforms/market/src/shared/utils/channel-username.ts @@ -3,8 +3,8 @@ import * as v from 'valibot'; import { usernameSchema } from '../validations'; /** - * A channel URL's username segment as the API stores it: decoded, without a leading «@», in lower - * case. `null` when it can't be a username, so the page answers 404 without asking the API. + * A channel URL's username segment as the API stores it: decoded, in lower case. `null` when it + * can't be a username, so the page answers 404 without asking the API. */ export function toChannelUsername(segment: string): string | null { let decoded: string; @@ -13,6 +13,6 @@ export function toChannelUsername(segment: string): string | null { } catch { return null; } - const parsed = v.safeParse(usernameSchema, decoded.trim().replace(/^@/, '')); + const parsed = v.safeParse(usernameSchema, decoded.trim()); return parsed.success ? parsed.output : null; } diff --git a/platforms/market/src/stores/checkout-draft/types.ts b/platforms/market/src/stores/checkout-draft/types.ts index 65e9759..24f01fa 100644 --- a/platforms/market/src/stores/checkout-draft/types.ts +++ b/platforms/market/src/stores/checkout-draft/types.ts @@ -28,8 +28,8 @@ export type PaymentSettlement = { export type CheckoutDraftState = { draft: CheckoutDraft | null; /** - * Invite codes that came with an invite link (`/@username?code=…`) or a checkout link - * (`/checkout/@username?code=…`, 0059), by the creator's account id, until a paid subscription to + * Invite codes that came with an invite link (`/channels/username?code=…`) or a checkout link + * (`/checkout/username?code=…`, 0059), by the creator's account id, until a paid subscription to * that creator or logout. Never shown or checked on the channel. */ inviteCodes: Record;