Skip to content

Latest commit

 

History

History

builder-frontend

README.md

Usage

$ npm install # or pnpm install or yarn install

Learn more on the Solid Website and come chat with us on our Discord

Available Scripts

In the project directory you can run:

npm run dev

Runs the app in the development mode.
Open http://localhost:5173 to view it in the browser.

npm run build

Builds the app for production to the dist folder.
It correctly bundles Solid in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

npm run format and npm run format:check

Formats src with Prettier's defaults, or checks that it is formatted.

npm run typecheck

Type-checks src, failing only when a file has more errors than typecheck-baseline.json records for it. After fixing type errors, run npm run typecheck -- --update to lower the baseline.

devbox run test -- builder-frontend runs the tests, the format check and the type check, as CI does.

Deployment

Learn more about deploying your application with the documentations

Screening results in custom form fields

The screening session (src/components/shared/screeningSession/screeningSession.tsx) and the editor register screeningResultsModule from src/components/screenerEditor/formJsExtensions/screeningResults/screeningResults.ts. Each form has its own service. Preact custom fields can read its reactive snapshot with useScreeningResults() from the adjacent useScreeningResults.ts:

const { results, pending, failed, mode } = useScreeningResults();

results is the latest ScreenerResult, or undefined before evaluation. pending stays true from an answer edit until results for those latest answers arrive, including the debounce interval and failed requests. failed is true when the latest evaluation failed, until one succeeds, so a field can show an error instead of waiting indefinitely. Previous results remain available while pending. Snapshots and their results are frozen copies; copy them before sorting or annotating. The screening session drops outdated responses before updating the service.

mode is live for published screeners and preview, and editor for sample results in the editing canvas. Editor samples use the configured benefit IDs and names, plus clearly named examples for any eligible, ineligible, or undecided outcome those benefits don't cover. Sample data and live results are kept outside form answers and saved schemas.

The hook uses the viewer's FormContext, shared by both field renderers. The useService exported by form-js 1.15 uses an editor-only context and cannot serve viewer fields. Consumers outside Preact can use getSnapshot() and subscribe() on the service; subscribe() returns an unsubscribe function and updates fire screeningResults.changed on the form's event bus.

Testing with a real form-js form

Tests that type into a rendered form-js form use answer() from src/testing/formJs.ts. form-js passes typed text on only after a 300ms pause or when the field loses focus (focusout, which Preact uses for onBlur), and it redraws a form about 60ms after an import, resetting any field whose text it hasn't received yet. answer() sends focusout, so each answer reaches the form at once and survives the redraw.

Print summary

Analysts can place a Print summary component anywhere in the form. It opens the browser's Print / Save as PDF dialog after screening results arrive. The summary includes the screener name, current date, benefit decisions, and the content from the first Next steps component the person can see, in schema order (including groups). Components hidden by a condition are skipped. It respects that component's showWhen setting. Without a visible Next steps component, it prints decisions and unmet requirements without application instructions.

The print renderer shares the on-screen Next steps renderer and adds full HTTP(S) URLs, email addresses and phone numbers next to link text that doesn't already show them. Printing hides the rest of the page and excludes answers. It uses no PDF service or upload, and removes the temporary print tree after the dialog closes. Printing is disabled for editor samples and while evaluations are pending or failed. Use Preview to print real results while building a screener.

AI-drafted schemas append Next steps (whenDecided) and Print summary after the questions. The server copies benefit content into the schema after generation; the model neither receives nor generates application instructions or contacts. As when an analyst places the component, a benefit without configured next-steps content is copied as empty. The editor warns about missing or empty content so analysts can add instructions before publishing.

Next steps component

Analysts can place Next steps from the presentation palette. Its next_steps schema field stores benefitContent, a map from benefit ID to the NextSteps shape, and showWhen: whenDecided (default) or whenComplete. Content is copied when the field is inserted. The properties panel opens a modal to edit the copy or reset an individual benefit from its source. New benefits need content added to existing components; removed benefits are ignored when displaying results.

The editor loads benefit sources in the background. New components finish copying their content when those requests settle; saving or opening their content modal waits for that copy. Existing components and other form edits remain usable. Failed loads show a retry action and preserve saved component content. Content edits change the form draft and require saving the form. Publish snapshots that schema; viewers do not fetch the working benefit content. Publishing keeps benefit IDs stable so those results match the copied content. Screener imports remap component copies to the newly allocated benefit IDs.

The component renders sanitized Markdown without template evaluation. Web links accept HTTP(S) URLs and open in a new tab. Pending or failed evaluations hide old instructions until fresh decisions arrive. Forms containing the component use its progress heading; existing forms without it keep the legacy completion message.

Unanswered questions in Next steps

For an undecided benefit, Next steps lists the form's question labels for missing inputs used by that benefit's undecided checks. Shared inputs are deduplicated; inputs used only by decided checks are omitted. Fields sharing a label add their group's label, and items of a repeated section with more than one item are numbered, such as "Age (Household member #2)". Questions a form condition currently hides are left out, since no one can answer them. Zero, No, and explicit None answers remain answered. The list uses the same normalized data sent to the eligibility service, including unknown CRM prefill preserved as null.

Published screeners, Preview, and the print summary share these labels. Pending or failed evaluations suppress old prompts along with old instructions, and prompts disappear when the benefit is decided. Labels are kept separately from answers in the results snapshot; answers and technical input paths are never printed by this feature. If an input has no static form label, Next steps keeps its general need-more-information message rather than inventing a question. The CRM nextSteps extension continues to contain decided benefits only.

Check explanations

Each configured check on a benefit can have an optional plain-language explanation, separate from its technical description and alias. In Configure Benefit, choose Edit explanation beside the alias. Explanations are plain text (up to 2,000 characters); clearing the field removes one. They belong to that check instance, so the same rule can have different explanations for different benefits.

Published and preview results show an information button for checks with saved explanations. Hover, focus with the keyboard, or tap to read it. Escape dismisses the tooltip, as does a second tap or a tap elsewhere. Its text is associated with the button for screen readers. Failed checks use the explanation in Requirements not met, including print summaries and CRM Next steps. Checks without one keep their alias or original name.