create-ailk 0.37.1 → 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 +129 -0
- 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 +2 -2
- package/dist/add-route.js +18 -11
- 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 +14 -1
- package/dist/sync-routes.js +86 -5
- package/dist/topology.d.ts +15 -1
- package/dist/topology.js +20 -4
- package/dist/update.d.ts +17 -2
- package/dist/update.js +480 -77
- 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,131 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* RSC, outside the account layout's SignedInShell (#8430), in the member's
|
|
6
|
-
* four-tab settings frame (D7) — standalone, the Admin's shape. It shows how
|
|
7
|
-
* this person signs in, then Log out, through the shared `SecuritySettings`
|
|
8
|
-
* (`security-panel.tsx` supplies its actions):
|
|
9
|
-
*
|
|
10
|
-
* - a site or hub that can email a password link: the Password row, set
|
|
11
|
-
* or changed by an emailed link to the person's own address;
|
|
12
|
-
* - any other site: one sentence naming the deployment's methods;
|
|
13
|
-
* - a spoke that signs in through its hub: the SAME Password row (#11162),
|
|
14
|
-
* its state read from the hub for the signed-in person, its link mailed
|
|
15
|
-
* by the hub through the spoke's own `/api/hub-session/password` — no
|
|
16
|
-
* "managed at <hub>" sentence and no link to the hub's Security page.
|
|
17
|
-
*
|
|
18
|
-
* `security-source.ts` picks the variant; this page turns it into text.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
import { AccountSettingsFrame, AccountSettingsPane } from "@working-theory/templates/account";
|
|
22
|
-
import { localeHref } from "@working-theory/ui";
|
|
23
|
-
import type { Metadata } from "next";
|
|
24
|
-
import { headers } from "next/headers";
|
|
25
|
-
import { getTranslations } from "next-intl/server";
|
|
26
|
-
import type { ReactElement } from "react";
|
|
27
|
-
|
|
28
|
-
import { SIGN_IN_PATH, SIGN_OUT_ENDPOINT } from "../../../../../lib/topology.generated";
|
|
29
|
-
import { accountSession } from "../account-data";
|
|
30
|
-
import { ErrorRow } from "../error-row";
|
|
31
|
-
import { memberSettingsFrame, type Translate } from "../settings-frame";
|
|
32
|
-
import type { SignInMethodId } from "../sign-in-method";
|
|
33
|
-
|
|
34
|
-
import { SecurityPanel, type SecurityPanelVariant } from "./security-panel";
|
|
35
|
-
import { securitySource } from "./security-source";
|
|
36
|
-
|
|
37
|
-
interface Props {
|
|
38
|
-
params: Promise<{ locale: string }>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
42
|
-
const { locale } = await params;
|
|
43
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
44
|
-
return { title: t("settings.security.title"), description: t("settings.signIn.lead") };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** The spoke's same-origin route that asks the hub to mail a password link (#11162). */
|
|
48
|
-
const HUB_SESSION_PASSWORD_PATH = "/api/hub-session/password";
|
|
49
|
-
|
|
50
|
-
/** Each sign-in method's phrase in the sentence (C5). */
|
|
51
|
-
const METHOD_KEYS = {
|
|
52
|
-
google: "settings.security.methods.google",
|
|
53
|
-
github: "settings.security.methods.github",
|
|
54
|
-
"magic-link": "settings.security.methods.magicLink",
|
|
55
|
-
email: "settings.security.methods.password",
|
|
56
|
-
} as const satisfies Record<SignInMethodId, string>;
|
|
57
|
-
|
|
58
|
-
export default async function AccountSecurityPage({ params }: Props): Promise<ReactElement> {
|
|
59
|
-
const { locale } = await params;
|
|
60
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
61
|
-
const session = await accountSession(locale);
|
|
62
|
-
const frame = memberSettingsFrame(locale, t as unknown as Translate, "security");
|
|
63
|
-
const email = session?.ctx.user.email ?? "";
|
|
64
|
-
const name = session?.ctx.user.name || email;
|
|
65
|
-
|
|
66
|
-
const source = await securitySource(await headers(), session?.ctx.init);
|
|
67
|
-
|
|
68
|
-
let variant: SecurityPanelVariant | null;
|
|
69
|
-
if (source.kind !== "sentence") {
|
|
70
|
-
// Both the password and the hub (#11162) sources are the Password row;
|
|
71
|
-
// `null` is its unavailable line — a failed read, or a hub with no state.
|
|
72
|
-
variant = source.hasPassword === null ? null : { kind: "password", hasPassword: source.hasPassword };
|
|
73
|
-
} else {
|
|
74
|
-
const methods = source.methods.map((id) => t(METHOD_KEYS[id], { email }));
|
|
75
|
-
variant = {
|
|
76
|
-
kind: "sentence",
|
|
77
|
-
text:
|
|
78
|
-
methods.length > 0
|
|
79
|
-
? t("settings.security.signsInWith", {
|
|
80
|
-
methods: new Intl.ListFormat(locale, { type: "disjunction" }).format(methods),
|
|
81
|
-
})
|
|
82
|
-
: t("settings.security.signedInAs", { email }),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<AccountSettingsFrame {...frame} name={name}>
|
|
88
|
-
<AccountSettingsPane
|
|
89
|
-
id="account-settings-security"
|
|
90
|
-
title={t("settings.security.title")}
|
|
91
|
-
lead={t("settings.signIn.lead")}
|
|
92
|
-
>
|
|
93
|
-
<SecurityPanel
|
|
94
|
-
variant={variant}
|
|
95
|
-
failed={
|
|
96
|
-
<ErrorRow message={t("settings.security.passwordUnavailable")} retryLabel={t("inbox.retry")} />
|
|
97
|
-
}
|
|
98
|
-
email={email}
|
|
99
|
-
// Absolute and same-origin, built here from BETTER_AUTH_URL — the
|
|
100
|
-
// `(auth)/forgot-password/page.tsx` derivation.
|
|
101
|
-
resetUrl={`${process.env.BETTER_AUTH_URL ?? ""}${localeHref(locale, "/reset-password")}`}
|
|
102
|
-
// On a spoke the hub mails the link, asked through this same-origin
|
|
103
|
-
// route (#11162); a site or hub asks Better Auth itself.
|
|
104
|
-
passwordEndpoint={source.kind === "hub" ? HUB_SESSION_PASSWORD_PATH : null}
|
|
105
|
-
locale={locale}
|
|
106
|
-
signOutEndpoint={SIGN_OUT_ENDPOINT}
|
|
107
|
-
// A hub-session sign-out lands home: the spoke's /account would sign
|
|
108
|
-
// the person straight back in (#11095 D4). A hub keeps /sign-in.
|
|
109
|
-
signInHref={localeHref(locale, SIGN_OUT_ENDPOINT ? "/" : (SIGN_IN_PATH ?? "/"))}
|
|
110
|
-
labels={{
|
|
111
|
-
methodsHeading: t("settings.security.methodsHeading"),
|
|
112
|
-
passwordLabel: t("settings.security.passwordLabel"),
|
|
113
|
-
passwordSet: t("settings.security.passwordSet"),
|
|
114
|
-
passwordNotSet: t("settings.security.passwordNotSet"),
|
|
115
|
-
setHint: t("settings.security.setHint"),
|
|
116
|
-
changeHint: t("settings.security.changeHint"),
|
|
117
|
-
setNote: t("settings.security.setNote", { email }),
|
|
118
|
-
changeNote: t("settings.security.changeNote", { email }),
|
|
119
|
-
setButton: t("settings.security.setButton"),
|
|
120
|
-
changeButton: t("settings.security.changeButton"),
|
|
121
|
-
sending: t("settings.security.sending"),
|
|
122
|
-
sent: t("settings.security.sent"),
|
|
123
|
-
sendFailed: t("settings.security.sendFailed"),
|
|
124
|
-
logOut: t("settings.security.logOut"),
|
|
125
|
-
logOutFailed: t("settings.security.logOutFailed"),
|
|
126
|
-
}}
|
|
127
|
-
/>
|
|
128
|
-
</AccountSettingsPane>
|
|
129
|
-
</AccountSettingsFrame>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
1
|
+
// Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
|
|
2
|
+
export { default } from "@working-theory/account/security/page";
|
|
3
|
+
export { generateMetadata } from "@working-theory/account/security/page";
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* spec docs/specs/8232-member-settings-account-general-and-spec.md D8).
|
|
4
|
-
*
|
|
5
|
-
* Settings is four tabs since #8339 — General · Security · Notifications ·
|
|
6
|
-
* Billing — and this one-page, anchored route (#7430) only forwards. A URL
|
|
7
|
-
* fragment never reaches the server, so `#billing` cannot be redirected
|
|
8
|
-
* here: the browser carries it across this redirect, and General's
|
|
9
|
-
* `BillingAnchor` sends it on to Billing; `#general` lands on General as it
|
|
10
|
-
* is. The hub's authorize step still sends an unverified person here
|
|
11
|
-
* (`VERIFY_EMAIL_PATH`), and this redirect carries them on.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { localeHref } from "@working-theory/ui";
|
|
15
|
-
import { redirect } from "next/navigation";
|
|
16
|
-
|
|
17
|
-
interface Props {
|
|
18
|
-
params: Promise<{ locale: string }>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default async function AccountSettingsPage({ params }: Props): Promise<never> {
|
|
22
|
-
const { locale } = await params;
|
|
23
|
-
redirect(localeHref(locale, "/account/general"));
|
|
24
|
-
}
|
|
1
|
+
// Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
|
|
2
|
+
export { default } from "@working-theory/account/settings/page";
|
|
@@ -1,60 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* RSC, inside the account layout's SignedInShell. Reached from the help
|
|
5
|
-
* menu (the rail's ? and the phone tab bar's Help), never a rail row (D13).
|
|
6
|
-
* The form files a contact lead of kind `support` with the session's email,
|
|
7
|
-
* so it lands in the admin Inbox as a message; the reply goes to that email.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { Heading, Text } from "@working-theory/ui/primitives";
|
|
11
|
-
import type { Metadata } from "next";
|
|
12
|
-
import { getTranslations } from "next-intl/server";
|
|
13
|
-
import type { ReactElement } from "react";
|
|
14
|
-
|
|
15
|
-
import { accountSession } from "../account-data";
|
|
16
|
-
|
|
17
|
-
import { SupportForm } from "./support-form";
|
|
18
|
-
|
|
19
|
-
interface Props {
|
|
20
|
-
params: Promise<{ locale: string }>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
24
|
-
const { locale } = await params;
|
|
25
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
26
|
-
return { title: t("support.title") };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default async function AccountSupportPage({ params }: Props): Promise<ReactElement> {
|
|
30
|
-
const { locale } = await params;
|
|
31
|
-
const t = await getTranslations({ locale, namespace: "account" });
|
|
32
|
-
const session = await accountSession(locale);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<div className="flex max-w-3xl flex-col gap-8 py-8" data-testid="account-support">
|
|
36
|
-
<div>
|
|
37
|
-
<Heading level={1} visual={2}>
|
|
38
|
-
{t("support.title")}
|
|
39
|
-
</Heading>
|
|
40
|
-
{session ? (
|
|
41
|
-
<Text as="p" variant="body-sm" tone="muted" className="mt-block-tight">
|
|
42
|
-
{t("support.lead", { email: session.ctx.user.email })}
|
|
43
|
-
</Text>
|
|
44
|
-
) : null}
|
|
45
|
-
</div>
|
|
46
|
-
<SupportForm
|
|
47
|
-
labels={{
|
|
48
|
-
subject: t("support.subject"),
|
|
49
|
-
message: t("support.message"),
|
|
50
|
-
submit: t("support.submit"),
|
|
51
|
-
submitting: t("support.submitting"),
|
|
52
|
-
required: t("support.required"),
|
|
53
|
-
success: t("support.success"),
|
|
54
|
-
error: t("support.error"),
|
|
55
|
-
unavailable: t("support.unavailable"),
|
|
56
|
-
}}
|
|
57
|
-
/>
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
1
|
+
// Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
|
|
2
|
+
export { default } from "@working-theory/account/support/page";
|
|
3
|
+
export { generateMetadata } from "@working-theory/account/support/page";
|
|
@@ -98,7 +98,13 @@ import {
|
|
|
98
98
|
resolvePageChrome,
|
|
99
99
|
routeFamilyOf,
|
|
100
100
|
} from "../../lib/page-chrome";
|
|
101
|
-
import {
|
|
101
|
+
import {
|
|
102
|
+
backLinkName,
|
|
103
|
+
navLabelsByPath,
|
|
104
|
+
parentHref,
|
|
105
|
+
servedParent,
|
|
106
|
+
} from "../../lib/profile-back-link";
|
|
107
|
+
import { servedPages } from "../../lib/served-pages";
|
|
102
108
|
import {
|
|
103
109
|
withPublicServicesColumns,
|
|
104
110
|
withPublicServicesPaths,
|
|
@@ -273,19 +279,23 @@ const FLASH_PREVENTION_SCRIPT = `(function(){
|
|
|
273
279
|
// ── Metadata ─────────────────────────────────────────────────────────────────
|
|
274
280
|
|
|
275
281
|
export async function generateMetadata(): Promise<Metadata> {
|
|
276
|
-
const ogImageUrl = getOgImageUrl({ title: SITE_NAME, schemaType: "WebSite" });
|
|
277
|
-
|
|
278
282
|
const headerStore = await headers();
|
|
279
283
|
const pathname = headerStore.get("x-pathname") ?? "/";
|
|
280
284
|
|
|
281
285
|
const locales = readLocales();
|
|
282
286
|
const baseUrl = resolveBaseUrl();
|
|
287
|
+
// #11244 — absolute: no layout sets `metadataBase`, so a relative og:image
|
|
288
|
+
// reached crawlers as a path they could not fetch.
|
|
289
|
+
const ogImageUrl = `${baseUrl.replace(/\/+$/, "")}${getOgImageUrl({ title: SITE_NAME, schemaType: "WebSite" })}`;
|
|
283
290
|
const languages = buildHreflangAlternates(
|
|
284
291
|
pathname,
|
|
285
292
|
locales,
|
|
286
293
|
DEFAULT_LOCALE,
|
|
287
294
|
baseUrl,
|
|
288
295
|
);
|
|
296
|
+
// #11239 — the last-resort preview and canonical for a route that returns
|
|
297
|
+
// none of its own: the request's own URL, never the home page's.
|
|
298
|
+
const requestUrl = pathname === "/" ? baseUrl : `${baseUrl}${pathname}`;
|
|
289
299
|
|
|
290
300
|
return {
|
|
291
301
|
title: SITE_NAME,
|
|
@@ -294,7 +304,7 @@ export async function generateMetadata(): Promise<Metadata> {
|
|
|
294
304
|
title: SITE_NAME,
|
|
295
305
|
description: SITE_DESCRIPTION,
|
|
296
306
|
type: "website",
|
|
297
|
-
url:
|
|
307
|
+
url: requestUrl,
|
|
298
308
|
images: [ogImageUrl],
|
|
299
309
|
},
|
|
300
310
|
twitter: {
|
|
@@ -305,7 +315,7 @@ export async function generateMetadata(): Promise<Metadata> {
|
|
|
305
315
|
},
|
|
306
316
|
...getStealthRobots(),
|
|
307
317
|
alternates: {
|
|
308
|
-
canonical:
|
|
318
|
+
canonical: requestUrl,
|
|
309
319
|
languages,
|
|
310
320
|
},
|
|
311
321
|
};
|
|
@@ -706,6 +716,29 @@ export default async function LocaleLayout({
|
|
|
706
716
|
items: col.items.map((item) => ({ ...item, label: labelFor(item.labelKey) })),
|
|
707
717
|
}));
|
|
708
718
|
|
|
719
|
+
// The bare header's back arrow (operator handoff 2026-11-09): the page's
|
|
720
|
+
// served parent — a content page, a code-rendered route or a nav entry —
|
|
721
|
+
// named in its label; home when no ancestor is served. Read only where
|
|
722
|
+
// the arrow renders. A slide-left arrival is rewritten client-side by
|
|
723
|
+
// NavBackLink (#8644).
|
|
724
|
+
// `returnLabel` names the deck home for a slide return, so the accessible
|
|
725
|
+
// name follows the href NavBackLink resolves to.
|
|
726
|
+
let bareBackLink: { href: string; label: string; returnLabel: string } | undefined;
|
|
727
|
+
if (!isHome && pageChrome.header === "bare") {
|
|
728
|
+
const titles = await servedPages(locale);
|
|
729
|
+
const navPathLabels = navLabelsByPath([publicNavItems, footerColumnDefs], labelFor);
|
|
730
|
+
const served = (path: string): boolean => titles.has(path) || navPathLabels.has(path);
|
|
731
|
+
const parent = servedParent({ pathname, locales: enabledLocales, served });
|
|
732
|
+
bareBackLink = {
|
|
733
|
+
href: parentHref(parent, homePath),
|
|
734
|
+
label:
|
|
735
|
+
parent === null
|
|
736
|
+
? tNav("home")
|
|
737
|
+
: tNav("backTo", { name: backLinkName(parent, { navLabels: navPathLabels, titles }) }),
|
|
738
|
+
returnLabel: tNav("home"),
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
|
|
709
742
|
// The site's own name (#6942) — `SITE_NAME` resolves from `_site.mdx`'s
|
|
710
743
|
// `siteName:`, so a customer's footer never carries the kit vendor's name.
|
|
711
744
|
// The holder is `siteIdentity.legalName` when declared (#7796), else the name.
|
|
@@ -792,11 +825,8 @@ export default async function LocaleLayout({
|
|
|
792
825
|
href="/favicon-16x16.png"
|
|
793
826
|
/>
|
|
794
827
|
<link rel="shortcut icon" href="/favicon.ico" />
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
sizes="180x180"
|
|
798
|
-
href="/apple-touch-icon.png"
|
|
799
|
-
/>
|
|
828
|
+
{/* #11244 — the apple-touch-icon is `app/apple-icon.tsx`, drawn from
|
|
829
|
+
the site's brand mark; Next.js emits its link on every page. */}
|
|
800
830
|
<link rel="manifest" href="/site.webmanifest" />
|
|
801
831
|
<GoogleAnalytics />
|
|
802
832
|
<VerificationMeta />
|
|
@@ -916,26 +946,13 @@ export default async function LocaleLayout({
|
|
|
916
946
|
// #7721 D4 — a bare inner page's header: the back arrow home
|
|
917
947
|
// and the mark. It carries no actions, so it is always the
|
|
918
948
|
// server Nav (nothing callable crosses the RSC boundary).
|
|
919
|
-
//
|
|
920
|
-
//
|
|
949
|
+
// 2026-11-09 — the arrow goes to the page's served parent
|
|
950
|
+
// (`bareBackLink` above), superseding #7744 D7's
|
|
951
|
+
// people-slide rule.
|
|
921
952
|
// #10049 D1 — `none` renders no header; a site-set `full`
|
|
922
953
|
// header shows the menus even on a `mark-only` design.
|
|
923
|
-
pageChrome.header === "none" ? undefined :
|
|
924
|
-
|
|
925
|
-
<Nav
|
|
926
|
-
{...navProps}
|
|
927
|
-
navItems={[]}
|
|
928
|
-
bar="bare"
|
|
929
|
-
backLink={{
|
|
930
|
-
href: backLinkHref({
|
|
931
|
-
pathname,
|
|
932
|
-
homePath,
|
|
933
|
-
home: homeLayout,
|
|
934
|
-
locales: enabledLocales,
|
|
935
|
-
}),
|
|
936
|
-
label: tNav("home"),
|
|
937
|
-
}}
|
|
938
|
-
/>
|
|
954
|
+
pageChrome.header === "none" ? undefined : bareBackLink ? (
|
|
955
|
+
<Nav {...navProps} navItems={[]} bar="bare" backLink={bareBackLink} />
|
|
939
956
|
) : (
|
|
940
957
|
<Nav
|
|
941
958
|
{...navProps}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The apple-touch-icon (#11244) — 180×180, drawn from the site's brand mark
|
|
3
|
+
* (`brand.logomark.light` in `content/_site.mdx`, else `/logomark.svg`) on
|
|
4
|
+
* the theme's bg, so every site has one. Next.js emits its
|
|
5
|
+
* `<link rel="apple-touch-icon">` in every page's head. It is what the
|
|
6
|
+
* `icon` share style previews with: Messages and Slack show the site icon,
|
|
7
|
+
* title and domain in place of an og:image.
|
|
8
|
+
*
|
|
9
|
+
* Satori reads inline styles only (the /og route's #6514 exception). The
|
|
10
|
+
* icon is rendered at build time, where `public/` is on disk; the /og route
|
|
11
|
+
* keeps its own copy of the mark read because it also fetches at request time.
|
|
12
|
+
*/
|
|
13
|
+
import { readFileSync } from "node:fs";
|
|
14
|
+
import { extname, resolve, sep } from "node:path";
|
|
15
|
+
|
|
16
|
+
import { BrandLogomarkSchema } from "@working-theory/site-config/schema";
|
|
17
|
+
import { tokens } from "@working-theory/theme";
|
|
18
|
+
import { ImageResponse } from "next/og";
|
|
19
|
+
|
|
20
|
+
import { SITE_LOGOMARK, SITE_NAME } from "../lib/site-brand";
|
|
21
|
+
|
|
22
|
+
export const size = { width: 180, height: 180 };
|
|
23
|
+
export const contentType = "image/png";
|
|
24
|
+
|
|
25
|
+
const MIME: Record<string, string> = {
|
|
26
|
+
".svg": "image/svg+xml",
|
|
27
|
+
".png": "image/png",
|
|
28
|
+
".jpg": "image/jpeg",
|
|
29
|
+
".jpeg": "image/jpeg",
|
|
30
|
+
".webp": "image/webp",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** The site's brand mark from `public/`, as a data URI. */
|
|
34
|
+
function markDataUri(): string | undefined {
|
|
35
|
+
try {
|
|
36
|
+
const src =
|
|
37
|
+
SITE_LOGOMARK === undefined ? "/logomark.svg" : BrandLogomarkSchema.parse(SITE_LOGOMARK).light;
|
|
38
|
+
const type = MIME[extname(src).toLowerCase()];
|
|
39
|
+
const root = resolve(process.cwd(), "public");
|
|
40
|
+
const file = resolve(root, `.${src}`);
|
|
41
|
+
if (type === undefined || !file.startsWith(root + sep)) return undefined;
|
|
42
|
+
return `data:${type};base64,${readFileSync(file).toString("base64")}`;
|
|
43
|
+
} catch {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default function AppleIcon(): ImageResponse {
|
|
49
|
+
const colors = tokens.colors.light;
|
|
50
|
+
const mark = markDataUri();
|
|
51
|
+
return new ImageResponse(
|
|
52
|
+
<div
|
|
53
|
+
style={{
|
|
54
|
+
display: "flex",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
justifyContent: "center",
|
|
57
|
+
width: "100%",
|
|
58
|
+
height: "100%",
|
|
59
|
+
backgroundColor: colors.bg,
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
{mark ? (
|
|
63
|
+
<img src={mark} alt="" width={128} height={128} />
|
|
64
|
+
) : (
|
|
65
|
+
<div style={{ color: colors.fg, fontSize: "96px", fontWeight: 700 }}>
|
|
66
|
+
{SITE_NAME.slice(0, 1).toUpperCase()}
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
</div>,
|
|
70
|
+
size,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -3,30 +3,40 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* #10940 D3 —
|
|
7
|
-
*
|
|
6
|
+
* #10940 D3 — the llms route reads the site listing and skips `ThankYouPage`
|
|
7
|
+
* rows.
|
|
8
8
|
*
|
|
9
9
|
* AC-1: on a database-backed site each public page is listed once, at the
|
|
10
10
|
* route that serves it. AC-3: with the empty listing (the default dep) the
|
|
11
11
|
* output is today's convention listing, apart from the ThankYouPage skip.
|
|
12
|
+
*
|
|
13
|
+
* #11394 — this suite is a template file `create-ailk update` carries, so it
|
|
14
|
+
* runs only the route that serves GET /llms.txt, which update carries with
|
|
15
|
+
* it. The docs-blog variant (`lib/slices/docs-blog/llms-route.ts`) is that
|
|
16
|
+
* module's bundle file: update never moves it, so a site's copy is the one
|
|
17
|
+
* its bundle delivered and can predate the listing. Its own suite beside it
|
|
18
|
+
* pins the same cases in this repo.
|
|
12
19
|
*/
|
|
13
20
|
|
|
14
21
|
import type { ContentAdapter } from "@working-theory/content-adapters";
|
|
15
22
|
import type { SiteListing } from "@working-theory/page-renderer";
|
|
16
23
|
|
|
24
|
+
// The site's own flags and listing are per-site files (`create-ailk` writes
|
|
25
|
+
// the flags; the listing is site-owned): this suite tests a site with public
|
|
26
|
+
// pages and the empty listing, never the site's own values (#11246).
|
|
27
|
+
// eslint-disable-next-line no-restricted-syntax -- #507: a per-site generated or site-owned file; this suite pins the value it tests (#11246)
|
|
28
|
+
jest.mock("../../../lib/modules.generated", () => ({
|
|
29
|
+
__esModule: true,
|
|
30
|
+
...jest.requireActual<object>("../../../lib/modules.generated"),
|
|
31
|
+
PUBLIC_PAGES: true,
|
|
32
|
+
}));
|
|
33
|
+
// eslint-disable-next-line no-restricted-syntax -- #507: a per-site generated or site-owned file; this suite pins the value it tests (#11246)
|
|
34
|
+
jest.mock("../../../lib/site-listing", () => ({ __esModule: true, SITE_LISTING: {} }));
|
|
35
|
+
|
|
17
36
|
type Route = typeof import("../route");
|
|
18
37
|
|
|
19
38
|
const BASE = "https://example.com";
|
|
20
|
-
|
|
21
|
-
// docs-blog carries no copy — only the routes that resolve here are run (#11085).
|
|
22
|
-
const ROUTES = ["../route", "../../../lib/slices/docs-blog/llms-route"].filter((path) => {
|
|
23
|
-
try {
|
|
24
|
-
require.resolve(path);
|
|
25
|
-
return true;
|
|
26
|
-
} catch {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
39
|
+
const ROUTES = ["../route"];
|
|
30
40
|
|
|
31
41
|
const PUBLIC_ROWS: Record<string, Array<{ type: string; slug: string; title: string }>> = {
|
|
32
42
|
AboutPage: [{ type: "AboutPage", slug: "about", title: "About" }],
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
+
|
|
3
|
+
exports[`/og — the brand card (#11244) matches its snapshot 1`] = `"<div data-card="share" data-schema-type="AboutPage" style="display:flex;width:100%;height:100%;background-color:#ffffff;font-family:system-ui, -apple-system, sans-serif"><div style="display:flex;width:16px;height:100%;background-color:#0a0a0a"></div><div style="display:flex;flex-direction:column;justify-content:space-between;flex:1;padding:72px 80px"><div style="display:flex;align-items:center;gap:20px"><img src="data:image/svg+xml;base64,<mark>" alt="" width="64" height="64"/><div style="color:#030712;font-size:30px;font-weight:600">Northwind Studio</div></div><div style="display:flex;color:#030712;font-size:76px;font-weight:700;line-height:1.1;letter-spacing:-0.02em">About us</div><div style="color:#4a5565;font-size:26px">northwind.example</div></div></div>"`;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment node
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The `card` share style (#11244): /og draws a 1200×630 card from the site's
|
|
6
|
+
* brand — its mark (or photo), the page title set large, the site name and
|
|
7
|
+
* domain — in place of the plain brand-colour block it replaced. The
|
|
8
|
+
* snapshot pins the card's markup; the last case holds it apart from the
|
|
9
|
+
* plain block.
|
|
10
|
+
*/
|
|
11
|
+
import { mkdtempSync, writeFileSync } from "node:fs";
|
|
12
|
+
import { tmpdir } from "node:os";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
|
|
15
|
+
import { tokens } from "@working-theory/theme";
|
|
16
|
+
import { ImageResponse } from "next/og";
|
|
17
|
+
import type { ReactElement } from "react";
|
|
18
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
19
|
+
|
|
20
|
+
// The site's brand comes from the env and `content/_site.mdx`, read at module
|
|
21
|
+
// load: set before the route is imported, with an empty content root.
|
|
22
|
+
const EMPTY_ROOT = mkdtempSync(join(tmpdir(), "og-card-empty-"));
|
|
23
|
+
process.env.NEXT_PUBLIC_SITE_NAME = "Northwind Studio";
|
|
24
|
+
process.env.NEXT_PUBLIC_BASE_URL = "https://northwind.example";
|
|
25
|
+
process.env.AILK_CONTENT_ROOT = EMPTY_ROOT;
|
|
26
|
+
|
|
27
|
+
jest.mock("next/og", () => ({
|
|
28
|
+
ImageResponse: jest.fn().mockImplementation(() => new Response("PNG", { status: 200 })),
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
let GET: typeof import("../route").GET;
|
|
32
|
+
let appleIcon: typeof import("../../apple-icon");
|
|
33
|
+
beforeAll(async () => {
|
|
34
|
+
({ GET } = await import("../route"));
|
|
35
|
+
appleIcon = await import("../../apple-icon");
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
async function cardFor(query: string): Promise<{ markup: string; options: unknown }> {
|
|
39
|
+
await GET(new Request(`https://example.com/og?${query}`));
|
|
40
|
+
const [tree, options] = jest.mocked(ImageResponse).mock.calls.at(-1)!;
|
|
41
|
+
return { markup: renderToStaticMarkup(tree as ReactElement), options };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
describe("/og — the brand card (#11244)", () => {
|
|
45
|
+
it("is 1200×630", async () => {
|
|
46
|
+
const { options } = await cardFor("title=About+us&schemaType=AboutPage");
|
|
47
|
+
expect(options).toMatchObject({ width: 1200, height: 630 });
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("sets the page title large, with the site name, the domain and the brand mark", async () => {
|
|
51
|
+
const { markup } = await cardFor("title=About+us&schemaType=AboutPage");
|
|
52
|
+
expect(markup).toContain(">About us</div>");
|
|
53
|
+
expect(markup).toContain("font-size:76px");
|
|
54
|
+
expect(markup).toMatch(/<img src="data:image\/svg\+xml;base64,[^"]+"/);
|
|
55
|
+
expect(markup).toContain(">Northwind Studio</div>");
|
|
56
|
+
expect(markup).toContain(">northwind.example</div>");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("drops a long title to the smaller size", async () => {
|
|
60
|
+
const { markup } = await cardFor(`title=${"A".repeat(80)}`);
|
|
61
|
+
expect(markup).toContain("font-size:60px");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("matches its snapshot", async () => {
|
|
65
|
+
const { markup } = await cardFor("title=About+us&schemaType=AboutPage");
|
|
66
|
+
expect(markup.replace(/base64,[^"]+/, "base64,<mark>")).toMatchSnapshot();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("is no longer the plain block: text on the bg surface, not a brand-colour fill", async () => {
|
|
70
|
+
const { markup } = await cardFor("title=About+us&schemaType=AboutPage");
|
|
71
|
+
const plainBlock = `background-color:${tokens.colors.light.brand};padding:80px`;
|
|
72
|
+
expect(markup).not.toContain(plainBlock);
|
|
73
|
+
expect(markup).toMatch(new RegExp(`^<div[^>]*background-color:${tokens.colors.light.bg}`));
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("shows a Person site's photo in place of the mark", async () => {
|
|
77
|
+
const root = mkdtempSync(join(tmpdir(), "og-card-"));
|
|
78
|
+
writeFileSync(
|
|
79
|
+
join(root, "_site.mdx"),
|
|
80
|
+
"---\nsiteIdentity:\n kind: Person\n image: https://cdn.example/sam.jpg\n---\n",
|
|
81
|
+
);
|
|
82
|
+
const fetchSpy = jest
|
|
83
|
+
.spyOn(globalThis, "fetch")
|
|
84
|
+
.mockResolvedValue(new Response("JPG", { headers: { "content-type": "image/jpeg" } }));
|
|
85
|
+
process.env.AILK_CONTENT_ROOT = root;
|
|
86
|
+
try {
|
|
87
|
+
const { markup } = await cardFor("title=About+us");
|
|
88
|
+
expect(fetchSpy).toHaveBeenCalledWith("https://cdn.example/sam.jpg", expect.anything());
|
|
89
|
+
expect(markup).toContain(`src="data:image/jpeg;base64,${Buffer.from("JPG").toString("base64")}"`);
|
|
90
|
+
expect(markup).not.toContain("data:image/svg+xml");
|
|
91
|
+
} finally {
|
|
92
|
+
process.env.AILK_CONTENT_ROOT = EMPTY_ROOT;
|
|
93
|
+
fetchSpy.mockRestore();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it("falls back to the mark when the photo cannot be fetched", async () => {
|
|
98
|
+
const root = mkdtempSync(join(tmpdir(), "og-card-"));
|
|
99
|
+
writeFileSync(
|
|
100
|
+
join(root, "_site.mdx"),
|
|
101
|
+
"---\nsiteIdentity:\n kind: Person\n image: https://cdn.example/sam.jpg\n---\n",
|
|
102
|
+
);
|
|
103
|
+
const fetchSpy = jest.spyOn(globalThis, "fetch").mockRejectedValue(new Error("timeout"));
|
|
104
|
+
process.env.AILK_CONTENT_ROOT = root;
|
|
105
|
+
try {
|
|
106
|
+
const { markup } = await cardFor("title=About+us");
|
|
107
|
+
expect(markup).toMatch(/<img src="data:image\/svg\+xml;base64,/);
|
|
108
|
+
} finally {
|
|
109
|
+
process.env.AILK_CONTENT_ROOT = EMPTY_ROOT;
|
|
110
|
+
fetchSpy.mockRestore();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("draws no image a query names", async () => {
|
|
115
|
+
const { markup } = await cardFor("title=T&photo=https%3A%2F%2Fevil.example%2Fx.png");
|
|
116
|
+
expect(markup).not.toContain("evil.example");
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe("apple-icon — the 180×180 touch icon from the brand mark (#11244)", () => {
|
|
121
|
+
it("is a 180×180 PNG of the site's mark", () => {
|
|
122
|
+
expect(appleIcon.size).toEqual({ width: 180, height: 180 });
|
|
123
|
+
expect(appleIcon.contentType).toBe("image/png");
|
|
124
|
+
appleIcon.default();
|
|
125
|
+
const [tree, options] = jest.mocked(ImageResponse).mock.calls.at(-1)!;
|
|
126
|
+
expect(options).toEqual({ width: 180, height: 180 });
|
|
127
|
+
expect(renderToStaticMarkup(tree as ReactElement)).toMatch(/<img src="data:image\/svg\+xml;base64,/);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
@@ -12,12 +12,11 @@
|
|
|
12
12
|
* - Post-sanitization empty title triggers fallback (302 redirect to static PNG)
|
|
13
13
|
* - On ImageResponse throw, falls back via 302 redirect to /og-default.png
|
|
14
14
|
*
|
|
15
|
-
* Fallback is a 302 redirect to /og-default.png
|
|
15
|
+
* Fallback is a 302 redirect to /og-default.png.
|
|
16
16
|
* Per spec § 3: "redirecting is simpler but exposes the fallback URL; both acceptable."
|
|
17
17
|
*
|
|
18
|
-
* Note: next/og's ImageResponse
|
|
19
|
-
*
|
|
20
|
-
* spinning up an actual V8 isolate.
|
|
18
|
+
* Note: in tests next/og's ImageResponse is mocked to return a minimal
|
|
19
|
+
* Response, so the handler contract is verified without rasterising.
|
|
21
20
|
*/
|
|
22
21
|
|
|
23
22
|
// --- Mocks set up BEFORE imports ---
|