create-ailk 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -2
- 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 +7 -2
- package/dist/add-route.js +28 -13
- package/dist/cli.js +52 -0
- package/dist/declined-routes.d.ts +13 -0
- package/dist/declined-routes.js +74 -0
- package/dist/derive-architecture.d.ts +0 -6
- package/dist/derive-architecture.js +9 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/language-import.d.ts +93 -0
- package/dist/language-import.js +270 -43
- package/dist/lib/import-mdx.js +1 -1
- package/dist/lib/scaffold-render-sweep.d.ts +6 -3
- package/dist/lib/scaffold-render-sweep.js +8 -4
- package/dist/migrate-content.d.ts +6 -2
- package/dist/migrate-content.js +62 -5
- package/dist/module-architecture.js +139 -103
- package/dist/paid-sections.d.ts +13 -0
- package/dist/paid-sections.js +35 -5
- package/dist/programmatic.js +6 -16
- package/dist/remove-module.js +67 -0
- package/dist/routes.d.ts +103 -0
- package/dist/routes.js +708 -0
- package/dist/site-manifest.js +1 -1
- package/dist/site-roster.d.ts +2 -1
- package/dist/site-roster.js +30 -8
- package/dist/spoke-checkout.d.ts +28 -27
- package/dist/spoke-checkout.js +71 -102
- package/dist/surfaces.d.ts +18 -0
- package/dist/surfaces.js +47 -282
- package/dist/sync-routes.d.ts +28 -1
- package/dist/sync-routes.js +144 -11
- package/dist/template-record.d.ts +11 -0
- package/dist/template-record.js +18 -0
- package/dist/topology.d.ts +15 -1
- package/dist/topology.js +20 -4
- package/dist/update.d.ts +31 -2
- package/dist/update.js +627 -99
- package/package.json +3 -3
- package/templates/README.md +1 -1
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/CLAUDE.md +62 -20
- package/templates/apps/web/account.config.tsx +101 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
- package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
- package/templates/apps/web/app/[locale]/layout.tsx +45 -28
- package/templates/apps/web/app/apple-icon.tsx +72 -0
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
- package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
- package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
- package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
- package/templates/apps/web/app/og/route.tsx +155 -72
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
- package/templates/apps/web/i18n/request.ts +44 -1
- package/templates/apps/web/jest.config.cjs +13 -1
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
- package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
- package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
- package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
- package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
- package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
- package/templates/apps/web/lib/listings.tsx +2 -2
- package/templates/apps/web/lib/nav-label-keys.ts +16 -2
- package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
- package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
- package/templates/apps/web/lib/profile-back-link.ts +105 -32
- package/templates/apps/web/lib/served-pages.ts +95 -0
- package/templates/apps/web/lib/site-brand.tsx +3 -5
- package/templates/apps/web/messages/en.json +8 -684
- package/templates/apps/web/middleware.ts +3 -1
- package/templates/apps/web/next.config.mjs +27 -0
- package/templates/apps/web/package.json +1 -0
- package/templates/customizations.yaml +9 -0
- package/templates/package.json +3 -1
- package/templates/tools/lint-architecture.ts +164 -11
- package/versions.json +48 -47
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
- package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
- package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
- package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
- package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
- package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
- package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
- package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
- package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
- package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
- package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
- package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
- package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
- package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
- package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
- package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
- package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
- package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
- package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
- package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
- package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
- package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
- package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
- package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
- package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
- package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
- package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
- package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
- package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
- package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
- package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
- package/templates/apps/web/lib/account-config.ts +0 -678
- package/templates/apps/web/lib/checkout-config.ts +0 -16
- package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
- package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
// oss: false
|
|
2
|
-
/**
|
|
3
|
-
* The respondent's own score on the results page (#10828, redesigned by
|
|
4
|
-
* #11013 spec E, D-E; AC-3).
|
|
5
|
-
*
|
|
6
|
-
* A scored submission opens with the points as a display number, "of {max}"
|
|
7
|
-
* and the total's Level name, the Level chart beside it — five columns
|
|
8
|
-
* numbered 01–05, the respondent's filled, a marker at their rounded share of
|
|
9
|
-
* all points — then Report Compiled over one `ScoreBar` per dimension in
|
|
10
|
-
* register order, each named by the stored Level name else "L{n}". An
|
|
11
|
-
* unscored magnet (no scoring, or no points to score) renders none of the
|
|
12
|
-
* three. The results view draws no bar.
|
|
13
|
-
*
|
|
14
|
-
* Mocks mirror `ResultsClient.no-commerce.test.tsx`; the translator echoes
|
|
15
|
-
* its values so every interpolated message is observable.
|
|
16
|
-
*/
|
|
17
|
-
import { render, screen, within } from "@testing-library/react";
|
|
18
|
-
import type { FlowConfig } from "@working-theory/validation";
|
|
19
|
-
|
|
20
|
-
jest.mock("@working-theory/api-client", () => ({
|
|
21
|
-
__esModule: true,
|
|
22
|
-
flows: { get: jest.fn() },
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
// The boundary under test is ResultsClient's render, not the results-email
|
|
26
|
-
// action (save.actions.test.ts) — the narrow-scope mock ResultsClient's suites carry.
|
|
27
|
-
// eslint-disable-next-line no-restricted-syntax -- see comment above
|
|
28
|
-
jest.mock("../../../save.actions", () => ({
|
|
29
|
-
sendResultsEmailAction: jest.fn(),
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
jest.mock("next-intl", () => ({
|
|
33
|
-
__esModule: true,
|
|
34
|
-
useTranslations:
|
|
35
|
-
() =>
|
|
36
|
-
(key: string, values?: Record<string, unknown>): string =>
|
|
37
|
-
values === undefined
|
|
38
|
-
? key
|
|
39
|
-
: `${key}:${Object.entries(values)
|
|
40
|
-
.map(([k, v]) => `${k}=${String(v)}`)
|
|
41
|
-
.join(",")}`,
|
|
42
|
-
useMessages: () => ({}),
|
|
43
|
-
}));
|
|
44
|
-
|
|
45
|
-
import { ResultsClient } from "../ResultsClient";
|
|
46
|
-
|
|
47
|
-
const SLUG = "ai-readiness";
|
|
48
|
-
const en = (s: string) => ({ en: s });
|
|
49
|
-
|
|
50
|
-
type Scoring = NonNullable<FlowConfig["scoring"]>;
|
|
51
|
-
|
|
52
|
-
/** One question per dimension; each option's weight is the points it scores. */
|
|
53
|
-
function question(name: string, weights: Record<string, number>) {
|
|
54
|
-
return {
|
|
55
|
-
key: `s_${name}`,
|
|
56
|
-
type: "segmentation" as const,
|
|
57
|
-
copy: { title: en(name) },
|
|
58
|
-
questions: [
|
|
59
|
-
{
|
|
60
|
-
name,
|
|
61
|
-
options: Object.keys(weights).map((value) => ({ value, label: en(value) })),
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const QUESTIONS = {
|
|
68
|
-
// 30 of 73 in one dimension, so the total is the dimension's share.
|
|
69
|
-
reach: { low: 30, high: 73 },
|
|
70
|
-
craft: { low: 0, high: 10 },
|
|
71
|
-
} as const;
|
|
72
|
-
|
|
73
|
-
function scoring(names: string[] | undefined = ["Exploring", "Practising", "Scaling", "Leading"]): Scoring {
|
|
74
|
-
return {
|
|
75
|
-
version: 1,
|
|
76
|
-
points: Object.entries(QUESTIONS).map(([q, weights]) => ({
|
|
77
|
-
name: `p_${q}`,
|
|
78
|
-
question: q,
|
|
79
|
-
kind: "optionWeights" as const,
|
|
80
|
-
weights: { ...weights },
|
|
81
|
-
})),
|
|
82
|
-
scores: { total: { sum: ["p_reach", "p_craft"] } },
|
|
83
|
-
tiers: [{ key: "all", when: { score: "total", gte: 0 } }],
|
|
84
|
-
default: "all",
|
|
85
|
-
dimensions: [
|
|
86
|
-
{ key: "reach", name: "Reach", questions: ["reach"] },
|
|
87
|
-
{ key: "craft", name: "Craft", questions: ["craft"] },
|
|
88
|
-
],
|
|
89
|
-
...(names !== undefined ? { levels: { names } } : {}),
|
|
90
|
-
} satisfies Scoring;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function config(scoringBlock: Scoring | undefined): FlowConfig {
|
|
94
|
-
return {
|
|
95
|
-
slug: SLUG,
|
|
96
|
-
defaultLocale: "en",
|
|
97
|
-
mode: "recommending",
|
|
98
|
-
steps: Object.entries(QUESTIONS).map(([q, weights]) => question(q, { ...weights })),
|
|
99
|
-
...(scoringBlock !== undefined ? { scoring: scoringBlock } : {}),
|
|
100
|
-
recommendation: { key: "result", copy: { title: en("Your AI readiness") } },
|
|
101
|
-
} as FlowConfig;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function renderResults(cfg: FlowConfig, answers: Record<string, string>): void {
|
|
105
|
-
render(<ResultsClient config={cfg} locale="en" answers={answers} slug={SLUG} payload="v1-abc" />);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function columns(): HTMLElement[] {
|
|
109
|
-
return within(screen.getByTestId("flow-level-chart")).getAllByTestId(/^flow-level-chart-column-\d$/);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function filledColumns(): number[] {
|
|
113
|
-
return columns()
|
|
114
|
-
.filter((col) => col.getAttribute("data-filled") === "true")
|
|
115
|
-
.map((col) => Number(col.getAttribute("data-level")));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** The AC's walk: only `reach` scores, so the total is 30 of 73 at `low`. */
|
|
119
|
-
function reachOnly(names?: string[]): Scoring {
|
|
120
|
-
const base = scoring(names);
|
|
121
|
-
return { ...base, points: base.points.slice(0, 1), scores: { total: { sum: ["p_reach"] } } };
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
describe("AC-3 — the score and the Level chart (decisions 10, 11)", () => {
|
|
125
|
-
const SCORED = config(reachOnly());
|
|
126
|
-
|
|
127
|
-
it("a walk at 30 of 73 renders '30', of {max}, the total's Level name, and no bar", () => {
|
|
128
|
-
renderResults(SCORED, { reach: "low", craft: "low" });
|
|
129
|
-
const total = screen.getByTestId("flow-results-score-total");
|
|
130
|
-
expect(within(total).getByTestId("flow-results-score-total-points")).toHaveTextContent(/^30$/);
|
|
131
|
-
expect(within(total).getByText("scoreOutOf:max=73")).toBeInTheDocument();
|
|
132
|
-
// 30 / 73 = 41.1% of all points is Level 3.
|
|
133
|
-
expect(within(total).getByTestId("flow-results-score-total-level")).toHaveTextContent("Scaling");
|
|
134
|
-
expect(screen.queryByTestId("flow-frame-bar")).not.toBeInTheDocument();
|
|
135
|
-
expect(screen.queryAllByTestId("flow-results-score-total-bar")).toHaveLength(0);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it("the chart renders five columns labelled 01 to 05 with only column 3 filled and its marker at 41%", () => {
|
|
139
|
-
renderResults(SCORED, { reach: "low", craft: "low" });
|
|
140
|
-
const chart = screen.getByTestId("flow-level-chart");
|
|
141
|
-
expect(chart.getAttribute("aria-label")).toBe("levelChartLabel:level=3,pct=41");
|
|
142
|
-
expect(columns().map((col) => col.textContent)).toEqual(["01", "02", "03", "04", "05"]);
|
|
143
|
-
expect(filledColumns()).toEqual([3]);
|
|
144
|
-
const marker = within(chart).getByTestId("flow-level-chart-marker");
|
|
145
|
-
expect(marker.parentElement?.getAttribute("style")).toContain("--flow-level-marker: 41%");
|
|
146
|
-
expect(marker).toHaveTextContent("41%");
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it("at 40% exactly column 3 is filled; at 100% column 5", () => {
|
|
150
|
-
const fifths = config({ ...scoring(), points: [{ name: "p_reach", question: "reach", kind: "optionWeights", weights: { low: 40, high: 100 } }], scores: { total: { sum: ["p_reach"] } } });
|
|
151
|
-
const { unmount } = render(
|
|
152
|
-
<ResultsClient config={fifths} locale="en" answers={{ reach: "low", craft: "low" }} slug={SLUG} payload="v1-a" />,
|
|
153
|
-
);
|
|
154
|
-
expect(filledColumns()).toEqual([3]);
|
|
155
|
-
expect(screen.getByTestId("flow-level-chart").getAttribute("aria-label")).toBe("levelChartLabel:level=3,pct=40");
|
|
156
|
-
unmount();
|
|
157
|
-
render(
|
|
158
|
-
<ResultsClient config={fifths} locale="en" answers={{ reach: "high", craft: "low" }} slug={SLUG} payload="v1-b" />,
|
|
159
|
-
);
|
|
160
|
-
expect(filledColumns()).toEqual([5]);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it("a Level 5 with four stored names reads the fallback label, never names[3]", () => {
|
|
164
|
-
renderResults(SCORED, { reach: "high", craft: "low" });
|
|
165
|
-
expect(screen.getByTestId("flow-results-score-total-level")).toHaveTextContent("label:n=5");
|
|
166
|
-
expect(screen.getByTestId("flow-results-score-total-level")).not.toHaveTextContent("Leading");
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it("a five-name register names Level 5 by its fifth name", () => {
|
|
170
|
-
renderResults(config(reachOnly(["Exploring", "Practising", "Scaling", "Leading", "Pioneering"])), {
|
|
171
|
-
reach: "high",
|
|
172
|
-
craft: "low",
|
|
173
|
-
});
|
|
174
|
-
expect(screen.getByTestId("flow-results-score-total-level")).toHaveTextContent("Pioneering");
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it("renders the heading and body above the score", () => {
|
|
178
|
-
renderResults(SCORED, { reach: "low", craft: "low" });
|
|
179
|
-
const heading = screen.getByRole("heading", { name: "Your AI readiness" });
|
|
180
|
-
const score = screen.getByTestId("flow-results-score");
|
|
181
|
-
expect(heading.compareDocumentPosition(score) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
describe("AC-3 — Report Compiled (decision 12)", () => {
|
|
186
|
-
it("heads one ScoreBar per dimension in register order, each named by the stored name else L{n}", () => {
|
|
187
|
-
renderResults(config(scoring()), { reach: "low", craft: "high" });
|
|
188
|
-
const report = screen.getByTestId("flow-results-report-compiled");
|
|
189
|
-
expect(within(report).getByRole("heading", { name: "reportCompiled" })).toBeInTheDocument();
|
|
190
|
-
const meters = within(report).getAllByRole("meter");
|
|
191
|
-
expect(meters.map((m) => m.getAttribute("aria-label"))).toEqual(["Reach", "Craft"]);
|
|
192
|
-
expect(meters.map((m) => m.getAttribute("aria-valuetext"))).toEqual([
|
|
193
|
-
// 30 / 73 = 41% is Level 3.
|
|
194
|
-
"30 / 73, Scaling",
|
|
195
|
-
// 100% is Level 5, which a four-name register leaves to the short fallback.
|
|
196
|
-
"10 / 10, levelShort:n=5",
|
|
197
|
-
]);
|
|
198
|
-
// The total is a display number, not a meter.
|
|
199
|
-
expect(screen.getAllByRole("meter")).toHaveLength(2);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
it("renders no Report Compiled for a register with no dimensions", () => {
|
|
203
|
-
const { dimensions: _dimensions, ...flat } = scoring();
|
|
204
|
-
renderResults(config(flat), { reach: "low", craft: "low" });
|
|
205
|
-
expect(screen.getByTestId("flow-results-score")).toBeInTheDocument();
|
|
206
|
-
expect(screen.queryByTestId("flow-results-report-compiled")).not.toBeInTheDocument();
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
describe("AC-3 — an unscored magnet (decision 19)", () => {
|
|
211
|
-
it.each([
|
|
212
|
-
["no scoring", config(undefined)],
|
|
213
|
-
[
|
|
214
|
-
"a max of 0",
|
|
215
|
-
config({
|
|
216
|
-
...scoring(),
|
|
217
|
-
points: [],
|
|
218
|
-
scores: {},
|
|
219
|
-
tiers: [{ key: "all", when: { answer: "reach", in: ["low", "high"] } }],
|
|
220
|
-
dimensions: [],
|
|
221
|
-
}),
|
|
222
|
-
],
|
|
223
|
-
])("%s: none of the score, the chart or Report Compiled render", (_label, cfg) => {
|
|
224
|
-
renderResults(cfg, { reach: "low", craft: "low" });
|
|
225
|
-
expect(screen.getByTestId("flow-results")).toBeInTheDocument();
|
|
226
|
-
expect(screen.queryByTestId("flow-results-score")).not.toBeInTheDocument();
|
|
227
|
-
expect(screen.queryByTestId("flow-level-chart")).not.toBeInTheDocument();
|
|
228
|
-
expect(screen.queryByTestId("flow-results-report-compiled")).not.toBeInTheDocument();
|
|
229
|
-
expect(screen.queryAllByRole("meter")).toHaveLength(0);
|
|
230
|
-
});
|
|
231
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// oss: false
|
|
2
|
-
/**
|
|
3
|
-
* checkout-seam.ts — where the results page meets commerce (#6786).
|
|
4
|
-
*
|
|
5
|
-
* The results page is signal-collectors' (it ships with the `flows` surface);
|
|
6
|
-
* checkout is commerce's optional add-on to it. A base file may not import a
|
|
7
|
-
* commerce file — `paidModuleTemplateExclusions()` sweeps every importer of a
|
|
8
|
-
* paid module's `ownedFiles` out of the keyless snapshot, and a scaffold
|
|
9
|
-
* without commerce has neither the file nor `@working-theory/ui-commerce` to
|
|
10
|
-
* resolve. So the dependency points the other way: commerce's
|
|
11
|
-
* `layout.tsx` beside this file provides a `ResultsCheckout` through
|
|
12
|
-
* `ResultsCheckoutContext`, and `ResultsClient` reads it. Next renders a
|
|
13
|
-
* route's `layout.tsx` only when the file exists, so a scaffold without
|
|
14
|
-
* commerce gets no provider, the context stays `undefined`, and the page
|
|
15
|
-
* offers no checkout action — every fit's terminal is Book a Call.
|
|
16
|
-
*
|
|
17
|
-
* Only types and the context live here; nothing in this file names a
|
|
18
|
-
* commerce module, and the types are structural so the commerce half
|
|
19
|
-
* satisfies them without either side importing the other's.
|
|
20
|
-
*/
|
|
21
|
-
import type {
|
|
22
|
-
FlowCheckoutInputRaw,
|
|
23
|
-
RecommendRegister,
|
|
24
|
-
WaitlistBillingPeriod,
|
|
25
|
-
WaitlistCreditStop,
|
|
26
|
-
WaitlistOffer,
|
|
27
|
-
} from "@working-theory/validation";
|
|
28
|
-
import type { ComponentType } from "react";
|
|
29
|
-
import { createContext } from "react";
|
|
30
|
-
|
|
31
|
-
import type { EmailMomentFailure } from "../../email-moment";
|
|
32
|
-
|
|
33
|
-
/** The seats / period / credit stop Pay sends — what the price card shows. */
|
|
34
|
-
export interface ResultsCheckoutConfiguration {
|
|
35
|
-
seats: number;
|
|
36
|
-
period: WaitlistBillingPeriod;
|
|
37
|
-
creditStop: WaitlistCreditStop;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** The checkout view's price card, controlled by `ResultsClient`. */
|
|
41
|
-
export interface ResultsPriceCardProps {
|
|
42
|
-
offer: WaitlistOffer;
|
|
43
|
-
currency: string;
|
|
44
|
-
locale: string;
|
|
45
|
-
defaultLocale?: string;
|
|
46
|
-
/** The register `price()` prices against — the same one the server serves. */
|
|
47
|
-
register: RecommendRegister;
|
|
48
|
-
value: ResultsCheckoutConfiguration;
|
|
49
|
-
onChange: (next: ResultsCheckoutConfiguration) => void;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Pay's input: the wire body MINUS the two return URLs (the action builds
|
|
54
|
-
* them from the app's own origin, #4875) PLUS the permalink `payload`.
|
|
55
|
-
*/
|
|
56
|
-
export type ResultsCheckoutInput = Omit<
|
|
57
|
-
FlowCheckoutInputRaw,
|
|
58
|
-
"successUrl" | "cancelUrl"
|
|
59
|
-
> & {
|
|
60
|
-
payload: string;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export interface ResultsCheckout {
|
|
64
|
-
PriceCard: ComponentType<ResultsPriceCardProps>;
|
|
65
|
-
/** Pay — a returned value is always a failure; success `redirect()`s. */
|
|
66
|
-
start: (
|
|
67
|
-
slug: string,
|
|
68
|
-
input: ResultsCheckoutInput,
|
|
69
|
-
) => Promise<EmailMomentFailure | undefined>;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export const ResultsCheckoutContext = createContext<
|
|
73
|
-
ResultsCheckout | undefined
|
|
74
|
-
>(undefined);
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// oss: false
|
|
2
|
-
/**
|
|
3
|
-
* meeting-seam.ts — where the results page meets scheduling (#11013 D-K).
|
|
4
|
-
*
|
|
5
|
-
* The results page is signal-collectors'; the Meeting card's data lives in
|
|
6
|
-
* `lib/meetings.tsx`, a scheduling file, and a signal-collectors scaffold may
|
|
7
|
-
* omit scheduling (`composeModuleSet`). A base file may not import a
|
|
8
|
-
* scheduling file — `paidModuleTemplateExclusions()` sweeps every importer of
|
|
9
|
-
* a paid module's `ownedFiles` out of the keyless snapshot, and a scaffold
|
|
10
|
-
* without scheduling has neither the file nor the `/meet` routes. So the
|
|
11
|
-
* dependency points the other way, on the `checkout-seam.ts` pattern:
|
|
12
|
-
* scheduling's `results/layout.tsx` (one segment above commerce's
|
|
13
|
-
* `results/[payload]/layout.tsx`, so the two nest) reads the served flow and
|
|
14
|
-
* the workspace's meetings on the server and provides AT MOST the one meeting
|
|
15
|
-
* the magnet's `conversionLink` names through `ResultsMeetingContext`, and
|
|
16
|
-
* `ResultsClient` reads it. Next renders a segment's `layout.tsx` only when
|
|
17
|
-
* the file exists, so a scaffold without scheduling has no provider, the
|
|
18
|
-
* context stays `undefined`, and an `appointment` link renders no card.
|
|
19
|
-
*
|
|
20
|
-
* Only a structural type and the context live here; nothing in this file
|
|
21
|
-
* names a scheduling module.
|
|
22
|
-
*/
|
|
23
|
-
import { createContext } from "react";
|
|
24
|
-
|
|
25
|
-
/** The one meeting the results page may show, mapped by the scheduling layout. */
|
|
26
|
-
export interface ResultsMeeting {
|
|
27
|
-
slug: string;
|
|
28
|
-
title: string;
|
|
29
|
-
description?: string;
|
|
30
|
-
/** The meeting's own page, locale-prefixed (`/<locale>/meet/<slug>`). */
|
|
31
|
-
href: string;
|
|
32
|
-
/** `/meet`'s own button label, "Book {n} min" (`schedule.bookLength`). */
|
|
33
|
-
bookLabel: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const ResultsMeetingContext = createContext<ResultsMeeting | undefined>(undefined);
|