Skip to content

[GoodBounty]: Finalize citizen claim Invite Rewards PR #109

Description

@L03TJ3

Summary

PR #91 adds InviteSDK-backed Invite Rewards to the citizen claim widget. Its two critical SDK flows are now in place: a user who registered a personal code can attach one inviter later, and an inviter can see whether they have collectable pending invitees. The remaining work is to make the UI production-ready and verifiably correct for users, without broadening the feature or changing protocol/SDK behavior.

The contributor should work on the existing PR branch, keep the change focused, and leave it ready for human review.

Contributor task

Desired behavior (acceptance criteria)

  • An inviter sees an accurate distinction between approved invitees, pending invitees, and invitees whose rewards are currently collectable.
  • The collect action is available only when the SDK reports at least one collectable pending invitee; collection leaves non-eligible pending invitees untouched.
  • A user receives visible success or error feedback after joining an inviter or collecting rewards, including after the join card is no longer shown.
  • The Invite Rewards tab remains usable on desktop and mobile in its loading, disconnected, unsupported-network, empty, pending, collectable, success, and error states.
  • The contributor can demonstrate the deferred-inviter and collection-ready paths without relying on a live wallet or live contract state.

Scope

In scope

  • Finish the Invite Rewards presentation and state handling already introduced in PR Integrate InviteSDK rewards flow into citizen claim widget #91.
  • Correct user-facing counts and labels. In particular, do not label all registered invitees as "approved"; use the protocol-provided approved/earned values where appropriate.
  • Show the current user’s earned invite reward total when that data is available.
  • Keep pending invitee addresses visible, use getCollectableInvitees() for collection readiness, and give a clear status for collectable versus waiting invitees.
  • Surface join/collection success and failure where the user can see it after the action completes.
  • Add deterministic component/adapter fixtures or mocked-SDK tests for the two agreed flows and the important UI states; update Storybook screenshots/evidence as needed.
  • Update the citizen-claim-widget README only where necessary to describe the final supported behavior and SDK version.

Out of scope

  • Changes to GoodProtocol, InvitesV2, or @goodsdks/invite-sdk.
    Anything that seems to be incorrect on sdk-level needs to be raised back to maintainers. no manual workarounds or hacks to make things work
  • A new wallet/provider abstraction, Wagmi/React Query, new public theme targets, or a redesign of the widget.
  • New invite campaign rules, payout rules, pagination/indexing infrastructure, or unrelated package refactors.
  • Changing the already implemented deferred-inviter protocol rule: it is allowed only while invitedBy is empty and the invite bounty is unpaid.

Starting points

  • packages/citizen-claim-widget/src/InviteRewards.tsx - Invite Rewards UI, counts, collection control, and visible feedback.
  • packages/citizen-claim-widget/src/inviteAdapter.ts - shared SDK-backed state, refresh, join, and collection actions.
  • packages/citizen-claim-widget/src/inviteRules.ts - pure rules for deferred attachment and collectable invitees.
  • tests/widgets/citizen-claim-widget/ - Playwright state-flow tests and curated visual evidence.
  • examples/storybook/src/stories/citizen-claim-widget/ - stories/fixtures used by the widget QA flow.
  • packages/citizen-claim-widget/README.md - integrator-facing behavior documentation.

Definition of Done (DoD) + How to test

DoD

  • PR Integrate InviteSDK rewards flow into citizen claim widget #91 stays focused on packages/citizen-claim-widget and the invite-sdk integration, its stories/tests, curated screenshots, and necessary documentation.
  • Approved, pending, collectable, and total-earned information is derived from the correct SDK/protocol values and is labelled accurately.
  • Any UI improvements should still follow patterns and use the design system as you can see across the citizen-claim-widget and the other widgets
  • The collect button is enabled only when getCollectableInvitees() is non-empty; the UI does not treat campaign activity as eligibility.
  • Deferred inviter attachment reuses the existing personal code and remains unavailable after an inviter is attached or the invite bounty is paid.
  • Join and collection errors/success messages remain visible in the Invite Rewards view after state refreshes or the join card disappears.
  • Tests exercise the actual adapter/UI action path for deferred attachment (including original-code reuse) and for collection readiness, using deterministic mocks or fixtures.
  • Stories/Playwright coverage demonstrates the key ready, pending, collectable, success, and error states; curated screenshots are updated only when intentionally changed.
  • Mobile and desktop layouts are manually tested to the extend you can (collecting rewards has a waiting time, so cannot be tested immediately) or the changed states.
  • pnpm install --frozen-lockfile, scoped build/lint, and the relevant Playwright tests pass; any environment limitation is recorded in the PR.
  • The PR description references [Feature]: Integrate invite-sdk into citizen-claim-widget following GoodWallet design & flow #84/[PLAN] Integrate invite SDK into citizen-claim-widget #85 and includes the completed acceptance checklist and test evidence.

How to test

pnpm install --frozen-lockfile
pnpm --filter @goodwidget/citizen-claim-widget build
pnpm --filter @goodwidget/citizen-claim-widget lint
pnpm storybook
# In a separate terminal, with Storybook running:
pnpm test:demo tests/widgets/citizen-claim-widget
pnpm test:storybook

If a command cannot be run, document why and provide the closest relevant evidence.

Handoff comment

Contributor: @<handle>
PR: #91
Commit: <commit>

Fixed:

- <fix>

Verified:

- <scenario>: <result>

Evidence:

- <stories/Playwright scenarios and the resulting UI states>

Remaining risks:

- <None / details>

Metadata

Metadata

Labels

GoodBounties - RareLarger features, touches multiple areas

Type

No type

Projects

Status
In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions