Skip to content

feat: add OnboardingExecutionFlow and skip redundant list in EmployeeListFlow#1990

Merged
dmortal merged 5 commits into
mainfrom
feat/onboarding-execution-flow
Jun 3, 2026
Merged

feat: add OnboardingExecutionFlow and skip redundant list in EmployeeListFlow#1990
dmortal merged 5 commits into
mainfrom
feat/onboarding-execution-flow

Conversation

@dmortal
Copy link
Copy Markdown
Contributor

@dmortal dmortal commented Jun 2, 2026

Summary

EmployeeListFlow currently shows a duplicate employee list on "Add employee" because it embeds the full OnboardingFlow, whose initial state is itself a list view. This PR extracts the wizard portion into a new OnboardingExecutionFlow so EmployeeListFlow lands the user directly on the Profile step, while OnboardingFlow keeps its standalone behavior unchanged. The composition mirrors the existing PayrollFlow / PayrollExecutionFlow pattern.

Changes

  • New OnboardingExecutionFlow component owning the wizard states (Profile → Compensation → Federal/State Taxes → Payment Method → Deductions → Documents → Summary), exported via the EmployeeOnboarding journey namespace.
  • OnboardingFlow reduced to a 3-state shell (indexexecutingfinal) that composes the new sub-flow internally; public API and standalone behavior preserved.
  • EmployeeListFlow.onboard now renders OnboardingExecutionFlow directly and routes EMPLOYEES_LIST / CANCEL back to the management list.

Testing

  • npm run test -- --run — 2960 passed, 1 expected fail (pre-existing).
  • npm run build — succeeds; endpoint inventory now reports the new OnboardingExecutionFlow (22 → 24 flows).
  • New src/components/Employee/EmployeeListFlow/EmployeeListFlow.test.tsx asserts that clicking "Add" from the management list lands on the Profile SSN field (no second list).
  • Existing OnboardingFlow.test.tsx happy path still passes end-to-end through the wizard.
  • Manual verification suggested: in Storybook, exercise the EmployeeListFlow story → click Add employee → confirm Profile renders; complete Summary → confirm return to the management list. Also spot-check the standalone OnboardingFlow story still shows its onboarding list at index.

…ListFlow

Extracts the employee onboarding wizard steps (Profile → Compensation →
Federal/State Taxes → Payment Method → Deductions → Documents → Summary)
into a new OnboardingExecutionFlow component, mirroring the
PayrollFlow / PayrollExecutionFlow composition.

EmployeeListFlow now renders OnboardingExecutionFlow directly on Add,
landing the user on Profile instead of a duplicate onboarding employee
list. OnboardingFlow's public API is unchanged; it still presents its
index list standalone and composes the new sub-flow internally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dmortal dmortal marked this pull request as ready for review June 2, 2026 17:41
@dmortal dmortal requested a review from a team as a code owner June 2, 2026 17:41
@dmortal dmortal requested a review from Copilot June 2, 2026 17:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors employee onboarding flow composition to avoid showing a redundant employee list when starting onboarding from EmployeeListFlow, by extracting the wizard portion into a new OnboardingExecutionFlow (mirroring the existing Payroll “ExecutionFlow” pattern).

Changes:

  • Introduces OnboardingExecutionFlow to own the onboarding wizard state machine (Profile → … → Summary).
  • Updates OnboardingFlow to a small shell that renders the list first, then delegates wizard execution to OnboardingExecutionFlow.
  • Updates EmployeeListFlow to render OnboardingExecutionFlow directly when adding an employee, and adds a targeted test to verify it lands on the Profile step.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/components/Employee/OnboardingFlow/onboardingStateMachine.ts Simplifies OnboardingFlow to a shell that delegates wizard execution to OnboardingExecutionFlow.
src/components/Employee/OnboardingFlow/OnboardingFlowComponents.tsx Adds an OnboardingExecutionFlowContextual wrapper and re-exports wizard contextual components/types.
src/components/Employee/OnboardingExecutionFlow/onboardingExecutionStateMachine.ts New wizard-focused state machine extracted from the former OnboardingFlow.
src/components/Employee/OnboardingExecutionFlow/OnboardingExecutionFlowComponents.tsx New shared context/types and contextual wrappers for wizard steps.
src/components/Employee/OnboardingExecutionFlow/OnboardingExecutionFlow.tsx New Flow component that wires the execution machine and initial context.
src/components/Employee/OnboardingExecutionFlow/index.ts Barrel exports for the new execution flow and its types.
src/components/Employee/index.ts Re-exports OnboardingExecutionFlow from the main Employee namespace.
src/components/Employee/exports/employeeOnboarding.ts Exposes OnboardingExecutionFlow via the EmployeeOnboarding journey namespace.
src/components/Employee/EmployeeListFlow/employeeListStateMachine.ts Adds EMPLOYEES_LIST/CANCEL transitions to return from onboarding back to the management list.
src/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.tsx Switches the onboarding sub-flow to render OnboardingExecutionFlow instead of OnboardingFlow.
src/components/Employee/EmployeeListFlow/EmployeeListFlow.test.tsx New test asserting “Add employee” lands directly on the Profile step.
docs/reference/endpoint-reference.md Updates flow/block reference to include OnboardingExecutionFlow in the composition graph.
docs/reference/endpoint-inventory.json Updates endpoint inventory to include the new flow and adjusted compositions.

Comment thread src/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.tsx Outdated
Comment thread src/components/Employee/OnboardingFlow/OnboardingFlowComponents.tsx
dmortal and others added 3 commits June 2, 2026 14:38
…ompanyId

- Rename OnboardingFlowContextual to OnboardingExecutionFlowContextual in
  EmployeeListFlowComponents.tsx so the wrapper name matches what it renders
- Add ensureRequired(companyId) in EmployeeListContextual for consistency
  with other useFlow contextual wrappers

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tion-flow

# Conflicts:
#	docs/reference/endpoint-reference.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dmortal dmortal enabled auto-merge (squash) June 3, 2026 15:00
@dmortal dmortal merged commit 8774f76 into main Jun 3, 2026
30 checks passed
@dmortal dmortal deleted the feat/onboarding-execution-flow branch June 3, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants