create-ailk 0.37.1 → 0.39.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 +19 -12
- 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 +12 -16
- 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 +73 -2
- package/dist/routes.d.ts +130 -0
- package/dist/routes.js +954 -0
- package/dist/site-manifest.js +6 -4
- package/dist/site-roster.d.ts +11 -2
- package/dist/site-roster.js +63 -21
- package/dist/spoke-checkout.d.ts +28 -27
- package/dist/spoke-checkout.js +71 -102
- package/dist/surfaces.d.ts +26 -0
- package/dist/surfaces.js +105 -293
- package/dist/sync-routes.d.ts +14 -1
- package/dist/sync-routes.js +108 -10
- package/dist/template-record.js +3 -1
- package/dist/topology.d.ts +26 -1
- package/dist/topology.js +273 -7
- 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 +87 -23
- package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +5 -1
- package/templates/apps/web/__tests__/__mocks__/next-intl.ts +5 -1
- package/templates/apps/web/__tests__/auth/seam.test.ts +34 -0
- package/templates/apps/web/account.config.tsx +100 -0
- package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +2 -2
- package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +1 -1
- package/templates/apps/web/app/[locale]/layout.tsx +46 -29
- 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/auth.config.tsx +107 -0
- package/templates/apps/web/auth.ts +2 -1
- package/templates/apps/web/i18n/request.ts +51 -1
- package/templates/apps/web/jest.config.cjs +17 -1
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
- package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +73 -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/server-api.ts +1 -1
- package/templates/apps/web/lib/site-brand.tsx +3 -5
- package/templates/apps/web/lib/topology.generated.ts +5 -0
- package/templates/apps/web/messages/en.json +8 -836
- package/templates/apps/web/middleware.ts +15 -26
- package/templates/apps/web/next.config.mjs +35 -0
- package/templates/apps/web/package.json +2 -0
- package/templates/apps/web/types/messages.d.ts +6 -1
- package/templates/customizations.yaml +9 -0
- package/templates/package.json +3 -1
- package/templates/tools/lint-architecture.ts +164 -11
- package/versions.json +49 -47
- package/templates/apps/web/app/[locale]/(auth)/__tests__/auth-pages.test.tsx +0 -322
- package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +0 -554
- package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/consent-actions.test.ts +0 -56
- package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/page.test.tsx +0 -164
- package/templates/apps/web/app/[locale]/(auth)/consent/consent-form.tsx +0 -132
- package/templates/apps/web/app/[locale]/(auth)/consent/consent.actions.ts +0 -51
- package/templates/apps/web/app/[locale]/(auth)/consent/page.tsx +0 -144
- package/templates/apps/web/app/[locale]/(auth)/forgot-password/forgot-password-card.tsx +0 -101
- package/templates/apps/web/app/[locale]/(auth)/forgot-password/page.tsx +0 -111
- package/templates/apps/web/app/[locale]/(auth)/layout.tsx +0 -81
- package/templates/apps/web/app/[locale]/(auth)/legal-footnote.tsx +0 -35
- package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +0 -179
- package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +0 -157
- package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +0 -126
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/next-path.test.ts +0 -54
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +0 -628
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +0 -43
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(auth)/sign-in/next-path.ts +0 -20
- package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +0 -234
- package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +0 -323
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +0 -93
- package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/page.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/sign-up-card.test.tsx +0 -309
- package/templates/apps/web/app/[locale]/(auth)/sign-up/page.tsx +0 -201
- package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up-card.tsx +0 -366
- package/templates/apps/web/app/[locale]/(auth)/use-auth-card-flow.ts +0 -116
- package/templates/apps/web/app/[locale]/(auth)/verify-email/__tests__/actions.test.ts +0 -94
- package/templates/apps/web/app/[locale]/(auth)/verify-email/actions.ts +0 -77
- package/templates/apps/web/app/[locale]/(auth)/verify-email/page.tsx +0 -154
- 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/[slug]/page.tsx +0 -161
- 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/appointments/page.tsx +0 -139
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +0 -406
- 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/[pieceId]/versions/[version]/file/route.ts +0 -190
- 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/artifacts/page.tsx +0 -182
- 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/page.tsx +0 -424
- 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/page.tsx +0 -218
- 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/[kind]/[id]/page.tsx +0 -119
- 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/message/[id]/file/route.ts +0 -80
- 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/page.tsx +0 -125
- 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/invitations/[invitationId]/page.tsx +0 -154
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +0 -152
- 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/notifications/page.tsx +0 -143
- 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/onboarding/page.tsx +0 -126
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +0 -306
- 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/privacy/export/route.ts +0 -102
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +0 -240
- 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/page.tsx +0 -131
- 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/page.tsx +0 -24
- 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/page.tsx +0 -60
- 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/app/api/auth/[...all]/route.ts +0 -16
- package/templates/apps/web/app/api/auth/hub/__tests__/continuation.test.ts +0 -143
- package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +0 -749
- package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +0 -964
- package/templates/apps/web/app/api/auth/hub/authorize/route.ts +0 -390
- package/templates/apps/web/app/api/auth/hub/continuation.ts +0 -127
- package/templates/apps/web/app/api/auth/hub/continue/[ref]/__tests__/route.test.ts +0 -188
- package/templates/apps/web/app/api/auth/hub/continue/[ref]/route.ts +0 -53
- package/templates/apps/web/app/api/auth/hub/email/route.ts +0 -111
- package/templates/apps/web/app/api/auth/hub/entry-shared.ts +0 -163
- package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +0 -86
- package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +0 -368
- package/templates/apps/web/app/api/auth/hub/password/return.ts +0 -86
- package/templates/apps/web/app/api/auth/hub/password/route.ts +0 -171
- package/templates/apps/web/app/api/auth/hub/purchase/route.ts +0 -230
- package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +0 -174
- package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +0 -60
- package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +0 -97
- package/templates/apps/web/app/api/auth/mcp/__tests__/continuation.test.ts +0 -92
- package/templates/apps/web/app/api/auth/mcp/continuation.ts +0 -89
- package/templates/apps/web/app/api/auth/mcp/continue/[ref]/__tests__/route.test.ts +0 -59
- package/templates/apps/web/app/api/auth/mcp/continue/[ref]/route.ts +0 -41
- package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +0 -1166
- package/templates/apps/web/app/api/hub-session/callback/route.ts +0 -134
- package/templates/apps/web/app/api/hub-session/email/route.ts +0 -125
- package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +0 -49
- package/templates/apps/web/app/api/hub-session/one-tap/route.ts +0 -106
- package/templates/apps/web/app/api/hub-session/open/route.ts +0 -111
- package/templates/apps/web/app/api/hub-session/password/return/route.ts +0 -69
- package/templates/apps/web/app/api/hub-session/password/route.ts +0 -106
- package/templates/apps/web/app/api/hub-session/sign-in/route.ts +0 -91
- package/templates/apps/web/app/api/hub-session/sign-out/route.ts +0 -54
- package/templates/apps/web/components/sign-out-trigger.tsx +0 -62
- package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
- package/templates/apps/web/lib/__tests__/auth-routes.test.ts +0 -140
- package/templates/apps/web/lib/account-config.ts +0 -678
- package/templates/apps/web/lib/auth-routes.ts +0 -125
- package/templates/apps/web/lib/checkout-config.ts +0 -16
- package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +0 -433
- package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +0 -332
- package/templates/apps/web/lib/hub-session/config.ts +0 -110
- package/templates/apps/web/lib/hub-session/entry.ts +0 -238
- package/templates/apps/web/lib/hub-session/index.ts +0 -21
- package/templates/apps/web/lib/hub-session/one-tap.tsx +0 -148
- package/templates/apps/web/lib/hub-session/reseal.ts +0 -90
- package/templates/apps/web/lib/hub-session/seal.ts +0 -86
- package/templates/apps/web/lib/hub-session/session.ts +0 -298
- package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +0 -277
- package/templates/apps/web/lib/next-path.ts +0 -35
- 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,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for `resolveNextPath` — the /sign-in `?next=` sanitizer (#4984).
|
|
3
|
-
* Foreign, protocol-relative, backslash, control-char, and non-string inputs
|
|
4
|
-
* all fall back; plain in-app paths pass through unchanged.
|
|
5
|
-
*
|
|
6
|
-
* `hrefWithNext` (#9912 D4) — a toggle carries `?next=` only when the page's
|
|
7
|
-
* resolved `next` is not its fallback.
|
|
8
|
-
*/
|
|
9
|
-
import { hrefWithNext, resolveNextPath } from "../next-path";
|
|
10
|
-
|
|
11
|
-
const FALLBACK = "/account";
|
|
12
|
-
|
|
13
|
-
describe("resolveNextPath()", () => {
|
|
14
|
-
it.each(["/account", "/en/account?tab=x", "/waitlist#a"])(
|
|
15
|
-
"accepts the in-app path %p",
|
|
16
|
-
(raw) => {
|
|
17
|
-
expect(resolveNextPath(raw, FALLBACK)).toBe(raw);
|
|
18
|
-
},
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
it.each([
|
|
22
|
-
["protocol-relative", "//evil.com"],
|
|
23
|
-
["backslash host trick", "/\\evil.com"],
|
|
24
|
-
["absolute URL", "https://evil.com"],
|
|
25
|
-
["bare host", "evil.com"],
|
|
26
|
-
["embedded space", "/acc ount"],
|
|
27
|
-
["CRLF", "/x\r\ny"],
|
|
28
|
-
["empty string", ""],
|
|
29
|
-
["undefined", undefined],
|
|
30
|
-
["string[] (repeated param)", ["/a"]],
|
|
31
|
-
])("rejects %s → fallback", (_label, raw) => {
|
|
32
|
-
expect(resolveNextPath(raw, FALLBACK)).toBe(FALLBACK);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
describe("hrefWithNext()", () => {
|
|
37
|
-
it("the fallback gives the bare href", () => {
|
|
38
|
-
expect(hrefWithNext("/sign-up", "/account", "/account")).toBe("/sign-up");
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("any other next rides as ?next=, URL-encoded", () => {
|
|
42
|
-
expect(
|
|
43
|
-
hrefWithNext("/sign-up", "/api/auth/hub/continue/abc_-1", "/account"),
|
|
44
|
-
).toBe("/sign-up?next=%2Fapi%2Fauth%2Fhub%2Fcontinue%2Fabc_-1");
|
|
45
|
-
expect(
|
|
46
|
-
hrefWithNext("/fr/sign-in", "/fr/account?tab=x", "/fr/account"),
|
|
47
|
-
).toBe("/fr/sign-in?next=%2Ffr%2Faccount%3Ftab%3Dx");
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("a refused next resolves to the fallback, so its toggle is bare", () => {
|
|
51
|
-
const next = resolveNextPath("//evil.example", FALLBACK);
|
|
52
|
-
expect(hrefWithNext("/sign-up", next, FALLBACK)).toBe("/sign-up");
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,628 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for the `/[locale]/sign-in` page (#4984).
|
|
3
|
-
*
|
|
4
|
-
* Covers:
|
|
5
|
-
* (a) OAuth-only (google) → sso body, exactly that provider, no email
|
|
6
|
-
* field, no sign-up footer.
|
|
7
|
-
* (b) google + github + email → password body with both social buttons,
|
|
8
|
-
* still no sign-up footer.
|
|
9
|
-
* (c) zero providers → inert card (no buttons, no form, not-configured
|
|
10
|
-
* subhead) — never a fabricated session.
|
|
11
|
-
* (d) provider click → `signIn.social({ provider, callbackURL: next })`;
|
|
12
|
-
* a failed launch renders the providerFailed message.
|
|
13
|
-
* (e) a foreign / protocol-relative `?next=` falls back to /account.
|
|
14
|
-
* (f) password submit → `signIn.email` with the typed credentials; an
|
|
15
|
-
* error result renders the signInFailed message.
|
|
16
|
-
* (g) the "Forgot password?" link renders only when the reset predicate is
|
|
17
|
-
* true — never a dead end pointing at reset's not-available state
|
|
18
|
-
* (#6018 AC-1). (#6068 repointed that predicate from `isResetAvailable()`
|
|
19
|
-
* to `resetSendConfigured()`; the mock below binds both to one fn, so
|
|
20
|
-
* these cases read identically either way.)
|
|
21
|
-
* (h) the email sign-in link (#7435): with "magic-link" active the form
|
|
22
|
-
* renders beside the providers (or alone); a `?error=` from a failed
|
|
23
|
-
* link maps to fixed copy and is never echoed.
|
|
24
|
-
* (i) the hinted email (#8757 D9): a valid single `?email=` is the starting
|
|
25
|
-
* value of every email input of the card; an invalid or repeated value,
|
|
26
|
-
* or none, leaves them empty as before. It signs no one in.
|
|
27
|
-
* (j) the one card (#9662): the site's logo and "Sign in to <site>" from
|
|
28
|
-
* the deployment's own data — a crafted query parameter cannot change
|
|
29
|
-
* the name — the "Don't have an account? Sign up" line linking
|
|
30
|
-
* /sign-up, and the Terms + Privacy acknowledgement.
|
|
31
|
-
* (k) the Sign up toggle (#9912 D4): it carries the validated `?next=` to
|
|
32
|
-
* /sign-up; a `next` resolveNextPath refuses, or none, gives the bare
|
|
33
|
-
* /sign-up.
|
|
34
|
-
*
|
|
35
|
-
* `next-intl/server` is mocked here against the real en.json, with `{name}`
|
|
36
|
-
* placeholders filled from the values passed, so `signIn` copy is asserted
|
|
37
|
-
* by its real strings and the heading by the name actually interpolated.
|
|
38
|
-
*/
|
|
39
|
-
import { render, screen, within } from "@testing-library/react";
|
|
40
|
-
import userEvent from "@testing-library/user-event";
|
|
41
|
-
|
|
42
|
-
const mockGetActiveProviderIds = jest.fn();
|
|
43
|
-
const mockIsResetAvailable = jest.fn();
|
|
44
|
-
// eslint-disable-next-line no-restricted-syntax -- #507: mock-internal rewrite pending; auth-env.ts is a pure env-introspection module with no external boundary to mock instead.
|
|
45
|
-
jest.mock("../../../../../lib/auth-env", () => ({
|
|
46
|
-
__esModule: true,
|
|
47
|
-
getActiveProviderIds: () => mockGetActiveProviderIds(),
|
|
48
|
-
isResetAvailable: () => mockIsResetAvailable(),
|
|
49
|
-
// #6068 repointed the forgot link from the flag-only `isResetAvailable()`
|
|
50
|
-
// at the send conjunction. This is a PARTIAL module mock, so an absent
|
|
51
|
-
// member is `undefined` rather than the real function — the page would
|
|
52
|
-
// throw on EVERY render here, not only the two (g) cases. Bound to the SAME
|
|
53
|
-
// jest.fn() the flag already drives, so every case below keeps the exact
|
|
54
|
-
// truth value and the exact expectation it was written with: no assertion
|
|
55
|
-
// in this file changes. Same remedy, same reason, as the sibling
|
|
56
|
-
// `auth-pages.test.tsx` mock.
|
|
57
|
-
resetSendConfigured: () => mockIsResetAvailable(),
|
|
58
|
-
}));
|
|
59
|
-
|
|
60
|
-
const mockSocial = jest.fn();
|
|
61
|
-
const mockEmail = jest.fn();
|
|
62
|
-
jest.mock("better-auth/react", () => ({
|
|
63
|
-
__esModule: true,
|
|
64
|
-
createAuthClient: () => ({
|
|
65
|
-
signIn: {
|
|
66
|
-
social: (...args: unknown[]) => mockSocial(...args),
|
|
67
|
-
email: (...args: unknown[]) => mockEmail(...args),
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
}));
|
|
71
|
-
|
|
72
|
-
// #8790 D2 — the spoke back link. The hub's secret and the registry read are
|
|
73
|
-
// the two boundaries the page crosses; the continuation itself is REAL
|
|
74
|
-
// (minted below with the same test secret), so the sealed-ref path is covered.
|
|
75
|
-
const TEST_SECRET = "test-secret-for-the-sign-in-page-suite";
|
|
76
|
-
// eslint-disable-next-line no-restricted-syntax -- #507: mock-internal rewrite pending; auth.ts is Better Auth's server singleton (a DB/HTTP boundary)
|
|
77
|
-
jest.mock("../../../../../auth", () => ({
|
|
78
|
-
__esModule: true,
|
|
79
|
-
resolveSecret: () => TEST_SECRET,
|
|
80
|
-
}));
|
|
81
|
-
// #11095 D7 — the remembered-method cookie, read through `cookies()`.
|
|
82
|
-
const mockCookies: Record<string, string> = {};
|
|
83
|
-
jest.mock("next/headers", () => ({
|
|
84
|
-
__esModule: true,
|
|
85
|
-
cookies: async () => ({
|
|
86
|
-
get: (name: string) =>
|
|
87
|
-
name in mockCookies ? { name, value: mockCookies[name] } : undefined,
|
|
88
|
-
}),
|
|
89
|
-
}));
|
|
90
|
-
const mockClientInfo = jest.fn();
|
|
91
|
-
jest.mock("@working-theory/api-client", () => ({
|
|
92
|
-
__esModule: true,
|
|
93
|
-
hubSignIn: { clientInfo: (...args: unknown[]) => mockClientInfo(...args) },
|
|
94
|
-
}));
|
|
95
|
-
// The global shim (__tests__/__mocks__/next-intl-server.ts) returns messages
|
|
96
|
-
// uninterpolated; this suite fills `{name}` placeholders so the heading's
|
|
97
|
-
// organization name is the one the page actually passed (#9662).
|
|
98
|
-
jest.mock("next-intl/server", () => {
|
|
99
|
-
const messages = jest.requireActual("../../../../../messages/en.json") as Record<
|
|
100
|
-
string,
|
|
101
|
-
Record<string, string>
|
|
102
|
-
>;
|
|
103
|
-
return {
|
|
104
|
-
__esModule: true,
|
|
105
|
-
getTranslations: async ({ namespace }: { namespace: string }) => {
|
|
106
|
-
const catalog = messages[namespace];
|
|
107
|
-
const t = (key: string, values?: Record<string, string>): string =>
|
|
108
|
-
(catalog?.[key] ?? `${namespace}.${key}`).replace(
|
|
109
|
-
/\{(\w+)\}/g,
|
|
110
|
-
(match, name: string) => values?.[name] ?? match,
|
|
111
|
-
);
|
|
112
|
-
t.has = (key: string): boolean => catalog?.[key] !== undefined;
|
|
113
|
-
return t;
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
import { mintContinuation } from "../../../../api/auth/hub/continuation";
|
|
119
|
-
import { SITE_NAME } from "../../../../../lib/site-brand";
|
|
120
|
-
import en from "../../../../../messages/en.json";
|
|
121
|
-
import Page, { generateMetadata } from "../page";
|
|
122
|
-
|
|
123
|
-
async function renderPage(next?: string, error?: string): Promise<void> {
|
|
124
|
-
const el = await Page({
|
|
125
|
-
params: Promise.resolve({ locale: "en" }),
|
|
126
|
-
searchParams: Promise.resolve({
|
|
127
|
-
...(next === undefined ? {} : { next }),
|
|
128
|
-
...(error === undefined ? {} : { error }),
|
|
129
|
-
}),
|
|
130
|
-
});
|
|
131
|
-
render(el);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
beforeEach(() => {
|
|
135
|
-
for (const name of Object.keys(mockCookies)) delete mockCookies[name];
|
|
136
|
-
mockGetActiveProviderIds.mockReset().mockReturnValue(["google"]);
|
|
137
|
-
mockIsResetAvailable.mockReset().mockReturnValue(false);
|
|
138
|
-
mockSocial.mockReset().mockResolvedValue({ data: {}, error: null });
|
|
139
|
-
mockEmail.mockReset().mockResolvedValue({ data: {}, error: null });
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
describe("generateMetadata()", () => {
|
|
143
|
-
it("uses the signIn namespace title + description", async () => {
|
|
144
|
-
const meta = await generateMetadata({
|
|
145
|
-
params: Promise.resolve({ locale: "en" }),
|
|
146
|
-
searchParams: Promise.resolve({}),
|
|
147
|
-
});
|
|
148
|
-
expect(meta.title).toBe(en.signIn.title);
|
|
149
|
-
expect(meta.description).toBe(en.signIn.description);
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
describe("/sign-in page", () => {
|
|
154
|
-
it("(a) OAuth-only: sso body with exactly the reported provider, no sign-up footer", async () => {
|
|
155
|
-
await renderPage("/account");
|
|
156
|
-
expect(screen.getByTestId("sign-in-page")).toBeInTheDocument();
|
|
157
|
-
expect(screen.getByTestId("auth-card")).toBeInTheDocument();
|
|
158
|
-
expect(screen.getByTestId("auth-sso-google")).toBeInTheDocument();
|
|
159
|
-
expect(screen.queryByTestId("auth-sso-github")).toBeNull();
|
|
160
|
-
expect(screen.queryByTestId("auth-email")).toBeNull();
|
|
161
|
-
expect(screen.queryByTestId("auth-submit")).toBeNull();
|
|
162
|
-
expect(screen.queryByTestId("auth-footer-link")).toBeNull();
|
|
163
|
-
expect(screen.queryByText(/create an account/i)).toBeNull();
|
|
164
|
-
expect(
|
|
165
|
-
screen.getByRole("heading", { name: `Sign in to ${SITE_NAME}` }),
|
|
166
|
-
).toBeInTheDocument();
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it("(b) email + OAuth: password body with both social buttons, no sign-up footer", async () => {
|
|
170
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "github", "email"]);
|
|
171
|
-
await renderPage("/account");
|
|
172
|
-
expect(screen.getByTestId("auth-email")).toBeInTheDocument();
|
|
173
|
-
expect(screen.getByTestId("auth-password")).toBeInTheDocument();
|
|
174
|
-
expect(screen.getByTestId("auth-social-row")).toBeInTheDocument();
|
|
175
|
-
expect(screen.getByTestId("auth-social-google")).toBeInTheDocument();
|
|
176
|
-
expect(screen.getByTestId("auth-social-github")).toBeInTheDocument();
|
|
177
|
-
expect(screen.queryByTestId("auth-sso-stack")).toBeNull();
|
|
178
|
-
expect(screen.queryByTestId("auth-footer-link")).toBeNull();
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it("(c) zero providers: inert card with the not-configured subhead, no buttons, no form", async () => {
|
|
182
|
-
mockGetActiveProviderIds.mockReturnValue([]);
|
|
183
|
-
await renderPage();
|
|
184
|
-
expect(screen.getByTestId("auth-card")).toBeInTheDocument();
|
|
185
|
-
expect(screen.queryByTestId("auth-sso-google")).toBeNull();
|
|
186
|
-
expect(screen.queryByTestId("auth-sso-github")).toBeNull();
|
|
187
|
-
expect(screen.queryByTestId("auth-submit")).toBeNull();
|
|
188
|
-
expect(screen.queryByTestId("auth-email")).toBeNull();
|
|
189
|
-
expect(
|
|
190
|
-
screen.getByText(en.signIn.notConfiguredSubhead),
|
|
191
|
-
).toBeInTheDocument();
|
|
192
|
-
expect(mockSocial).not.toHaveBeenCalled();
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it("(d) provider click launches signIn.social with the sanitised next path", async () => {
|
|
196
|
-
const user = userEvent.setup();
|
|
197
|
-
await renderPage("/account");
|
|
198
|
-
await user.click(screen.getByTestId("auth-sso-google"));
|
|
199
|
-
expect(mockSocial).toHaveBeenCalledTimes(1);
|
|
200
|
-
expect(mockSocial).toHaveBeenCalledWith({
|
|
201
|
-
provider: "google",
|
|
202
|
-
callbackURL: "/account",
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
it("(d) a failed provider launch renders the providerFailed message", async () => {
|
|
207
|
-
const user = userEvent.setup();
|
|
208
|
-
mockSocial.mockResolvedValue({ data: null, error: { message: "nope" } });
|
|
209
|
-
await renderPage("/account");
|
|
210
|
-
await user.click(screen.getByTestId("auth-sso-google"));
|
|
211
|
-
expect(
|
|
212
|
-
await screen.findByText(en.signIn.providerFailed),
|
|
213
|
-
).toBeInTheDocument();
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
it("(e) a protocol-relative ?next= falls back to /account", async () => {
|
|
217
|
-
const user = userEvent.setup();
|
|
218
|
-
await renderPage("//evil.com");
|
|
219
|
-
await user.click(screen.getByTestId("auth-sso-google"));
|
|
220
|
-
expect(mockSocial).toHaveBeenCalledWith({
|
|
221
|
-
provider: "google",
|
|
222
|
-
callbackURL: "/account",
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
it("(f) password submit calls signIn.email and surfaces signInFailed on error", async () => {
|
|
227
|
-
const user = userEvent.setup();
|
|
228
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "email"]);
|
|
229
|
-
mockEmail.mockResolvedValue({ data: null, error: { message: "bad" } });
|
|
230
|
-
await renderPage("/en/account?tab=x");
|
|
231
|
-
await user.type(screen.getByTestId("auth-email"), "ada@example.com");
|
|
232
|
-
await user.type(screen.getByTestId("auth-password"), "s3cr3t");
|
|
233
|
-
await user.click(screen.getByTestId("auth-submit"));
|
|
234
|
-
expect(mockEmail).toHaveBeenCalledWith({
|
|
235
|
-
email: "ada@example.com",
|
|
236
|
-
password: "s3cr3t",
|
|
237
|
-
callbackURL: "/en/account?tab=x",
|
|
238
|
-
});
|
|
239
|
-
expect(await screen.findByText(en.signIn.signInFailed)).toBeInTheDocument();
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
it("(f) a rejected signIn.email call surfaces signInFailed too (code review, #6018)", async () => {
|
|
243
|
-
const user = userEvent.setup();
|
|
244
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "email"]);
|
|
245
|
-
mockEmail.mockRejectedValue(new Error("network"));
|
|
246
|
-
await renderPage("/account");
|
|
247
|
-
await user.type(screen.getByTestId("auth-email"), "ada@example.com");
|
|
248
|
-
await user.type(screen.getByTestId("auth-password"), "s3cr3t");
|
|
249
|
-
await user.click(screen.getByTestId("auth-submit"));
|
|
250
|
-
expect(await screen.findByText(en.signIn.signInFailed)).toBeInTheDocument();
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
it("(g) renders the forgot link when password reset is available", async () => {
|
|
254
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "email"]);
|
|
255
|
-
mockIsResetAvailable.mockReturnValue(true);
|
|
256
|
-
await renderPage("/account");
|
|
257
|
-
expect(screen.getByTestId("auth-forgot")).toHaveAttribute(
|
|
258
|
-
"href",
|
|
259
|
-
"/forgot-password",
|
|
260
|
-
);
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
it("(g) omits the forgot link when password reset is unavailable", async () => {
|
|
264
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "email"]);
|
|
265
|
-
mockIsResetAvailable.mockReturnValue(false);
|
|
266
|
-
await renderPage("/account");
|
|
267
|
-
expect(screen.getByTestId("auth-password")).toBeInTheDocument();
|
|
268
|
-
expect(screen.queryByTestId("auth-forgot")).toBeNull();
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
describe("/sign-in page — the email sign-in link (#7435)", () => {
|
|
273
|
-
it("(h) renders no email-link form when 'magic-link' is not active", async () => {
|
|
274
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "email"]);
|
|
275
|
-
await renderPage("/account");
|
|
276
|
-
expect(screen.queryByTestId("auth-email-link-form")).toBeNull();
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
it("(h) with google + magic-link: the Google button and 'Email me a sign-in link'", async () => {
|
|
280
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "magic-link"]);
|
|
281
|
-
await renderPage("/account");
|
|
282
|
-
// Google sits under the "or" as a social button, no longer an SSO stack.
|
|
283
|
-
expect(screen.getByTestId("auth-social-google")).toBeInTheDocument();
|
|
284
|
-
expect(screen.queryByTestId("auth-sso-google")).toBeNull();
|
|
285
|
-
expect(screen.getByTestId("auth-submit")).toHaveTextContent(
|
|
286
|
-
en.signIn.emailLinkSubmit,
|
|
287
|
-
);
|
|
288
|
-
expect(en.signIn.emailLinkSubmit).toBe("Send me a magic link");
|
|
289
|
-
// One "or" divider between the primary and Google (#8790 D5).
|
|
290
|
-
expect(screen.getAllByTestId("auth-divider")).toHaveLength(1);
|
|
291
|
-
expect(screen.queryByTestId("auth-email-link-divider")).toBeNull();
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it("(h) with magic-link only: the form renders and the not-configured subhead does not", async () => {
|
|
295
|
-
mockGetActiveProviderIds.mockReturnValue(["magic-link"]);
|
|
296
|
-
await renderPage();
|
|
297
|
-
expect(screen.getByTestId("auth-email")).toBeInTheDocument();
|
|
298
|
-
expect(screen.queryByText(en.signIn.notConfiguredSubhead)).toBeNull();
|
|
299
|
-
// The heading stands alone — no subhead (#8790 D3); #9662 names the site.
|
|
300
|
-
expect(
|
|
301
|
-
screen.getByRole("heading", { name: `Sign in to ${SITE_NAME}` }),
|
|
302
|
-
).toBeInTheDocument();
|
|
303
|
-
expect(en.signIn.heading).toBe("Sign in to {site}");
|
|
304
|
-
expect(screen.queryByTestId("auth-method-switch")).toBeNull();
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
it("(h) beside the password form when the password method is active too", async () => {
|
|
308
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "email", "magic-link"]);
|
|
309
|
-
await renderPage("/account");
|
|
310
|
-
// The sign-in link leads; the password is one quiet switch away, in place
|
|
311
|
-
// (#8790 D4), and the typed email survives the switch.
|
|
312
|
-
expect(screen.queryByTestId("auth-password")).toBeNull();
|
|
313
|
-
expect(screen.getByTestId("auth-submit")).toHaveTextContent(
|
|
314
|
-
en.signIn.emailLinkSubmit,
|
|
315
|
-
);
|
|
316
|
-
const user = userEvent.setup();
|
|
317
|
-
await user.type(screen.getByTestId("auth-email"), "member@example.com");
|
|
318
|
-
await user.click(screen.getByTestId("auth-method-switch"));
|
|
319
|
-
expect(screen.getByTestId("auth-password")).toBeInTheDocument();
|
|
320
|
-
expect(screen.getByTestId("auth-email")).toHaveValue("member@example.com");
|
|
321
|
-
expect(screen.getByTestId("auth-submit")).toHaveTextContent(
|
|
322
|
-
en.signIn.submit,
|
|
323
|
-
);
|
|
324
|
-
expect(screen.getByTestId("auth-method-switch")).toHaveTextContent(
|
|
325
|
-
en.signIn.useEmailLink,
|
|
326
|
-
);
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
it.each(["INVALID_TOKEN", "new_user_signup_disabled"])(
|
|
330
|
-
"(h) ?error=%s renders the expired-link notice",
|
|
331
|
-
async (error) => {
|
|
332
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "magic-link"]);
|
|
333
|
-
await renderPage("/account", error);
|
|
334
|
-
expect(screen.getByTestId("sign-in-link-notice")).toHaveTextContent(
|
|
335
|
-
en.signIn.emailLinkExpired,
|
|
336
|
-
);
|
|
337
|
-
},
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
it("(h) any other ?error renders signInFailed and never echoes the value", async () => {
|
|
341
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "magic-link"]);
|
|
342
|
-
await renderPage("/account", "<script>alert(1)</script>");
|
|
343
|
-
expect(screen.getByTestId("sign-in-link-notice")).toHaveTextContent(
|
|
344
|
-
en.signIn.signInFailed,
|
|
345
|
-
);
|
|
346
|
-
expect(document.body.innerHTML).not.toContain("alert(1)");
|
|
347
|
-
expect(document.body.innerHTML).not.toContain("<script");
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
it("(h) no ?error → no notice", async () => {
|
|
351
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "magic-link"]);
|
|
352
|
-
await renderPage("/account");
|
|
353
|
-
expect(screen.queryByTestId("sign-in-link-notice")).toBeNull();
|
|
354
|
-
});
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
describe("/sign-in page — the spoke back link (#8790 D2)", () => {
|
|
358
|
-
beforeEach(() => {
|
|
359
|
-
mockClientInfo.mockReset();
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
it("names the spoke from the registry when the continuation opens", async () => {
|
|
363
|
-
mockClientInfo.mockResolvedValue({
|
|
364
|
-
ok: true,
|
|
365
|
-
body: {
|
|
366
|
-
clientId: "spoke_1",
|
|
367
|
-
name: "Wendi Henry",
|
|
368
|
-
origin: "https://wendihenry.com",
|
|
369
|
-
},
|
|
370
|
-
});
|
|
371
|
-
const ref = mintContinuation(
|
|
372
|
-
"client_id=spoke_1&response_type=code",
|
|
373
|
-
TEST_SECRET,
|
|
374
|
-
);
|
|
375
|
-
await renderPage(`/api/auth/hub/continue/${ref}`);
|
|
376
|
-
expect(mockClientInfo).toHaveBeenCalledWith("spoke_1");
|
|
377
|
-
const back = screen.getByTestId("auth-back-link");
|
|
378
|
-
// #11095 D5: the spoke's home — its /account would start the hub hop again.
|
|
379
|
-
expect(back).toHaveAttribute("href", "https://wendihenry.com/");
|
|
380
|
-
// This suite's next-intl shim returns messages uninterpolated, so the
|
|
381
|
-
// label's shape is what is asserted here; the ICU fill is next-intl's.
|
|
382
|
-
expect(back).toHaveTextContent(/^Back to/);
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
it("renders no back link when the registry does not know the client", async () => {
|
|
386
|
-
mockClientInfo.mockResolvedValue({ ok: false, status: 404 });
|
|
387
|
-
const ref = mintContinuation("client_id=spoke_gone", TEST_SECRET);
|
|
388
|
-
await renderPage(`/api/auth/hub/continue/${ref}`);
|
|
389
|
-
expect(screen.queryByTestId("auth-back-link")).toBeNull();
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
it("renders no back link on a direct visit", async () => {
|
|
393
|
-
await renderPage("/account");
|
|
394
|
-
expect(screen.queryByTestId("auth-back-link")).toBeNull();
|
|
395
|
-
});
|
|
396
|
-
|
|
397
|
-
it("renders no back link, and no error, when the continuation cannot be opened", async () => {
|
|
398
|
-
// A continuation-shaped `next` whose ref is garbage: the secret load or
|
|
399
|
-
// the open throws, and the page degrades to the direct-visit render.
|
|
400
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "magic-link"]);
|
|
401
|
-
await renderPage("/api/auth/hub/continue/not-a-real-continuation");
|
|
402
|
-
expect(screen.queryByTestId("auth-back-link")).toBeNull();
|
|
403
|
-
expect(screen.getByTestId("auth-email")).toBeInTheDocument();
|
|
404
|
-
});
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
describe("/sign-in page — the hinted email (#8757 D9)", () => {
|
|
408
|
-
async function renderWithEmail(email?: string | string[]): Promise<void> {
|
|
409
|
-
const el = await Page({
|
|
410
|
-
params: Promise.resolve({ locale: "en" }),
|
|
411
|
-
searchParams: Promise.resolve({
|
|
412
|
-
next: "/account",
|
|
413
|
-
...(email === undefined ? {} : { email }),
|
|
414
|
-
}),
|
|
415
|
-
});
|
|
416
|
-
render(el);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
function emailInputs(): HTMLInputElement[] {
|
|
420
|
-
return Array.from(
|
|
421
|
-
document.querySelectorAll<HTMLInputElement>('input[type="email"]'),
|
|
422
|
-
);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
beforeEach(() => {
|
|
426
|
-
// One email input on the card (#8790 D4): the sign-in link and the password share it.
|
|
427
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "email", "magic-link"]);
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
it("(i) ?email=a%40b.example → the card's email input has that value", async () => {
|
|
431
|
-
// Next hands the page the decoded value.
|
|
432
|
-
await renderWithEmail("a@b.example");
|
|
433
|
-
const inputs = emailInputs();
|
|
434
|
-
expect(inputs).toHaveLength(1);
|
|
435
|
-
expect(screen.getByTestId("auth-email")).toHaveValue("a@b.example");
|
|
436
|
-
for (const input of inputs) expect(input).toHaveValue("a@b.example");
|
|
437
|
-
// A starting value only — nothing was sent.
|
|
438
|
-
expect(mockEmail).not.toHaveBeenCalled();
|
|
439
|
-
expect(mockSocial).not.toHaveBeenCalled();
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
it.each([
|
|
443
|
-
["an invalid value (?email=nope)", "nope"],
|
|
444
|
-
[
|
|
445
|
-
"a repeated value (?email=a%40b.example&email=c%40d.example)",
|
|
446
|
-
["a@b.example", "c@d.example"],
|
|
447
|
-
],
|
|
448
|
-
["a value carrying a query separator", "a@b.example&next=/x"],
|
|
449
|
-
["no parameter", undefined],
|
|
450
|
-
] as const)(
|
|
451
|
-
"(i) %s → empty email inputs, as today",
|
|
452
|
-
async (_label, email) => {
|
|
453
|
-
await renderWithEmail(
|
|
454
|
-
email === undefined || typeof email === "string" ? email : [...email],
|
|
455
|
-
);
|
|
456
|
-
const inputs = emailInputs();
|
|
457
|
-
expect(inputs).toHaveLength(1);
|
|
458
|
-
for (const input of inputs) {
|
|
459
|
-
expect(input).toHaveValue("");
|
|
460
|
-
expect(input).not.toHaveAttribute("value");
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
);
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
describe("/sign-in page — the one card (#9662)", () => {
|
|
467
|
-
beforeEach(() => {
|
|
468
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "email", "magic-link"]);
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
it("(j) renders the site's logo and 'Sign in to <site>' from the deployment's data", async () => {
|
|
472
|
-
await renderPage("/account");
|
|
473
|
-
expect(screen.getByTestId("auth-card-logo")).toBeInTheDocument();
|
|
474
|
-
expect(screen.getByRole("heading", { level: 2 })).toHaveTextContent(
|
|
475
|
-
`Sign in to ${SITE_NAME}`,
|
|
476
|
-
);
|
|
477
|
-
expect(screen.getByLabelText(en.signIn.email)).toBe(
|
|
478
|
-
screen.getByTestId("auth-email"),
|
|
479
|
-
);
|
|
480
|
-
expect(en.signIn.email).toBe("Email");
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
it("(j) a crafted query parameter cannot change the organization name", async () => {
|
|
484
|
-
const crafted = "Evil Corp";
|
|
485
|
-
expect(SITE_NAME).not.toBe(crafted);
|
|
486
|
-
const el = await Page({
|
|
487
|
-
params: Promise.resolve({ locale: "en" }),
|
|
488
|
-
searchParams: Promise.resolve({
|
|
489
|
-
next: `/account?site=${encodeURIComponent(crafted)}`,
|
|
490
|
-
site: crafted,
|
|
491
|
-
organization: crafted,
|
|
492
|
-
name: crafted,
|
|
493
|
-
siteName: crafted,
|
|
494
|
-
}),
|
|
495
|
-
});
|
|
496
|
-
render(el);
|
|
497
|
-
expect(screen.getByRole("heading", { level: 2 })).toHaveTextContent(
|
|
498
|
-
`Sign in to ${SITE_NAME}`,
|
|
499
|
-
);
|
|
500
|
-
expect(document.body.textContent).not.toContain(crafted);
|
|
501
|
-
});
|
|
502
|
-
|
|
503
|
-
it("(j) the prospect line toggles to /sign-up, with no trailing period", async () => {
|
|
504
|
-
await renderPage("/account");
|
|
505
|
-
expect(screen.getByTestId("auth-card-prospect")).toHaveTextContent(
|
|
506
|
-
/^Don't have an account\? Sign up$/,
|
|
507
|
-
);
|
|
508
|
-
expect(screen.getByTestId("auth-card-prospect-link")).toHaveAttribute(
|
|
509
|
-
"href",
|
|
510
|
-
"/sign-up",
|
|
511
|
-
);
|
|
512
|
-
});
|
|
513
|
-
|
|
514
|
-
it("(j) 'Send me a magic link' first, the in-place password switch, then 'or' and Google", async () => {
|
|
515
|
-
await renderPage("/account");
|
|
516
|
-
expect(screen.getByTestId("auth-submit")).toHaveTextContent(
|
|
517
|
-
"Send me a magic link",
|
|
518
|
-
);
|
|
519
|
-
expect(screen.getByTestId("auth-method-switch")).toHaveTextContent(
|
|
520
|
-
"Sign in using password",
|
|
521
|
-
);
|
|
522
|
-
expect(screen.getByTestId("auth-divider")).toHaveTextContent(/^or$/);
|
|
523
|
-
expect(screen.getByTestId("auth-social-google")).toBeInTheDocument();
|
|
524
|
-
});
|
|
525
|
-
|
|
526
|
-
it("(j) ends on the Terms of Service + Privacy Policy acknowledgement, linking the site's own routes", async () => {
|
|
527
|
-
await renderPage("/account");
|
|
528
|
-
const footnote = screen.getByTestId("auth-card-footnote");
|
|
529
|
-
expect(footnote).toHaveTextContent(
|
|
530
|
-
/^You acknowledge that you read, and agree to our Terms of Service and our Privacy Policy\.$/,
|
|
531
|
-
);
|
|
532
|
-
expect(
|
|
533
|
-
within(footnote).getByRole("link", { name: "Terms of Service" }),
|
|
534
|
-
).toHaveAttribute("href", "/terms");
|
|
535
|
-
expect(
|
|
536
|
-
within(footnote).getByRole("link", { name: "Privacy Policy" }),
|
|
537
|
-
).toHaveAttribute("href", "/privacy");
|
|
538
|
-
expect(within(footnote).getAllByRole("link")).toHaveLength(2);
|
|
539
|
-
});
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
describe("/sign-in page — the Sign up toggle keeps the next (#9912 D4)", () => {
|
|
543
|
-
beforeEach(() => {
|
|
544
|
-
mockClientInfo.mockReset().mockResolvedValue({ ok: false, status: 404 });
|
|
545
|
-
});
|
|
546
|
-
|
|
547
|
-
it("(k) a continuation next rides the toggle to /sign-up, URL-encoded", async () => {
|
|
548
|
-
const ref = mintContinuation("client_id=spoke_1", TEST_SECRET);
|
|
549
|
-
const next = `/api/auth/hub/continue/${ref}`;
|
|
550
|
-
await renderPage(next);
|
|
551
|
-
expect(screen.getByTestId("auth-card-prospect-link")).toHaveAttribute(
|
|
552
|
-
"href",
|
|
553
|
-
`/sign-up?next=${encodeURIComponent(next)}`,
|
|
554
|
-
);
|
|
555
|
-
});
|
|
556
|
-
|
|
557
|
-
it("(k) an in-app next rides the toggle too", async () => {
|
|
558
|
-
await renderPage("/account/billing");
|
|
559
|
-
expect(screen.getByTestId("auth-card-prospect-link")).toHaveAttribute(
|
|
560
|
-
"href",
|
|
561
|
-
"/sign-up?next=%2Faccount%2Fbilling",
|
|
562
|
-
);
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
it.each([
|
|
566
|
-
["a protocol-relative next", "//evil.example"],
|
|
567
|
-
["an absolute next", "https://evil.example/x"],
|
|
568
|
-
["a backslash next", "/\\evil.example"],
|
|
569
|
-
["a control character", "/x\r\ny"],
|
|
570
|
-
])(
|
|
571
|
-
"(k) %s fails resolveNextPath, so the toggle is the bare /sign-up",
|
|
572
|
-
async (_label, next) => {
|
|
573
|
-
await renderPage(next);
|
|
574
|
-
expect(screen.getByTestId("auth-card-prospect-link")).toHaveAttribute(
|
|
575
|
-
"href",
|
|
576
|
-
"/sign-up",
|
|
577
|
-
);
|
|
578
|
-
},
|
|
579
|
-
);
|
|
580
|
-
|
|
581
|
-
it("(k) no next: the bare /sign-up", async () => {
|
|
582
|
-
await renderPage();
|
|
583
|
-
expect(screen.getByTestId("auth-card-prospect-link")).toHaveAttribute(
|
|
584
|
-
"href",
|
|
585
|
-
"/sign-up",
|
|
586
|
-
);
|
|
587
|
-
});
|
|
588
|
-
});
|
|
589
|
-
|
|
590
|
-
// #11095 AC-6 (D7): a returning person's card leads with the provider they
|
|
591
|
-
// last launched; a value that does not parse changes nothing.
|
|
592
|
-
describe("/sign-in page — the remembered method (#11095 D7)", () => {
|
|
593
|
-
it("with ailk-sign-in-method=google: Continue with Google first, no email field, and Use another way restores the card", async () => {
|
|
594
|
-
const user = userEvent.setup();
|
|
595
|
-
mockGetActiveProviderIds.mockReturnValue(["google", "magic-link"]);
|
|
596
|
-
mockCookies["ailk-sign-in-method"] = "google";
|
|
597
|
-
await renderPage();
|
|
598
|
-
const lead = screen.getByTestId("auth-sso-google");
|
|
599
|
-
expect(lead).toHaveTextContent(`${en.signIn.continueWith} ${en.signIn.google}`);
|
|
600
|
-
expect(screen.getAllByRole("button")[0]).toBe(lead);
|
|
601
|
-
expect(screen.queryByTestId("auth-email")).toBeNull();
|
|
602
|
-
const another = screen.getByTestId("sign-in-use-another-way");
|
|
603
|
-
expect(another).toHaveTextContent(en.signIn.useAnotherWay);
|
|
604
|
-
|
|
605
|
-
await user.click(another);
|
|
606
|
-
expect(screen.getByTestId("auth-email")).toBeInTheDocument();
|
|
607
|
-
expect(screen.getByTestId("auth-social-google")).toBeInTheDocument();
|
|
608
|
-
});
|
|
609
|
-
|
|
610
|
-
it.each([
|
|
611
|
-
["evil", ["google", "magic-link"]],
|
|
612
|
-
["github", ["google", "magic-link"]],
|
|
613
|
-
["", ["google", "magic-link"]],
|
|
614
|
-
])(
|
|
615
|
-
"a cookie of %j (not an active provider) renders exactly the no-cookie card",
|
|
616
|
-
async (value, active) => {
|
|
617
|
-
mockGetActiveProviderIds.mockReturnValue(active);
|
|
618
|
-
await renderPage();
|
|
619
|
-
const today = document.body.innerHTML;
|
|
620
|
-
document.body.innerHTML = "";
|
|
621
|
-
|
|
622
|
-
mockCookies["ailk-sign-in-method"] = value;
|
|
623
|
-
await renderPage();
|
|
624
|
-
expect(document.body.innerHTML).toBe(today);
|
|
625
|
-
expect(screen.queryByTestId("sign-in-use-another-way")).toBeNull();
|
|
626
|
-
},
|
|
627
|
-
);
|
|
628
|
-
});
|