Skip to content

Commit

Permalink
feat: siw-1944 ongoing badge updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ale-mazz committed Jan 9, 2025
1 parent 22ca3e6 commit 532ca97
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ts/features/itwallet/common/store/selectors/preferences.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addYears, isFuture, isPast } from "date-fns";
import { addHours, isFuture, isPast } from "date-fns";
import { createSelector } from "reselect";
import { GlobalState } from "../../../../../store/reducers/types";
import { ItwPreferencesState } from "../reducers/preferences";
Expand Down Expand Up @@ -45,6 +45,7 @@ export const itwRequestedCredentialsSelector = createSelector(
// This acts as a soft boolean flag: it is unlikely to happen that a credential remains
// in the "requested" status for this long. This allows for flexibility to adjust the
// timeframe in the future if needed.
.filter(([_, requestedAt]) => isFuture(addYears(requestedAt, 1)))
// 09/01/25: The timeframe has been adjusted to 24 hours to match the new requirements.
.filter(([_, requestedAt]) => isFuture(addHours(requestedAt, 24)))
.map(([credentialType]) => credentialType)
);
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ import {
} from "../../machine/credential/selectors";
import { ItwCredentialIssuanceMachineContext } from "../../machine/provider";
import { useCredentialEventsTracking } from "../hooks/useCredentialEventsTracking";
import { useIOSelector } from "../../../../store/hooks";
import { useIOSelector, useIOStore } from "../../../../store/hooks";
import { itwDeferredIssuanceScreenContentSelector } from "../../../../store/reducers/backendStatus/remoteConfig";
import { getFullLocale } from "../../../../utils/locale";
import { serializeFailureReason } from "../../common/utils/itwStoreUtils";
import { itwUnflagCredentialAsRequested } from "../../common/store/actions/preferences.ts";

export const ItwIssuanceCredentialFailureScreen = () => {
const failureOption =
Expand Down Expand Up @@ -57,6 +58,7 @@ type ContentViewProps = { failure: CredentialIssuanceFailure };
* Renders the content of the screen
*/
const ContentView = ({ failure }: ContentViewProps) => {
const store = useIOStore();
const machineRef = ItwCredentialIssuanceMachineContext.useActorRef();
const credentialType = ItwCredentialIssuanceMachineContext.useSelector(
selectCredentialTypeOption
Expand Down Expand Up @@ -133,6 +135,14 @@ const ContentView = ({ failure }: ContentViewProps) => {
};
// Dynamic errors extracted from the entity configuration, with fallback
case CredentialIssuanceFailureType.INVALID_STATUS:
// Unflag the credential since the user is not entitled to it or it's not available
pipe(
credentialType,
O.map(value => {
store.dispatch(itwUnflagCredentialAsRequested(value));
})
);

return {
title:
invalidStatusDetails.message?.title ??
Expand Down

0 comments on commit 532ca97

Please sign in to comment.