Skip to content

Feature: Align AI Credits widget with credit-history API shape#89

Open
blueogin wants to merge 4 commits into
mainfrom
feat/ai-credits/api-shape-update
Open

Feature: Align AI Credits widget with credit-history API shape#89
blueogin wants to merge 4 commits into
mainfrom
feat/ai-credits/api-shape-update

Conversation

@blueogin

@blueogin blueogin commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

Align @goodwidget/ai-credits-widget with the updated AntSeed account APIs:

  • GET /v1/accounts/:account/credit is profile-only (no gdCredits); profile may include buyerAddress
  • History/usage/settlement use GET /v1/accounts/:account/credit-history (offset pagination; one page for now)
  • POST /v1/accounts/:buyer/operator-consent sends required body payer

Depends on AntSeed backend shipping the matching API shape (GoodDollar/antseed-integration#11). Widget will fail against older /credit responses that still return gdCredits.

About # (link your issue here)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • PR title matches follow: (Feature|Bug|Chore) Task Name
  • My code follows the style guidelines of this project
  • I have followed all the instructions described in the initial task (check Definitions of Done)
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added reference to a related issue in the repository
  • I have added a detailed description of the changes proposed in the pull request. I am as descriptive as possible, assisting reviewers as much as possible.
  • I have added screenshots related to my pull request (for frontend tasks)
  • I have pasted a gif showing the feature.
  • @mentions of the person or team responsible for reviewing proposed changes

…tion to operator consent requests and implementing credit history retrieval functionality. Update types and response structures for improved credit management and user experience.
@blueogin
blueogin requested review from a team and L03TJ3 July 15, 2026 19:14
blueogin added 3 commits July 16, 2026 08:53
…I changes. Changed endpoint from `/credit` to `/profile` for fetching payer wallet information, enhancing clarity in the widget's functionality.
…new endpoint for credit history retrieval. Update the buyer address resolution logic to utilize the credit history entries, improving accuracy in buyer identification. Remove unused buyerAddress property from types for cleaner code.
… payer field from requests and responses. Update the adapter and backend client to reflect these changes, ensuring cleaner code and improved consistency in consent management.

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

Aligns @goodwidget/ai-credits-widget with the updated AntSeed account API split between profile (/profile) and paginated history (/credit-history), updating both the production client and mocks accordingly.

Changes:

  • Updates backend response types to remove gdCredits from the profile response and introduce CreditHistoryResponse / CreditHistoryQuery.
  • Adds /credit-history support to the backend client and migrates transactions/usage/settlement lookups to use it.
  • Updates Storybook docs to reflect the new endpoints and responsibilities.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
packages/ai-credits-widget/src/backendTypes.ts Updates TS types to reflect profile-only response and adds credit-history response/query types.
packages/ai-credits-widget/src/backendClient.ts Implements credit-history fetching + mock pagination, switches dependent logic to the new endpoints, and adjusts buyer-resolution logic.
examples/storybook/src/stories/ai-credits-widget/AiCreditsWidget.mdx Documents the new /profile + /credit-history API split for the widget’s production stories.

Comment thread packages/ai-credits-widget/src/backendClient.ts
Comment thread packages/ai-credits-widget/src/backendClient.ts
Comment thread packages/ai-credits-widget/src/backendClient.ts
Comment thread packages/ai-credits-widget/src/backendClient.ts
@L03TJ3

L03TJ3 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Non-blocking but make sure your pull-request descriptions stay up to date to the actual implementation.

it refers to endpoint ...../credit while the antseed integration and locally use a /profile endpoint?
likely just stale description but pointing it out if it might hide some inconsistency somewhere

@blueogin

Copy link
Copy Markdown
Contributor Author

@L03TJ3
The pr description is outdated - I prompted copilot to fix it

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.

4 participants