create-ailk 0.35.1 → 0.36.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 +1 -1
- package/component-catalog.json +12 -1
- package/component-catalog.md +6 -5
- package/dist/lib/env-catalog.js +8 -0
- package/dist/surfaces.js +6 -3
- package/dist/topology.d.ts +4 -4
- package/dist/topology.js +104 -60
- package/package.json +3 -3
- package/templates/.env.example +21 -0
- package/templates/apps/api/.env.example +7 -0
- package/templates/apps/api/CLAUDE.md +9 -4
- package/templates/apps/mcp/CLAUDE.md +4 -2
- package/templates/apps/web/.env.example +16 -0
- package/templates/apps/web/CLAUDE.md +46 -5
- package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +2 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +52 -1
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +43 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +108 -1
- package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +36 -3
- package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +37 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +90 -33
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +9 -4
- package/templates/apps/web/app/[locale]/(authed)/__tests__/gate.test.tsx +79 -348
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +12 -1
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +55 -2
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +10 -5
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +60 -6
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +32 -3
- package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +8 -1
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +7 -3
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +215 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +65 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +47 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +122 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +214 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +35 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +266 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +116 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +12 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +154 -0
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +6 -4
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -1
- package/templates/apps/web/app/[locale]/(authed)/layout.tsx +15 -13
- package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +20 -52
- package/templates/apps/web/app/[locale]/layout.tsx +24 -75
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +50 -0
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +48 -7
- package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +749 -0
- package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +166 -7
- package/templates/apps/web/app/api/auth/hub/authorize/route.ts +96 -30
- package/templates/apps/web/app/api/auth/hub/continuation.ts +51 -2
- package/templates/apps/web/app/api/auth/hub/email/route.ts +111 -0
- package/templates/apps/web/app/api/auth/hub/entry-shared.ts +163 -0
- package/templates/apps/web/app/api/auth/hub/purchase/route.ts +230 -0
- package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +174 -0
- package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +60 -0
- package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +97 -0
- package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +475 -7
- package/templates/apps/web/app/api/hub-session/callback/route.ts +13 -47
- package/templates/apps/web/app/api/hub-session/email/route.ts +125 -0
- package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +49 -0
- package/templates/apps/web/app/api/hub-session/one-tap/route.ts +106 -0
- package/templates/apps/web/app/api/hub-session/open/route.ts +111 -0
- package/templates/apps/web/app/api/hub-session/sign-in/route.ts +23 -40
- package/templates/apps/web/app/api/hub-session/sign-out/route.ts +1 -10
- package/templates/apps/web/auth.ts +133 -6
- package/templates/apps/web/components/sign-out-trigger.tsx +1 -1
- package/templates/apps/web/lib/__tests__/auth-email.test.ts +141 -0
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +445 -0
- package/templates/apps/web/lib/__tests__/auth-sms.test.ts +140 -0
- package/templates/apps/web/lib/__tests__/fixtures/tsconfig.flow.json +18 -0
- package/templates/apps/web/lib/__tests__/site-header.test.ts +13 -0
- package/templates/apps/web/lib/__tests__/telemetry-scrub.test.ts +19 -1
- package/templates/apps/web/lib/auth-email.ts +62 -6
- package/templates/apps/web/lib/auth-env.ts +13 -0
- package/templates/apps/web/lib/auth-sms.ts +180 -0
- package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +28 -0
- package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +332 -0
- package/templates/apps/web/lib/hub-session/config.ts +7 -1
- package/templates/apps/web/lib/hub-session/entry.ts +238 -0
- package/templates/apps/web/lib/hub-session/index.ts +1 -4
- package/templates/apps/web/lib/hub-session/one-tap.tsx +148 -0
- package/templates/apps/web/lib/hub-session/session.ts +120 -2
- package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +277 -0
- package/templates/apps/web/lib/site-header.ts +14 -1
- package/templates/apps/web/lib/telemetry-scrub.ts +11 -0
- package/templates/apps/web/lib/topology.generated.ts +39 -0
- package/templates/apps/web/messages/en.json +112 -20
- package/templates/apps/web/middleware.ts +34 -2
- package/templates/apps/web/security-headers.config.ts +21 -0
- package/versions.json +47 -47
- package/templates/apps/web/app/[locale]/(authed)/sign-in-gate.tsx +0 -162
- package/templates/apps/web/components/signed-in-nav.tsx +0 -79
- package/templates/apps/web/lib/hub-session/__tests__/sign-in-gate.test.tsx +0 -180
- package/templates/apps/web/lib/hub-session/sign-in-gate.tsx +0 -162
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The account layout hands the generated seam's sign-out wiring to the client
|
|
3
3
|
* frame (#8465): a client component cannot import `topology.generated.ts`, so
|
|
4
|
-
* the server layout reads `SIGN_OUT_ENDPOINT`
|
|
5
|
-
*
|
|
4
|
+
* the server layout reads `SIGN_OUT_ENDPOINT` and passes it, with the home as
|
|
5
|
+
* the landing after a sign-out (#11095 D4), as props. Also pins that the Help center
|
|
6
6
|
* href is rendered only for an https URL (the #8467 review's Low finding).
|
|
7
7
|
*/
|
|
8
8
|
import { render } from "@testing-library/react";
|
|
9
|
+
import { localeHref } from "@working-theory/ui";
|
|
9
10
|
import type { ReactElement } from "react";
|
|
10
11
|
|
|
11
12
|
jest.mock("next-intl/server", () => ({
|
|
@@ -103,17 +104,21 @@ afterEach(() => {
|
|
|
103
104
|
});
|
|
104
105
|
|
|
105
106
|
describe("sign-out wiring (#8465)", () => {
|
|
106
|
-
|
|
107
|
+
// #11095 D4 — the spoke's /account redirects into the hub sign-in, which
|
|
108
|
+
// signs the person straight back in while their hub session lives, so a
|
|
109
|
+
// hub-session sign-out lands on the localized home.
|
|
110
|
+
it("passes the endpoint and the localized home on a hub sign-in spoke", async () => {
|
|
107
111
|
mockSeam = {
|
|
108
112
|
SIGN_IN_PATH: "/account",
|
|
109
113
|
SIGN_OUT_ENDPOINT: "/api/hub-session/sign-out",
|
|
110
114
|
};
|
|
111
115
|
const props = await renderLayout("fr");
|
|
112
116
|
expect(props.signOutEndpoint).toBe("/api/hub-session/sign-out");
|
|
113
|
-
expect(props.signInHref).toBe("
|
|
117
|
+
expect(props.signInHref).toBe(localeHref("fr", "/"));
|
|
118
|
+
expect(props.signInHref).not.toMatch(/account/);
|
|
114
119
|
});
|
|
115
120
|
|
|
116
|
-
it("
|
|
121
|
+
it("lands on the home when the seam names no sign-in path too", async () => {
|
|
117
122
|
mockSeam = {
|
|
118
123
|
SIGN_IN_PATH: null,
|
|
119
124
|
SIGN_OUT_ENDPOINT: "/api/hub-session/sign-out",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* logo and the For-you items; this component wires them to the shell with
|
|
7
7
|
* what only the client has: the current path and the sign-out call.
|
|
8
8
|
*
|
|
9
|
-
* `createAuthClient()` at module scope is the `
|
|
9
|
+
* `createAuthClient()` at module scope is the `(auth)` cards' idiom. Log
|
|
10
10
|
* out ends the session, then navigates and refreshes so every RSC under the
|
|
11
11
|
* `(authed)` gate re-reads the (now absent) session.
|
|
12
12
|
*
|
|
@@ -18,13 +18,16 @@
|
|
|
18
18
|
* have no subscription".
|
|
19
19
|
*
|
|
20
20
|
* After any of the three, one plain line when some of the member's billing
|
|
21
|
-
* is on a Stripe account this spoke's key cannot read (#8217 D12)
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* is on a Stripe account this spoke's key cannot read (#8217 D12); on a spoke
|
|
22
|
+
* that signs in through its hub, the member's Purchases (`loadPurchases()`,
|
|
23
|
+
* #11096 D9: offering, amount, date; nothing when there are none, the error
|
|
24
|
+
* row when the read fails); then each section a module contributes
|
|
25
|
+
* (`accountBillingSections`, #8231 D4), then each section the site adds
|
|
26
|
+
* (`siteBillingSections`, #9401 D7).
|
|
24
27
|
*/
|
|
25
28
|
|
|
26
29
|
import { AccountSettingsFrame, AccountSettingsPane, CurrentPlanCard } from "@working-theory/templates/account";
|
|
27
|
-
import { Button, Text } from "@working-theory/ui/primitives";
|
|
30
|
+
import { Button, MoneyAmount, Text } from "@working-theory/ui/primitives";
|
|
28
31
|
import type { Metadata } from "next";
|
|
29
32
|
import { getTranslations } from "next-intl/server";
|
|
30
33
|
import type { ReactElement } from "react";
|
|
@@ -33,7 +36,7 @@ import { accountBillingSections } from "../../../../../lib/account-config";
|
|
|
33
36
|
import { siteBillingSections } from "../../../../../lib/site-contributions";
|
|
34
37
|
import { accountSession } from "../account-data";
|
|
35
38
|
import { openBillingPortal } from "../actions";
|
|
36
|
-
import { type BillingState, loadBilling } from "../billing-source";
|
|
39
|
+
import { type BillingState, type PurchasesState, loadBilling, loadPurchases } from "../billing-source";
|
|
37
40
|
import { ErrorRow } from "../error-row";
|
|
38
41
|
import { memberSettingsFrame, SettingsSection, type Translate as MemberTranslate } from "../settings-frame";
|
|
39
42
|
|
|
@@ -113,6 +116,55 @@ function Subscription({
|
|
|
113
116
|
);
|
|
114
117
|
}
|
|
115
118
|
|
|
119
|
+
/** The member's purchases (#11096 D9): one row each — offering, amount, date. */
|
|
120
|
+
function Purchases({
|
|
121
|
+
state,
|
|
122
|
+
locale,
|
|
123
|
+
t,
|
|
124
|
+
}: {
|
|
125
|
+
state: PurchasesState;
|
|
126
|
+
locale: string;
|
|
127
|
+
t: Translate;
|
|
128
|
+
}): ReactElement | null {
|
|
129
|
+
if (state.kind === "failed") {
|
|
130
|
+
return (
|
|
131
|
+
<div data-testid="account-billing-purchases-error">
|
|
132
|
+
<ErrorRow message={t("billing.purchasesUnavailable")} retryLabel={t("inbox.retry")} />
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
if (state.items.length === 0) return null;
|
|
137
|
+
const date = new Intl.DateTimeFormat(locale, { dateStyle: "medium" });
|
|
138
|
+
return (
|
|
139
|
+
<div data-testid="account-billing-purchases">
|
|
140
|
+
<SettingsSection id="purchases" title={t("billing.purchases")}>
|
|
141
|
+
<div className="flex flex-col divide-y divide-(--color-border)">
|
|
142
|
+
{state.items.map((purchase) => (
|
|
143
|
+
<div
|
|
144
|
+
key={purchase.id}
|
|
145
|
+
className="flex flex-wrap items-baseline justify-between gap-2 py-3"
|
|
146
|
+
data-testid="account-billing-purchase"
|
|
147
|
+
>
|
|
148
|
+
<Text as="span" variant="body-sm" className="font-medium">
|
|
149
|
+
{purchase.offering}
|
|
150
|
+
</Text>
|
|
151
|
+
<Text as="span" variant="body-sm" tone="muted">
|
|
152
|
+
{purchase.amountMinor !== null && purchase.currency !== null ? (
|
|
153
|
+
<>
|
|
154
|
+
<MoneyAmount amountMinor={purchase.amountMinor} currency={purchase.currency} locale={locale} />
|
|
155
|
+
{" · "}
|
|
156
|
+
</>
|
|
157
|
+
) : null}
|
|
158
|
+
{date.format(new Date(purchase.purchasedAt))}
|
|
159
|
+
</Text>
|
|
160
|
+
</div>
|
|
161
|
+
))}
|
|
162
|
+
</div>
|
|
163
|
+
</SettingsSection>
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
116
168
|
export default async function AccountBillingPage({ params }: Props): Promise<ReactElement> {
|
|
117
169
|
const { locale } = await params;
|
|
118
170
|
const t = await getTranslations({ locale, namespace: "account" });
|
|
@@ -132,7 +184,7 @@ export default async function AccountBillingPage({ params }: Props): Promise<Rea
|
|
|
132
184
|
}
|
|
133
185
|
|
|
134
186
|
const { ctx } = session;
|
|
135
|
-
const state = await loadBilling(ctx.init);
|
|
187
|
+
const [state, purchases] = await Promise.all([loadBilling(ctx.init), loadPurchases(ctx.init)]);
|
|
136
188
|
const name = ctx.user.name || ctx.user.email;
|
|
137
189
|
|
|
138
190
|
return (
|
|
@@ -163,6 +215,8 @@ export default async function AccountBillingPage({ params }: Props): Promise<Rea
|
|
|
163
215
|
</div>
|
|
164
216
|
) : null}
|
|
165
217
|
|
|
218
|
+
{purchases !== null ? <Purchases state={purchases} locale={locale} t={t} /> : null}
|
|
219
|
+
|
|
166
220
|
{[...accountBillingSections, ...siteBillingSections].map((section) => (
|
|
167
221
|
<SettingsSection key={section.id} id={section.id} title={ctx.t(section.title)}>
|
|
168
222
|
{section.render(ctx)}
|
|
@@ -24,6 +24,13 @@
|
|
|
24
24
|
* false "you have no subscription";
|
|
25
25
|
* - otherwise `subscription`, absent optional fields read as `null`.
|
|
26
26
|
*
|
|
27
|
+
* `loadPurchases()` (#11096 D9) is the Purchases list under the plan card, on
|
|
28
|
+
* a spoke that signs in through its hub only: `member.purchases` with the hub
|
|
29
|
+
* credential — the leads of the caller's Person whose email is the caller's
|
|
30
|
+
* verified email, so a purchase link's account finds its purchase. A 401,
|
|
31
|
+
* 403 or 404 (an older hub) is an empty list; any other failure is `failed`.
|
|
32
|
+
* Everywhere else it is `null` and nothing is read.
|
|
33
|
+
*
|
|
27
34
|
* `billingPortalUrl()` is the one place a portal URL is minted, for
|
|
28
35
|
* `openBillingPortal` (`actions.ts`): the spoke's own key through the same
|
|
29
36
|
* loader on a hub-mode spoke, else the hub's portal route. `null` means no
|
|
@@ -31,10 +38,12 @@
|
|
|
31
38
|
*/
|
|
32
39
|
|
|
33
40
|
import {
|
|
41
|
+
member,
|
|
34
42
|
subscription,
|
|
35
43
|
type SubscriptionLifecycleStatus,
|
|
36
44
|
type SubscriptionPaymentMethod,
|
|
37
45
|
} from "@working-theory/api-client";
|
|
46
|
+
import type { MemberPurchase } from "@working-theory/validation";
|
|
38
47
|
|
|
39
48
|
import { forwardedCookieInit } from "../../../../lib/server-api";
|
|
40
49
|
import {
|
|
@@ -59,8 +68,11 @@ export type BillingState =
|
|
|
59
68
|
| { kind: "none"; unreadable: boolean }
|
|
60
69
|
| { kind: "failed" };
|
|
61
70
|
|
|
62
|
-
/**
|
|
63
|
-
|
|
71
|
+
/**
|
|
72
|
+
* The statuses that mean "nothing to show this caller" — no subscription
|
|
73
|
+
* (C9), no purchases (#11096 D9) — rather than a failed read.
|
|
74
|
+
*/
|
|
75
|
+
const NOTHING_TO_SHOW_STATUSES: ReadonlySet<number> = new Set([401, 403, 404]);
|
|
64
76
|
|
|
65
77
|
/** PII-safe error identity for logs (the `checkout.actions.ts` idiom: `err.name` only). */
|
|
66
78
|
function errorName(err: unknown): string {
|
|
@@ -95,7 +107,7 @@ export async function loadBilling(init: { headers: Record<string, string> }): Pr
|
|
|
95
107
|
try {
|
|
96
108
|
const res = await subscription.me(init, { include: "billing" });
|
|
97
109
|
if (!res.ok) {
|
|
98
|
-
if (
|
|
110
|
+
if (NOTHING_TO_SHOW_STATUSES.has(res.status)) return { kind: "none", unreadable: false };
|
|
99
111
|
console.error(`[account] read failed source=billing status=${res.status}`);
|
|
100
112
|
return { kind: "failed" };
|
|
101
113
|
}
|
|
@@ -116,6 +128,23 @@ export async function loadBilling(init: { headers: Record<string, string> }): Pr
|
|
|
116
128
|
}
|
|
117
129
|
}
|
|
118
130
|
|
|
131
|
+
export type PurchasesState = { kind: "items"; items: MemberPurchase[] } | { kind: "failed" };
|
|
132
|
+
|
|
133
|
+
/** The member's purchases on a hub-sign-in spoke, or `null` anywhere else (#11096 D9). */
|
|
134
|
+
export async function loadPurchases(init: { headers: Record<string, string> }): Promise<PurchasesState | null> {
|
|
135
|
+
if (SIGN_IN_PROVIDER !== "hub") return null;
|
|
136
|
+
try {
|
|
137
|
+
const res = await member.purchases(init);
|
|
138
|
+
if (res.ok) return { kind: "items", items: res.body.items };
|
|
139
|
+
if (NOTHING_TO_SHOW_STATUSES.has(res.status)) return { kind: "items", items: [] };
|
|
140
|
+
console.error(`[account] read failed source=purchases status=${res.status}`);
|
|
141
|
+
return { kind: "failed" };
|
|
142
|
+
} catch (err) {
|
|
143
|
+
logReadFailure("purchases", err);
|
|
144
|
+
return { kind: "failed" };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
119
148
|
/**
|
|
120
149
|
* The caller's Stripe billing-portal URL, or `null` for no portal (#8217
|
|
121
150
|
* D10). Minted on a Manage click, never on render: on a hub-mode spoke from
|
|
@@ -145,7 +145,8 @@ describe("the consent page (#9966 D2, AC-4)", () => {
|
|
|
145
145
|
const fields = Array.from(form.querySelectorAll("input"));
|
|
146
146
|
expect(fields.map((f) => [f.type, f.name, f.value])).toEqual([["hidden", "ref", ref]]);
|
|
147
147
|
expect(screen.getByTestId("hub-connect-continue").textContent).toBe("Continue");
|
|
148
|
-
|
|
148
|
+
// #11095 D5: Cancel goes to the spoke's home, never an /account URL.
|
|
149
|
+
expect(screen.getByTestId("hub-connect-cancel").getAttribute("href")).toBe(`${SPOKE_ORIGIN}/`);
|
|
149
150
|
});
|
|
150
151
|
|
|
151
152
|
it.each([
|
|
@@ -156,6 +157,10 @@ describe("the consent page (#9966 D2, AC-4)", () => {
|
|
|
156
157
|
])("%s renders unavailable and no form", async (_name, ref) => {
|
|
157
158
|
await renderPage(ref());
|
|
158
159
|
expectUnavailable();
|
|
160
|
+
// #11095 D5: with no client read, the back link goes to the hub's home.
|
|
161
|
+
const back = screen.getByTestId("hub-connect-back");
|
|
162
|
+
expect(back.getAttribute("href")).toBe("/");
|
|
163
|
+
expect(back.textContent).toBe("Back to the site");
|
|
159
164
|
});
|
|
160
165
|
|
|
161
166
|
it("a client the registry does not answer for renders unavailable and no form", async () => {
|
|
@@ -175,6 +180,8 @@ describe("the consent page (#9966 D2, AC-4)", () => {
|
|
|
175
180
|
mintContinuation(query({ redirect_uri: "https://other.example.com/api/hub-session/callback" }), mockSecret),
|
|
176
181
|
);
|
|
177
182
|
expectUnavailable();
|
|
183
|
+
// #11095 D5: the client was read, so the back link goes to its home.
|
|
184
|
+
expect(screen.getByTestId("hub-connect-back").getAttribute("href")).toBe(`${SPOKE_ORIGIN}/`);
|
|
178
185
|
});
|
|
179
186
|
|
|
180
187
|
it("generateMetadata keeps the ref out of a cross-site Referer and the page out of the index", async () => {
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* authorize keys sealed as `ref`. This page opens the ref, names the spoke
|
|
8
8
|
* from the registry (`hubSignIn.clientInfo`) — never from the query — and
|
|
9
9
|
* offers one Continue: a same-origin form POST of `ref` back to the authorize
|
|
10
|
-
* route, which alone sends `consent: true`. Cancel goes to
|
|
10
|
+
* route, which alone sends `consent: true`. Cancel goes to the spoke's home
|
|
11
|
+
* (#11095 D5): its `/account` would start the hub sign-in again.
|
|
11
12
|
*
|
|
12
13
|
* The form renders only when the ref's `redirect_uri` is on the origin the
|
|
13
14
|
* registry names, so the page never names one site while the code goes to
|
|
@@ -116,7 +117,10 @@ export default async function HubConnectPage({ params, searchParams }: Props): P
|
|
|
116
117
|
{t("unavailable.body")}
|
|
117
118
|
</Text>
|
|
118
119
|
</div>
|
|
119
|
-
<Link
|
|
120
|
+
<Link
|
|
121
|
+
href={client ? `${client.origin}/` : localeHref(locale, "/")}
|
|
122
|
+
data-testid="hub-connect-back"
|
|
123
|
+
>
|
|
120
124
|
{t("unavailable.back")}
|
|
121
125
|
</Link>
|
|
122
126
|
</div>
|
|
@@ -143,7 +147,7 @@ export default async function HubConnectPage({ params, searchParams }: Props): P
|
|
|
143
147
|
<Button type="submit" size="big" data-testid="hub-connect-continue">
|
|
144
148
|
{t("continue")}
|
|
145
149
|
</Button>
|
|
146
|
-
<Link href={
|
|
150
|
+
<Link href={`${client.origin}/`} data-testid="hub-connect-cancel">
|
|
147
151
|
{t("cancel")}
|
|
148
152
|
</Link>
|
|
149
153
|
</form>
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Account page's phone step (#11106, spec
|
|
3
|
+
* docs/specs/11106-the-workforce-foundation-roles-by-spec.md D9; AC-6's
|
|
4
|
+
* "a user sets and verifies a phone in the hub's Account settings").
|
|
5
|
+
*
|
|
6
|
+
* - the island: send a code, then verify it; a verified number shows with
|
|
7
|
+
* "Verified" and Remove; a refusal shows its line; a build without the
|
|
8
|
+
* step, or an unverified email, shows its line and no form;
|
|
9
|
+
* - the server actions: each is a SERVER call on the plugin with the
|
|
10
|
+
* request's headers, `verifyPhoneCode` always with `updatePhoneNumber:
|
|
11
|
+
* true`, Remove writes `phoneNumber: null`, a refusal maps to its reason,
|
|
12
|
+
* a build without the step answers `unavailable` with no call, and no log
|
|
13
|
+
* line carries the number or the code.
|
|
14
|
+
*/
|
|
15
|
+
import { act, fireEvent, render, screen } from "@testing-library/react";
|
|
16
|
+
|
|
17
|
+
const mockSendOtp = jest.fn();
|
|
18
|
+
const mockVerify = jest.fn();
|
|
19
|
+
const mockUpdateUser = jest.fn();
|
|
20
|
+
const mockPhoneStepActive = jest.fn();
|
|
21
|
+
// eslint-disable-next-line no-restricted-syntax -- #507: auth.ts is Better Auth's server singleton (a DB/HTTP boundary); its phone endpoints are the actions' one dependency.
|
|
22
|
+
jest.mock("../../../../../../auth", () => ({
|
|
23
|
+
__esModule: true,
|
|
24
|
+
phoneStepActive: () => mockPhoneStepActive(),
|
|
25
|
+
auth: {
|
|
26
|
+
api: {
|
|
27
|
+
sendPhoneNumberOTP: (...args: unknown[]) => mockSendOtp(...args),
|
|
28
|
+
verifyPhoneNumber: (...args: unknown[]) => mockVerify(...args),
|
|
29
|
+
updateUser: (...args: unknown[]) => mockUpdateUser(...args),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
const REQUEST_HEADERS = new Headers({ cookie: "better-auth.session_token=abc" });
|
|
35
|
+
jest.mock("next/headers", () => ({
|
|
36
|
+
__esModule: true,
|
|
37
|
+
headers: jest.fn(async () => REQUEST_HEADERS),
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
const mockRefresh = jest.fn();
|
|
41
|
+
jest.mock("next/navigation", () => ({
|
|
42
|
+
__esModule: true,
|
|
43
|
+
useRouter: () => ({ refresh: mockRefresh }),
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
import { removePhone, sendPhoneCode, verifyPhoneCode } from "../phone-actions";
|
|
47
|
+
import { PhoneVerification, type PhoneVerificationLabels } from "../phone-verification";
|
|
48
|
+
|
|
49
|
+
const NUMBER = "+15555550123";
|
|
50
|
+
const CODE = "482913";
|
|
51
|
+
|
|
52
|
+
const LABELS: PhoneVerificationLabels = {
|
|
53
|
+
title: "Phone",
|
|
54
|
+
lead: "Only you can set it.",
|
|
55
|
+
number: "Mobile number",
|
|
56
|
+
numberHint: "Include the country code.",
|
|
57
|
+
sendCode: "Send code",
|
|
58
|
+
sending: "Sending…",
|
|
59
|
+
code: "Code",
|
|
60
|
+
codeHint: "Six digits.",
|
|
61
|
+
verify: "Verify",
|
|
62
|
+
verifying: "Verifying…",
|
|
63
|
+
verified: "Verified",
|
|
64
|
+
remove: "Remove",
|
|
65
|
+
sent: "We texted you a code.",
|
|
66
|
+
unavailable: "Phone verification isn't available on this site.",
|
|
67
|
+
unverifiedEmail: "Confirm your email address first.",
|
|
68
|
+
errors: {
|
|
69
|
+
invalid_number: "Bad number.",
|
|
70
|
+
invalid_code: "Bad code.",
|
|
71
|
+
taken: "Taken.",
|
|
72
|
+
too_many: "Too many.",
|
|
73
|
+
unverified: "Unverified.",
|
|
74
|
+
signed_out: "Signed out.",
|
|
75
|
+
unavailable: "Unavailable.",
|
|
76
|
+
failed: "Failed.",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const apiError = (code: string) => Object.assign(new Error(code), { body: { code } });
|
|
81
|
+
|
|
82
|
+
let logLines: string[] = [];
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
jest.clearAllMocks();
|
|
85
|
+
mockPhoneStepActive.mockReturnValue(true);
|
|
86
|
+
mockSendOtp.mockResolvedValue({ message: "code sent" });
|
|
87
|
+
mockVerify.mockResolvedValue({ status: true });
|
|
88
|
+
mockUpdateUser.mockResolvedValue({ status: true });
|
|
89
|
+
logLines = [];
|
|
90
|
+
jest.spyOn(console, "error").mockImplementation((...args: unknown[]) => {
|
|
91
|
+
logLines.push(args.map(String).join(" "));
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
afterEach(() => {
|
|
96
|
+
jest.restoreAllMocks();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
describe("the island", () => {
|
|
100
|
+
it("sends a code, then verifies it, and refreshes the page", async () => {
|
|
101
|
+
render(<PhoneVerification available emailVerified phone={null} labels={LABELS} />);
|
|
102
|
+
fireEvent.change(screen.getByTestId("account-phone-number-input"), { target: { value: NUMBER } });
|
|
103
|
+
await act(async () => {
|
|
104
|
+
fireEvent.click(screen.getByTestId("account-phone-send"));
|
|
105
|
+
});
|
|
106
|
+
expect(mockSendOtp).toHaveBeenCalledWith({ body: { phoneNumber: NUMBER }, headers: REQUEST_HEADERS });
|
|
107
|
+
expect(screen.getByTestId("account-phone-sent")).toHaveTextContent(LABELS.sent);
|
|
108
|
+
|
|
109
|
+
fireEvent.change(screen.getByTestId("account-phone-code-input"), { target: { value: CODE } });
|
|
110
|
+
await act(async () => {
|
|
111
|
+
fireEvent.click(screen.getByTestId("account-phone-verify"));
|
|
112
|
+
});
|
|
113
|
+
expect(mockVerify).toHaveBeenCalledWith({
|
|
114
|
+
body: { phoneNumber: NUMBER, code: CODE, updatePhoneNumber: true },
|
|
115
|
+
headers: REQUEST_HEADERS,
|
|
116
|
+
});
|
|
117
|
+
expect(mockRefresh).toHaveBeenCalledTimes(1);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it("a refused code shows its line and refreshes nothing", async () => {
|
|
121
|
+
mockVerify.mockRejectedValue(apiError("INVALID_OTP"));
|
|
122
|
+
render(<PhoneVerification available emailVerified phone={null} labels={LABELS} />);
|
|
123
|
+
fireEvent.change(screen.getByTestId("account-phone-number-input"), { target: { value: NUMBER } });
|
|
124
|
+
await act(async () => {
|
|
125
|
+
fireEvent.click(screen.getByTestId("account-phone-send"));
|
|
126
|
+
});
|
|
127
|
+
fireEvent.change(screen.getByTestId("account-phone-code-input"), { target: { value: CODE } });
|
|
128
|
+
await act(async () => {
|
|
129
|
+
fireEvent.click(screen.getByTestId("account-phone-verify"));
|
|
130
|
+
});
|
|
131
|
+
expect(screen.getByTestId("account-phone-error")).toHaveTextContent(LABELS.errors.invalid_code);
|
|
132
|
+
expect(mockRefresh).not.toHaveBeenCalled();
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("a verified number shows with Verified and Remove, which clears it", async () => {
|
|
136
|
+
render(
|
|
137
|
+
<PhoneVerification available emailVerified phone={{ number: NUMBER, verified: true }} labels={LABELS} />,
|
|
138
|
+
);
|
|
139
|
+
expect(screen.getByTestId("account-phone-number")).toHaveTextContent(NUMBER);
|
|
140
|
+
expect(screen.getByTestId("account-phone-verified")).toHaveTextContent(LABELS.verified);
|
|
141
|
+
expect(screen.queryByTestId("account-phone-number-input")).toBeNull();
|
|
142
|
+
await act(async () => {
|
|
143
|
+
fireEvent.click(screen.getByTestId("account-phone-remove"));
|
|
144
|
+
});
|
|
145
|
+
expect(mockUpdateUser).toHaveBeenCalledWith({ body: { phoneNumber: null }, headers: REQUEST_HEADERS });
|
|
146
|
+
expect(mockRefresh).toHaveBeenCalledTimes(1);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it("a build without the step shows the not-available line and no form", () => {
|
|
150
|
+
render(<PhoneVerification available={false} emailVerified phone={null} labels={LABELS} />);
|
|
151
|
+
expect(screen.getByTestId("account-phone-unavailable")).toHaveTextContent(LABELS.unavailable);
|
|
152
|
+
expect(screen.queryByTestId("account-phone-send-form")).toBeNull();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it("an unverified email shows the confirm-email line and no form", () => {
|
|
156
|
+
render(<PhoneVerification available emailVerified={false} phone={null} labels={LABELS} />);
|
|
157
|
+
expect(screen.getByTestId("account-phone-unverified-email")).toHaveTextContent(LABELS.unverifiedEmail);
|
|
158
|
+
expect(screen.queryByTestId("account-phone-send-form")).toBeNull();
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
describe("the server actions", () => {
|
|
163
|
+
it.each([
|
|
164
|
+
["INVALID_PHONE_NUMBER", "invalid_number"],
|
|
165
|
+
["EMAIL_NOT_VERIFIED", "unverified"],
|
|
166
|
+
["SESSION_REQUIRED", "signed_out"],
|
|
167
|
+
["SOMETHING_ELSE", "failed"],
|
|
168
|
+
])("sendPhoneCode maps %s to %s", async (code, reason) => {
|
|
169
|
+
mockSendOtp.mockRejectedValue(apiError(code));
|
|
170
|
+
expect(await sendPhoneCode(NUMBER)).toEqual({ ok: false, reason });
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it.each([
|
|
174
|
+
["INVALID_OTP", "invalid_code"],
|
|
175
|
+
["TOO_MANY_ATTEMPTS", "too_many"],
|
|
176
|
+
["PHONE_NUMBER_EXIST", "taken"],
|
|
177
|
+
])("verifyPhoneCode maps %s to %s", async (code, reason) => {
|
|
178
|
+
mockVerify.mockRejectedValue(apiError(code));
|
|
179
|
+
expect(await verifyPhoneCode(NUMBER, CODE)).toEqual({ ok: false, reason });
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it("verifyPhoneCode always asks for updatePhoneNumber, never a sign-in", async () => {
|
|
183
|
+
expect(await verifyPhoneCode(NUMBER, CODE)).toEqual({ ok: true });
|
|
184
|
+
expect(mockVerify.mock.calls[0]![0].body.updatePhoneNumber).toBe(true);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it("refuses untrusted input before any call", async () => {
|
|
188
|
+
expect(await sendPhoneCode({ phoneNumber: NUMBER })).toEqual({ ok: false, reason: "invalid_number" });
|
|
189
|
+
expect(await verifyPhoneCode(NUMBER, "1234567")).toEqual({ ok: false, reason: "invalid_code" });
|
|
190
|
+
expect(mockSendOtp).not.toHaveBeenCalled();
|
|
191
|
+
expect(mockVerify).not.toHaveBeenCalled();
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it("a build without the step answers unavailable with no call", async () => {
|
|
195
|
+
mockPhoneStepActive.mockReturnValue(false);
|
|
196
|
+
expect(await sendPhoneCode(NUMBER)).toEqual({ ok: false, reason: "unavailable" });
|
|
197
|
+
expect(await verifyPhoneCode(NUMBER, CODE)).toEqual({ ok: false, reason: "unavailable" });
|
|
198
|
+
expect(await removePhone()).toEqual({ ok: false, reason: "unavailable" });
|
|
199
|
+
expect(mockSendOtp).not.toHaveBeenCalled();
|
|
200
|
+
expect(mockVerify).not.toHaveBeenCalled();
|
|
201
|
+
expect(mockUpdateUser).not.toHaveBeenCalled();
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it("no log line carries the number or the code", async () => {
|
|
205
|
+
mockSendOtp.mockRejectedValue(apiError("INVALID_PHONE_NUMBER"));
|
|
206
|
+
mockVerify.mockRejectedValue(apiError("INVALID_OTP"));
|
|
207
|
+
await sendPhoneCode(NUMBER);
|
|
208
|
+
await verifyPhoneCode(NUMBER, CODE);
|
|
209
|
+
expect(logLines.length).toBe(2);
|
|
210
|
+
for (const line of logLines) {
|
|
211
|
+
expect(line).not.toContain(NUMBER.slice(1));
|
|
212
|
+
expect(line).not.toContain(CODE);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
});
|
package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment node
|
|
3
|
+
*
|
|
4
|
+
* User settings › General reaches sign-in only through the generated seam
|
|
5
|
+
* (#11138). A spoke that signs in through its hub keeps this page, but not
|
|
6
|
+
* `auth.ts` or any other sign-in or database file, so a direct import here
|
|
7
|
+
* would make create-ailk's spoke closure drop the page with them and refuse.
|
|
8
|
+
* Every non-test source file under `account/general` is read, and none may
|
|
9
|
+
* name one of those files, statically or by `import()`/`require`; the phone
|
|
10
|
+
* step goes through `loadPhoneApi` in `lib/topology.generated.ts` instead.
|
|
11
|
+
*/
|
|
12
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
13
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
14
|
+
|
|
15
|
+
const GENERAL = resolve(__dirname, "..");
|
|
16
|
+
const WEB = resolve(GENERAL, "../../../../..");
|
|
17
|
+
|
|
18
|
+
/** The sign-in and database files a spoke does not carry, relative to apps/web. */
|
|
19
|
+
const SIGN_IN_FILES = [
|
|
20
|
+
"auth",
|
|
21
|
+
"lib/prisma-for-auth",
|
|
22
|
+
"lib/mcp-oauth",
|
|
23
|
+
"lib/license-key-store",
|
|
24
|
+
"app/api/auth",
|
|
25
|
+
"app/[locale]/(auth)",
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const sources = readdirSync(GENERAL).filter((name) => /\.tsx?$/.test(name));
|
|
29
|
+
|
|
30
|
+
function specifiers(text: string): string[] {
|
|
31
|
+
return [
|
|
32
|
+
...text.matchAll(/(?:\bfrom\s+|\bimport\s*\(\s*|\brequire\s*\(\s*)["'`]([^"'`]+)["'`]/g),
|
|
33
|
+
].map((m) => m[1] as string);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe("account/general imports sign-in only through the seam (#11138)", () => {
|
|
37
|
+
it("reads every source file", () => {
|
|
38
|
+
expect(sources).toEqual(expect.arrayContaining(["page.tsx", "phone-actions.ts"]));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it.each(sources)("%s names no sign-in or database file", (name) => {
|
|
42
|
+
const file = join(GENERAL, name);
|
|
43
|
+
const reached = specifiers(readFileSync(file, "utf8"))
|
|
44
|
+
.filter((spec) => spec.startsWith("."))
|
|
45
|
+
.map((spec) =>
|
|
46
|
+
relative(WEB, resolve(dirname(file), spec))
|
|
47
|
+
.split("\\")
|
|
48
|
+
.join("/")
|
|
49
|
+
.replace(/\.tsx?$/, ""),
|
|
50
|
+
);
|
|
51
|
+
expect(
|
|
52
|
+
reached.filter((target) =>
|
|
53
|
+
SIGN_IN_FILES.some((seed) => target === seed || target.startsWith(`${seed}/`)),
|
|
54
|
+
),
|
|
55
|
+
).toEqual([]);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("the phone step reads the seam", () => {
|
|
59
|
+
for (const name of ["page.tsx", "phone-actions.ts"]) {
|
|
60
|
+
expect(readFileSync(join(GENERAL, name), "utf8")).toMatch(
|
|
61
|
+
/from "\.\.\/\.\.\/\.\.\/\.\.\/\.\.\/lib\/topology\.generated"/,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
*
|
|
12
12
|
* - the contact details (`AccountContactDetails`, #8435 D13) — only on the
|
|
13
13
|
* member path, seeded from `member.contact` and saved by `saveContact`;
|
|
14
|
+
* - the phone step (`PhoneVerification`, #11106 D9) — on a hub only: the
|
|
15
|
+
* person sets and verifies their own number, read from their Better Auth
|
|
16
|
+
* session; a build without the phone plugin shows the not-available line;
|
|
14
17
|
* - any section a module contributes (`accountSettingsSections`);
|
|
15
18
|
* - `BillingAnchor`, which forwards a `#billing` fragment to Billing.
|
|
16
19
|
*
|
|
@@ -31,16 +34,19 @@ import {
|
|
|
31
34
|
} from "@working-theory/templates/account";
|
|
32
35
|
import { Separator, Text } from "@working-theory/ui/primitives";
|
|
33
36
|
import type { Metadata } from "next";
|
|
37
|
+
import { headers } from "next/headers";
|
|
34
38
|
import { getTranslations } from "next-intl/server";
|
|
35
39
|
import type { ReactElement } from "react";
|
|
36
40
|
|
|
37
41
|
import { accountSettingsSections } from "../../../../../lib/account-config";
|
|
42
|
+
import { readPhoneStep, TOPOLOGY } from "../../../../../lib/topology.generated";
|
|
38
43
|
import { accountSession } from "../account-data";
|
|
39
44
|
import { siteThemeModeCount } from "../settings/theme-modes";
|
|
40
45
|
import { memberSettingsFrame, SettingsSection, type Translate } from "../settings-frame";
|
|
41
46
|
|
|
42
47
|
import { BillingAnchor } from "./billing-anchor";
|
|
43
48
|
import { saveContact } from "./contact-actions";
|
|
49
|
+
import { PhoneVerification, type PhoneVerificationLabels } from "./phone-verification";
|
|
44
50
|
import { GeneralSettings } from "./profile-form";
|
|
45
51
|
import { loadProfileSource } from "./profile-source";
|
|
46
52
|
|
|
@@ -77,6 +83,36 @@ export default async function AccountGeneralPage({ params }: Props): Promise<Rea
|
|
|
77
83
|
|
|
78
84
|
const { ctx } = session;
|
|
79
85
|
const source = await loadProfileSource(ctx);
|
|
86
|
+
// The phone step reads through the generated seam (#11138); a spoke's hub
|
|
87
|
+
// holds the person, so a spoke has none.
|
|
88
|
+
const phoneStep = TOPOLOGY === "spoke" ? null : await readPhoneStep(await headers());
|
|
89
|
+
const phoneLabels: PhoneVerificationLabels = {
|
|
90
|
+
title: t("profile.phoneTitle"),
|
|
91
|
+
lead: t("profile.phoneLead"),
|
|
92
|
+
number: t("profile.phoneNumber"),
|
|
93
|
+
numberHint: t("profile.phoneNumberHint"),
|
|
94
|
+
sendCode: t("profile.phoneSendCode"),
|
|
95
|
+
sending: t("profile.phoneSending"),
|
|
96
|
+
code: t("profile.phoneCode"),
|
|
97
|
+
codeHint: t("profile.phoneCodeHint"),
|
|
98
|
+
verify: t("profile.phoneVerify"),
|
|
99
|
+
verifying: t("profile.phoneVerifying"),
|
|
100
|
+
verified: t("profile.phoneVerified"),
|
|
101
|
+
remove: t("profile.phoneRemove"),
|
|
102
|
+
sent: t("profile.phoneSent"),
|
|
103
|
+
unavailable: t("profile.phoneUnavailable"),
|
|
104
|
+
unverifiedEmail: t("profile.phoneUnverifiedEmail"),
|
|
105
|
+
errors: {
|
|
106
|
+
invalid_number: t("profile.phoneErrors.invalid_number"),
|
|
107
|
+
invalid_code: t("profile.phoneErrors.invalid_code"),
|
|
108
|
+
taken: t("profile.phoneErrors.taken"),
|
|
109
|
+
too_many: t("profile.phoneErrors.too_many"),
|
|
110
|
+
unverified: t("profile.phoneErrors.unverified"),
|
|
111
|
+
signed_out: t("profile.phoneErrors.signed_out"),
|
|
112
|
+
unavailable: t("profile.phoneErrors.unavailable"),
|
|
113
|
+
failed: t("profile.phoneErrors.failed"),
|
|
114
|
+
},
|
|
115
|
+
};
|
|
80
116
|
|
|
81
117
|
// #8435 D13 — the person's confirmed contact on this site. A failed read
|
|
82
118
|
// renders the section's "unavailable" line, never the form: a form seeded
|
|
@@ -163,6 +199,17 @@ export default async function AccountGeneralPage({ params }: Props): Promise<Rea
|
|
|
163
199
|
</div>
|
|
164
200
|
</>
|
|
165
201
|
) : null}
|
|
202
|
+
{phoneStep ? (
|
|
203
|
+
<>
|
|
204
|
+
<Separator />
|
|
205
|
+
<PhoneVerification
|
|
206
|
+
available={phoneStep.available}
|
|
207
|
+
emailVerified={ctx.user.emailVerified}
|
|
208
|
+
phone={phoneStep.phone}
|
|
209
|
+
labels={phoneLabels}
|
|
210
|
+
/>
|
|
211
|
+
</>
|
|
212
|
+
) : null}
|
|
166
213
|
{accountSettingsSections.map((section) => (
|
|
167
214
|
<SettingsSection key={section.id} id={section.id} title={ctx.t(section.title)}>
|
|
168
215
|
{section.render(ctx)}
|