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
package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx
DELETED
|
@@ -1,520 +0,0 @@
|
|
|
1
|
-
// oss: false
|
|
2
|
-
/**
|
|
3
|
-
* Tests for FlowStepperClient's permalink completion redirect on a
|
|
4
|
-
* `mode:"recommending"` flow (#4770 D1/D7/D12).
|
|
5
|
-
*
|
|
6
|
-
* A SEPARATE file from `FlowStepperClient.test.tsx` — the regression floor
|
|
7
|
-
* §5.2 requires stay UNEDITED — because that file's fixtures are all
|
|
8
|
-
* `qualifying`-shaped (no `mode`/`offers`), so it never exercises the
|
|
9
|
-
* recommending branch this spec adds. Scope extension (§4's own D6
|
|
10
|
-
* precedent): the smallest addition that gives AC5's two novel assertions a
|
|
11
|
-
* test home without touching the regression-floor file.
|
|
12
|
-
*
|
|
13
|
-
* AC5 (bullet 5, this file's half) — completing a recommending flow pushes
|
|
14
|
-
* the results permalink, whose decoded payload matches the answers
|
|
15
|
-
* submitted. (The qualifying-flow half of AC5 is already covered, unedited,
|
|
16
|
-
* by `FlowStepperClient.test.tsx`'s own AC1/AC4 suites.)
|
|
17
|
-
*
|
|
18
|
-
* AC5 (bullet 6) — a recommending flow whose field steps submitted an
|
|
19
|
-
* email, a name, a phone number, and free text produces a payload whose
|
|
20
|
-
* decoded answers contain NONE of those four submitted substrings, and
|
|
21
|
-
* whose keys are exactly the flow's segmentation question ids.
|
|
22
|
-
*
|
|
23
|
-
* `@working-theory/ui`'s FlowStepper is mocked as a minimal stub that
|
|
24
|
-
* captures the `onSubmitStep`/`onCompleted` props it receives, exactly as
|
|
25
|
-
* the sibling file does — this file's scope is FlowStepperClient's own
|
|
26
|
-
* wiring, not FlowStepper's own submission/step-navigation behavior
|
|
27
|
-
* (covered by its own package test).
|
|
28
|
-
*/
|
|
29
|
-
import { render } from "@testing-library/react";
|
|
30
|
-
import type { FlowConfig } from "@working-theory/validation";
|
|
31
|
-
import { decodePermalink } from "@working-theory/validation";
|
|
32
|
-
import type { ReactElement } from "react";
|
|
33
|
-
|
|
34
|
-
const mockPush = jest.fn();
|
|
35
|
-
jest.mock("next/navigation", () => ({
|
|
36
|
-
useRouter: () => ({ push: mockPush }),
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
jest.mock("next-intl", () => ({
|
|
40
|
-
useTranslations: () => (key: string) => key,
|
|
41
|
-
useMessages: () => ({}),
|
|
42
|
-
}));
|
|
43
|
-
|
|
44
|
-
// FlowStepperClient binds onSubmitStep directly to this Server Action, and
|
|
45
|
-
// the boundary under test here is the onCompleted -> router.push wiring, not
|
|
46
|
-
// the action itself (covered by flow.actions.test.ts) — mirrors the sibling
|
|
47
|
-
// FlowStepperClient.test.tsx's identical narrow-scope justification.
|
|
48
|
-
// eslint-disable-next-line no-restricted-syntax -- see comment above
|
|
49
|
-
jest.mock("../flow.actions", () => ({
|
|
50
|
-
submitFlowStepAction: jest.fn(),
|
|
51
|
-
}));
|
|
52
|
-
|
|
53
|
-
interface MockFlowStepperProps {
|
|
54
|
-
onSubmitStep: (payload: {
|
|
55
|
-
stepKey: string;
|
|
56
|
-
values: Record<string, unknown>;
|
|
57
|
-
locale?: string;
|
|
58
|
-
}) => Promise<{
|
|
59
|
-
ok: boolean;
|
|
60
|
-
kind?: string;
|
|
61
|
-
response?: { completed: boolean; segment?: string };
|
|
62
|
-
}>;
|
|
63
|
-
onCompleted?: (result: { segment?: string }) => void;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let captured: MockFlowStepperProps | undefined;
|
|
67
|
-
|
|
68
|
-
jest.mock("@working-theory/ui-signal-collectors", () => ({
|
|
69
|
-
FlowStepper: (props: MockFlowStepperProps) => {
|
|
70
|
-
captured = props;
|
|
71
|
-
return require("react").createElement("div", {
|
|
72
|
-
"data-testid": "mock-flow-stepper",
|
|
73
|
-
}) as ReactElement;
|
|
74
|
-
},
|
|
75
|
-
}));
|
|
76
|
-
|
|
77
|
-
import { submitFlowStepAction } from "../flow.actions";
|
|
78
|
-
import { FlowStepperClient } from "../FlowStepperClient";
|
|
79
|
-
|
|
80
|
-
const mockSubmitFlowStepAction = submitFlowStepAction as jest.MockedFunction<
|
|
81
|
-
typeof submitFlowStepAction
|
|
82
|
-
>;
|
|
83
|
-
|
|
84
|
-
const SLUG = "ailk-recommender";
|
|
85
|
-
|
|
86
|
-
function recommendingFlowConfig(): FlowConfig {
|
|
87
|
-
return {
|
|
88
|
-
slug: SLUG,
|
|
89
|
-
defaultLocale: "en",
|
|
90
|
-
mode: "recommending",
|
|
91
|
-
steps: [
|
|
92
|
-
{
|
|
93
|
-
key: "team",
|
|
94
|
-
type: "segmentation",
|
|
95
|
-
copy: { title: { en: "Team" } },
|
|
96
|
-
questions: [
|
|
97
|
-
{
|
|
98
|
-
name: "team_size",
|
|
99
|
-
options: [
|
|
100
|
-
{ value: "solo", label: { en: "Solo" } },
|
|
101
|
-
{ value: "agency", label: { en: "Agency" } },
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: "wants_seo",
|
|
106
|
-
options: [
|
|
107
|
-
{ value: "yes", label: { en: "Yes" } },
|
|
108
|
-
{ value: "no", label: { en: "No" } },
|
|
109
|
-
],
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
key: "contact",
|
|
115
|
-
type: "field",
|
|
116
|
-
copy: { title: { en: "Contact" } },
|
|
117
|
-
fields: [
|
|
118
|
-
{
|
|
119
|
-
name: "email",
|
|
120
|
-
inputType: "email",
|
|
121
|
-
required: true,
|
|
122
|
-
copy: { label: { en: "Email" } },
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "name",
|
|
126
|
-
inputType: "text",
|
|
127
|
-
required: true,
|
|
128
|
-
copy: { label: { en: "Name" } },
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
name: "phone",
|
|
132
|
-
inputType: "tel",
|
|
133
|
-
copy: { label: { en: "Phone" } },
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: "message",
|
|
137
|
-
inputType: "textarea",
|
|
138
|
-
copy: { label: { en: "Message" } },
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
offers: [
|
|
144
|
-
{
|
|
145
|
-
key: "free_oss",
|
|
146
|
-
copy: { name: { en: "Free" } },
|
|
147
|
-
price: { kind: "label", label: { en: "Free" } },
|
|
148
|
-
rules: [
|
|
149
|
-
{
|
|
150
|
-
when: { answer: "team_size", eq: "solo" },
|
|
151
|
-
reason: { en: "You're solo" },
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
} as FlowConfig;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function pushedPayload(): string {
|
|
160
|
-
expect(mockPush).toHaveBeenCalledTimes(1);
|
|
161
|
-
const pushedUrl = mockPush.mock.calls[0]?.[0] as string;
|
|
162
|
-
const match = pushedUrl.match(new RegExp(`^/en/flows/${SLUG}/results/(.+)$`));
|
|
163
|
-
expect(match).not.toBeNull();
|
|
164
|
-
return match![1]!;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
beforeEach(() => {
|
|
168
|
-
mockPush.mockClear();
|
|
169
|
-
mockSubmitFlowStepAction.mockClear();
|
|
170
|
-
captured = undefined;
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
describe("FlowStepperClient — permalink completion on a recommending flow (#4770 AC5 bullet 5)", () => {
|
|
174
|
-
it("pushes the results permalink, whose decoded payload matches the answers submitted", async () => {
|
|
175
|
-
mockSubmitFlowStepAction.mockResolvedValueOnce({
|
|
176
|
-
ok: true,
|
|
177
|
-
response: {
|
|
178
|
-
sessionId: "sess1",
|
|
179
|
-
landed: "team",
|
|
180
|
-
nextStepKey: null,
|
|
181
|
-
completed: true,
|
|
182
|
-
},
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
render(
|
|
186
|
-
<FlowStepperClient
|
|
187
|
-
config={recommendingFlowConfig()}
|
|
188
|
-
locale="en"
|
|
189
|
-
slug={SLUG}
|
|
190
|
-
/>,
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
const result = await captured!.onSubmitStep({
|
|
194
|
-
stepKey: "team",
|
|
195
|
-
values: { team_size: "solo", wants_seo: "yes" },
|
|
196
|
-
locale: "en",
|
|
197
|
-
});
|
|
198
|
-
expect(result.ok).toBe(true);
|
|
199
|
-
|
|
200
|
-
captured!.onCompleted?.({});
|
|
201
|
-
|
|
202
|
-
const decoded = decodePermalink(pushedPayload());
|
|
203
|
-
expect(decoded.ok).toBe(true);
|
|
204
|
-
if (!decoded.ok) return;
|
|
205
|
-
expect(decoded.value.flowSlug).toBe(SLUG);
|
|
206
|
-
expect(decoded.value.answers).toEqual({
|
|
207
|
-
team_size: "solo",
|
|
208
|
-
wants_seo: "yes",
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
describe("FlowStepperClient — PII exclusion on a recommending flow (#4770 AC5 bullet 6)", () => {
|
|
214
|
-
it("excludes every field-step value; keys are exactly the segmentation question ids", async () => {
|
|
215
|
-
mockSubmitFlowStepAction
|
|
216
|
-
.mockResolvedValueOnce({
|
|
217
|
-
ok: true,
|
|
218
|
-
response: {
|
|
219
|
-
sessionId: "sess1",
|
|
220
|
-
landed: "team",
|
|
221
|
-
nextStepKey: "contact",
|
|
222
|
-
completed: false,
|
|
223
|
-
},
|
|
224
|
-
})
|
|
225
|
-
.mockResolvedValueOnce({
|
|
226
|
-
ok: true,
|
|
227
|
-
response: {
|
|
228
|
-
sessionId: "sess1",
|
|
229
|
-
landed: "contact",
|
|
230
|
-
nextStepKey: null,
|
|
231
|
-
completed: true,
|
|
232
|
-
},
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
render(
|
|
236
|
-
<FlowStepperClient
|
|
237
|
-
config={recommendingFlowConfig()}
|
|
238
|
-
locale="en"
|
|
239
|
-
slug={SLUG}
|
|
240
|
-
/>,
|
|
241
|
-
);
|
|
242
|
-
|
|
243
|
-
await captured!.onSubmitStep({
|
|
244
|
-
stepKey: "team",
|
|
245
|
-
values: { team_size: "agency", wants_seo: "no" },
|
|
246
|
-
locale: "en",
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
const PII_PAYLOAD = {
|
|
250
|
-
email: "jane@example.com",
|
|
251
|
-
name: "Jane Doe",
|
|
252
|
-
phone: "555-123-4567",
|
|
253
|
-
message: "Please reach out about the enterprise plan as soon as possible",
|
|
254
|
-
};
|
|
255
|
-
await captured!.onSubmitStep({
|
|
256
|
-
stepKey: "contact",
|
|
257
|
-
values: PII_PAYLOAD,
|
|
258
|
-
locale: "en",
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
captured!.onCompleted?.({});
|
|
262
|
-
|
|
263
|
-
const decoded = decodePermalink(pushedPayload());
|
|
264
|
-
expect(decoded.ok).toBe(true);
|
|
265
|
-
if (!decoded.ok) return;
|
|
266
|
-
|
|
267
|
-
expect(Object.keys(decoded.value.answers).sort()).toEqual([
|
|
268
|
-
"team_size",
|
|
269
|
-
"wants_seo",
|
|
270
|
-
]);
|
|
271
|
-
|
|
272
|
-
const serializedAnswers = JSON.stringify(decoded.value.answers);
|
|
273
|
-
for (const value of Object.values(PII_PAYLOAD)) {
|
|
274
|
-
expect(serializedAnswers).not.toContain(value);
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
// Code-review finding (#4770): the permalink's answer set must include the
|
|
280
|
-
// `whenHidden` auto-answers of a currently-hidden segmentation step —
|
|
281
|
-
// exactly what the server's own completion-payload assembly
|
|
282
|
-
// (flow-engine.ts's completeSubmission) merges in via `hiddenAnswers()` —
|
|
283
|
-
// so a cold-load recommendation never silently diverges from what the same
|
|
284
|
-
// walk would score through the server's own pipeline.
|
|
285
|
-
function recommendingFlowConfigWithHiddenStep(): FlowConfig {
|
|
286
|
-
return {
|
|
287
|
-
slug: SLUG,
|
|
288
|
-
defaultLocale: "en",
|
|
289
|
-
mode: "recommending",
|
|
290
|
-
steps: [
|
|
291
|
-
{
|
|
292
|
-
key: "team",
|
|
293
|
-
type: "segmentation",
|
|
294
|
-
copy: { title: { en: "Team" } },
|
|
295
|
-
questions: [
|
|
296
|
-
{
|
|
297
|
-
name: "team_size",
|
|
298
|
-
options: [
|
|
299
|
-
{ value: "solo", label: { en: "Solo" } },
|
|
300
|
-
{ value: "agency", label: { en: "Agency" } },
|
|
301
|
-
],
|
|
302
|
-
},
|
|
303
|
-
],
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
key: "extras",
|
|
307
|
-
type: "segmentation",
|
|
308
|
-
copy: { title: { en: "Extras" } },
|
|
309
|
-
// Hidden whenever team_size !== "agency" — never landed/submitted
|
|
310
|
-
// for a "solo" visitor, so its answer never reaches answersRef.
|
|
311
|
-
showIf: { answer: "team_size", eq: "agency" },
|
|
312
|
-
whenHidden: { extras_included: "none" },
|
|
313
|
-
questions: [
|
|
314
|
-
{
|
|
315
|
-
name: "extras_included",
|
|
316
|
-
options: [
|
|
317
|
-
{ value: "none", label: { en: "None" } },
|
|
318
|
-
{ value: "addon", label: { en: "Add-on" } },
|
|
319
|
-
],
|
|
320
|
-
},
|
|
321
|
-
],
|
|
322
|
-
},
|
|
323
|
-
],
|
|
324
|
-
offers: [
|
|
325
|
-
{
|
|
326
|
-
key: "free_oss",
|
|
327
|
-
copy: { name: { en: "Free" } },
|
|
328
|
-
price: { kind: "label", label: { en: "Free" } },
|
|
329
|
-
rules: [
|
|
330
|
-
{
|
|
331
|
-
when: { answer: "team_size", eq: "solo" },
|
|
332
|
-
reason: { en: "You're solo" },
|
|
333
|
-
},
|
|
334
|
-
],
|
|
335
|
-
},
|
|
336
|
-
],
|
|
337
|
-
} as FlowConfig;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
describe("FlowStepperClient — hidden-step whenHidden auto-answers reach the permalink (code-review finding, #4770)", () => {
|
|
341
|
-
it("includes a currently-hidden segmentation step's whenHidden auto-answer, never submitted directly", async () => {
|
|
342
|
-
mockSubmitFlowStepAction.mockResolvedValueOnce({
|
|
343
|
-
ok: true,
|
|
344
|
-
response: {
|
|
345
|
-
sessionId: "sess1",
|
|
346
|
-
landed: "team",
|
|
347
|
-
nextStepKey: null,
|
|
348
|
-
completed: true,
|
|
349
|
-
},
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
render(
|
|
353
|
-
<FlowStepperClient
|
|
354
|
-
config={recommendingFlowConfigWithHiddenStep()}
|
|
355
|
-
locale="en"
|
|
356
|
-
slug={SLUG}
|
|
357
|
-
/>,
|
|
358
|
-
);
|
|
359
|
-
|
|
360
|
-
// Only "team" is ever submitted — "extras" is hidden (showIf fails for
|
|
361
|
-
// team_size:"solo") and its step is never landed/submitted.
|
|
362
|
-
await captured!.onSubmitStep({
|
|
363
|
-
stepKey: "team",
|
|
364
|
-
values: { team_size: "solo" },
|
|
365
|
-
locale: "en",
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
captured!.onCompleted?.({});
|
|
369
|
-
|
|
370
|
-
const decoded = decodePermalink(pushedPayload());
|
|
371
|
-
expect(decoded.ok).toBe(true);
|
|
372
|
-
if (!decoded.ok) return;
|
|
373
|
-
|
|
374
|
-
expect(decoded.value.answers).toEqual({
|
|
375
|
-
team_size: "solo",
|
|
376
|
-
extras_included: "none",
|
|
377
|
-
});
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
// ─── #4842 AC-6 (the write half) — the walk's session id rides sessionStorage
|
|
382
|
-
// (additive; the cases above are the regression floor and stay as they were) ─
|
|
383
|
-
|
|
384
|
-
describe("FlowStepperClient — session hand-off on completion (#4842 AC-6, write half)", () => {
|
|
385
|
-
const STORAGE_KEY = `ailk:flow-session:${SLUG}`;
|
|
386
|
-
|
|
387
|
-
beforeEach(() => {
|
|
388
|
-
window.sessionStorage.clear();
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
it("a recommending completion writes the LAST onSubmitStep result's response.sessionId before router.push", async () => {
|
|
392
|
-
mockSubmitFlowStepAction
|
|
393
|
-
.mockResolvedValueOnce({
|
|
394
|
-
ok: true,
|
|
395
|
-
response: { sessionId: "sess-first", landed: "team", nextStepKey: "contact", completed: false },
|
|
396
|
-
})
|
|
397
|
-
.mockResolvedValueOnce({
|
|
398
|
-
ok: true,
|
|
399
|
-
response: { sessionId: "sess-last", landed: "contact", nextStepKey: null, completed: true },
|
|
400
|
-
});
|
|
401
|
-
let storedAtPush: string | null | undefined;
|
|
402
|
-
mockPush.mockImplementationOnce(() => {
|
|
403
|
-
storedAtPush = window.sessionStorage.getItem(STORAGE_KEY);
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
render(<FlowStepperClient config={recommendingFlowConfig()} locale="en" slug={SLUG} />);
|
|
407
|
-
|
|
408
|
-
await captured!.onSubmitStep({
|
|
409
|
-
stepKey: "team",
|
|
410
|
-
values: { team_size: "solo", wants_seo: "yes" },
|
|
411
|
-
locale: "en",
|
|
412
|
-
});
|
|
413
|
-
expect(window.sessionStorage.getItem(STORAGE_KEY)).toBeNull();
|
|
414
|
-
await captured!.onSubmitStep({
|
|
415
|
-
stepKey: "contact",
|
|
416
|
-
values: { email: "jane@example.com", name: "Jane" },
|
|
417
|
-
locale: "en",
|
|
418
|
-
});
|
|
419
|
-
expect(window.sessionStorage.getItem(STORAGE_KEY)).toBeNull();
|
|
420
|
-
|
|
421
|
-
captured!.onCompleted?.({});
|
|
422
|
-
|
|
423
|
-
expect(mockPush).toHaveBeenCalledTimes(1);
|
|
424
|
-
expect(storedAtPush).toBe("sess-last");
|
|
425
|
-
expect(window.sessionStorage.getItem(STORAGE_KEY)).toBe("sess-last");
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
it("a qualifying completion writes nothing", async () => {
|
|
429
|
-
mockSubmitFlowStepAction.mockResolvedValueOnce({
|
|
430
|
-
ok: true,
|
|
431
|
-
response: { sessionId: "sess-q", landed: "team", nextStepKey: null, completed: true },
|
|
432
|
-
});
|
|
433
|
-
const { mode: _mode, offers: _offers, ...qualifying } = recommendingFlowConfig();
|
|
434
|
-
|
|
435
|
-
render(<FlowStepperClient config={qualifying as FlowConfig} locale="en" slug={SLUG} />);
|
|
436
|
-
|
|
437
|
-
await captured!.onSubmitStep({
|
|
438
|
-
stepKey: "team",
|
|
439
|
-
values: { team_size: "solo", wants_seo: "yes" },
|
|
440
|
-
locale: "en",
|
|
441
|
-
});
|
|
442
|
-
captured!.onCompleted?.({});
|
|
443
|
-
|
|
444
|
-
expect(window.sessionStorage.getItem(STORAGE_KEY)).toBeNull();
|
|
445
|
-
});
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
// ─── #11013 spec E, D-J (AC-3) — a recommending flow with no offers now reaches
|
|
449
|
-
// the results page; a flow with offers pushes exactly as before ─────────────
|
|
450
|
-
|
|
451
|
-
describe("FlowStepperClient — the results push on a recommending flow with no offers (#11013 D-J, AC-3)", () => {
|
|
452
|
-
function noOffersConfig(extra: Record<string, unknown> = {}): FlowConfig {
|
|
453
|
-
const { offers: _offers, ...rest } = recommendingFlowConfig();
|
|
454
|
-
return { ...rest, ...extra } as FlowConfig;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
it("no offers, no by-result rows, no ending: the completed walk pushes the results permalink", async () => {
|
|
458
|
-
mockSubmitFlowStepAction.mockResolvedValueOnce({
|
|
459
|
-
ok: true,
|
|
460
|
-
response: { sessionId: "sess-r", landed: "team", nextStepKey: null, completed: true },
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
render(<FlowStepperClient config={noOffersConfig()} locale="en" slug={SLUG} />);
|
|
464
|
-
expect(captured?.onCompleted).toBeDefined();
|
|
465
|
-
|
|
466
|
-
await captured!.onSubmitStep({
|
|
467
|
-
stepKey: "team",
|
|
468
|
-
values: { team_size: "solo", wants_seo: "yes" },
|
|
469
|
-
locale: "en",
|
|
470
|
-
});
|
|
471
|
-
captured!.onCompleted?.({});
|
|
472
|
-
|
|
473
|
-
const decoded = decodePermalink(pushedPayload());
|
|
474
|
-
expect(decoded.ok).toBe(true);
|
|
475
|
-
if (!decoded.ok) return;
|
|
476
|
-
expect(decoded.value.answers).toEqual({ team_size: "solo", wants_seo: "yes" });
|
|
477
|
-
expect(window.sessionStorage.getItem(`ailk:flow-session:${SLUG}`)).toBe("sess-r");
|
|
478
|
-
});
|
|
479
|
-
|
|
480
|
-
it("a flow that is not recommending is passed no onCompleted and pushes nothing", async () => {
|
|
481
|
-
mockSubmitFlowStepAction.mockResolvedValueOnce({
|
|
482
|
-
ok: true,
|
|
483
|
-
response: { sessionId: "sess-q", landed: "team", nextStepKey: null, completed: true },
|
|
484
|
-
});
|
|
485
|
-
const { mode: _mode, ...qualifying } = noOffersConfig();
|
|
486
|
-
|
|
487
|
-
render(<FlowStepperClient config={qualifying as FlowConfig} locale="en" slug={SLUG} />);
|
|
488
|
-
expect(captured?.onCompleted).toBeUndefined();
|
|
489
|
-
await captured!.onSubmitStep({ stepKey: "team", values: { team_size: "solo" }, locale: "en" });
|
|
490
|
-
expect(mockPush).not.toHaveBeenCalled();
|
|
491
|
-
});
|
|
492
|
-
|
|
493
|
-
it("a recommending flow with an ending and offers is passed no onCompleted (the ending wins, D-I)", () => {
|
|
494
|
-
render(
|
|
495
|
-
<FlowStepperClient
|
|
496
|
-
config={{
|
|
497
|
-
...recommendingFlowConfig(),
|
|
498
|
-
ending: { default: { kind: "screen", headline: { en: "Done" } } },
|
|
499
|
-
} as FlowConfig}
|
|
500
|
-
locale="en"
|
|
501
|
-
slug={SLUG}
|
|
502
|
-
/>,
|
|
503
|
-
);
|
|
504
|
-
expect(captured?.onCompleted).toBeUndefined();
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
it("a recommending flow with offers and no ending pushes the permalink as at the pin", async () => {
|
|
508
|
-
mockSubmitFlowStepAction.mockResolvedValueOnce({
|
|
509
|
-
ok: true,
|
|
510
|
-
response: { sessionId: "sess-o", landed: "team", nextStepKey: null, completed: true },
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
render(<FlowStepperClient config={recommendingFlowConfig()} locale="en" slug={SLUG} />);
|
|
514
|
-
await captured!.onSubmitStep({ stepKey: "team", values: { team_size: "agency", wants_seo: "no" }, locale: "en" });
|
|
515
|
-
captured!.onCompleted?.({});
|
|
516
|
-
|
|
517
|
-
const decoded = decodePermalink(pushedPayload());
|
|
518
|
-
expect(decoded.ok && decoded.value.answers).toEqual({ team_size: "agency", wants_seo: "no" });
|
|
519
|
-
});
|
|
520
|
-
});
|