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
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
// signs in through its hub and carries commerce (#8217); elsewhere, null.
|
|
12
12
|
// readOwnAccounts lists the signed-in person's own sign-in accounts through
|
|
13
13
|
// Better Auth on a hub (#8431); a spoke has none here, so it answers null.
|
|
14
|
+
// readPhoneStep and loadPhoneApi read and write the account's phone step
|
|
15
|
+
// through Better Auth on a hub (#11138); a spoke's hub holds the person, so
|
|
16
|
+
// both answer null.
|
|
14
17
|
|
|
15
18
|
export const TOPOLOGY: "hub" | "spoke" = "hub";
|
|
16
19
|
export const UNSERVED_MCP_TOOLS: readonly string[] = [];
|
|
@@ -41,6 +44,42 @@ export async function readOwnAccounts(
|
|
|
41
44
|
return auth.api.listUserAccounts({ headers });
|
|
42
45
|
}
|
|
43
46
|
|
|
47
|
+
export type PhoneStep = {
|
|
48
|
+
available: boolean;
|
|
49
|
+
phone: { number: string; verified: boolean } | null;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type PhoneApi = {
|
|
53
|
+
sendPhoneNumberOTP: (input: { body: { phoneNumber: string }; headers: Headers }) => Promise<unknown>;
|
|
54
|
+
verifyPhoneNumber: (input: {
|
|
55
|
+
body: { phoneNumber: string; code: string; updatePhoneNumber: boolean };
|
|
56
|
+
headers: Headers;
|
|
57
|
+
}) => Promise<unknown>;
|
|
58
|
+
updateUser: (input: { body: { phoneNumber: null }; headers: Headers }) => Promise<unknown>;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export async function readPhoneStep(headers: Headers): Promise<PhoneStep | null> {
|
|
62
|
+
const { auth } = await import("../auth");
|
|
63
|
+
// Whether the phone plugin is installed on this instance (#11106 D9).
|
|
64
|
+
const api: object = auth.api;
|
|
65
|
+
const available = "sendPhoneNumberOTP" in api;
|
|
66
|
+
if (!available) return { available, phone: null };
|
|
67
|
+
const session = await auth.api.getSession({ headers });
|
|
68
|
+
// The plugin's two user fields, which the conditional install leaves out
|
|
69
|
+
// of the inferred session type.
|
|
70
|
+
const user = (session?.user ?? {}) as { phoneNumber?: unknown; phoneNumberVerified?: unknown };
|
|
71
|
+
const phone =
|
|
72
|
+
typeof user.phoneNumber === "string" && user.phoneNumber !== ""
|
|
73
|
+
? { number: user.phoneNumber, verified: user.phoneNumberVerified === true }
|
|
74
|
+
: null;
|
|
75
|
+
return { available, phone };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function loadPhoneApi(): Promise<PhoneApi | null> {
|
|
79
|
+
const { auth, phoneStepActive } = await import("../auth");
|
|
80
|
+
return phoneStepActive() ? auth.api : null;
|
|
81
|
+
}
|
|
82
|
+
|
|
44
83
|
export async function registerSiteStores(): Promise<void> {
|
|
45
84
|
const { registerLicenseKeyStore } = await import("./license-key-store");
|
|
46
85
|
await registerLicenseKeyStore();
|
|
@@ -374,7 +374,8 @@
|
|
|
374
374
|
"unknownBody": "Check your email for the receipt from checkout — it has everything about your order.",
|
|
375
375
|
"ctaHeadline": "Keep going",
|
|
376
376
|
"ctaDescription": "Have a look at what else we offer.",
|
|
377
|
-
"ctaLabel": "Browse services"
|
|
377
|
+
"ctaLabel": "Browse services",
|
|
378
|
+
"openAccount": "Open your account"
|
|
378
379
|
},
|
|
379
380
|
"cancel": {
|
|
380
381
|
"title": "Checkout canceled",
|
|
@@ -621,6 +622,8 @@
|
|
|
621
622
|
"emailLinkSentHeading": "Check your email",
|
|
622
623
|
"emailLinkSentSubhead": "Look for a message from this site.",
|
|
623
624
|
"emailLinkBack": "Back to sign in",
|
|
625
|
+
"continueWith": "Continue with",
|
|
626
|
+
"useAnotherWay": "Use another way",
|
|
624
627
|
"emailLinkSentBody": "If an account uses that address, a sign-in link is on its way. It works once and expires in 5 minutes.",
|
|
625
628
|
"emailLinkFailed": "We couldn't send a sign-in link. Try again.",
|
|
626
629
|
"emailLinkRateLimited": "Too many requests. Wait a minute, then try again.",
|
|
@@ -708,6 +711,7 @@
|
|
|
708
711
|
},
|
|
709
712
|
"account": {
|
|
710
713
|
"title": "Your account",
|
|
714
|
+
"yourAccount": "Your account",
|
|
711
715
|
"description": "What changed, what's coming, and what needs you.",
|
|
712
716
|
"artifacts": {
|
|
713
717
|
"title": "Artifacts",
|
|
@@ -985,16 +989,59 @@
|
|
|
985
989
|
"gate": {
|
|
986
990
|
"emptyHeadline": "Sign-in isn't available yet",
|
|
987
991
|
"emptyDescription": "This site hasn't turned on sign-in for members yet. Check back soon, or contact the site owner.",
|
|
988
|
-
"signInLink": "Go to the sign-in page",
|
|
989
992
|
"homeLink": "Back to the site",
|
|
990
|
-
"hubHeadline": "Sign in to {site}",
|
|
991
|
-
"hubDescription": "You sign in on our main site, then come straight back here.",
|
|
992
|
-
"hubSignIn": "Sign in",
|
|
993
993
|
"title": "Sign in"
|
|
994
994
|
},
|
|
995
|
+
"spokeSignIn": {
|
|
996
|
+
"heading": "Sign in to {site}",
|
|
997
|
+
"subhead": "Enter your email and we'll send you a link to sign in.",
|
|
998
|
+
"emailLabel": "Email",
|
|
999
|
+
"submit": "Email me a sign-in link",
|
|
1000
|
+
"newHere": "New here? Accept to create your account with the same link.",
|
|
1001
|
+
"agreementsError": "To create an account, accept every agreement.",
|
|
1002
|
+
"google": "Continue with Google",
|
|
1003
|
+
"sent": "Check your email",
|
|
1004
|
+
"sentBody": "If that address can sign in here, a sign-in link is on its way. It works for 5 minutes.",
|
|
1005
|
+
"back": "Use another email",
|
|
1006
|
+
"unavailable": "Sign-in isn't available right now. Try again in a few minutes.",
|
|
1007
|
+
"exists": "You already have an account. Enter your email to sign in.",
|
|
1008
|
+
"claimInvalid": "That link has expired or was already used. Enter your email to sign in.",
|
|
1009
|
+
"openHeading": "Open your account",
|
|
1010
|
+
"openLead": "By opening your account you accept:",
|
|
1011
|
+
"open": "Open my account"
|
|
1012
|
+
},
|
|
1013
|
+
"billing": {
|
|
1014
|
+
"purchases": "Purchases",
|
|
1015
|
+
"purchasesUnavailable": "We couldn't load your purchases."
|
|
1016
|
+
},
|
|
995
1017
|
"profile": {
|
|
996
1018
|
"email": "Email",
|
|
997
|
-
"unverified": "Email not verified"
|
|
1019
|
+
"unverified": "Email not verified",
|
|
1020
|
+
"phoneTitle": "Phone",
|
|
1021
|
+
"phoneLead": "A verified number your workspaces can reach you on. Only you can set it.",
|
|
1022
|
+
"phoneNumber": "Mobile number",
|
|
1023
|
+
"phoneNumberHint": "Include the country code, for example +1 555 555 0123.",
|
|
1024
|
+
"phoneSendCode": "Send code",
|
|
1025
|
+
"phoneSending": "Sending…",
|
|
1026
|
+
"phoneCode": "Code",
|
|
1027
|
+
"phoneCodeHint": "The six-digit code we texted you. It expires in 5 minutes.",
|
|
1028
|
+
"phoneVerify": "Verify",
|
|
1029
|
+
"phoneVerifying": "Verifying…",
|
|
1030
|
+
"phoneVerified": "Verified",
|
|
1031
|
+
"phoneRemove": "Remove",
|
|
1032
|
+
"phoneSent": "We texted you a code.",
|
|
1033
|
+
"phoneUnavailable": "Phone verification isn't available on this site.",
|
|
1034
|
+
"phoneUnverifiedEmail": "Confirm your email address first, then you can add a phone.",
|
|
1035
|
+
"phoneErrors": {
|
|
1036
|
+
"invalid_number": "Enter a mobile number with its country code, such as +1 555 555 0123. Only some countries are supported.",
|
|
1037
|
+
"invalid_code": "That code didn't match or has expired. Send a new one.",
|
|
1038
|
+
"taken": "That number is already on another account.",
|
|
1039
|
+
"too_many": "Too many tries. Send a new code.",
|
|
1040
|
+
"unverified": "Confirm your email address first.",
|
|
1041
|
+
"signed_out": "Your session ended. Sign in again.",
|
|
1042
|
+
"unavailable": "Phone verification isn't available on this site.",
|
|
1043
|
+
"failed": "Something went wrong. Try again."
|
|
1044
|
+
}
|
|
998
1045
|
},
|
|
999
1046
|
"results": {
|
|
1000
1047
|
"heading": "My results",
|
|
@@ -1107,6 +1154,27 @@
|
|
|
1107
1154
|
"invalidInput": "Check what you entered and try again.",
|
|
1108
1155
|
"failed": "This could not be sent. Try again."
|
|
1109
1156
|
}
|
|
1157
|
+
},
|
|
1158
|
+
"invitation": {
|
|
1159
|
+
"title": "Join {organization}",
|
|
1160
|
+
"lead": "{inviter} invited you to join {organization} as {role}.",
|
|
1161
|
+
"leadNoInviter": "You've been invited to join {organization} as {role}.",
|
|
1162
|
+
"accept": "Accept invitation",
|
|
1163
|
+
"joined": "You've joined {organization}.",
|
|
1164
|
+
"joinedLead": "Sign in to the Admin to start working there.",
|
|
1165
|
+
"otherAddress": "This invitation is for a different email address. Sign out and sign in with the invited address.",
|
|
1166
|
+
"expired": "This invitation has expired. Ask the person who invited you to send it again.",
|
|
1167
|
+
"notPending": "This invitation is no longer open.",
|
|
1168
|
+
"alreadyMember": "You're already a member of this organization.",
|
|
1169
|
+
"void": "This invitation can no longer be accepted. Ask an owner or admin to invite you again.",
|
|
1170
|
+
"failed": "We couldn't accept the invitation. Try again.",
|
|
1171
|
+
"roles": {
|
|
1172
|
+
"owner": "an owner",
|
|
1173
|
+
"admin": "an admin",
|
|
1174
|
+
"member": "a member",
|
|
1175
|
+
"editor": "an editor",
|
|
1176
|
+
"viewer": "a viewer"
|
|
1177
|
+
}
|
|
1110
1178
|
}
|
|
1111
1179
|
},
|
|
1112
1180
|
"admin": {
|
|
@@ -1289,26 +1357,50 @@
|
|
|
1289
1357
|
"liveError": "Couldn't update. Try again.",
|
|
1290
1358
|
"detail": {
|
|
1291
1359
|
"backLabel": "Meetings",
|
|
1292
|
-
"captionUnit": "Meeting",
|
|
1293
1360
|
"statusLive": "Live",
|
|
1294
1361
|
"statusOff": "Off",
|
|
1295
|
-
"
|
|
1296
|
-
"customersAriaLabel": "{title}: members only",
|
|
1297
|
-
"membersOnlyHint": "Signed-in members can use this. A live item stays public.",
|
|
1298
|
-
"privateSwitchLabel": "Private",
|
|
1299
|
-
"privateAriaLabel": "{title}: private",
|
|
1300
|
-
"privateHint": "Listed on /private instead of /meet. Anyone with the link can still book.",
|
|
1362
|
+
"liveLabel": "Live",
|
|
1301
1363
|
"roleNote": "Only an owner or admin can manage meeting types.",
|
|
1302
|
-
"
|
|
1364
|
+
"editInProvider": "Edit in Cal.com",
|
|
1365
|
+
"openOnSite": "Open on site",
|
|
1366
|
+
"address": {
|
|
1367
|
+
"heading": "This appointment",
|
|
1368
|
+
"linkLabel": "Link",
|
|
1369
|
+
"linkHint": "The address visitors book at.",
|
|
1370
|
+
"linkPrefixHint": "Set by the site.",
|
|
1371
|
+
"linkFixedHint": "Booked from the account, not a page of its own.",
|
|
1372
|
+
"viewportDesktop": "Desktop view"
|
|
1373
|
+
},
|
|
1374
|
+
"whoCanBook": "Who can book",
|
|
1375
|
+
"visibility": {
|
|
1376
|
+
"public": "Public",
|
|
1377
|
+
"private": "Private",
|
|
1378
|
+
"authenticated": "Authenticated"
|
|
1379
|
+
},
|
|
1380
|
+
"whoHints": {
|
|
1381
|
+
"public": "Listed on /meet. Anyone can book.",
|
|
1382
|
+
"publicOff": "Listed on /meet once it is live.",
|
|
1383
|
+
"private": "Listed on /private, not /meet. Anyone with the link can book.",
|
|
1384
|
+
"authenticated": "Members only, from their account. Not listed on the site."
|
|
1385
|
+
},
|
|
1386
|
+
"createdLabel": "Created",
|
|
1387
|
+
"sourceLabel": "Source",
|
|
1388
|
+
"sourceValue": "Cal.com",
|
|
1389
|
+
"tabDetails": "Details",
|
|
1390
|
+
"tabBookings": "Bookings",
|
|
1391
|
+
"detailsHeading": "Details",
|
|
1392
|
+
"detailsCaption": "Synced from Cal.com",
|
|
1303
1393
|
"durationLabel": "Duration",
|
|
1304
1394
|
"priceLabel": "Price",
|
|
1305
|
-
"linkLabel": "Link",
|
|
1306
1395
|
"timeZoneLabel": "Time zone",
|
|
1396
|
+
"descriptionLabel": "Description",
|
|
1397
|
+
"locationLabel": "Location",
|
|
1398
|
+
"nextUpHeading": "Next up",
|
|
1399
|
+
"noBookings": "No upcoming bookings.",
|
|
1307
1400
|
"priceFree": "Free",
|
|
1308
|
-
"
|
|
1309
|
-
"
|
|
1310
|
-
"
|
|
1311
|
-
"privateOffToast": "Private: off for {title}",
|
|
1401
|
+
"liveOnToast": "{title} is on",
|
|
1402
|
+
"liveOffToast": "{title} is off",
|
|
1403
|
+
"visibilityToast": "Who can book {title}: {state}",
|
|
1312
1404
|
"errorToast": "Couldn't update"
|
|
1313
1405
|
}
|
|
1314
1406
|
},
|
|
@@ -1572,7 +1664,7 @@
|
|
|
1572
1664
|
"unavailable": {
|
|
1573
1665
|
"title": "This sign-in can't continue",
|
|
1574
1666
|
"body": "The link may have expired. Go back to the site you came from and sign in again.",
|
|
1575
|
-
"back": "Back to
|
|
1667
|
+
"back": "Back to the site"
|
|
1576
1668
|
}
|
|
1577
1669
|
},
|
|
1578
1670
|
"mcpConsent": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
import { NextRequest, NextResponse } from "next/server";
|
|
50
50
|
import createMiddleware from "next-intl/middleware";
|
|
51
51
|
|
|
52
|
-
import { isBookingPath } from "./lib/auth-routes";
|
|
52
|
+
import { isAccountPath, isBookingPath } from "./lib/auth-routes";
|
|
53
53
|
import {
|
|
54
54
|
DOCS_PATH,
|
|
55
55
|
DOCS_ROUTE,
|
|
@@ -65,6 +65,7 @@ import {
|
|
|
65
65
|
} from "./lib/services-path";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_SECURITY_HEADERS,
|
|
68
|
+
ONE_TAP_SECURITY_HEADERS,
|
|
68
69
|
SCHEDULING_SECURITY_HEADERS,
|
|
69
70
|
applyHeaders,
|
|
70
71
|
} from "./security-headers.config";
|
|
@@ -175,6 +176,16 @@ const FILE_ROUTE_SECURITY_HEADERS: Readonly<Record<string, string>> =
|
|
|
175
176
|
),
|
|
176
177
|
);
|
|
177
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Whether this site signs in through its hub (#11096): the hub's sign-in
|
|
181
|
+
* origin, which only a hub-sign-in spoke sets (`lib/hub-session/config.ts`).
|
|
182
|
+
* Read from the environment, not `lib/topology.generated`, whose spoke render
|
|
183
|
+
* imports the Node-only session module this Edge bundle must not carry.
|
|
184
|
+
*/
|
|
185
|
+
function signsInThroughHub(): boolean {
|
|
186
|
+
return (process.env.AILK_HUB_SIGN_IN_URL?.trim() ?? "") !== "";
|
|
187
|
+
}
|
|
188
|
+
|
|
178
189
|
export function middleware(request: NextRequest): NextResponse {
|
|
179
190
|
// Step 1: Forward x-pathname to server components so generateMetadata can
|
|
180
191
|
// build path-aware hreflang alternates (P2 S1). Clone the request headers
|
|
@@ -182,6 +193,18 @@ export function middleware(request: NextRequest): NextResponse {
|
|
|
182
193
|
// doesn't clobber the original user-facing path.
|
|
183
194
|
const requestHeaders = new Headers(request.headers);
|
|
184
195
|
requestHeaders.set("x-pathname", request.nextUrl.pathname);
|
|
196
|
+
// #11096 D1 — the (authed) gate renders from a layout, which gets no
|
|
197
|
+
// searchParams, so on a hub-sign-in spoke an account path's query rides
|
|
198
|
+
// beside the path. Always this request's own value: a client-sent
|
|
199
|
+
// `x-search` is dropped everywhere. It can hold a purchase claim, so no
|
|
200
|
+
// other path or topology carries it, and nothing logs or reports it.
|
|
201
|
+
requestHeaders.delete("x-search");
|
|
202
|
+
if (
|
|
203
|
+
signsInThroughHub() &&
|
|
204
|
+
isAccountPath(request.nextUrl.pathname, enabledLocales)
|
|
205
|
+
) {
|
|
206
|
+
requestHeaders.set("x-search", request.nextUrl.search);
|
|
207
|
+
}
|
|
185
208
|
|
|
186
209
|
// Non-locale routes are served as requested — no rewrite, no redirect.
|
|
187
210
|
if (isNonLocaleRoute(request.nextUrl.pathname)) {
|
|
@@ -251,6 +274,8 @@ export function middleware(request: NextRequest): NextResponse {
|
|
|
251
274
|
// pages of a site that carries the scheduling module get the same map with
|
|
252
275
|
// Cal.com's origin added to the CSP (#8843 D12); no other page does. The
|
|
253
276
|
// file routes get the six others and keep their own sandbox CSP (#9162).
|
|
277
|
+
// A hub-sign-in spoke that turned Google One Tap on (`AILK_HUB_ONE_TAP=on`)
|
|
278
|
+
// gets Google's origins on its other pages (#11096 D10, SEC-11096-10).
|
|
254
279
|
applyHeaders(
|
|
255
280
|
intlResponse.headers,
|
|
256
281
|
isFileRoutePath(request.nextUrl.pathname)
|
|
@@ -258,8 +283,15 @@ export function middleware(request: NextRequest): NextResponse {
|
|
|
258
283
|
: SCHEDULING_PAGES &&
|
|
259
284
|
isBookingPath(request.nextUrl.pathname, enabledLocales)
|
|
260
285
|
? SCHEDULING_SECURITY_HEADERS
|
|
261
|
-
:
|
|
286
|
+
: signsInThroughHub() && process.env.AILK_HUB_ONE_TAP === "on"
|
|
287
|
+
? ONE_TAP_SECURITY_HEADERS
|
|
288
|
+
: DEFAULT_SECURITY_HEADERS,
|
|
262
289
|
);
|
|
290
|
+
// SEC-11096-4 — a page that carries a purchase claim in its query sends no
|
|
291
|
+
// referrer, so no request it makes carries the claim in `Referer`.
|
|
292
|
+
if (request.nextUrl.searchParams.has("claim")) {
|
|
293
|
+
intlResponse.headers.set("Referrer-Policy", "no-referrer");
|
|
294
|
+
}
|
|
263
295
|
// #10040 decision 7 — a site with neither marketing nor docs-blog (a hub)
|
|
264
296
|
// asks every crawler to keep out of every page, read from the module list.
|
|
265
297
|
if (!PUBLIC_PAGES) intlResponse.headers.set("X-Robots-Tag", "noindex");
|
|
@@ -142,6 +142,27 @@ export const SCHEDULING_CSP: CspDirectiveMap = Object.freeze({
|
|
|
142
142
|
export const SCHEDULING_SECURITY_HEADERS: Readonly<Record<string, string>> =
|
|
143
143
|
Object.freeze(buildHeaders({ csp: SCHEDULING_CSP }));
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Google One Tap's CSP additions (#11096 D10, SEC-11096-10). A spoke that
|
|
147
|
+
* signs in through its hub and sets `AILK_HUB_ONE_TAP=on` loads Google's
|
|
148
|
+
* Identity Services script on its signed-out account page, which fetches,
|
|
149
|
+
* styles and frames from Google. Only such a spoke names Google:
|
|
150
|
+
* `middleware.ts` applies this map while the setting is on, as it applies
|
|
151
|
+
* `SCHEDULING_CSP` on booking paths. `'self'` in `frame-src` keeps
|
|
152
|
+
* same-origin frames working, which `default-src 'self'` allowed until the
|
|
153
|
+
* directive existed.
|
|
154
|
+
*/
|
|
155
|
+
export const ONE_TAP_CSP: CspDirectiveMap = Object.freeze({
|
|
156
|
+
"script-src": Object.freeze(["https://accounts.google.com/gsi/client"]),
|
|
157
|
+
"connect-src": Object.freeze(["https://accounts.google.com/gsi/"]),
|
|
158
|
+
"style-src": Object.freeze(["https://accounts.google.com/gsi/"]),
|
|
159
|
+
"frame-src": Object.freeze(["'self'", "https://accounts.google.com"]),
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
/** The header map for a One Tap spoke's pages: the default plus `ONE_TAP_CSP`. */
|
|
163
|
+
export const ONE_TAP_SECURITY_HEADERS: Readonly<Record<string, string>> =
|
|
164
|
+
Object.freeze(buildHeaders({ csp: ONE_TAP_CSP }));
|
|
165
|
+
|
|
145
166
|
/** Write every entry from a header map onto a Headers object. */
|
|
146
167
|
export function applyHeaders(
|
|
147
168
|
target: Headers,
|
package/versions.json
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@working-theory/admin-ui": "0.
|
|
3
|
-
"@working-theory/aeo": "0.
|
|
4
|
-
"@working-theory/agent-context": "0.
|
|
2
|
+
"@working-theory/admin-ui": "0.60.0",
|
|
3
|
+
"@working-theory/aeo": "0.60.0",
|
|
4
|
+
"@working-theory/agent-context": "0.60.0",
|
|
5
5
|
"@working-theory/agent-contract": "0.1.0",
|
|
6
6
|
"@working-theory/agent-memory": "0.0.0",
|
|
7
7
|
"@working-theory/ai": "0.1.0",
|
|
8
|
-
"@working-theory/analytics": "0.
|
|
9
|
-
"@working-theory/api": "0.
|
|
10
|
-
"@working-theory/api-client": "0.
|
|
8
|
+
"@working-theory/analytics": "0.60.0",
|
|
9
|
+
"@working-theory/api": "0.60.0",
|
|
10
|
+
"@working-theory/api-client": "0.60.0",
|
|
11
11
|
"@working-theory/cda-filesystem": "0.0.0",
|
|
12
|
-
"@working-theory/cli": "0.
|
|
13
|
-
"@working-theory/common": "0.
|
|
12
|
+
"@working-theory/cli": "0.60.0",
|
|
13
|
+
"@working-theory/common": "0.60.0",
|
|
14
14
|
"@working-theory/consent": "0.1.0",
|
|
15
|
-
"@working-theory/content-adapters": "0.
|
|
16
|
-
"@working-theory/content-projection": "0.
|
|
17
|
-
"@working-theory/email": "0.
|
|
15
|
+
"@working-theory/content-adapters": "0.60.0",
|
|
16
|
+
"@working-theory/content-projection": "0.60.0",
|
|
17
|
+
"@working-theory/email": "0.60.0",
|
|
18
18
|
"@working-theory/env": "0.0.0",
|
|
19
|
-
"@working-theory/eslint-config": "0.
|
|
20
|
-
"@working-theory/fumadocs-schema": "0.
|
|
19
|
+
"@working-theory/eslint-config": "0.60.0",
|
|
20
|
+
"@working-theory/fumadocs-schema": "0.60.0",
|
|
21
21
|
"@working-theory/ids": "0.20.0",
|
|
22
|
-
"@working-theory/jsonld": "0.
|
|
23
|
-
"@working-theory/license": "0.
|
|
24
|
-
"@working-theory/mcp-server": "0.
|
|
25
|
-
"@working-theory/metadata": "0.
|
|
26
|
-
"@working-theory/observability": "0.
|
|
27
|
-
"@working-theory/page-renderer": "0.
|
|
22
|
+
"@working-theory/jsonld": "0.60.0",
|
|
23
|
+
"@working-theory/license": "0.60.0",
|
|
24
|
+
"@working-theory/mcp-server": "0.60.0",
|
|
25
|
+
"@working-theory/metadata": "0.60.0",
|
|
26
|
+
"@working-theory/observability": "0.60.0",
|
|
27
|
+
"@working-theory/page-renderer": "0.60.0",
|
|
28
28
|
"@working-theory/plugin-mcp": "0.1.3",
|
|
29
|
-
"@working-theory/schema": "0.
|
|
30
|
-
"@working-theory/schema-pack-registry": "0.
|
|
31
|
-
"@working-theory/schema-validator": "0.
|
|
32
|
-
"@working-theory/sections-registry": "0.
|
|
33
|
-
"@working-theory/site-config": "0.
|
|
34
|
-
"@working-theory/spoke-checkout": "0.7.
|
|
35
|
-
"@working-theory/stripe-client": "0.
|
|
36
|
-
"@working-theory/templates": "0.
|
|
37
|
-
"@working-theory/theme": "0.
|
|
38
|
-
"@working-theory/ui": "0.
|
|
39
|
-
"@working-theory/validation": "0.
|
|
40
|
-
"@working-theory/web-i18n": "0.
|
|
41
|
-
"@working-theory/admin": "0.
|
|
42
|
-
"@working-theory/api-commerce": "0.1.
|
|
43
|
-
"@working-theory/api-content-write": "0.
|
|
44
|
-
"@working-theory/api-hub": "0.
|
|
45
|
-
"@working-theory/api-multi-tenant": "0.
|
|
46
|
-
"@working-theory/api-scheduling": "0.
|
|
47
|
-
"@working-theory/api-signal-collectors": "0.
|
|
48
|
-
"@working-theory/api-workspace": "0.
|
|
29
|
+
"@working-theory/schema": "0.60.0",
|
|
30
|
+
"@working-theory/schema-pack-registry": "0.60.0",
|
|
31
|
+
"@working-theory/schema-validator": "0.60.0",
|
|
32
|
+
"@working-theory/sections-registry": "0.60.0",
|
|
33
|
+
"@working-theory/site-config": "0.60.0",
|
|
34
|
+
"@working-theory/spoke-checkout": "0.7.16",
|
|
35
|
+
"@working-theory/stripe-client": "0.60.0",
|
|
36
|
+
"@working-theory/templates": "0.60.0",
|
|
37
|
+
"@working-theory/theme": "0.60.0",
|
|
38
|
+
"@working-theory/ui": "0.60.0",
|
|
39
|
+
"@working-theory/validation": "0.60.0",
|
|
40
|
+
"@working-theory/web-i18n": "0.60.0",
|
|
41
|
+
"@working-theory/admin": "0.14.0",
|
|
42
|
+
"@working-theory/api-commerce": "0.1.14",
|
|
43
|
+
"@working-theory/api-content-write": "0.8.0",
|
|
44
|
+
"@working-theory/api-hub": "0.5.0",
|
|
45
|
+
"@working-theory/api-multi-tenant": "0.3.0",
|
|
46
|
+
"@working-theory/api-scheduling": "0.5.0",
|
|
47
|
+
"@working-theory/api-signal-collectors": "0.6.0",
|
|
48
|
+
"@working-theory/api-workspace": "0.8.0",
|
|
49
49
|
"@working-theory/billing-client": "0.0.0",
|
|
50
50
|
"@working-theory/branding": "0.0.0",
|
|
51
51
|
"@working-theory/license-client": "0.0.0",
|
|
52
52
|
"@working-theory/license-manifest": "0.0.0",
|
|
53
|
-
"@working-theory/mcp-scheduling": "0.4.
|
|
54
|
-
"@working-theory/mcp-signal-collectors": "0.2.
|
|
55
|
-
"@working-theory/mcp-workspace": "0.8.
|
|
53
|
+
"@working-theory/mcp-scheduling": "0.4.1",
|
|
54
|
+
"@working-theory/mcp-signal-collectors": "0.2.14",
|
|
55
|
+
"@working-theory/mcp-workspace": "0.8.1",
|
|
56
56
|
"@working-theory/partner-session": "0.0.0",
|
|
57
57
|
"@working-theory/preview-protocol": "0.0.0",
|
|
58
|
-
"@working-theory/ui-commerce": "0.23.
|
|
59
|
-
"@working-theory/ui-docs-blog": "0.23.
|
|
60
|
-
"@working-theory/ui-scheduling": "0.25.
|
|
61
|
-
"@working-theory/ui-signal-collectors": "0.29.
|
|
58
|
+
"@working-theory/ui-commerce": "0.23.38",
|
|
59
|
+
"@working-theory/ui-docs-blog": "0.23.38",
|
|
60
|
+
"@working-theory/ui-scheduling": "0.25.12",
|
|
61
|
+
"@working-theory/ui-signal-collectors": "0.29.1",
|
|
62
62
|
"@working-theory/web": "0.0.0",
|
|
63
63
|
"@working-theory/app-api": "1.0.0",
|
|
64
64
|
"@working-theory/mcp": "0.0.0",
|
|
65
|
-
"@working-theory/database": "0.
|
|
65
|
+
"@working-theory/database": "0.60.0"
|
|
66
66
|
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use client"; // social sign-in requires a client-side Better Auth call
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* SignInGate — the `(authed)` group's own front door (#4665 D9).
|
|
5
|
-
*
|
|
6
|
-
* This gate composes the shipped `AuthPanel` section directly (so the
|
|
7
|
-
* dashboard is reachable in place, unlike `apps-paid/admin`, which redirects
|
|
8
|
-
* to "/" on no session) and ALSO links to `apps/web`'s own `/sign-in` page
|
|
9
|
-
* (#4984) carrying `?next=<pathname>`, so a visitor who prefers the full
|
|
10
|
-
* sign-in surface lands back on the exact page they requested.
|
|
11
|
-
*
|
|
12
|
-
* `providers` arrives as a prop, resolved by the `(authed)` layout (an RSC)
|
|
13
|
-
* from the server's provider env (#7419). This module must never read that
|
|
14
|
-
* env itself: it is bundled for the browser, where `GOOGLE_CLIENT_ID` and the
|
|
15
|
-
* like are always unset, so a client-side read always came back empty.
|
|
16
|
-
*
|
|
17
|
-
* Zero active providers → an `EmptyState` naming the missing configuration
|
|
18
|
-
* (the `AuthPanel` UI-contract forbids fabricating a session — spec
|
|
19
|
-
* Clarifications), still followed by the sign-in link. `callbackURL` is the
|
|
20
|
-
* current pathname (via `usePathname()`) so a successful social sign-in
|
|
21
|
-
* lands back on the exact dashboard page the visitor requested.
|
|
22
|
-
*
|
|
23
|
-
* Email sign-in link (#7435 § D9): when the layout passes `card` with
|
|
24
|
-
* `emailLink`, the gate renders `/sign-in`'s own `SignInCard` — the same
|
|
25
|
-
* providers plus "Send me a magic link" — in place of `AuthPanel`, whose
|
|
26
|
-
* email + password form has no submit wiring and would otherwise sit inert
|
|
27
|
-
* beside the new field. Without the prop every render is what it was before.
|
|
28
|
-
*
|
|
29
|
-
* The one card (#9662): on the member `/account` gate the layout passes
|
|
30
|
-
* `card` whenever a method is on, with the site's mark, the "Don't have an
|
|
31
|
-
* account? Sign up" line and the Terms + Privacy acknowledgement, so the gate
|
|
32
|
-
* renders the same card `/sign-in` does.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
import { EmptyState, Link } from "@working-theory/ui/primitives";
|
|
36
|
-
import { AuthPanel, type AuthPanelProvider } from "@working-theory/ui/sections";
|
|
37
|
-
import { createAuthClient } from "better-auth/react";
|
|
38
|
-
import { usePathname } from "next/navigation";
|
|
39
|
-
import type { ReactElement, ReactNode } from "react";
|
|
40
|
-
|
|
41
|
-
import { SignInCard } from "../(auth)/sign-in/sign-in-card";
|
|
42
|
-
import type { SignInCardText } from "../(auth)/sign-in/sign-in-text";
|
|
43
|
-
|
|
44
|
-
const authClient = createAuthClient();
|
|
45
|
-
|
|
46
|
-
export interface SignInGateLabels {
|
|
47
|
-
emptyHeadline: string;
|
|
48
|
-
emptyDescription: string;
|
|
49
|
-
/** Visible text of the link to the full sign-in page (#4984). */
|
|
50
|
-
signInLinkLabel: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface SignInGateProps {
|
|
54
|
-
labels: SignInGateLabels;
|
|
55
|
-
/** Locale-prefixed sign-in page path — `localeHref(locale, "/sign-in")`. */
|
|
56
|
-
signInPath: string;
|
|
57
|
-
/** The active social providers, resolved server-side by the layout (#7419). */
|
|
58
|
-
providers: AuthPanelProvider[];
|
|
59
|
-
/**
|
|
60
|
-
* Renders `SignInCard` in place of `AuthPanel` — present when the email
|
|
61
|
-
* sign-in link is on (#7435) or on the member gate (#9662). The card's copy,
|
|
62
|
-
* mark, prospect line and footnote are resolved server-side by the layout.
|
|
63
|
-
*/
|
|
64
|
-
card?: {
|
|
65
|
-
text: SignInCardText;
|
|
66
|
-
/** Offer "Send me a magic link" — the email sign-in link is on. */
|
|
67
|
-
emailLink: boolean;
|
|
68
|
-
logo?: ReactNode;
|
|
69
|
-
prospect?: { prompt: string; linkLabel: string; href: string };
|
|
70
|
-
footnote?: ReactNode;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function SignInGate({
|
|
75
|
-
labels,
|
|
76
|
-
signInPath,
|
|
77
|
-
providers,
|
|
78
|
-
card,
|
|
79
|
-
}: SignInGateProps): ReactElement {
|
|
80
|
-
const pathname = usePathname();
|
|
81
|
-
const signInHref = `${signInPath}?next=${encodeURIComponent(pathname)}`;
|
|
82
|
-
|
|
83
|
-
const signInLink = (
|
|
84
|
-
<Link
|
|
85
|
-
href={signInHref}
|
|
86
|
-
data-testid="sign-in-gate-link"
|
|
87
|
-
// 24px hit-area floor (Rule 14) — a bare inline link's line-height box
|
|
88
|
-
// falls short on its own.
|
|
89
|
-
className="inline-flex min-h-6 items-center px-2"
|
|
90
|
-
>
|
|
91
|
-
{labels.signInLinkLabel}
|
|
92
|
-
</Link>
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
if (card) {
|
|
96
|
-
const { text } = card;
|
|
97
|
-
return (
|
|
98
|
-
<div
|
|
99
|
-
className="flex min-h-screen flex-col items-center justify-center gap-4 py-section"
|
|
100
|
-
data-testid="sign-in-gate"
|
|
101
|
-
>
|
|
102
|
-
{/* AuthShell's 400px column: the cap sits on the wrapper, never on the card (AuthShell.tsx). */}
|
|
103
|
-
<div className="w-full max-w-100">
|
|
104
|
-
<SignInCard
|
|
105
|
-
providers={providers}
|
|
106
|
-
method="sso"
|
|
107
|
-
next={pathname}
|
|
108
|
-
labels={text.labels}
|
|
109
|
-
notConfiguredSubhead={text.notConfiguredSubhead}
|
|
110
|
-
errorLabels={text.errorLabels}
|
|
111
|
-
emailLink={card.emailLink}
|
|
112
|
-
errorCallbackURL={signInHref}
|
|
113
|
-
signInHref={signInHref}
|
|
114
|
-
emailLinkLabels={text.emailLinkLabels}
|
|
115
|
-
{...(card.logo !== undefined ? { logo: card.logo } : {})}
|
|
116
|
-
{...(card.prospect !== undefined
|
|
117
|
-
? { prospect: card.prospect }
|
|
118
|
-
: {})}
|
|
119
|
-
{...(card.footnote !== undefined
|
|
120
|
-
? { footnote: card.footnote }
|
|
121
|
-
: {})}
|
|
122
|
-
/>
|
|
123
|
-
</div>
|
|
124
|
-
{signInLink}
|
|
125
|
-
</div>
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (providers.length === 0) {
|
|
130
|
-
return (
|
|
131
|
-
<div
|
|
132
|
-
className="flex min-h-screen flex-col items-center justify-center gap-4"
|
|
133
|
-
data-testid="sign-in-gate-empty"
|
|
134
|
-
>
|
|
135
|
-
<EmptyState
|
|
136
|
-
headline={labels.emptyHeadline}
|
|
137
|
-
description={labels.emptyDescription}
|
|
138
|
-
/>
|
|
139
|
-
{signInLink}
|
|
140
|
-
</div>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<div
|
|
146
|
-
className="flex min-h-screen flex-col items-center justify-center gap-4 py-section"
|
|
147
|
-
data-testid="sign-in-gate"
|
|
148
|
-
>
|
|
149
|
-
<AuthPanel
|
|
150
|
-
sectionName="auth-panel"
|
|
151
|
-
data={{ mode: "signin", providers }}
|
|
152
|
-
onProviderClick={(provider) => {
|
|
153
|
-
void authClient.signIn.social({
|
|
154
|
-
provider,
|
|
155
|
-
callbackURL: pathname,
|
|
156
|
-
});
|
|
157
|
-
}}
|
|
158
|
-
/>
|
|
159
|
-
{signInLink}
|
|
160
|
-
</div>
|
|
161
|
-
);
|
|
162
|
-
}
|