From c593e095542aaf53e7903e4d78c0ab9cfb0b65b9 Mon Sep 17 00:00:00 2001 From: Amiram_se Date: Sat, 10 Oct 2026 13:29:48 +0400 Subject: [PATCH] feat(apps): rules pages under /terms, pricing editor with leave guard, page-size errors on subscriptions and transactions, pending channel gate, welcome sheet and invite notes on channels, registration back on step 4 Co-Authored-By: Claude Opus 5.5 --- .../(auth)/auth/register/details/loading.tsx | 3 +- .../app/(auth)/auth/register/details/page.tsx | 17 ++- .../(flow)/checkout/[username]/loading.tsx | 1 + .../checkout-template/CheckoutTemplate.tsx | 2 + .../src/app/(flow)/dashboard/pricing/page.tsx | 41 +----- .../payment/result/[paymentId]/loading.tsx | 1 + apps/bear/src/app/(flow)/terms/layout.tsx | 54 +++++++ apps/bear/src/app/(flow)/terms/loading.tsx | 20 +++ apps/bear/src/app/(flow)/terms/page.tsx | 35 ++++- .../app/(flow)/terms/subscription/loading.tsx | 19 ++- .../app/(flow)/terms/subscription/page.tsx | 36 ++--- .../templates/post-template/PostTemplate.tsx | 1 + .../channel-template/ChannelTemplate.tsx | 130 +++++++++-------- .../(investor)/subscriptions/page.tsx | 6 +- .../(investor)/transactions/page.tsx | 6 +- .../creator-profile/(form)/loading.tsx | 1 + .../creator-profile/done/loading.tsx | 2 +- .../onboarding/investor-profile/loading.tsx | 2 +- apps/bear/src/bootstrap/bootstrap.client.ts | 25 +++- .../(auth)/auth/register/details/loading.tsx | 8 +- .../app/(auth)/auth/register/details/page.tsx | 22 ++- .../(flow)/checkout/[username]/loading.tsx | 1 + .../checkout-template/CheckoutTemplate.tsx | 2 + .../src/app/(flow)/dashboard/pricing/page.tsx | 36 +---- .../payment/result/[paymentId]/loading.tsx | 1 + apps/bull/src/app/(flow)/terms/layout.tsx | 47 ++++++ apps/bull/src/app/(flow)/terms/loading.tsx | 17 +++ apps/bull/src/app/(flow)/terms/page.tsx | 32 +++- .../app/(flow)/terms/subscription/loading.tsx | 8 +- .../app/(flow)/terms/subscription/page.tsx | 26 +--- .../templates/post-template/PostTemplate.tsx | 1 + .../channel-template/ChannelTemplate.tsx | 138 ++++++++++-------- .../(investor)/subscriptions/page.tsx | 6 +- .../(investor)/transactions/page.tsx | 6 +- .../creator-profile/(form)/loading.tsx | 1 + .../creator-profile/done/loading.tsx | 2 +- .../onboarding/investor-profile/loading.tsx | 2 +- apps/bull/src/bootstrap/bootstrap.client.ts | 25 +++- 38 files changed, 487 insertions(+), 296 deletions(-) create mode 100644 apps/bear/src/app/(flow)/terms/layout.tsx create mode 100644 apps/bear/src/app/(flow)/terms/loading.tsx create mode 100644 apps/bull/src/app/(flow)/terms/layout.tsx create mode 100644 apps/bull/src/app/(flow)/terms/loading.tsx diff --git a/apps/bear/src/app/(auth)/auth/register/details/loading.tsx b/apps/bear/src/app/(auth)/auth/register/details/loading.tsx index bb06537..3bf9ccb 100644 --- a/apps/bear/src/app/(auth)/auth/register/details/loading.tsx +++ b/apps/bear/src/app/(auth)/auth/register/details/loading.tsx @@ -1,4 +1,5 @@ import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; +import { ROUTES } from '@lumina/market/app/navigation'; import { i18n } from '../../../../../i18n'; import { AuthTemplate } from '../../../../templates/auth-template'; @@ -6,7 +7,7 @@ import { AuthTemplate } from '../../../../templates/auth-template'; /** Registration step 4, before its frame arrives. The same frame and skeleton as the page, so nothing moves when it arrives. */ export default function Loading() { return ( - + + + } /> diff --git a/apps/bear/src/app/(flow)/checkout/[username]/loading.tsx b/apps/bear/src/app/(flow)/checkout/[username]/loading.tsx index 50003df..a22c6c5 100644 --- a/apps/bear/src/app/(flow)/checkout/[username]/loading.tsx +++ b/apps/bear/src/app/(flow)/checkout/[username]/loading.tsx @@ -22,6 +22,7 @@ export default function Loading() { > } label={i18n.t('payment:checkout.loading')} diff --git a/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx b/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx index baf1f05..e582f6f 100644 --- a/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx +++ b/apps/bear/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx @@ -45,6 +45,8 @@ export function CheckoutTemplate({ channel }: CheckoutTemplateProps) { channelHref={ROUTES.channel(channel.username)} layout="desktop" creator={} + creatorName={channel.displayName ?? channel.username} + creatorLinks={channel.socialLinks} /> diff --git a/apps/bear/src/app/(flow)/dashboard/pricing/page.tsx b/apps/bear/src/app/(flow)/dashboard/pricing/page.tsx index 7fef865..a65e74c 100644 --- a/apps/bear/src/app/(flow)/dashboard/pricing/page.tsx +++ b/apps/bear/src/app/(flow)/dashboard/pricing/page.tsx @@ -1,17 +1,7 @@ import { FlexBox } from '@lumina/island/atoms/flex-box'; -import { PartBoundary } from '@lumina/market/app/error-boundaries'; -import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; -import { - DesktopHeader, - DesktopPageTitle, - ROUTES, -} from '@lumina/market/app/navigation'; -import { - PricingForm, - PricingFormSkeleton, -} from '@lumina/market/app/screens/(flow)/dashboard/pricing/organisms/pricing-form'; +import { DesktopHeader } from '@lumina/market/app/navigation'; +import { PricingEditor } from '@lumina/market/app/screens/(flow)/dashboard/pricing/organisms/pricing-editor'; import type { Metadata } from 'next'; -import { Suspense } from 'react'; import { i18n } from '../../../../i18n'; @@ -22,14 +12,11 @@ export const metadata: Metadata = { /** * C7, «ویرایش قیمت‌ها» on desktop (C7 ۸.۱): the creator header with داشبورد on, «بازگشت» above - * the title (to طرح‌های اشتراک when opened on its own, R14), and the form in the 560 column. The form is the creator's own, so it renders in the - * browser behind cards of the same size. + * the title (to طرح‌های اشتراک when opened on its own, R14), and the form in the 560 column; with + * unsaved changes, leaving asks first (J10-4n). The form is the creator's own, so it renders in + * the browser behind cards of the same size. */ export default function PricingPage() { - const skeleton = ( - - ); - return ( @@ -38,22 +25,8 @@ export default function PricingPage() { justifyContent="justify-center" className="px-8 py-10" > - - - - - - - - - + + diff --git a/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx b/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx index 64bf071..02cb102 100644 --- a/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx +++ b/apps/bear/src/app/(flow)/payment/result/[paymentId]/loading.tsx @@ -22,6 +22,7 @@ export default function Loading() { {/* To the channel paid for once the payment loads (R14), never to the bank. */} diff --git a/apps/bear/src/app/(flow)/terms/layout.tsx b/apps/bear/src/app/(flow)/terms/layout.tsx new file mode 100644 index 0000000..4c7d63c --- /dev/null +++ b/apps/bear/src/app/(flow)/terms/layout.tsx @@ -0,0 +1,54 @@ +// First: the static `metadata` below reads a server-only namespace, which the server bootstrap +// adds to i18n when this module loads, whichever module Next loads first (0055). +import '../../../bootstrap/bootstrap.server'; + +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { DesktopHeader, DesktopPageTitle } from '@lumina/market/app/navigation'; +import { RulesTabs } from '@lumina/market/app/screens/(flow)/terms/organisms/rules-tabs'; +import type { Metadata } from 'next'; +import type { ReactNode } from 'react'; + +import { i18n } from '../../../i18n'; + +export const metadata: Metadata = { + title: i18n.t('rules:meta-title'), + description: i18n.t('rules:meta-description'), +}; + +/** + * «قوانین لومینا» on desktop (G-2r): the 640 column under the header, with back beside the title + * «قوانین لومینا» and the tab row «قوانین عمومی» · «شرایط اشتراک»; each tab's text sits in a panel. + * Each tab is its own route with its own loading, so the title and the row stay while one loads; + * back returns to where the rules were opened. No nav item is active. + */ +export default function RulesLayout({ children }: { children: ReactNode }) { + const t = i18n.getFixedT(null, 'rules'); + + return ( + + + + + + + {children} + + + + ); +} diff --git a/apps/bear/src/app/(flow)/terms/loading.tsx b/apps/bear/src/app/(flow)/terms/loading.tsx new file mode 100644 index 0000000..b35db5a --- /dev/null +++ b/apps/bear/src/app/(flow)/terms/loading.tsx @@ -0,0 +1,20 @@ +import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton'; +import { Card } from '@lumina/island/molecules/card'; + +import { i18n } from '../../../i18n'; + +/** «قوانین عمومی» before it arrives, under the section's title and tabs: its panel of lines. */ +export default function Loading() { + return ( + + + + + + + + + + + ); +} diff --git a/apps/bear/src/app/(flow)/terms/page.tsx b/apps/bear/src/app/(flow)/terms/page.tsx index fd7844a..6ebb630 100644 --- a/apps/bear/src/app/(flow)/terms/page.tsx +++ b/apps/bear/src/app/(flow)/terms/page.tsx @@ -1,10 +1,29 @@ -import { ROUTES } from '@lumina/market/app/navigation'; -import { redirect } from 'next/navigation'; +// First: the static `metadata` below reads a server-only namespace, which the server bootstrap +// adds to i18n when this module loads, whichever module Next loads first (0055). +import '../../../bootstrap/bootstrap.server'; -/** - * `/terms`, the address the boards give «شرایط اشتراک» (G-2), sends on to the page at its own - * address. Temporary, so `/terms` can become a page of its own later. - */ -export default function TermsPage(): never { - redirect(ROUTES.terms); +import { Card } from '@lumina/island/molecules/card'; +import { + GeneralRules, + generalRulesLabels, +} from '@lumina/market/app/screens/organisms/general-rules'; +import type { Metadata } from 'next'; + +import { i18n } from '../../../i18n'; + +export const metadata: Metadata = { + title: i18n.t('rules:meta-title'), + description: i18n.t('rules:meta-description'), +}; + +/** «قوانین عمومی», the first tab of «قوانین لومینا» on desktop (G-2r): the text in a panel. */ +export default function GeneralRulesPage() { + return ( + + + + ); } diff --git a/apps/bear/src/app/(flow)/terms/subscription/loading.tsx b/apps/bear/src/app/(flow)/terms/subscription/loading.tsx index 345a829..6aaccb2 100644 --- a/apps/bear/src/app/(flow)/terms/subscription/loading.tsx +++ b/apps/bear/src/app/(flow)/terms/subscription/loading.tsx @@ -1,19 +1,18 @@ import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton'; +import { Card } from '@lumina/island/molecules/card'; import { i18n } from '../../../../i18n'; -/** The terms before they arrive: a few paragraphs' worth of lines. */ +/** The terms before they arrive, under the section's title and tabs: their panel of lines. */ export default function Loading() { return ( - - - - - + + + + + + + ); } diff --git a/apps/bear/src/app/(flow)/terms/subscription/page.tsx b/apps/bear/src/app/(flow)/terms/subscription/page.tsx index 079e3ff..6929733 100644 --- a/apps/bear/src/app/(flow)/terms/subscription/page.tsx +++ b/apps/bear/src/app/(flow)/terms/subscription/page.tsx @@ -2,9 +2,7 @@ // adds to i18n when this module loads, whichever module Next loads first (0055). import '../../../../bootstrap/bootstrap.server'; -import { FlexBox } from '@lumina/island/atoms/flex-box'; import { Card } from '@lumina/island/molecules/card'; -import { DesktopHeader, DesktopPageTitle } from '@lumina/market/app/navigation'; import { SubscriptionTerms, subscriptionTermsLabels, @@ -21,8 +19,8 @@ export const metadata: Metadata = { }; /** - * «شرایط اشتراک» on desktop (S5 ۲.۱): the text in a panel of the 640 column under the header, - * about 75 characters a line, with back beside the title. + * «شرایط اشتراک», the second tab of «قوانین لومینا» on desktop (S5 ۲.۱, G-2): the text in a panel + * of the section's 640 column, about 75 characters a line; the title and tabs come from the layout. */ export default function SubscriptionTermsPage() { const labels = subscriptionTermsLabels( @@ -32,28 +30,12 @@ export default function SubscriptionTermsPage() { ); return ( - - - - - - - - - - - + + + ); } diff --git a/apps/bear/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/PostTemplate.tsx b/apps/bear/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/PostTemplate.tsx index c779d5c..92e38cb 100644 --- a/apps/bear/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/PostTemplate.tsx +++ b/apps/bear/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/PostTemplate.tsx @@ -49,6 +49,7 @@ export function PostTemplate({ username={channel.username} channelUrl={channelUrl} layout="desktop" + saleOpen={channel.saleOpen} /> } diff --git a/apps/bear/src/app/(main)/channels/[username]/templates/channel-template/ChannelTemplate.tsx b/apps/bear/src/app/(main)/channels/[username]/templates/channel-template/ChannelTemplate.tsx index 2dd3e81..1a4728c 100644 --- a/apps/bear/src/app/(main)/channels/[username]/templates/channel-template/ChannelTemplate.tsx +++ b/apps/bear/src/app/(main)/channels/[username]/templates/channel-template/ChannelTemplate.tsx @@ -1,6 +1,7 @@ import { FlexBox } from '@lumina/island/atoms/flex-box'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { PartBoundary } from '@lumina/market/app/error-boundaries'; +import { ApprovedWelcome } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/approved-welcome'; import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions'; import { ChannelDeskBack } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-desk-back'; import { ChannelFeed } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-feed/server'; @@ -8,6 +9,7 @@ import { ChannelHeader, channelHeaderLabels, } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header'; +import { PendingChannelGate } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found'; import { ChannelShare } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-share'; import { ChannelStats } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-stats/server'; import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable'; @@ -56,6 +58,69 @@ export function ChannelTemplate({ ); } + const publicChannel = ( + <> + + + } + stats={ + <> + + + + } + > + + + + + } + actions={ + + + + } + labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))} + verified={!channel.verificationPending} + /> + + + } + > + + + + + ); + return ( - - } - stats={ - <> - - - - } - > - - - - - } - actions={ - - - - } - labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))} - /> - - - } - > - - - + {channel.verificationPending ? ( + + {publicChannel} + + ) : ( + publicChannel + )} ); diff --git a/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx b/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx index 2b9082f..dc74143 100644 --- a/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx +++ b/apps/bear/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx @@ -26,11 +26,7 @@ export default function SubscriptionsPage() { ); return ( - + diff --git a/apps/bear/src/app/(main)/dashboard/(investor)/transactions/page.tsx b/apps/bear/src/app/(main)/dashboard/(investor)/transactions/page.tsx index 644fc27..b024abf 100644 --- a/apps/bear/src/app/(main)/dashboard/(investor)/transactions/page.tsx +++ b/apps/bear/src/app/(main)/dashboard/(investor)/transactions/page.tsx @@ -26,11 +26,7 @@ export default function TransactionsPage() { ); return ( - + diff --git a/apps/bear/src/app/(onboarding)/onboarding/creator-profile/(form)/loading.tsx b/apps/bear/src/app/(onboarding)/onboarding/creator-profile/(form)/loading.tsx index 078dc81..289d0f6 100644 --- a/apps/bear/src/app/(onboarding)/onboarding/creator-profile/(form)/loading.tsx +++ b/apps/bear/src/app/(onboarding)/onboarding/creator-profile/(form)/loading.tsx @@ -9,6 +9,7 @@ export default function Loading() { return ( diff --git a/apps/bear/src/app/(onboarding)/onboarding/creator-profile/done/loading.tsx b/apps/bear/src/app/(onboarding)/onboarding/creator-profile/done/loading.tsx index 36d0d7d..4f38cab 100644 --- a/apps/bear/src/app/(onboarding)/onboarding/creator-profile/done/loading.tsx +++ b/apps/bear/src/app/(onboarding)/onboarding/creator-profile/done/loading.tsx @@ -8,7 +8,7 @@ import { AuthTemplate } from '../../../../templates/auth-template'; export default function Loading() { return ( - + ); } diff --git a/apps/bear/src/app/(onboarding)/onboarding/investor-profile/loading.tsx b/apps/bear/src/app/(onboarding)/onboarding/investor-profile/loading.tsx index f9a04c5..2c789b7 100644 --- a/apps/bear/src/app/(onboarding)/onboarding/investor-profile/loading.tsx +++ b/apps/bear/src/app/(onboarding)/onboarding/investor-profile/loading.tsx @@ -8,7 +8,7 @@ import { AuthTemplate } from '../../../templates/auth-template'; export default function Loading() { return ( - + ); } diff --git a/apps/bear/src/bootstrap/bootstrap.client.ts b/apps/bear/src/bootstrap/bootstrap.client.ts index 7fef858..bd5aaa1 100644 --- a/apps/bear/src/bootstrap/bootstrap.client.ts +++ b/apps/bear/src/bootstrap/bootstrap.client.ts @@ -4,7 +4,13 @@ import { http } from '@lumina/libs/http'; import { captureInstallPrompt, configureServiceWorker } from '@lumina/libs/pwa'; import { mapApiErrorBody } from '@lumina/market/app/http'; import { setEnv as setMarketEnv } from '@lumina/market/env'; -import { AUTH_ENDPOINTS, AUTH_EVENTS } from '@lumina/market/features/auth'; +import { + AUTH_ENDPOINTS, + AUTH_EVENTS, + endSuspendedSession, + isSessionSuspended, + suspendedSessionOf, +} from '@lumina/market/features/auth'; import { API_PROXY_PATH, API_VERSION_PATH } from '../constants'; import { clientEnv } from '../env'; @@ -20,16 +26,27 @@ setMarketEnv({ }); // The browser calls the API on this site's origin, proxied to the gateway (0018). The session // lives in HttpOnly cookies the browser sends itself. A 401 runs one refresh for the whole app; -// when that fails the session is over and the shell signs the user out. +// when that fails the session is over and the shell signs the user out. A 401 `ACCOUNT_SUSPENDED` +// never refreshes: the account was suspended mid-session, so the session ends and the page halts +// (J01-3d), once, whichever request learns it first. http.configure({ baseUrl: `${API_PROXY_PATH}${API_VERSION_PATH}`, refresh: { endpoint: AUTH_ENDPOINTS.refresh, - onFailure: () => - eventEmitter.emit(AUTH_EVENTS.logout, { reason: 'session-ended' }), + shouldRefresh: (error) => + error.status === 401 && suspendedSessionOf(error) === null, + onFailure: () => { + if (isSessionSuspended()) return; + eventEmitter.emit(AUTH_EVENTS.logout, { reason: 'session-ended' }); + }, }, mapErrorBody: mapApiErrorBody, }); +http.interceptors.response.use(undefined, (error) => { + const suspension = suspendedSessionOf(error); + if (suspension) endSuspendedSession(suspension); + return error; +}); configureErrorHandler(ERROR_HANDLER_CONFIG); // The service worker stores only JS, CSS, fonts and the icon sprite (pwa lib); the AppShell // registers it when this flag is on, and turning the flag off unregisters it for every visitor. diff --git a/apps/bull/src/app/(auth)/auth/register/details/loading.tsx b/apps/bull/src/app/(auth)/auth/register/details/loading.tsx index 53a72b3..c5aec12 100644 --- a/apps/bull/src/app/(auth)/auth/register/details/loading.tsx +++ b/apps/bull/src/app/(auth)/auth/register/details/loading.tsx @@ -1,4 +1,5 @@ import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; +import { ROUTES } from '@lumina/market/app/navigation'; import { i18n } from '../../../../../i18n'; import { AuthTopBar } from '../../../../organisms/auth-top-bar'; @@ -8,7 +9,12 @@ import { AuthTemplate } from '../../../../templates/auth-template'; export default function Loading() { return ( } + header={ + + } > } + header={ + + } > + } /> diff --git a/apps/bull/src/app/(flow)/checkout/[username]/loading.tsx b/apps/bull/src/app/(flow)/checkout/[username]/loading.tsx index 091f34d..d776b44 100644 --- a/apps/bull/src/app/(flow)/checkout/[username]/loading.tsx +++ b/apps/bull/src/app/(flow)/checkout/[username]/loading.tsx @@ -12,6 +12,7 @@ export default function Loading() { } label={i18n.t('payment:checkout.loading')} diff --git a/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx b/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx index fbf7865..7289815 100644 --- a/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx +++ b/apps/bull/src/app/(flow)/checkout/[username]/templates/checkout-template/CheckoutTemplate.tsx @@ -27,6 +27,8 @@ export function CheckoutTemplate({ channel }: CheckoutTemplateProps) { channelHref={ROUTES.channel(channel.username)} layout="mobile" creator={} + creatorName={channel.displayName ?? channel.username} + creatorLinks={channel.socialLinks} /> diff --git a/apps/bull/src/app/(flow)/dashboard/pricing/page.tsx b/apps/bull/src/app/(flow)/dashboard/pricing/page.tsx index 38df658..63ee481 100644 --- a/apps/bull/src/app/(flow)/dashboard/pricing/page.tsx +++ b/apps/bull/src/app/(flow)/dashboard/pricing/page.tsx @@ -1,13 +1,6 @@ import { FlexBox } from '@lumina/island/atoms/flex-box'; -import { PartBoundary } from '@lumina/market/app/error-boundaries'; -import { AuthGuard } from '@lumina/market/app/guards/auth-guard'; -import { MobileTopBar, ROUTES } from '@lumina/market/app/navigation'; -import { - PricingForm, - PricingFormSkeleton, -} from '@lumina/market/app/screens/(flow)/dashboard/pricing/organisms/pricing-form'; +import { PricingEditor } from '@lumina/market/app/screens/(flow)/dashboard/pricing/organisms/pricing-editor'; import type { Metadata } from 'next'; -import { Suspense } from 'react'; import { i18n } from '../../../../i18n'; @@ -19,33 +12,14 @@ export const metadata: Metadata = { /** * C7, «ویرایش قیمت‌ها» on mobile: a task page pushed from the «قیمت طرح‌ها» card, back · title · * support and no bottom nav (Creator Dashboard ۴.۱; consistency rules R7, R8); opened on its own, - * back goes to طرح‌های اشتراک (R14). The form pads itself and pins its save to the bottom. It is - * the creator's own, so it renders in the browser behind cards of the same size. + * back goes to طرح‌های اشتراک (R14), and with unsaved changes it asks first (J10-4n). The form + * pads itself and pins its save to the bottom. It is the creator's own, so it renders in the + * browser behind cards of the same size. */ export default function PricingPage() { - const skeleton = ( - - ); - return ( - - - - - - - - - - + ); } diff --git a/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx b/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx index 8886055..c3ac1fa 100644 --- a/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx +++ b/apps/bull/src/app/(flow)/payment/result/[paymentId]/loading.tsx @@ -15,6 +15,7 @@ export default function Loading() { /> diff --git a/apps/bull/src/app/(flow)/terms/layout.tsx b/apps/bull/src/app/(flow)/terms/layout.tsx new file mode 100644 index 0000000..3bc7f25 --- /dev/null +++ b/apps/bull/src/app/(flow)/terms/layout.tsx @@ -0,0 +1,47 @@ +// First: the static `metadata` below reads a server-only namespace, which the server bootstrap +// adds to i18n when this module loads, whichever module Next loads first (0055). +import '../../../bootstrap/bootstrap.server'; + +import { FlexBox } from '@lumina/island/atoms/flex-box'; +import { MobileTopBar } from '@lumina/market/app/navigation'; +import { RulesTabs } from '@lumina/market/app/screens/(flow)/terms/organisms/rules-tabs'; +import type { Metadata } from 'next'; +import type { ReactNode } from 'react'; + +import { i18n } from '../../../i18n'; + +export const metadata: Metadata = { + title: i18n.t('rules:meta-title'), + description: i18n.t('rules:meta-description'), +}; + +/** + * «قوانین لومینا» on mobile (G-2r): a task page pushed from حساب کاربری, checkout, a suspended card + * or the support sheet: back · «قوانین لومینا» · support, no bottom nav, then the tab row + * «قوانین عمومی» · «شرایط اشتراک». Each tab is its own route with its own loading, so the bar and + * the row stay while one loads; back returns to where the rules were opened. + */ +export default function RulesLayout({ children }: { children: ReactNode }) { + const t = i18n.getFixedT(null, 'rules'); + + return ( + + + + + {children} + + + ); +} diff --git a/apps/bull/src/app/(flow)/terms/loading.tsx b/apps/bull/src/app/(flow)/terms/loading.tsx new file mode 100644 index 0000000..d6762e6 --- /dev/null +++ b/apps/bull/src/app/(flow)/terms/loading.tsx @@ -0,0 +1,17 @@ +import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton'; + +import { i18n } from '../../../i18n'; + +/** «قوانین عمومی» before it arrives, under the section's bar and tabs: a few sections' worth of lines. */ +export default function Loading() { + return ( + + + + + + + + + ); +} diff --git a/apps/bull/src/app/(flow)/terms/page.tsx b/apps/bull/src/app/(flow)/terms/page.tsx index fd7844a..2ead918 100644 --- a/apps/bull/src/app/(flow)/terms/page.tsx +++ b/apps/bull/src/app/(flow)/terms/page.tsx @@ -1,10 +1,26 @@ -import { ROUTES } from '@lumina/market/app/navigation'; -import { redirect } from 'next/navigation'; +// First: the static `metadata` below reads a server-only namespace, which the server bootstrap +// adds to i18n when this module loads, whichever module Next loads first (0055). +import '../../../bootstrap/bootstrap.server'; -/** - * `/terms`, the address the boards give «شرایط اشتراک» (G-2), sends on to the page at its own - * address. Temporary, so `/terms` can become a page of its own later. - */ -export default function TermsPage(): never { - redirect(ROUTES.terms); +import { + GeneralRules, + generalRulesLabels, +} from '@lumina/market/app/screens/organisms/general-rules'; +import type { Metadata } from 'next'; + +import { i18n } from '../../../i18n'; + +export const metadata: Metadata = { + title: i18n.t('rules:meta-title'), + description: i18n.t('rules:meta-description'), +}; + +/** «قوانین عمومی», the first tab of «قوانین لومینا» on mobile (G-2r), under the section's bar. */ +export default function GeneralRulesPage() { + return ( + + ); } diff --git a/apps/bull/src/app/(flow)/terms/subscription/loading.tsx b/apps/bull/src/app/(flow)/terms/subscription/loading.tsx index 345a829..097d60f 100644 --- a/apps/bull/src/app/(flow)/terms/subscription/loading.tsx +++ b/apps/bull/src/app/(flow)/terms/subscription/loading.tsx @@ -2,14 +2,10 @@ import { Skeleton, SkeletonRegion } from '@lumina/island/atoms/skeleton'; import { i18n } from '../../../../i18n'; -/** The terms before they arrive: a few paragraphs' worth of lines. */ +/** The terms before they arrive, under the section's bar and tabs: a few paragraphs' worth of lines. */ export default function Loading() { return ( - + diff --git a/apps/bull/src/app/(flow)/terms/subscription/page.tsx b/apps/bull/src/app/(flow)/terms/subscription/page.tsx index d665c38..c7db727 100644 --- a/apps/bull/src/app/(flow)/terms/subscription/page.tsx +++ b/apps/bull/src/app/(flow)/terms/subscription/page.tsx @@ -2,8 +2,6 @@ // adds to i18n when this module loads, whichever module Next loads first (0055). import '../../../../bootstrap/bootstrap.server'; -import { FlexBox } from '@lumina/island/atoms/flex-box'; -import { MobileTopBar } from '@lumina/market/app/navigation'; import { SubscriptionTerms, subscriptionTermsLabels, @@ -20,8 +18,9 @@ export const metadata: Metadata = { }; /** - * «شرایط اشتراک» on mobile (S5 ۱.۱): a task page pushed from checkout, a suspended card or the - * support sheet, back · title · support and no bottom nav; back returns to where it was opened. + * «شرایط اشتراک», the second tab of «قوانین لومینا» on mobile (S5 ۱.۱, G-2): the section's bar and + * tabs come from its layout; back returns to where the rules were opened (checkout, a suspended + * card, the support sheet). */ export default function SubscriptionTermsPage() { const labels = subscriptionTermsLabels( @@ -31,19 +30,10 @@ export default function SubscriptionTermsPage() { ); return ( - - - - - - + ); } diff --git a/apps/bull/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/PostTemplate.tsx b/apps/bull/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/PostTemplate.tsx index 9d69ac6..f4d5ac2 100644 --- a/apps/bull/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/PostTemplate.tsx +++ b/apps/bull/src/app/(main)/channels/[username]/posts/[id]/templates/post-template/PostTemplate.tsx @@ -46,6 +46,7 @@ export function PostTemplate({ username={channel.username} channelUrl={channelUrl} layout="mobile" + saleOpen={channel.saleOpen} /> } diff --git a/apps/bull/src/app/(main)/channels/[username]/templates/channel-template/ChannelTemplate.tsx b/apps/bull/src/app/(main)/channels/[username]/templates/channel-template/ChannelTemplate.tsx index 64bef96..d6c6cc5 100644 --- a/apps/bull/src/app/(main)/channels/[username]/templates/channel-template/ChannelTemplate.tsx +++ b/apps/bull/src/app/(main)/channels/[username]/templates/channel-template/ChannelTemplate.tsx @@ -2,12 +2,14 @@ import { FlexBox } from '@lumina/island/atoms/flex-box'; import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset'; import { PartBoundary } from '@lumina/market/app/error-boundaries'; import { MobileTopBar } from '@lumina/market/app/navigation'; +import { ApprovedWelcome } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/approved-welcome'; import { ChannelActions } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-actions'; import { ChannelFeed } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-feed/server'; import { ChannelHeader, channelHeaderLabels, } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-header'; +import { PendingChannelGate } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-not-found'; import { ChannelShare } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-share'; import { ChannelStats } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-stats/server'; import { ChannelUnavailable } from '@lumina/market/app/screens/(main)/channels/[username]/organisms/channel-unavailable'; @@ -52,6 +54,75 @@ export function ChannelTemplate({ ); } + const publicChannel = ( + <> + + + } + stats={ + <> + + + + } + > + + + + + } + actions={ + + + + } + labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))} + verified={!channel.verificationPending} + /> + + + + } + > + + + + + + ); + return ( <> - - } - stats={ - <> - - - - } - > - - - - - } - actions={ - - - - } - labels={channelHeaderLabels(t, i18n.getFixedT(null, 'common'))} - /> - - - - } - > - - - - + {channel.verificationPending ? ( + + {publicChannel} + + ) : ( + publicChannel + )} ); diff --git a/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx b/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx index c601770..d6029c0 100644 --- a/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx +++ b/apps/bull/src/app/(main)/dashboard/(investor)/subscriptions/page.tsx @@ -26,11 +26,7 @@ export default function SubscriptionsPage() { ); return ( - + diff --git a/apps/bull/src/app/(main)/dashboard/(investor)/transactions/page.tsx b/apps/bull/src/app/(main)/dashboard/(investor)/transactions/page.tsx index 57caf1a..ca05561 100644 --- a/apps/bull/src/app/(main)/dashboard/(investor)/transactions/page.tsx +++ b/apps/bull/src/app/(main)/dashboard/(investor)/transactions/page.tsx @@ -26,11 +26,7 @@ export default function TransactionsPage() { ); return ( - + diff --git a/apps/bull/src/app/(onboarding)/onboarding/creator-profile/(form)/loading.tsx b/apps/bull/src/app/(onboarding)/onboarding/creator-profile/(form)/loading.tsx index 3f4c8fe..2593834 100644 --- a/apps/bull/src/app/(onboarding)/onboarding/creator-profile/(form)/loading.tsx +++ b/apps/bull/src/app/(onboarding)/onboarding/creator-profile/(form)/loading.tsx @@ -11,6 +11,7 @@ export default function Loading() { header={} > diff --git a/apps/bull/src/app/(onboarding)/onboarding/creator-profile/done/loading.tsx b/apps/bull/src/app/(onboarding)/onboarding/creator-profile/done/loading.tsx index bd6b9f3..24301fd 100644 --- a/apps/bull/src/app/(onboarding)/onboarding/creator-profile/done/loading.tsx +++ b/apps/bull/src/app/(onboarding)/onboarding/creator-profile/done/loading.tsx @@ -9,7 +9,7 @@ import { AuthTemplate } from '../../../../templates/auth-template'; export default function Loading() { return ( }> - + ); } diff --git a/apps/bull/src/app/(onboarding)/onboarding/investor-profile/loading.tsx b/apps/bull/src/app/(onboarding)/onboarding/investor-profile/loading.tsx index bb7c985..03b382f 100644 --- a/apps/bull/src/app/(onboarding)/onboarding/investor-profile/loading.tsx +++ b/apps/bull/src/app/(onboarding)/onboarding/investor-profile/loading.tsx @@ -10,7 +10,7 @@ export default function Loading() { } > - + ); } diff --git a/apps/bull/src/bootstrap/bootstrap.client.ts b/apps/bull/src/bootstrap/bootstrap.client.ts index 7fef858..bd5aaa1 100644 --- a/apps/bull/src/bootstrap/bootstrap.client.ts +++ b/apps/bull/src/bootstrap/bootstrap.client.ts @@ -4,7 +4,13 @@ import { http } from '@lumina/libs/http'; import { captureInstallPrompt, configureServiceWorker } from '@lumina/libs/pwa'; import { mapApiErrorBody } from '@lumina/market/app/http'; import { setEnv as setMarketEnv } from '@lumina/market/env'; -import { AUTH_ENDPOINTS, AUTH_EVENTS } from '@lumina/market/features/auth'; +import { + AUTH_ENDPOINTS, + AUTH_EVENTS, + endSuspendedSession, + isSessionSuspended, + suspendedSessionOf, +} from '@lumina/market/features/auth'; import { API_PROXY_PATH, API_VERSION_PATH } from '../constants'; import { clientEnv } from '../env'; @@ -20,16 +26,27 @@ setMarketEnv({ }); // The browser calls the API on this site's origin, proxied to the gateway (0018). The session // lives in HttpOnly cookies the browser sends itself. A 401 runs one refresh for the whole app; -// when that fails the session is over and the shell signs the user out. +// when that fails the session is over and the shell signs the user out. A 401 `ACCOUNT_SUSPENDED` +// never refreshes: the account was suspended mid-session, so the session ends and the page halts +// (J01-3d), once, whichever request learns it first. http.configure({ baseUrl: `${API_PROXY_PATH}${API_VERSION_PATH}`, refresh: { endpoint: AUTH_ENDPOINTS.refresh, - onFailure: () => - eventEmitter.emit(AUTH_EVENTS.logout, { reason: 'session-ended' }), + shouldRefresh: (error) => + error.status === 401 && suspendedSessionOf(error) === null, + onFailure: () => { + if (isSessionSuspended()) return; + eventEmitter.emit(AUTH_EVENTS.logout, { reason: 'session-ended' }); + }, }, mapErrorBody: mapApiErrorBody, }); +http.interceptors.response.use(undefined, (error) => { + const suspension = suspendedSessionOf(error); + if (suspension) endSuspendedSession(suspension); + return error; +}); configureErrorHandler(ERROR_HANDLER_CONFIG); // The service worker stores only JS, CSS, fonts and the icon sprite (pwa lib); the AppShell // registers it when this flag is on, and turning the flag off unregisters it for every visitor.