Skip to content

Conversation

@MosCD3
Copy link
Contributor

@MosCD3 MosCD3 commented Sep 4, 2025

Summary of Changes

This PR refactors credential card rendering to decouple the UI components from OCA bundle logic and unify data handling across credential types. Key updates include:
• Introduced a mapper-first architecture:
• mapAnonCredsToCard and related mappers now handle attribute selection, primary/secondary ordering, PII detection (allPI), and proof request filtering.
• UI components (Card11Pure, Card10Pure) now only render the mapped data without interpreting OCA overlays.
• Added proof request support:
• When proofContext is true and displayItems are passed, the mapper uses only those attributes/predicates in the given order.
• Prevents leakage of extra credential attributes in proof cards.
• Updated CredentialCardGen.tsx to pass displayItems through to the mapper during proof flows.
• Removed redundant attribute reordering logic from UI components (e.g. Card11Pure).
• Ensured allPI and status are computed in the mapper and exposed in the unified card data model.

The work is still in progress

Fixes #1437

Screenshots, videos, or gifs

Credential Rendering - Frame 1

Breaking change guide

•	Breaking: UI components no longer reorder attributes based on primaryAttributeKey/secondaryAttributeKey.
•	If downstream code depended on that behavior, use the new mappers to prepare data with the desired ordering.
•	Otherwise, existing card usage remains unchanged.

Related Issues

Replace this text with issue #'s that are relevant to this PR. If there are none, simply enter N/A

Pull Request Checklist

Tick all boxes below to demonstrate that you have completed the respective task. If the item does not apply to your this PR check it anyway to make it apparent that there's nothing to do.

  • All commits contain a DCO Signed-off-by line (we use the DCO GitHub app to enforce this)
  • If applicable, screenshots, gifs, or video are included for UI changes
  • If applicable, breaking changes are described above along with how to address them
  • If applicable, added changeset(s)
  • Added sufficient tests so that overall code coverage is not reduced

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

Pro Tip 🤓

  • Read our contribution guide at least once; it will save you a few review cycles!
  • Your PR will likely not be reviewed until all the above boxes are checked and all automated checks have passed

Signed-off-by: Mostafa Gamal <[email protected]>
@changeset-bot
Copy link

changeset-bot bot commented Sep 4, 2025

⚠️ No Changeset found

Latest commit: f7f6b03

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@MosCD3 MosCD3 changed the title Refactor types feat: Refactor UI to decouple from Credential types Sep 4, 2025
@codecov-commenter
Copy link

codecov-commenter commented Sep 4, 2025

Codecov Report

❌ Patch coverage is 10.34483% with 286 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.01%. Comparing base (b1fb127) to head (f7f6b03).

Files with missing lines Patch % Lines
packages/core/src/wallet/map-to-card.ts 5.04% 113 Missing ⚠️
packages/core/src/components/misc/Card11Pure.tsx 1.40% 70 Missing ⚠️
packages/core/src/components/misc/Card10Pure.tsx 1.51% 65 Missing ⚠️
...ges/core/src/components/misc/CredentialCardGen.tsx 4.76% 20 Missing ⚠️
...core/src/components/misc/CredentialCardGenLogo.tsx 10.00% 9 Missing ⚠️
packages/core/src/screens/ListCredentials.tsx 20.00% 8 Missing ⚠️
packages/core/src/wallet/CardPresenter.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1635      +/-   ##
==========================================
- Coverage   53.25%   52.01%   -1.25%     
==========================================
  Files         307      314       +7     
  Lines       10937    11247     +310     
  Branches     2957     3215     +258     
==========================================
+ Hits         5825     5850      +25     
- Misses       5082     5348     +266     
- Partials       30       49      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Mostafa Gamal <[email protected]>
Signed-off-by: Mostafa Gamal <[email protected]>
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
21.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@jleach jleach changed the title feat: Refactor UI to decouple from Credential types feat: refactor UI to decouple from Credential types Sep 19, 2025
@tbloomfi
Copy link

@MosCD3 I think that credential ordering should be included in the normalized credential metadata - it is not included in the original conceptual diagram. Attribute ordering is a concept in OCA and openid4vci metadata and likely approaches.

@MosCD3 MosCD3 marked this pull request as ready for review December 8, 2025 14:29
@MosCD3 MosCD3 requested a review from a team as a code owner December 8, 2025 14:29
MosCD3 and others added 8 commits December 8, 2025 09:30
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
21.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

REFACTOR: Decouple credential card view (list, offer, proof) from OCA

3 participants