feat(gp): PayrollAdminOnboarding flow — mutations, schemas, and step components (PBYR-4044)#1142
Open
hamzaremote wants to merge 4 commits into
Open
feat(gp): PayrollAdminOnboarding flow — mutations, schemas, and step components (PBYR-4044)#1142hamzaremote wants to merge 4 commits into
hamzaremote wants to merge 4 commits into
Conversation
Add GPStepCallbacks<TSuccess> to src/flows/types.ts — the shared callback prop type used by all GP step components. Replace the empty scaffold types in PayrollAdminOnboarding/types.ts with real component signatures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GPAdminStepCallbacks is the public callback type consumers pass to each admin step component. useGPOnboardingSteps is the hook consumers need to read step state in an outer company-manager context. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6c04d26. Configure here.
Contributor
📦 Bundle Size Report
Size Limits
Largest Files (Top 5)
View All Files (358 total)
✅ Bundle size check passed |
Contributor
📊 Coverage Report
|
| Metric | Current | Previous | Change | Status |
|---|---|---|---|---|
| Lines | 85.73% | 88.45% | -2.72% | 🔴 |
| Statements | 85.17% | 87.86% | -2.69% | 🔴 |
| Functions | 82.89% | 84.83% | -1.94% | 🔴 |
| Branches | 77.82% | 79.83% | -2.01% | 🔴 |
Detailed Breakdown
Lines Coverage
- Covered: 3882 / 4528
- Coverage: 85.73%
- Change: -2.72% (0 lines)
Statements Coverage
- Covered: 3944 / 4631
- Coverage: 85.17%
- Change: -2.69% (0 statements)
Functions Coverage
- Covered: 1051 / 1268
- Coverage: 82.89%
- Change: -1.94% (0 functions)
Branches Coverage
- Covered: 2438 / 3133
- Coverage: 77.82%
- Change: -2.01% (0 branches)
✅ Coverage check passed
Contributor
|
Deploy preview for adp-cost-calculator ready!
Deployed with vercel-action |
Contributor
|
Deploy preview for remote-flows ready!
Deployed with vercel-action |
Two bugs flagged in review: 1. onSubmit guards returned undefined on failure (missing countryCode, missing employmentId, or no id in the create-employment response). useStepSubmitHandler treated undefined as success and called next(), advancing the wizard with no API write. Guards now throw so the catch block handles them correctly. 2. skipCountry only required initialCountryCode, so a pre-filled country with no initialEmploymentId would hide the select_country step (the only place createEmployment runs) and leave the flow with no employmentId for contract_details and beyond. skipCountry now requires both initialCountryCode and initialEmploymentId — meaning "skip" is only valid when resuming an existing employment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Completes the
PayrollAdminOnboardingflow skeleton that was scaffolded in an earlier PR. The scaffold had step state and a render-prop container but no mutations, no schema loading, and no step components — this PR adds all of that.Part of the GP payroll split plan (
GP_PAYROLL_SPLIT_PLAN.md). Stacks on #1134.What's added:
api.ts— React Query hooks for the four admin API calls:useGPFormSchema(schema per step),useGPCreateEmployment,useGPUpdateContractDetails,useGPUpdateAdministrativeDetails,useGPInviteEmployeehooks.tsx— mutations wired intoonSubmit, one schema query per step gated byenabled: currentStep === X(lazy, never fetches ahead),refetchSteps()called after each successful submitcomponents/—SelectCountryStep,ContractDetailsStep,AdministrativeDetailsStep,InvitationStep,PayrollAdminForm,SubmitButton,BackButton,useStepSubmitHandlersrc/flows/types.ts—GPStepCallbacks<TSuccess>shared callback type (used here and by the employee flow in the next PR)src/index.tsx— exportsGPAdminStepCallbacks,useGPOnboardingStepsNote on
InvitationStep: this step doesn't go throughuseStepSubmitHandlerbecause there's no form — it's a single button that fires the invite mutation directly. It owns its mutation instance and callsadminBag.refetchSteps()/adminBag.next()itself.Test plan
npm run type-check— no errorsnpm run test— passesnpm run buildcompletes without OOM (heap raise from fix: datepicker dropdown navigation + JSF logging + build heap #1134 helps here)Note
Medium Risk
Touches employment creation and contract/admin data writes via new mutations; incorrect skip-country logic was fixed but flow state still depends on API responses and step refetch.
Overview
Completes the PayrollAdminOnboarding scaffold with end-to-end admin onboarding: country selection, JSON-schema forms per step, employment create/update APIs, and employee invite.
Adds
api.tsReact Query hooks for country form schemas (with optionalemployment_idfor role-aware fields), create employment, contract/administrative updates, and invite.usePayrollAdminOnboardingnow loads schemas only on the active step, validates/parses via JSF, runs the right mutation inonSubmit, stores the new employment ID after create, and refetches onboarding steps after each successful save.New step UI: country picker + basic info, contract and administrative
PayrollAdminFormsteps,InvitationStep(invite mutation only), and sharedSubmitButton/BackButton/useStepSubmitHandler. Render-prop types move from empty placeholders toGPStepCallbacks(also exported asGPAdminStepCallbacks). Resume behavior fix: country step is skipped only when both initialcountryCodeandemploymentIdare provided, so create employment is not skipped by mistake.Public exports add
GPAdminStepCallbacksanduseGPOnboardingSteps.Reviewed by Cursor Bugbot for commit 0de1fff. Bugbot is set up for automated code reviews on this repo. Configure here.