Skip to content

[Feature] AI Credits widget: "Revoke Operator" button with confirmation dialog #154

Description

@goodbounties-nanoclaw-agent

Feature summary

Add a red "Revoke Operator" button to the Manage tab's BuyerOperatorCard in packages/ai-credits-widget. Clicking it opens a confirmation dialog explaining that revoking will deduct any bonus balance and stop any active stream bonuses; confirming triggers the revoke action.

Problem or opportunity

BuyerOperatorCard.tsx (packages/ai-credits-widget/src/components/manage/) already shows operator-consent state (operatorConsented, operatorConsentPending) and a "Sign Consent"/"Consented" action, but there is no way for a user to revoke operator status once granted. Users need a clear, deliberate way to revoke, with an explicit warning about the consequences (bonus deduction, stream bonuses stopped) before they do it.

Proposed solution

  1. Add a red "Revoke Operator" button to BuyerOperatorCard.tsx, shown when operatorConsented is true, using the existing Button component with the existing error/red color token (no new button variant).
  2. On click, open a confirmation dialog using the existing imperative dialog system (createDialog/GoodWidgetDialog in packages/ui/src/components/Dialog.tsx) — no new dialog component.
  3. Dialog copy explains: revoking removes the operator's ability to act on your behalf; any bonus balance will be deducted, and any active stream bonuses will stop.
  4. On confirm, call a new revokeOperatorConsent action (to be added to widgetRuntimeContract.ts/backendClient.ts, since no revoke action currently exists in this package) which calls the antseed-integration backend's operator-reset endpoint . assume it will be on /v1/accounts/revoke-operator and it will require signature hash in similar format to other permissioned endpoints.

Required states, flows, and behaviors

  • operatorConsented === true → "Revoke Operator" button visible (red).
  • operatorConsented === false (no operator granted) → button not shown.
  • Click "Revoke Operator" → confirmation dialog opens; no action taken yet.
  • Confirm in dialog → revoke action fires; on success, card updates to reflect no operator consented (mirrors the existing "Sign Consent" success-state update).
  • Cancel/dismiss dialog → no change, operator remains active.
  • Revoke action failure → error surfaced consistent with existing error handling in BuyerOperatorCard.tsx.

Acceptance criteria

  • "Revoke Operator" button is red and only visible when operator consent is currently active.
  • Clicking it always shows a confirmation dialog before any revoke action is taken.
  • Dialog copy explains bonus-balance deduction and stream-bonus stoppage.
  • Confirming revokes operator status end-to-end (calls the backend reset endpoint) and updates the UI state.
  • Canceling the dialog leaves operator status unchanged.
  • Reuses existing Button/Dialog components and color tokens — no new UI primitives added.

Additional context

Requested by Hadar Rottenberg (Bounty Lead) in #goodbounties-lead, 2026-08-10 — standalone from issue #150 (explicit consent-step gating/copy), per Hadar's confirmation. Depends on the antseed-integration operator-reset endpoint (companion bounty, tracked separately) for the actual on-chain/backend revoke call — flag as an open dependency for the plan stage if that endpoint isn't ready yet. Relevant files: packages/ai-credits-widget/src/components/manage/BuyerOperatorCard.tsx, packages/ai-credits-widget/src/operatorConsent.ts, packages/ai-credits-widget/src/widgetRuntimeContract.ts, packages/ai-credits-widget/src/backendClient.ts, packages/ui/src/components/Dialog.tsx.

Create the plan (keep this section in the issue body)

Based on the above description create an execution plan in a new sub-issue and preserve the original issue content unchanged.
Do not execute the plan until given instructions to do so.

Sub-issue requirements:

  • Title format: [DRAFT][PLAN] <what issue is being planned>
  • Type: Task
  • Description must start with: <sub-issue title>
  • Link the sub-issue back to this parent issue.

Instructions when creating the plan:

  • Map relevant files that are too be used as reference from all repos mentioned
  • import existing @GoodDollar packages
  • Map new components that should be created. Assess when a new component should be created in the new savings widget package or made part of the reusable packages/ui

Plan specification required sections:

  • Required states, flows, and behaviors
  • Execution plan
  • acceptance criteria
  • human-reviewer checklist

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Prepare AI Task

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions