Feature: AI Credits Widget UX improvements, GoodID verification, and buy-flow polish#78
Open
blueogin wants to merge 31 commits into
Open
Feature: AI Credits Widget UX improvements, GoodID verification, and buy-flow polish#78blueogin wants to merge 31 commits into
blueogin wants to merge 31 commits into
Conversation
…roved clarity in purchase flow
…ues, improve formatting functions for better user feedback
… updating quote calculations and UI components for improved user experience
…itsWidget, streamline validation logic for improved clarity
…ponents for improved display of financial information in AiCreditsWidget
… user feedback on deposit and stream bonuses
…space between currency symbol and value for improved readability
…r guidance on purchasing credits
…etup FAQ for clearer user guidance
…ng in useAiCreditsAdapter for improved user experience
…in useAiCreditsAdapter for improved functionality
…tor consent management in AiCreditsWidget
…vements for better credit management and user experience
…ure and additional operator status handling for better credit management
…agement with new state properties and improved quote handling
…g and enhance credit management with new state properties
…t and adapter, enhancing credit management and quote processing
…er guidance and credit management, including enhanced FAQ details and formatting in UsageLog
…ng in AiCreditsWidget adapter for improved user experience and credit management
…and G$ amounts, and update buyer address resolution logic for better credit management
…fication functionality and updating dependencies for enhanced user experience
…ser rejection handling and improving state management during payment processes
… status, enhancing flow control and state management during payment processes
…d improving initial stream amount resolution for better user experience in credit management
There was a problem hiding this comment.
Pull request overview
This PR improves the AI Credits widget purchase/manage UX, adds a dedicated wallet “connecting” state, introduces GoodID verification via @goodsdks/citizen-sdk, and refactors quoting/balance math toward USD-micro based accounting.
Changes:
- Add a first-class
connectingwidget status + Storybook/Playwright coverage for it. - Refactor buy/manage flows: buyer key handling via in-memory payer session, updated stepper/drawer behavior, updated stats layout, new FAQ, and backend-fetched credit history.
- Rework quote/minimums and backend types to center on USD micro amounts (and GoodID bonus display).
Reviewed changes
Copilot reviewed 34 out of 47 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/widgets/ai-credits-widget/states.spec.ts | Adds a QA state test + screenshot for the new connecting state. |
| pnpm-lock.yaml | Locks new dependency versions after adding Citizen SDK. |
| packages/ui/src/components-test/ScrollArea.tsx | Introduces a ScrollArea test component with hidden scrollbars (web). |
| packages/ui/src/components-test/ScrollArea.ts | Removes the old ScrollArea test component definition. |
| packages/ai-credits-widget/src/widgetRuntimeContract.ts | Updates the runtime contract: new connecting status and reshaped state/actions/events. |
| packages/ai-credits-widget/src/vaultMinimums.ts | Changes minimum validation and messaging to use USD thresholds and quote-derived USD values. |
| packages/ai-credits-widget/src/Untitled | Adds a stray file (should be removed). |
| packages/ai-credits-widget/src/quoteMath.ts | Refactors quote math and formatting helpers; adds GoodID bonus helpers and USD display formatting. |
| packages/ai-credits-widget/src/payerSession.ts | Adds in-memory payer session storage for buyer/operator session fields. |
| packages/ai-credits-widget/src/integration.ts | Registers the new connecting state in integration metadata. |
| packages/ai-credits-widget/src/index.ts | Updates public exports to match renamed/removed types and helpers. |
| packages/ai-credits-widget/src/goodIdVerification.ts | Adds GoodID verification entrypoint using Citizen SDK + wallet provider transport. |
| packages/ai-credits-widget/src/components/theme/cards.ts | Tweaks Bonus badge spacing/alignment for better small-screen layout. |
| packages/ai-credits-widget/src/components/manage/UsageLog.tsx | Switches UsageLog to fetch backend entries and render a scrollable funding history. |
| packages/ai-credits-widget/src/components/manage/SetupSnippet.tsx | Changes API setup snippet generation and makes it conditional on buyer pubkey. |
| packages/ai-credits-widget/src/components/manage/CreditsManagementCard.tsx | Updates Manage stats layout and switches displayed balances to USD micro amounts. |
| packages/ai-credits-widget/src/components/manage/BuyerOperatorCard.tsx | Renames buyer/operator fields and updates consent/key UI. |
| packages/ai-credits-widget/src/components/index.ts | Exports the new Buy Credits FAQ component. |
| packages/ai-credits-widget/src/components/flow/purchaseFlowUtils.ts | Updates flow-step mapping logic to new buyer key + consent model. |
| packages/ai-credits-widget/src/components/flow/AiCreditsPurchaseFlow.tsx | Refactors purchase flow drawer behavior, quote handling, and GoodID verify flow. |
| packages/ai-credits-widget/src/components/flow/AiCreditsFlowStepper.tsx | Updates stepper to incorporate the “saved buyer key” gating. |
| packages/ai-credits-widget/src/components/buy/OperatorConsentStep.tsx | Renames props/state to match new buyer key + consent fields. |
| packages/ai-credits-widget/src/components/buy/BuyerKeyPanel.tsx | Updates buyer key UI to new pub/prv naming and “saved” confirmation state. |
| packages/ai-credits-widget/src/components/buy/BuyCreditsFaq.tsx | Adds an FAQ card explaining buyer/operator, GoodID bonuses, and flows. |
| packages/ai-credits-widget/src/components/buy/AmountPicker.tsx | Refactors amounts UI around live quote building, USD estimates, and GoodID bonus UI. |
| packages/ai-credits-widget/src/components/buy/AiCreditsHero.tsx | Simplifies hero bonus badge logic and text. |
| packages/ai-credits-widget/src/chainClient.ts | Simplifies chain quote building to return quote amounts only. |
| packages/ai-credits-widget/src/backendTypes.ts | Updates backend types: makes credit/profile fields required and renames settlement output. |
| packages/ai-credits-widget/src/backendClient.ts | Updates balance helpers and account-view building; changes usage log to return raw entries. |
| packages/ai-credits-widget/src/AiCreditsWidget.tsx | Updates widget UI to support connecting state, new buy/manage UIs, and adds FAQ. |
| packages/ai-credits-widget/src/adapter.ts | Refactors adapter state/actions for new quoting, payer session, and GoodID verification. |
| packages/ai-credits-widget/package.json | Adds @goodsdks/citizen-sdk dependency. |
| examples/storybook/src/stories/helpers/aiCreditsWidgetStories.tsx | Updates QA runtime fixtures to new contract + adds Connecting story. |
| examples/storybook/src/stories/ai-credits-widget/AiCreditsWidgetQA.stories.tsx | Adds the Connecting QA story export. |
| examples/storybook/src/stories/ai-credits-widget/AiCreditsWidget.mdx | Updates docs copy to reflect new drawer/stepper interaction. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: blueogin <43612769+blueogin@users.noreply.github.com>
…proved user understanding
… improved readability and maintainability
…ponents for clarity on deposit limits
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
Closes #74.
Polishes the AI Credits widget so buying and managing credits feels clearer and less error-prone on mobile and in the wallet flow.
What changed