Skip to content

feat(client): scope the securities trade counterparty picker to securities - #4258

Merged
gilgardosh merged 2 commits into
mainfrom
feat/security-counterparty-picker
Aug 20, 2026
Merged

feat(client): scope the securities trade counterparty picker to securities#4258
gilgardosh merged 2 commits into
mainfrom
feat/security-counterparty-picker

Conversation

@gilgardosh

Copy link
Copy Markdown
Collaborator

Final step of the per-security businesses plan. Stacked on #4257.

Closes the loop on the screenshot that started this: on a foreign-securities charge, the main
transaction's counterparty should be the specific security, the fee row stays Poalim, and the
ledger is untouched.

When the main transaction has no counterparty yet, its picker now lists the tenant's security
businesses plus the general foreign-securities business
(the fallback for a trade whose security
cannot be told) instead of the whole business directory — where the right answer is a needle in a
haystack and a wrong one is one click away. Each option carries its ISIN, which is what tells two
share classes of one issuer apart. The fee row keeps the full list, matching the server's suggestion
rule (#4255).

The rule is decided client-side from what the charge already knows, so chargeType is threaded from
charge-extended-infoChargeTransactionsTableTransactionsTable onto the row, exactly like
enableEdit/enableChargeLink. The other TransactionsTable callers (business transactions tab,
balance report) pass no charge type and are unaffected.

The suggestion itself needed no client change — the cell already pre-seeds the select from
missingInfoSuggestions, which now resolves the security named in the description.

Adds useGetSecurityBusinesses (the securities-scoped counterpart of useGetAdminBusinesses) and
surfaces UserContext.foreignSecuritiesBusinessId through the user provider for the fallback option.

Verification

  • yarn generate, yarn lint, yarn prettier clean; client typechecks and yarn build succeeds.
  • yarn test — 3439 passed.

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 narrows the counterparty picker for the main transaction row of a ForeignSecuritiesCharge so that users choose from security businesses (plus a general fallback business) instead of the full business directory, while keeping the fee row behavior unchanged.

Changes:

  • Thread chargeType from ChargeExtendedInfoChargeTransactionsTableTransactionsTable → row cells to enable charge-type-specific UI behavior.
  • Add useGetSecurityBusinesses and update the counterparty cell to use security-scoped options (with ISIN in labels) plus UserContext.foreignSecuritiesBusinessId as a fallback.
  • Extend UserContext and update client tests/changeset to reflect the new context field and behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/client/src/providers/user-provider.tsx Exposes foreignSecuritiesBusinessId via the user context query + mapping.
packages/client/src/hooks/use-get-security-businesses.ts Adds a new hook to fetch and format selectable security businesses (with ISIN).
packages/client/src/components/transactions-table/index.tsx Adds optional chargeType prop and threads it into row data.
packages/client/src/components/transactions-table/columns.tsx Extends row type to include chargeType for use in cells.
packages/client/src/components/transactions-table/cells/counterparty.tsx Scopes counterparty picker options to securities for foreign-securities main rows, with fallback.
packages/client/src/components/charges/charge-transactions-table.tsx Passes chargeType down into TransactionsTable.
packages/client/src/components/charges/charge-extended-info.tsx Provides chargeType into the charge transactions table when rendered in charge view.
packages/client/src/components/tests/user-menu.test.tsx Updates test fixture to include foreignSecuritiesBusinessId.
.changeset/security-counterparty-picker.md Documents the client-facing behavior change for release notes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/client/src/components/transactions-table/index.tsx
Comment thread packages/client/src/components/transactions-table/columns.tsx
Comment thread packages/client/src/hooks/use-get-security-businesses.ts Outdated
@gilgardosh
gilgardosh force-pushed the feat/security-business-tab branch from 5a78f8c to 5e176c4 Compare August 20, 2026 09:52
@gilgardosh
gilgardosh force-pushed the feat/security-counterparty-picker branch from b208d3d to d24c7f9 Compare August 20, 2026 09:55
@gilgardosh
gilgardosh temporarily deployed to accounter-fullstack August 20, 2026 09:55 — with GitHub Actions Inactive
@gilgardosh
gilgardosh temporarily deployed to accounter-fullstack August 20, 2026 09:55 — with GitHub Actions Inactive
@gilgardosh
gilgardosh force-pushed the feat/security-business-tab branch 3 times, most recently from 566a682 to e137d21 Compare August 20, 2026 13:56
Base automatically changed from feat/security-business-tab to main August 20, 2026 14:54
@gilgardosh
gilgardosh changed the base branch from main to feat/security-businesses-plan August 20, 2026 14:59
@gilgardosh
gilgardosh force-pushed the feat/security-counterparty-picker branch from d24c7f9 to b472fd6 Compare August 20, 2026 14:59
@gilgardosh
gilgardosh temporarily deployed to accounter-fullstack August 20, 2026 14:59 — with GitHub Actions Inactive
@gilgardosh
gilgardosh temporarily deployed to accounter-fullstack August 20, 2026 14:59 — with GitHub Actions Inactive
gilgardosh and others added 2 commits August 20, 2026 18:00
…ities

The main transaction of a foreign-securities charge settles against the
security it traded, so its counterparty picker now lists security businesses
plus the general foreign-securities business, each labelled with its ISIN,
instead of the whole business directory. The fee row keeps the full list.

chargeType is threaded from charge-extended-info down to the counterparty
cell the same way enableEdit is; other TransactionsTable callers pass none
and are unaffected.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Addresses review feedback.

useGetSecurityBusinesses now takes a pause flag, and the counterparty cell
passes pause: !isSecurityTrade - the hook is called from a table cell, so a
plain transactions table was running the AllSecurityBusinesses query once per
row for a list it never shows.

chargeType is the shared ChargeType union instead of string across the three
layers that thread it, since it is compared against typename literals.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@gilgardosh
gilgardosh force-pushed the feat/security-counterparty-picker branch from b472fd6 to 67fdbf8 Compare August 20, 2026 15:00
@gilgardosh
gilgardosh temporarily deployed to accounter-fullstack August 20, 2026 15:00 — with GitHub Actions Inactive
@gilgardosh
gilgardosh changed the base branch from feat/security-businesses-plan to main August 20, 2026 15:00
@gilgardosh
gilgardosh temporarily deployed to accounter-fullstack August 20, 2026 15:00 — with GitHub Actions Inactive
@gilgardosh
gilgardosh merged commit b643366 into main Aug 20, 2026
9 checks passed
@gilgardosh
gilgardosh deleted the feat/security-counterparty-picker branch August 20, 2026 15:09
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.

2 participants