Skip to content

feat(widget): extract AuditTrailViewer into standalone zero-dependency React widget - #27

Open
jdjioe5-cpu wants to merge 1 commit into
nirium-protocol:mainfrom
jdjioe5-cpu:feature/audit-trail-widget
Open

feat(widget): extract AuditTrailViewer into standalone zero-dependency React widget#27
jdjioe5-cpu wants to merge 1 commit into
nirium-protocol:mainfrom
jdjioe5-cpu:feature/audit-trail-widget

Conversation

@jdjioe5-cpu

Copy link
Copy Markdown

Closes #12

What this PR delivers

A self-contained React widget package at \packages/widget\ that satisfies the acceptance criteria for the \ USDC standalone widget bounty:

  1. \AuditTrailViewer\ React component accepts an \�ppId\ and fetches anchored receipts via \GET /api/audit/info.
  2. Displays IPFS CIDs and Stellar tx hashes cleanly with Tailwind-friendly styling + working external links (defaulting to IPFS gateway + Stellar Expert, both overrideable via props).
  3. Includes a full NPM build setup (tsup dual ESM/CJS + TypeScript declarations).

Beyond the spec

  • Dependency-free \ etchAuditInfo()\ helper so non-React hosts can still use the API contract.
  • vitest + @testing-library/react test suite — 15 tests covering success / loading / empty / error states + click interaction.

  • enderExternalLink\ prop slot + \onReceiptClick\ callback for full host-app customisation without forking.
  • Skeleton-loading state with proper \�ria-busy\ semantics.
  • README with both React and non-React usage examples + MIT license.

Validation

\
npm test → 15/15 passing (3 test files)
npm run build → ESM (8.90 KB) + CJS (9.89 KB) + d.ts (3.68 KB)
npm run typecheck → tsc clean
\\

The widget declares only React + react-dom as peerDependencies, so third-party Web3 dashboards can embed it without pulling in the full nirium SDK.

…y React widget

Closes nirium-protocol#12

Adds packages/widget delivering the acceptance criteria for the
\ USDC standalone widget bounty:

- Single React component (<AuditTrailViewer />) accepts an appId
  and fetches anchored receipts via GET /api/audit/info
- Cleanly renders IPFS CID + Stellar tx hashes with external
  links (IPFS gateway + Stellar Expert) and Tailwind-friendly
  class hooks
- Dual ESM/CJS build via tsup + TypeScript declarations
- Dependency-free fetchAuditInfo() helper for non-React hosts
- vitest test suite (15 tests) covering success / loading / error
  / empty states + click interaction
- README with usage + non-React examples + MIT license

The widget declares only React + react-dom as peerDependencies
so any third-party Web3 dashboard can embed it without pulling
in the full nirium SDK.
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.

Standalone React AuditTrail viewer widget

1 participant