create-ailk 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -2
- package/component-catalog.json +44 -6
- package/component-catalog.md +6 -5
- package/dist/add-module.js +16 -1
- package/dist/add-route.d.ts +7 -2
- package/dist/add-route.js +28 -13
- package/dist/cli.js +52 -0
- package/dist/declined-routes.d.ts +13 -0
- package/dist/declined-routes.js +74 -0
- package/dist/derive-architecture.d.ts +0 -6
- package/dist/derive-architecture.js +9 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/language-import.d.ts +93 -0
- package/dist/language-import.js +270 -43
- package/dist/lib/import-mdx.js +1 -1
- package/dist/lib/scaffold-render-sweep.d.ts +6 -3
- package/dist/lib/scaffold-render-sweep.js +8 -4
- package/dist/migrate-content.d.ts +6 -2
- package/dist/migrate-content.js +62 -5
- package/dist/module-architecture.js +139 -103
- package/dist/paid-sections.d.ts +13 -0
- package/dist/paid-sections.js +35 -5
- package/dist/programmatic.js +6 -16
- package/dist/remove-module.js +67 -0
- package/dist/routes.d.ts +103 -0
- package/dist/routes.js +708 -0
- package/dist/site-manifest.js +1 -1
- package/dist/site-roster.d.ts +2 -1
- package/dist/site-roster.js +30 -8
- package/dist/spoke-checkout.d.ts +28 -27
- package/dist/spoke-checkout.js +71 -102
- package/dist/surfaces.d.ts +18 -0
- package/dist/surfaces.js +47 -282
- package/dist/sync-routes.d.ts +28 -1
- package/dist/sync-routes.js +144 -11
- package/dist/template-record.d.ts +11 -0
- package/dist/template-record.js +18 -0
- package/dist/topology.d.ts +15 -1
- package/dist/topology.js +20 -4
- package/dist/update.d.ts +31 -2
- package/dist/update.js +627 -99
- package/package.json +3 -3
- package/templates/README.md +1 -1
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/CLAUDE.md +62 -20
- package/templates/apps/web/account.config.tsx +101 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
- package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
- package/templates/apps/web/app/[locale]/layout.tsx +45 -28
- package/templates/apps/web/app/apple-icon.tsx +72 -0
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
- package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
- package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
- package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
- package/templates/apps/web/app/og/route.tsx +155 -72
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
- package/templates/apps/web/i18n/request.ts +44 -1
- package/templates/apps/web/jest.config.cjs +13 -1
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
- package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
- package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
- package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
- package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
- package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
- package/templates/apps/web/lib/listings.tsx +2 -2
- package/templates/apps/web/lib/nav-label-keys.ts +16 -2
- package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
- package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
- package/templates/apps/web/lib/profile-back-link.ts +105 -32
- package/templates/apps/web/lib/served-pages.ts +95 -0
- package/templates/apps/web/lib/site-brand.tsx +3 -5
- package/templates/apps/web/messages/en.json +8 -684
- package/templates/apps/web/middleware.ts +3 -1
- package/templates/apps/web/next.config.mjs +27 -0
- package/templates/apps/web/package.json +1 -0
- package/templates/customizations.yaml +9 -0
- package/templates/package.json +3 -1
- package/templates/tools/lint-architecture.ts +164 -11
- package/versions.json +48 -47
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
- package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
- package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
- package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
- package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
- package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
- package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
- package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
- package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
- package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
- package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
- package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
- package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
- package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
- package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
- package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
- package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
- package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
- package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
- package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
- package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
- package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
- package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
- package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
- package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
- package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
- package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
- package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
- package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
- package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
- package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
- package/templates/apps/web/lib/account-config.ts +0 -678
- package/templates/apps/web/lib/checkout-config.ts +0 -16
- package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
- package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
|
@@ -1,218 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* #8232 D2).
|
|
4
|
-
*
|
|
5
|
-
* RSC, outside the account layout's SignedInShell (#8430), in the member's
|
|
6
|
-
* settings frame (D7; five tabs since #8438 D14) — standalone, the Admin's
|
|
7
|
-
* shape. Renders the shared
|
|
8
|
-
* `AccountSettings` composition (@working-theory/templates/account, spec
|
|
9
|
-
* 8339 D4) — the same General form the Admin renders — through the client
|
|
10
|
-
* adapter `GeneralSettings` (`profile-form.tsx`). Below the form, each a
|
|
11
|
-
* card of the pane (#11167 — the pane draws every direct child as one):
|
|
12
|
-
*
|
|
13
|
-
* - the contact details (`ContactDetails` over `AccountContactDetails`,
|
|
14
|
-
* #8435 D13) — only on the member path, seeded from `member.contact` and
|
|
15
|
-
* saved by `saveContact`, which also derives the account name from the
|
|
16
|
-
* first and last names (#11167 ruling 5 — the member General renders no
|
|
17
|
-
* Name field);
|
|
18
|
-
* - the phone step (`PhoneVerification`, #11106 D9) — on a hub only: the
|
|
19
|
-
* person sets and verifies their own number, read from their Better Auth
|
|
20
|
-
* session; a build without the phone plugin shows the not-available line;
|
|
21
|
-
* - any section a module contributes (`accountSettingsSections`);
|
|
22
|
-
* - `BillingAnchor`, which forwards a `#billing` fragment to Billing — it
|
|
23
|
-
* renders nothing, so it sits beside the composition, not in a card.
|
|
24
|
-
*
|
|
25
|
-
* Color mode renders on every site (#11167 ruling 3, as on the Admin); the
|
|
26
|
-
* one-palette gate of #7430 is gone. The Photo and the person's name come
|
|
27
|
-
* from `loadProfileSource` (D3) — on the member path the photo is the hub's
|
|
28
|
-
* (#11167 ruling 4).
|
|
29
|
-
*
|
|
30
|
-
* Sign-in moved to Security, cookie settings moved to Notifications then to
|
|
31
|
-
* Privacy (#8339 C6), and Request account deletion moved to Privacy (#8438
|
|
32
|
-
* D16) — General no longer renders any of the three.
|
|
33
|
-
*
|
|
34
|
-
* Whether the profile and deletion go through the member API is
|
|
35
|
-
* `loadProfileSource` (D3), never a topology test here.
|
|
36
|
-
*/
|
|
1
|
+
// Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
|
|
2
|
+
import Page from "@working-theory/account/general/page";
|
|
37
3
|
|
|
38
|
-
import
|
|
39
|
-
import {
|
|
40
|
-
AccountSettingsFrame,
|
|
41
|
-
AccountSettingsPane,
|
|
42
|
-
type AccountContact,
|
|
43
|
-
} from "@working-theory/templates/account";
|
|
44
|
-
import { Text } from "@working-theory/ui/primitives";
|
|
45
|
-
import type { Metadata } from "next";
|
|
46
|
-
import { headers } from "next/headers";
|
|
47
|
-
import { getTranslations } from "next-intl/server";
|
|
48
|
-
import type { ReactElement } from "react";
|
|
4
|
+
import config from "../../../../../account.config";
|
|
49
5
|
|
|
50
|
-
|
|
51
|
-
import { readPhoneStep, TOPOLOGY } from "../../../../../lib/topology.generated";
|
|
52
|
-
import { accountSession } from "../account-data";
|
|
53
|
-
import { memberSettingsFrame, SettingsSection, type Translate } from "../settings-frame";
|
|
6
|
+
export { generateMetadata } from "@working-theory/account/general/page";
|
|
54
7
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
import { loadProfileSource } from "./profile-source";
|
|
60
|
-
|
|
61
|
-
interface Props {
|
|
62
|
-
params: Promise<{ locale: string }>;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
66
|
-
const { locale } = await params;
|
|
67
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
68
|
-
return { title: t("settings.general.title"), description: t("settings.general.lead") };
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export default async function AccountGeneralPage({ params }: Props): Promise<ReactElement> {
|
|
72
|
-
const { locale } = await params;
|
|
73
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
74
|
-
const session = await accountSession(locale);
|
|
75
|
-
|
|
76
|
-
// Unreachable behind the (authed) gate; a session that expired between
|
|
77
|
-
// the layout and the page renders the pane's title alone.
|
|
78
|
-
if (!session) {
|
|
79
|
-
return (
|
|
80
|
-
<AccountSettingsFrame {...memberSettingsFrame(locale, t as unknown as Translate, "general")} name="">
|
|
81
|
-
<AccountSettingsPane
|
|
82
|
-
id="account-settings-general"
|
|
83
|
-
title={t("settings.general.title")}
|
|
84
|
-
lead={t("settings.general.lead")}
|
|
85
|
-
>
|
|
86
|
-
{null}
|
|
87
|
-
</AccountSettingsPane>
|
|
88
|
-
</AccountSettingsFrame>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const { ctx } = session;
|
|
93
|
-
const source = await loadProfileSource(ctx);
|
|
94
|
-
// The phone step reads through the generated seam (#11138); a spoke's hub
|
|
95
|
-
// holds the person, so a spoke has none.
|
|
96
|
-
const phoneStep = TOPOLOGY === "spoke" ? null : await readPhoneStep(await headers());
|
|
97
|
-
const phoneLabels: PhoneVerificationLabels = {
|
|
98
|
-
title: t("profile.phoneTitle"),
|
|
99
|
-
lead: t("profile.phoneLead"),
|
|
100
|
-
number: t("profile.phoneNumber"),
|
|
101
|
-
numberHint: t("profile.phoneNumberHint"),
|
|
102
|
-
sendCode: t("profile.phoneSendCode"),
|
|
103
|
-
sending: t("profile.phoneSending"),
|
|
104
|
-
code: t("profile.phoneCode"),
|
|
105
|
-
codeHint: t("profile.phoneCodeHint"),
|
|
106
|
-
verify: t("profile.phoneVerify"),
|
|
107
|
-
verifying: t("profile.phoneVerifying"),
|
|
108
|
-
verified: t("profile.phoneVerified"),
|
|
109
|
-
remove: t("profile.phoneRemove"),
|
|
110
|
-
sent: t("profile.phoneSent"),
|
|
111
|
-
unavailable: t("profile.phoneUnavailable"),
|
|
112
|
-
unverifiedEmail: t("profile.phoneUnverifiedEmail"),
|
|
113
|
-
errors: {
|
|
114
|
-
invalid_number: t("profile.phoneErrors.invalid_number"),
|
|
115
|
-
invalid_code: t("profile.phoneErrors.invalid_code"),
|
|
116
|
-
taken: t("profile.phoneErrors.taken"),
|
|
117
|
-
too_many: t("profile.phoneErrors.too_many"),
|
|
118
|
-
unverified: t("profile.phoneErrors.unverified"),
|
|
119
|
-
signed_out: t("profile.phoneErrors.signed_out"),
|
|
120
|
-
unavailable: t("profile.phoneErrors.unavailable"),
|
|
121
|
-
failed: t("profile.phoneErrors.failed"),
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// #8435 D13 — the person's confirmed contact on this site. A failed read
|
|
126
|
-
// renders the section's "unavailable" line, never the form: a form seeded
|
|
127
|
-
// from nothing would offer to replace details it never showed.
|
|
128
|
-
let contactRead: { ok: true; contact: AccountContact | null } | { ok: false } | null = null;
|
|
129
|
-
if (source.via === "member") {
|
|
130
|
-
try {
|
|
131
|
-
const res = await member.contact(ctx.init);
|
|
132
|
-
contactRead = res.ok ? { ok: true, contact: res.body.contact } : { ok: false };
|
|
133
|
-
} catch {
|
|
134
|
-
contactRead = { ok: false };
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<>
|
|
140
|
-
<GeneralSettings
|
|
141
|
-
frame={memberSettingsFrame(locale, t as unknown as Translate, "general")}
|
|
142
|
-
user={{ name: ctx.user.name ?? "", email: ctx.user.email, image: source.image }}
|
|
143
|
-
labels={{
|
|
144
|
-
title: t("settings.general.title"),
|
|
145
|
-
lead: t("settings.general.lead"),
|
|
146
|
-
colorMode: t("settings.general.colorMode"),
|
|
147
|
-
light: t("settings.general.light"),
|
|
148
|
-
auto: t("settings.general.auto"),
|
|
149
|
-
dark: t("settings.general.dark"),
|
|
150
|
-
emailLabel: t("settings.general.email"),
|
|
151
|
-
nameLabel: t("settings.general.name"),
|
|
152
|
-
photoLabel: t("settings.general.photo"),
|
|
153
|
-
photoPlaceholder: t("settings.general.photoPlaceholder"),
|
|
154
|
-
saveButton: t("settings.general.save"),
|
|
155
|
-
saving: t("settings.general.saving"),
|
|
156
|
-
saved: t("settings.general.saved"),
|
|
157
|
-
saveError: t("settings.general.saveError"),
|
|
158
|
-
nameRequired: t("settings.general.nameRequired"),
|
|
159
|
-
photoInvalid: t("settings.general.photoInvalid"),
|
|
160
|
-
unverified: t("settings.general.unverified"),
|
|
161
|
-
unavailable: t("settings.general.unavailable"),
|
|
162
|
-
}}
|
|
163
|
-
colorMode={{ cookieName: process.env.NEXT_PUBLIC_THEME_COOKIE_NAME ?? "ailk-theme" }}
|
|
164
|
-
via={source.via}
|
|
165
|
-
>
|
|
166
|
-
{contactRead ? (
|
|
167
|
-
<div data-testid="account-contact-section">
|
|
168
|
-
{contactRead.ok ? (
|
|
169
|
-
<ContactDetails
|
|
170
|
-
contact={contactRead.contact}
|
|
171
|
-
labels={{
|
|
172
|
-
title: t("settings.general.contact.title"),
|
|
173
|
-
givenName: t("settings.general.contact.givenName"),
|
|
174
|
-
familyName: t("settings.general.contact.familyName"),
|
|
175
|
-
telephone: t("settings.general.contact.telephone"),
|
|
176
|
-
address: t("settings.general.contact.address"),
|
|
177
|
-
companyName: t("settings.general.contact.companyName"),
|
|
178
|
-
jobTitle: t("settings.general.contact.jobTitle"),
|
|
179
|
-
save: t("settings.general.contact.save"),
|
|
180
|
-
saving: t("settings.general.contact.saving"),
|
|
181
|
-
saved: t("settings.general.contact.saved"),
|
|
182
|
-
addressIncomplete: t("settings.general.contact.addressIncomplete"),
|
|
183
|
-
errors: {
|
|
184
|
-
telephone: t("settings.general.contact.errors.telephone"),
|
|
185
|
-
invalid: t("settings.general.contact.errors.invalid"),
|
|
186
|
-
unverified: t("settings.general.contact.errors.unverified"),
|
|
187
|
-
unavailable: t("settings.general.contact.errors.unavailable"),
|
|
188
|
-
failed: t("settings.general.contact.errors.failed"),
|
|
189
|
-
},
|
|
190
|
-
}}
|
|
191
|
-
/>
|
|
192
|
-
) : (
|
|
193
|
-
<span data-testid="account-contact-unavailable">
|
|
194
|
-
<Text as="p" variant="body-sm" tone="muted">
|
|
195
|
-
{t("settings.general.contact.unavailable")}
|
|
196
|
-
</Text>
|
|
197
|
-
</span>
|
|
198
|
-
)}
|
|
199
|
-
</div>
|
|
200
|
-
) : null}
|
|
201
|
-
{phoneStep ? (
|
|
202
|
-
<PhoneVerification
|
|
203
|
-
available={phoneStep.available}
|
|
204
|
-
emailVerified={ctx.user.emailVerified}
|
|
205
|
-
phone={phoneStep.phone}
|
|
206
|
-
labels={phoneLabels}
|
|
207
|
-
/>
|
|
208
|
-
) : null}
|
|
209
|
-
{accountSettingsSections.map((section) => (
|
|
210
|
-
<SettingsSection key={section.id} id={section.id} title={ctx.t(section.title)}>
|
|
211
|
-
{section.render(ctx)}
|
|
212
|
-
</SettingsSection>
|
|
213
|
-
))}
|
|
214
|
-
</GeneralSettings>
|
|
215
|
-
<BillingAnchor locale={locale} />
|
|
216
|
-
</>
|
|
217
|
-
);
|
|
8
|
+
export default async function Route(
|
|
9
|
+
props: Omit<Parameters<typeof Page>[0], "config">,
|
|
10
|
+
) {
|
|
11
|
+
return Page({ ...props, config });
|
|
218
12
|
}
|
|
@@ -1,119 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* the D8 detail contract).
|
|
4
|
-
*
|
|
5
|
-
* RSC, inside the account layout's SignedInShell (the rail keeps Inbox
|
|
6
|
-
* selected here). The item is found the way the contract says: its kind's
|
|
7
|
-
* `load` runs again and the `[id]` is matched — so the page shows only what
|
|
8
|
-
* the caller's own reads return. The kind's `renderDetail` fills the shared
|
|
9
|
-
* `InboxItemFrame`; the area supplies the back link, the caption (the kind's
|
|
10
|
-
* label) and the title, so every kind's detail reads as one frame.
|
|
11
|
-
*
|
|
12
|
-
* #11007 — a conversation kind (`accountChatKinds`: a message) renders
|
|
13
|
-
* through the frame's chat layout — RecordHeader over the message as a
|
|
14
|
-
* start-side bubble; every other kind keeps the stacked head and fields.
|
|
15
|
-
* #11152 — such a kind's item also links to the member thread page
|
|
16
|
-
* (`../../thread`, Open conversation), first among its actions: the whole
|
|
17
|
-
* exchange, with the composer, is one step away from any one message.
|
|
18
|
-
*
|
|
19
|
-
* An unknown kind, or an id the kind did not load, is a not-found — never an
|
|
20
|
-
* empty frame. A failed read is not a not-found: it renders an error with
|
|
21
|
-
* Retry (D12's posture).
|
|
22
|
-
*/
|
|
1
|
+
// Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
|
|
2
|
+
import Page from "@working-theory/account/inbox/[kind]/[id]/page";
|
|
23
3
|
|
|
24
|
-
import
|
|
25
|
-
import { localeHref } from "@working-theory/ui";
|
|
26
|
-
import type { Metadata } from "next";
|
|
27
|
-
import { notFound } from "next/navigation";
|
|
28
|
-
import { getTranslations } from "next-intl/server";
|
|
29
|
-
import type { ReactElement } from "react";
|
|
4
|
+
import config from "../../../../../../../account.config";
|
|
30
5
|
|
|
31
|
-
|
|
32
|
-
import { accountSession, logReadFailure } from "../../../account-data";
|
|
33
|
-
import { ErrorRow } from "../../../error-row";
|
|
6
|
+
export { generateMetadata } from "@working-theory/account/inbox/[kind]/[id]/page";
|
|
34
7
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* A segment, percent-decoded when it decodes. The route param is matched in
|
|
41
|
-
* both forms (`matches` below), so an id is found whether or not the
|
|
42
|
-
* framework already decoded it — and an id that itself contains `%XX` still
|
|
43
|
-
* matches its raw form.
|
|
44
|
-
*/
|
|
45
|
-
function decodeSegment(segment: string): string {
|
|
46
|
-
try {
|
|
47
|
-
return decodeURIComponent(segment);
|
|
48
|
-
} catch {
|
|
49
|
-
return segment;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
54
|
-
const { locale } = await params;
|
|
55
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
56
|
-
return { title: t("inbox.title") };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default async function AccountInboxItemPage({ params }: Props): Promise<ReactElement> {
|
|
60
|
-
const { locale, kind: kindSegment, id: idSegment } = await params;
|
|
61
|
-
const matches = (value: string, segment: string): boolean =>
|
|
62
|
-
value === segment || value === decodeSegment(segment);
|
|
63
|
-
const kind = accountInboxKinds.find((k) => matches(k.kind, kindSegment));
|
|
64
|
-
if (!kind) notFound();
|
|
65
|
-
|
|
66
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
67
|
-
const session = await accountSession(locale);
|
|
68
|
-
if (!session) notFound();
|
|
69
|
-
|
|
70
|
-
const back = { href: localeHref(locale, "/account"), label: t("inbox.back") };
|
|
71
|
-
|
|
72
|
-
let items;
|
|
73
|
-
try {
|
|
74
|
-
items = await kind.load(session.ctx);
|
|
75
|
-
} catch (err) {
|
|
76
|
-
logReadFailure(`kind:${kind.kind}`, err);
|
|
77
|
-
return (
|
|
78
|
-
<div className="max-w-3xl py-8" data-testid="account-item">
|
|
79
|
-
<ErrorRow message={t("inbox.itemError")} retryLabel={t("inbox.retry")} />
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const item = items.find((candidate) => matches(candidate.id, idSegment));
|
|
85
|
-
if (!item) notFound();
|
|
86
|
-
|
|
87
|
-
const detail = kind.renderDetail(item, session.ctx);
|
|
88
|
-
const chat = accountChatKinds.has(kind.kind);
|
|
89
|
-
// #11152 — a conversation kind's item opens the thread; the kind's own actions follow.
|
|
90
|
-
const actions = [
|
|
91
|
-
...(chat
|
|
92
|
-
? [
|
|
93
|
-
{
|
|
94
|
-
key: "thread",
|
|
95
|
-
label: t("thread.open"),
|
|
96
|
-
variant: "outline" as const,
|
|
97
|
-
href: localeHref(locale, "/account/inbox/thread"),
|
|
98
|
-
},
|
|
99
|
-
]
|
|
100
|
-
: []),
|
|
101
|
-
...(detail.actions ?? []),
|
|
102
|
-
];
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<InboxItemFrame
|
|
106
|
-
back={back}
|
|
107
|
-
caption={session.ctx.t(kind.label)}
|
|
108
|
-
title={item.title}
|
|
109
|
-
lead={detail.lead}
|
|
110
|
-
status={detail.status}
|
|
111
|
-
{...(actions.length > 0 ? { actions } : {})}
|
|
112
|
-
fields={detail.fields}
|
|
113
|
-
{...(chat ? { layout: "chat" as const } : {})}
|
|
114
|
-
testIdPrefix="account-item"
|
|
115
|
-
>
|
|
116
|
-
{detail.body}
|
|
117
|
-
</InboxItemFrame>
|
|
118
|
-
);
|
|
8
|
+
export default async function Route(
|
|
9
|
+
props: Omit<Parameters<typeof Page>[0], "config">,
|
|
10
|
+
) {
|
|
11
|
+
return Page({ ...props, config });
|
|
119
12
|
}
|
|
@@ -1,80 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* A message's file action (the `message` Inbox kind, `lib/account-config.ts`)
|
|
5
|
-
* links here. The browser holds neither the client's hub credential (sealed in
|
|
6
|
-
* the `hub-session` cookie) nor this site's spoke key, so this route reads
|
|
7
|
-
* `GET /v1/member/messages/:id/file` with `forwardedCookieInit()` — the
|
|
8
|
-
* caller's own credential, so a client only ever gets their own file — and
|
|
9
|
-
* streams the bytes back unread.
|
|
10
|
-
*
|
|
11
|
-
* SEC-7877-D (the obligation in `@working-theory/api-client`'s `member.ts`):
|
|
12
|
-
* the bytes go out with all five hub headers UNCHANGED — `Content-Type`,
|
|
13
|
-
* `Content-Disposition` (attachment), `X-Content-Type-Options: nosniff`, the
|
|
14
|
-
* sandbox `Content-Security-Policy` and `Cache-Control: private, no-store` —
|
|
15
|
-
* so the file is never a document on this origin and never cached on the way.
|
|
16
|
-
* A hub answer missing any of the five is refused 502 rather than served
|
|
17
|
-
* without it.
|
|
18
|
-
*
|
|
19
|
-
* On a single site the read carries the caller's session cookie; on a spoke
|
|
20
|
-
* that signs in through its hub, the client's hub credential (#8231 D9).
|
|
21
|
-
* A refusal has no body: no credential (signed out) is a 401, a hub 4xx keeps
|
|
22
|
-
* its status, and a hub 5xx, a transport the api-client refuses or a hub call
|
|
23
|
-
* that throws is a 502.
|
|
24
|
-
*/
|
|
25
|
-
import { member, type MemberFileHeaders } from "@working-theory/api-client";
|
|
26
|
-
|
|
27
|
-
import { forwardedCookieInit } from "../../../../../../../../lib/server-api";
|
|
28
|
-
|
|
29
|
-
interface Context {
|
|
30
|
-
params: Promise<{ locale: string; id: string }>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** The response header each of the five hub headers goes out under. */
|
|
34
|
-
const FILE_HEADER_NAMES: Record<keyof MemberFileHeaders, string> = {
|
|
35
|
-
contentType: "Content-Type",
|
|
36
|
-
contentDisposition: "Content-Disposition",
|
|
37
|
-
contentTypeOptions: "X-Content-Type-Options",
|
|
38
|
-
contentSecurityPolicy: "Content-Security-Policy",
|
|
39
|
-
cacheControl: "Cache-Control",
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
function refusal(status: number): Response {
|
|
43
|
-
return new Response(null, { status, headers: { "Cache-Control": "private, no-store" } });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** The refusal's status, from the api-client's `{ ok: false, status, body }`. */
|
|
47
|
-
function refusalStatus(status: number, body: unknown): number {
|
|
48
|
-
if (status === 0) {
|
|
49
|
-
const code = (body as { error?: { code?: unknown } } | null)?.error?.code;
|
|
50
|
-
return code === "unauthorized" ? 401 : 502;
|
|
51
|
-
}
|
|
52
|
-
return status >= 500 ? 502 : status;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// platform-decisions-waiver: api-versioning — a page-scoped download link on the site's own account area, not an API contract; it re-serves the versioned hub route /v1/member/messages/:id/file
|
|
56
|
-
export async function GET(_request: Request, { params }: Context): Promise<Response> {
|
|
57
|
-
const { id } = await params;
|
|
58
|
-
|
|
59
|
-
// The api-client throws, rather than answering `{ ok: false }`, on a
|
|
60
|
-
// network failure or a redirect — that is a 502 too, never Next's own 500.
|
|
61
|
-
let res: Awaited<ReturnType<typeof member.messageFile>>;
|
|
62
|
-
try {
|
|
63
|
-
res = await member.messageFile(id, await forwardedCookieInit());
|
|
64
|
-
} catch {
|
|
65
|
-
return refusal(502);
|
|
66
|
-
}
|
|
67
|
-
if (!res.ok) return refusal(refusalStatus(res.status, res.body));
|
|
68
|
-
|
|
69
|
-
const { stream, headers } = res.body;
|
|
70
|
-
const out = new Headers();
|
|
71
|
-
for (const [key, name] of Object.entries(FILE_HEADER_NAMES) as [keyof MemberFileHeaders, string][]) {
|
|
72
|
-
const value = headers[key];
|
|
73
|
-
if (value === null) {
|
|
74
|
-
await stream.cancel();
|
|
75
|
-
return refusal(502);
|
|
76
|
-
}
|
|
77
|
-
out.set(name, value);
|
|
78
|
-
}
|
|
79
|
-
return new Response(stream, { status: 200, headers: out });
|
|
80
|
-
}
|
|
1
|
+
// Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
|
|
2
|
+
export { GET } from "@working-theory/account/inbox/message/[id]/file/route";
|
|
@@ -1,125 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* workspace (#11152; operator ruling 2026-11-08).
|
|
4
|
-
*
|
|
5
|
-
* RSC, inside the account layout's SignedInShell (the rail keeps Inbox
|
|
6
|
-
* selected under /account/inbox/…). The Admin reads a client's exchange as
|
|
7
|
-
* one per-person thread page; the member gets the same page shape, through
|
|
8
|
-
* the same shared pieces (`@working-theory/templates/account`): the Record
|
|
9
|
-
* frame — `InboxItemFrame layout="chat"`, its `RecordHeader` titled
|
|
10
|
-
* Messages with the back link to the Inbox's Messages tab — over every
|
|
11
|
-
* message between this person and the workspace, OLDEST FIRST, each the
|
|
12
|
-
* bubble its own Inbox kind renders (`renderDetail`: the provider's messages
|
|
13
|
-
* on the start side, the member's own sent requests and messages on the
|
|
14
|
-
* end), a message's own actions (a file's Download, Open onboarding) under
|
|
15
|
-
* its bubble, and the shared `ThreadComposer` pinned at the foot
|
|
16
|
-
* (`member-thread-composer.tsx`): one field, Send, the existing member
|
|
17
|
-
* message write. The New menu's Send message navigates here (#11152 AC-1);
|
|
18
|
-
* the lightbox it opened is retired. One stream per (person, workspace):
|
|
19
|
-
* `thread-data.ts` records the decision.
|
|
20
|
-
*
|
|
21
|
-
* An empty thread reads the empty line above the composer; a kind's failed
|
|
22
|
-
* read renders the error row with Retry above what did load (D12's
|
|
23
|
-
* posture); signed out is a not-found (the layout's gate renders in the
|
|
24
|
-
* page's place).
|
|
25
|
-
*/
|
|
1
|
+
// Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
|
|
2
|
+
import Page from "@working-theory/account/inbox/thread/page";
|
|
26
3
|
|
|
27
|
-
import
|
|
28
|
-
import { localeHref } from "@working-theory/ui";
|
|
29
|
-
import { Button, Link, Text } from "@working-theory/ui/primitives";
|
|
30
|
-
import type { Metadata } from "next";
|
|
31
|
-
import { notFound } from "next/navigation";
|
|
32
|
-
import { getTranslations } from "next-intl/server";
|
|
33
|
-
import type { ReactElement } from "react";
|
|
4
|
+
import config from "../../../../../../account.config";
|
|
34
5
|
|
|
35
|
-
|
|
36
|
-
import { ErrorRow } from "../../error-row";
|
|
37
|
-
import { newActionErrorLabels } from "../../new-popups";
|
|
6
|
+
export { generateMetadata } from "@working-theory/account/inbox/thread/page";
|
|
38
7
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
params: Promise<{ locale: string }>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
47
|
-
const { locale } = await params;
|
|
48
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
49
|
-
return { title: t("thread.title") };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** A bubble's own action, as a small link under it; an RSC detail carries `href` actions only. */
|
|
53
|
-
function EntryAction({ action }: { action: InboxItemAction }): ReactElement | null {
|
|
54
|
-
if (action.href === undefined) return null;
|
|
55
|
-
return (
|
|
56
|
-
<Button asChild variant={action.variant} size="thin">
|
|
57
|
-
<Link href={action.href} variant="bare" data-testid={`account-thread-action-${action.key}`}>
|
|
58
|
-
{action.label}
|
|
59
|
-
</Link>
|
|
60
|
-
</Button>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default async function AccountThreadPage({ params }: Props): Promise<ReactElement> {
|
|
65
|
-
const { locale } = await params;
|
|
66
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
67
|
-
const session = await accountSession(locale);
|
|
68
|
-
if (!session) notFound();
|
|
69
|
-
|
|
70
|
-
const { entries, failed } = await loadThread(session.ctx);
|
|
71
|
-
// The refusal lines the composer shows, keyed on `sendMessage`'s codes — the popups' own map.
|
|
72
|
-
const errors = newActionErrorLabels(session.ctx.t);
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<InboxItemFrame
|
|
76
|
-
layout="chat"
|
|
77
|
-
back={{ href: localeHref(locale, "/account?tab=messages"), label: t("inbox.back") }}
|
|
78
|
-
caption={t("thread.title")}
|
|
79
|
-
title={t("thread.title")}
|
|
80
|
-
testIdPrefix="account-thread"
|
|
81
|
-
composer={
|
|
82
|
-
<MemberThreadComposer
|
|
83
|
-
labels={{
|
|
84
|
-
label: t("thread.composer.label"),
|
|
85
|
-
body: t("thread.composer.body"),
|
|
86
|
-
placeholder: t("thread.composer.placeholder"),
|
|
87
|
-
send: t("thread.composer.send"),
|
|
88
|
-
sending: t("thread.composer.sending"),
|
|
89
|
-
sent: t("thread.composer.sent"),
|
|
90
|
-
needsContent: t("thread.composer.needsContent"),
|
|
91
|
-
failed: t("new.errors.failed"),
|
|
92
|
-
}}
|
|
93
|
-
errors={errors}
|
|
94
|
-
/>
|
|
95
|
-
}
|
|
96
|
-
>
|
|
97
|
-
{failed ? <ErrorRow message={t("thread.error")} retryLabel={t("inbox.retry")} /> : null}
|
|
98
|
-
{!failed && entries.length === 0 ? (
|
|
99
|
-
<Text as="p" variant="body-sm" tone="muted" data-testid="account-thread-empty">
|
|
100
|
-
{t("thread.empty")}
|
|
101
|
-
</Text>
|
|
102
|
-
) : null}
|
|
103
|
-
{entries.map(({ kind, item }) => {
|
|
104
|
-
const detail = kind.renderDetail(item, session.ctx);
|
|
105
|
-
return (
|
|
106
|
-
<div
|
|
107
|
-
key={`${kind.kind}:${item.id}`}
|
|
108
|
-
className="flex flex-col gap-2"
|
|
109
|
-
data-testid="account-thread-entry"
|
|
110
|
-
data-kind={kind.kind}
|
|
111
|
-
>
|
|
112
|
-
{detail.body}
|
|
113
|
-
{detail.actions && detail.actions.length > 0 ? (
|
|
114
|
-
<div className="flex flex-wrap gap-2">
|
|
115
|
-
{detail.actions.map((action) => (
|
|
116
|
-
<EntryAction key={action.key} action={action} />
|
|
117
|
-
))}
|
|
118
|
-
</div>
|
|
119
|
-
) : null}
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
})}
|
|
123
|
-
</InboxItemFrame>
|
|
124
|
-
);
|
|
8
|
+
export default async function Route(
|
|
9
|
+
props: Omit<Parameters<typeof Page>[0], "config">,
|
|
10
|
+
) {
|
|
11
|
+
return Page({ ...props, config });
|
|
125
12
|
}
|