Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(IT Wallet): [SIW-1824] Show alert if wallet instance is revoked #6547

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

RiccardoMolinari95
Copy link
Collaborator

@RiccardoMolinari95 RiccardoMolinari95 commented Dec 12, 2024

Short description

This PR adds functionality to display an alert in the wallet section when the Wallet Instance has been revoked. The alerts are displayed based on the revocation reason.

List of changes proposed in this pull request

  • add itwUpdateWalletInstanceStatus in getStatusOrResetWalletInstance to update the wallet instance status
  • update the global state of Wallet Instance including revocation details
  • add itwWalletInstanceStatusSelector to retrieve WI status
  • add useItwWalletInstanceRevocationAlert to display Alert in based on the revocation reason

How to test

Simulate or revoked via Web the wallet instance revocation and navigate to wallet section

CERTIFICATE_REVOKED_BY_ISSUER
https://github.com/user-attachments/assets/9aa867fb-f690-4da4-8e19-a1e53298e6de

REVOKED_BY_USER
https://github.com/user-attachments/assets/24899e8b-0110-4228-8edc-8f2b6da3e7e3

.env.local Outdated Show resolved Hide resolved
.env.production Outdated Show resolved Hide resolved
ts/config.ts Outdated Show resolved Hide resolved
@pagopa-github-bot pagopa-github-bot changed the title [SIW-1824] Show alert if wallet instance is revoked feat(IT Wallet): [SIW-1824] Show alert if wallet instance is revoked Dec 13, 2024
@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Dec 13, 2024

Affected stories

  • 🌟 SIW-1824: Come utente voglio essere avvisato con un'informativa qualora il wallet sia stato revocato
    subtask of

Generated by 🚫 dangerJS against 2c2b0c3

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 44.18605% with 24 lines in your changes missing coverage. Please review.

Project coverage is 25.99%. Comparing base (4f204b4) to head (d92a539).
Report is 909 commits behind head on master.

Files with missing lines Patch % Lines
...stance/hook/useItwWalletInstanceRevocationAlert.ts 37.50% 20 Missing ⚠️
...es/itwallet/walletInstance/store/reducers/index.ts 0.00% 2 Missing ⚠️
...s/itwallet/walletInstance/store/selectors/index.ts 71.42% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #6547       +/-   ##
===========================================
- Coverage   48.42%   25.99%   -22.44%     
===========================================
  Files        1488     1309      -179     
  Lines       31617    27745     -3872     
  Branches     7669     6204     -1465     
===========================================
- Hits        15311     7212     -8099     
- Misses      16238    20519     +4281     
+ Partials       68       14       -54     
Files with missing lines Coverage Δ
ts/config.ts 100.00% <ø> (ø)
ts/features/itwallet/machine/credential/actions.ts 0.00% <ø> (ø)
ts/features/itwallet/machine/eid/actions.ts 1.53% <ø> (ø)
ts/features/itwallet/trustmark/machine/actions.ts 12.50% <ø> (ø)
...res/itwallet/walletInstance/store/actions/index.ts 100.00% <100.00%> (ø)
...eatures/wallet/components/WalletCardsContainer.tsx 84.00% <100.00%> (ø)
...es/itwallet/walletInstance/store/reducers/index.ts 75.00% <0.00%> (ø)
...s/itwallet/walletInstance/store/selectors/index.ts 71.42% <71.42%> (ø)
...stance/hook/useItwWalletInstanceRevocationAlert.ts 37.50% <37.50%> (ø)

... and 1810 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbe6980...d92a539. Read the comment docs.


/**
* Hook to monitor wallet instance status and display alerts if revoked.
* @param walletInstanceStatus - The status of the wallet instance, including whether it is revoked and the reason for revocation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param walletInstanceStatus - The status of the wallet instance, including whether it is revoked and the reason for revocation.

@@ -27,10 +28,18 @@ const reducer = (
switch (action.type) {
case getType(itwWalletInstanceAttestationStore): {
return {
...state,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
...state,

I think it's correct to reset the state when we save a new WI: if there is already a status stored, it is for sure referred to a past WI.
What do you think?

Comment on lines +22 to +25
export const itwWalletInstanceStatusSelector = createSelector(
(state: GlobalState) => state.features.itWallet.walletInstance.status,
status => status
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified as follows

Suggested change
export const itwWalletInstanceStatusSelector = createSelector(
(state: GlobalState) => state.features.itWallet.walletInstance.status,
status => status
);
export const itwWalletInstanceStatusSelector = (state: GlobalState) => state.features.itWallet.walletInstance.status;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants