feat: company suspension (cancel account) flow and blocks - #2695
Draft
aaronlee777 wants to merge 6 commits into
Draft
aaronlee777 wants to merge 6 commits into
aaronlee777 wants to merge 6 commits into
Conversation
Add the `companySuspension` unstable feature flag, the
`company/suspension/created` and `company/suspension/done` events, and MSW
handlers for the GET/POST `/companies/{id}/suspensions` endpoints. These
underpin the company suspension ("cancel account") components that follow.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the standalone, alpha-gated SuspensionForm block that collects the suspension reason and tax-reconciliation preferences. Reproduces the gws-flows conditional logic: the provider field appears only when switching providers, Customer-Support warnings surface for FEIN/entity-type changes and switching to Gusto, comments become required when leaving for "other", and the tax-filing checkboxes vs. the future-filings warning toggle by reconcile method (clearing hidden values before submit). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the standalone, alpha-gated SuspensionSummary block that confirms a company's suspension. It fetches the company's suspensions, summarizes the one with the latest effective date, derives the tax year/quarter timezone-safely via normalizeToDate, lists what Gusto will handle, and renders a refund table when taxes are being refunded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the alpha-gated SuspensionFlow orchestrator that drives the form to the summary via a robot3 state machine and opens directly on the summary when the company is already suspended. The summary state is a plain terminal state (not final()) so completion bubbles via onEvent and the screen stays interactive if the host keeps it mounted (SDK-1169). Expose SuspensionFlow, SuspensionForm, and SuspensionSummary through a new CompanyManagement namespace, and include a partner-facing GUIDE. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Register a CompanyManagement category in the dev-app registry so SuspensionFlow, SuspensionForm, and SuspensionSummary appear in the sidebar, add the "Company Management" sidebar label, teach the prop analyzer about the new namespace, and regenerate the registry data (entity requirements plus the companySuspension unstable-feature toggle). Co-Authored-By: Claude Opus 4.8 <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
Ports the Company Suspension ("Cancel account") flow — which exists today in gws-flows — into the SDK as native React components. Adds a guided
SuspensionFlowplus two independently-mountable block components (SuspensionForm,SuspensionSummary), exposed through a newCompanyManagementnamespace and gated behind an@alpharelease tag + a newcompanySuspensionunstable-feature flag.Uses the existing
@gusto/embedded-apiendpoints:POST/GET /companies/{id}/suspensionsanduseCompaniesGetSuspenseforisSuspended.What's included
SuspensionForm— collects the suspension reason and tax-reconciliation preferences, with the gws-flows conditional logic reproduced:switching_provider→ shows the provider field (cleared/omitted otherwise)changing_ein_or_entity_typeandleavingFor === gusto_com→ contact-Support warnings (both require Support; API returns 422)leavingFor === other→commentsbecomes required with the alternate labelpay_taxes→ filing checkboxes;refund_taxes→ hides + clears them and shows the future-filings warning; neither shown until a method is chosenSuspensionSummary— read-only confirmation derived from the latest suspension: timezone-safe year/quarter, the "what we'll handle" list, and a refund table for refunded taxes.SuspensionFlow— robot3 orchestrator: form → summary; opens directly on the summary when the company is already suspended. Summary is a plain terminal state (notfinal()) so completion bubbles viaonEventand the screen stays interactive if the host keeps it mounted (SDK-1169).company/suspension/createdandcompany/suspension/doneevents, MSW handlers, i18n namespaces, a partner-facingGUIDE.md, Storybook stories, and unit tests.companySuspensionunstable feature to view them).Commits
SuspensionFormblockSuspensionSummaryblockSuspensionFloworchestrator +CompanyManagementexportsTesting
npm run test -- --run src/components/Company/Suspension— 17 passing; full Company suite (215) greennpx tsc --noEmitclean ·eslintclean ·npm run buildsucceedsNotes / open questions
leavingForas a grouped select; the SDK'sComboBoxprimitive has no option-group support, so this uses a flat searchable ComboBox ordered by group. Flag if grouping is required.npm run derive(reference-docs regen for the new@alphaexports), and E2E.--no-verify: the pre-commitcspellstep requires Node ≥22.18 but the local env runs 20.16, so it fails on any Markdown file. Build/lint/tests were run manually instead.🤖 Generated with Claude Code