diff --git a/locales/de/index.json b/locales/de/index.json index 16ff9769438..47d6a3dd0c5 100644 --- a/locales/de/index.json +++ b/locales/de/index.json @@ -3573,11 +3573,6 @@ "body": "Vergewissere dich, dass du im Besitz des gültigen physischen Dokuments bist, bevor du dessen digitale Version anforderst.", "primaryAction": "Verstanden" }, - "asyncCredentialError": { - "title": "Das Führerscheinamt bearbeitet deinen Antrag", - "body": "Du erhältst in der App eine Mitteilung, dass du fortfahren kannst, sobald dein Antrag bearbeitet ist.", - "primaryAction": "Verstanden" - }, "credentialAlreadyAdded": { "title": "Du hast dieses Dokument bereits", "body": "Die digitale Version des Dokuments befindet sich bereits in deinem Konto.", diff --git a/locales/en/index.json b/locales/en/index.json index 0950cbd4a04..0d0cf6cb087 100644 --- a/locales/en/index.json +++ b/locales/en/index.json @@ -4854,11 +4854,6 @@ "body": "Assicurati di avere il documento fisico valido prima di richiedere la sua versione digitale.", "primaryAction": "Ho capito" }, - "asyncCredentialError": { - "title": "La Motorizzazione Civile ha preso in carico la tua richiesta", - "body": "Riceverai un messaggio in app per continuare appena La Motorizzazione Civile avrà elaborato la tua richiesta.", - "primaryAction": "Ho capito" - }, "issuerNotTrustedCommonError": { "title": "Un problema non permette di continuare", "subtitle": "Si è verificato un errore tecnico che impedisce di ottenere {{credential}}. Riprova.\nSe il problema persiste, contatta l’assistenza.", diff --git a/locales/it/index.json b/locales/it/index.json index 4a97b2393f2..d8df0a69720 100644 --- a/locales/it/index.json +++ b/locales/it/index.json @@ -5086,11 +5086,6 @@ "body": "Assicurati di avere il documento fisico valido prima di richiedere la sua versione digitale.", "primaryAction": "Ho capito" }, - "asyncCredentialError": { - "title": "La Motorizzazione Civile ha preso in carico la tua richiesta", - "body": "Riceverai un messaggio in app per continuare appena La Motorizzazione Civile avrà elaborato la tua richiesta.", - "primaryAction": "Ho capito" - }, "issuerNotTrustedCommonError": { "title": "Un problema non permette di continuare", "subtitle": "Si è verificato un errore tecnico che impedisce di ottenere {{credential}}. Riprova.\nSe il problema persiste, contatta l’assistenza.", @@ -5134,6 +5129,12 @@ "cieNotRegistered": { "title": "Registra la CIE in app CieID per continuare", "subtitle": "Per ottenere IT-Wallet, completa prima la registrazione della tua CIE in app CieID e poi riprova." + }, + "mdlMessageExpired": { + "title": "Richiesta scaduta", + "subtitleStart": "Questa richiesta non è più valida ma puoi aggiungere di nuovo la tua ", + "subtitleBold": "Patente su IO.", + "primaryAction": "Aggiungi di nuovo" } }, "notMatchingIdentityScreen": { diff --git a/ts/features/common/store/reducers/__tests__/__snapshots__/index.test.ts.snap b/ts/features/common/store/reducers/__tests__/__snapshots__/index.test.ts.snap index 490eacd92c7..5764e5b162f 100644 --- a/ts/features/common/store/reducers/__tests__/__snapshots__/index.test.ts.snap +++ b/ts/features/common/store/reducers/__tests__/__snapshots__/index.test.ts.snap @@ -163,9 +163,7 @@ exports[`featuresPersistor should match snapshot 1`] = ` "_tag": "None", }, }, - "preferences": { - "requestedCredentials": {}, - }, + "preferences": {}, "securePreferences": { "offlineAccessCounter": 0, "unverifiedCredentialsAccessCounter": 0, diff --git a/ts/features/itwallet/analytics/enum.ts b/ts/features/itwallet/analytics/enum.ts index 360f659a33b..3514e4a8edd 100644 --- a/ts/features/itwallet/analytics/enum.ts +++ b/ts/features/itwallet/analytics/enum.ts @@ -13,7 +13,6 @@ export enum ITW_SCREENVIEW_EVENTS { WALLET_ADD_LIST_ITEM = "WALLET_ADD_LIST_ITEM", ITW_DATA_SHARE = "ITW_DATA_SHARE", ITW_CREDENTIAL_DETAIL = "ITW_CREDENTIAL_DETAIL", - ITW_DEFERRED_ISSUING = "ITW_DEFERRED_ISSUING", "ITW_CREDENTIAL_FAC-SIMILE" = "ITW_CREDENTIAL_FAC-SIMILE", ITW_OFFLINE_WALLET = "ITW_OFFLINE_WALLET", ITW_OFFLINE_BOTTOM_SHEET = "ITW_OFFLINE_BOTTOM_SHEET", diff --git a/ts/features/itwallet/analytics/index.ts b/ts/features/itwallet/analytics/index.ts index 0f7d6dfeef6..c7173a291b4 100644 --- a/ts/features/itwallet/analytics/index.ts +++ b/ts/features/itwallet/analytics/index.ts @@ -435,13 +435,6 @@ export function trackItWalletCieCardReadingSuccess(itw_flow: ItwFlow) { ); } -export function trackItWalletDeferredIssuing(credential: MixPanelCredential) { - void mixpanelTrack( - ITW_SCREENVIEW_EVENTS.ITW_DEFERRED_ISSUING, - buildEventProperties("UX", "screen_view", { credential }) - ); -} - export function trackWalletCredentialFAC_SIMILE( credential: MixPanelCredential ) { diff --git a/ts/features/itwallet/common/store/actions/preferences.ts b/ts/features/itwallet/common/store/actions/preferences.ts index 8a1dfcd07fb..76499483a8f 100644 --- a/ts/features/itwallet/common/store/actions/preferences.ts +++ b/ts/features/itwallet/common/store/actions/preferences.ts @@ -5,14 +5,6 @@ export const itwCloseDiscoveryBanner = createStandardAction( "ITW_CLOSE_DISCOVERY_BANNER" )(); -export const itwFlagCredentialAsRequested = createStandardAction( - "ITW_FLAG_CREDENTIAL_AS_REQUESTED" -)(); - -export const itwUnflagCredentialAsRequested = createStandardAction( - "ITW_UNFLAG_CREDENTIAL_AS_REQUESTED" -)(); - export const itwSetReviewPending = createStandardAction( "ITW_SET_REVIEW_PENDING" )(); @@ -51,8 +43,6 @@ export const itwSetPidReissuingSurveyHidden = createStandardAction( export type ItwPreferencesActions = | ActionType - | ActionType - | ActionType | ActionType | ActionType | ActionType diff --git a/ts/features/itwallet/common/store/reducers/__tests__/__snapshots__/index.test.ts.snap b/ts/features/itwallet/common/store/reducers/__tests__/__snapshots__/index.test.ts.snap index 84a607c7496..f95aebf6a31 100644 --- a/ts/features/itwallet/common/store/reducers/__tests__/__snapshots__/index.test.ts.snap +++ b/ts/features/itwallet/common/store/reducers/__tests__/__snapshots__/index.test.ts.snap @@ -23,9 +23,7 @@ exports[`itWalletReducer should match snapshot [if this test fails, remember to "_tag": "None", }, }, - "preferences": { - "requestedCredentials": {}, - }, + "preferences": {}, "securePreferences": { "offlineAccessCounter": 0, "unverifiedCredentialsAccessCounter": 0, diff --git a/ts/features/itwallet/common/store/reducers/__tests__/index.test.ts b/ts/features/itwallet/common/store/reducers/__tests__/index.test.ts index 6cc26271577..05c811eb2f5 100644 --- a/ts/features/itwallet/common/store/reducers/__tests__/index.test.ts +++ b/ts/features/itwallet/common/store/reducers/__tests__/index.test.ts @@ -115,4 +115,18 @@ describe("itWalletReducer migrations", () => { preferences: { requestedCredentials: {} } }); }); + + it("should migrate the store to version 9 and remove requestedCredentials", async () => { + const previousState = { + _persist: { version: 7, rehydrated: false }, + preferences: { requestedCredentials: { MDL: true } } + }; + + const newState = await migrate(previousState, 9); + + expect(newState).toEqual({ + _persist: { version: 7, rehydrated: false }, + preferences: {} + }); + }); }); diff --git a/ts/features/itwallet/common/store/reducers/__tests__/preferences.test.ts b/ts/features/itwallet/common/store/reducers/__tests__/preferences.test.ts index bb6645fbe97..f9acb98b29d 100644 --- a/ts/features/itwallet/common/store/reducers/__tests__/preferences.test.ts +++ b/ts/features/itwallet/common/store/reducers/__tests__/preferences.test.ts @@ -3,10 +3,8 @@ import MockDate from "mockdate"; import { applicationChangeState } from "../../../../../../store/actions/application"; import { itwCloseDiscoveryBanner, - itwFlagCredentialAsRequested, itwSetAuthLevel, - itwSetClaimValuesHidden, - itwUnflagCredentialAsRequested + itwSetClaimValuesHidden } from "../../actions/preferences"; import reducer, { itwPreferencesInitialState, @@ -15,9 +13,7 @@ import reducer, { import { itwLifecycleStoresReset } from "../../../../lifecycle/store/actions"; describe("IT Wallet preferences reducer", () => { - const INITIAL_STATE: ItwPreferencesState = { - requestedCredentials: {} - }; + const INITIAL_STATE: ItwPreferencesState = {}; it("should return the initial state", () => { expect(reducer(undefined, applicationChangeState("active"))).toEqual( @@ -40,48 +36,9 @@ describe("IT Wallet preferences reducer", () => { MockDate.reset(); }); - it("should handle itwFlagCredentialAsRequested action", () => { - const mockDate = "2024-11-14T20:43:21.361Z"; - MockDate.set(mockDate); - - const action = itwFlagCredentialAsRequested("MDL"); - const newState = reducer(INITIAL_STATE, action); - - expect(newState).toEqual({ - ...newState, - requestedCredentials: { - MDL: mockDate - } - }); - MockDate.reset(); - }); - - it("should handle itwRemoveRequestedCredential action", () => { - const mockDate = "2024-11-14T20:43:21.361Z"; - MockDate.set(mockDate); - - const action = itwUnflagCredentialAsRequested("MDL"); - const newState = reducer( - { - ...INITIAL_STATE, - requestedCredentials: { - MDL: mockDate - } - }, - action - ); - - expect(newState).toEqual({ - ...newState, - requestedCredentials: {} - }); - MockDate.reset(); - }); - it("should handle itwLifecycleStoresReset action and ensure some values are not reset", () => { const initialState: ItwPreferencesState = { hideDiscoveryBannerUntilDate: "2024-11-14T20:43:21.361Z", - requestedCredentials: { MDL: "2024-11-14T20:43:21.361Z" }, isPendingReview: true, authLevel: "L2", claimValuesHidden: true, @@ -128,7 +85,6 @@ describe("IT Wallet preferences reducer", () => { const newState = reducer( { hideDiscoveryBannerUntilDate: "abcd", - requestedCredentials: { MDL: "abcd" }, isPendingReview: true, authLevel: "L2", claimValuesHidden: true, diff --git a/ts/features/itwallet/common/store/reducers/index.ts b/ts/features/itwallet/common/store/reducers/index.ts index 219f7f420cc..9920e6edd02 100644 --- a/ts/features/itwallet/common/store/reducers/index.ts +++ b/ts/features/itwallet/common/store/reducers/index.ts @@ -56,7 +56,7 @@ const itwReducer = combineReducers({ credentialsCatalogue: itwCredentialsCatalogueReducer }); -const CURRENT_REDUX_ITW_STORE_VERSION = 8; +const CURRENT_REDUX_ITW_STORE_VERSION = 9; export const migrations: MigrationManifest = { // Added preferences store @@ -109,7 +109,11 @@ export const migrations: MigrationManifest = { // Removed hideFeedbackBannerUntilDate from preferences "8": (state: PersistedState): PersistedState => - _.omit(state, "preferences.hideFeedbackBannerUntilDate") + _.omit(state, "preferences.hideFeedbackBannerUntilDate"), + + // Removed requestedCredentials from preferences + "9": (state: PersistedState): PersistedState => + _.omit(state, "preferences.requestedCredentials") }; const itwPersistConfig: PersistConfig = { diff --git a/ts/features/itwallet/common/store/reducers/preferences.ts b/ts/features/itwallet/common/store/reducers/preferences.ts index cdf563e771e..0a5bd2feea9 100644 --- a/ts/features/itwallet/common/store/reducers/preferences.ts +++ b/ts/features/itwallet/common/store/reducers/preferences.ts @@ -3,13 +3,11 @@ import { getType } from "typesafe-actions"; import { Action } from "../../../../../store/actions/types"; import { itwCloseDiscoveryBanner, - itwFlagCredentialAsRequested, itwSetAuthLevel, itwSetClaimValuesHidden, itwSetFiscalCodeWhitelisted, itwSetReviewPending, itwSetWalletInstanceRemotelyActive, - itwUnflagCredentialAsRequested, itwSetWalletUpgradeMDLDetailsBannerHidden, itwFreezeSimplifiedActivationRequirements, itwClearSimplifiedActivationRequirements, @@ -21,10 +19,6 @@ import { ItwAuthLevel } from "../../utils/itwTypesUtils.ts"; export type ItwPreferencesState = { // Date until which the discovery banner should be hidden hideDiscoveryBannerUntilDate?: string; - // Stores the list of requested credentials which supports delayed issuance - // Each credential type is associated with a date (ISO string) which represents - // the date of the last issuance request. - requestedCredentials: { [credentialType: string]: string }; // Indicates whether the user should see the modal to review the app. isPendingReview?: boolean; // Indicates the SPID/CIE authentication level used to obtain the eid @@ -46,9 +40,7 @@ export type ItwPreferencesState = { isPidReissuingSurveyHidden?: boolean; }; -export const itwPreferencesInitialState: ItwPreferencesState = { - requestedCredentials: {} -}; +export const itwPreferencesInitialState: ItwPreferencesState = {}; const reducer = ( state: ItwPreferencesState = itwPreferencesInitialState, @@ -62,29 +54,6 @@ const reducer = ( }; } - case getType(itwFlagCredentialAsRequested): { - return { - ...state, - requestedCredentials: { - ...state.requestedCredentials, - [action.payload]: new Date().toISOString() - } - }; - } - - case getType(itwUnflagCredentialAsRequested): { - if (action.payload in state.requestedCredentials) { - const { [action.payload]: _, ...requestedCredentials } = - state.requestedCredentials; - - return { - ...state, - requestedCredentials - }; - } - return state; - } - case getType(itwSetReviewPending): { return { ...state, diff --git a/ts/features/itwallet/common/store/selectors/__tests__/preferences.test.ts b/ts/features/itwallet/common/store/selectors/__tests__/preferences.test.ts index 8e3505e76b1..11c3484bed7 100644 --- a/ts/features/itwallet/common/store/selectors/__tests__/preferences.test.ts +++ b/ts/features/itwallet/common/store/selectors/__tests__/preferences.test.ts @@ -6,7 +6,6 @@ import { appReducer } from "../../../../../../store/reducers"; import { itwAuthLevelSelector, itwIsDiscoveryBannerHiddenSelector, - itwRequestedCredentialsSelector, itwIsPidReissuingSurveyHiddenSelector } from "../preferences"; import { ItwAuthLevel } from "../../../utils/itwTypesUtils.ts"; @@ -31,27 +30,6 @@ describe("itwIsDiscoveryBannerHiddenSelector", () => { }); }); -describe("itwRequestedCredentialsSelector", () => { - it("should return the list of requested credentials in the past 24 hours", () => { - MockDate.set("2023-11-15T20:43:21.361Z"); - - const globalState = appReducer(undefined, applicationChangeState("active")); - - expect( - itwRequestedCredentialsSelector( - _.set(globalState, "features.itWallet.preferences", { - requestedCredentials: { - MDL: "2023-11-14T20:43:21.362Z", - EuropeanDisabilityCard: "2023-11-14T20:43:21.360Z", - EuropeanHealthInsuranceCard: "2023-11-14T20:43:21.361Z" - } - }) - ) - ).toEqual(["MDL"]); - MockDate.reset(); - }); -}); - describe("itwAuthLevelSelector", () => { afterEach(() => { // Always reset the date after each test to avoid side effects diff --git a/ts/features/itwallet/common/store/selectors/preferences.ts b/ts/features/itwallet/common/store/selectors/preferences.ts index da35155c913..3581d4dfb90 100644 --- a/ts/features/itwallet/common/store/selectors/preferences.ts +++ b/ts/features/itwallet/common/store/selectors/preferences.ts @@ -1,4 +1,4 @@ -import { addHours, isFuture, isPast } from "date-fns"; +import { isPast } from "date-fns"; import { createSelector } from "reselect"; import { GlobalState } from "../../../../../store/reducers/types"; import { ItwPreferencesState } from "../reducers/preferences"; @@ -24,21 +24,6 @@ export const itwIsDiscoveryBannerHiddenSelector = createSelector( isPastDate(hideDiscoveryBannerUntilDate) ); -/** - * Returns the list of requested credentials in the past 7 days. - */ -export const itwRequestedCredentialsSelector = createSelector( - itwPreferencesSelector, - ({ requestedCredentials }: ItwPreferencesState) => - Object.entries(requestedCredentials) - // 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. - // 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) -); - /** * Returns whether the app review modal should be shown. */ diff --git a/ts/features/itwallet/common/store/selectors/remoteConfig.ts b/ts/features/itwallet/common/store/selectors/remoteConfig.ts index 03b480af069..890c9a6aca7 100644 --- a/ts/features/itwallet/common/store/selectors/remoteConfig.ts +++ b/ts/features/itwallet/common/store/selectors/remoteConfig.ts @@ -93,20 +93,7 @@ export const itwDisabledCredentialsSelector = createSelector( ); /** - * Return the remote config content for the deferred issuance screen content. - */ -export const itwDeferredIssuanceScreenContentSelector = createSelector( - itwRemoteConfigSelector, - itwConfig => - pipe( - itwConfig, - O.map(itw => itw.deferred_issuance_screen_content), - O.toUndefined - ) -); - -/** - * Return the remote config content for the deferred issuance screen content. + * Return the remote config content for the iPatente CTA's visibility. */ export const itwIsIPatenteCtaEnabledSelector = createSelector( itwRemoteConfigSelector, diff --git a/ts/features/itwallet/common/utils/itwCredentialIssuanceUtils.ts b/ts/features/itwallet/common/utils/itwCredentialIssuanceUtils.ts index 1c8eac3dcf5..4fc61bf569a 100644 --- a/ts/features/itwallet/common/utils/itwCredentialIssuanceUtils.ts +++ b/ts/features/itwallet/common/utils/itwCredentialIssuanceUtils.ts @@ -27,6 +27,12 @@ export type RequestCredentialParams = { skipMdocIssuance: boolean; }; +/** + * List of credentials that cannot be issued in parallel, only sequentially. + * Currently only the mDL must be requested sequentially because of locking issues. + */ +const SEQUENTIAL_ISSUANCE_CREDENTIALS = ["mDL"]; + /** * Requests a credential from the issuer. * @param env - The environment to use for the wallet provider base URL @@ -149,85 +155,36 @@ export const obtainCredential = async ({ } ); - // TODO: [SIW-2839] remove this entire `if` block after the async issuance dismissal - if ( - credentialType === "mDL" && - !operationType && - accessToken.authorization_details.length > 1 - ) { - const sdJwtCredId = extractCredentialIdFromEC( - issuerConf, - "mDL", - CredentialFormat.SD_JWT - ); - const sdJwtAuthDetails = accessToken.authorization_details.find( - auth => auth.credential_configuration_id === sdJwtCredId - ); - if (!sdJwtAuthDetails) { - throw new Error("Missing authorization details for SD-JWT mDL"); - } - - // A 201 status code (async issuance) thrown here is caught in the machine and leads to the async failure screen. - // The code requesting the mDoc credential is never reached. - const sdJwtCredential = await requestAndParseCredential({ - accessToken, - clientId, - credentialType, - authDetails: sdJwtAuthDetails, - env, - dPopCryptoContext, - issuerConf - }); + const params: Omit = { + accessToken, + clientId, + credentialType, + env, + dPopCryptoContext, + issuerConf, + operationType + }; - // If we get here it means no error was thrown, so the response must be a 200 OK. We can request the mdoc in reissuing mode. - const mdocCredId = extractCredentialIdFromEC( - issuerConf, - "mDL", - CredentialFormat.MDOC - ); - const mdocAuthDetails = accessToken.authorization_details.find( - auth => auth.credential_configuration_id === mdocCredId - ); - if (!mdocAuthDetails) { - return { - credentials: [sdJwtCredential] - }; + if (SEQUENTIAL_ISSUANCE_CREDENTIALS.includes(credentialType)) { + const credentials: Array = []; + for (const authDetails of accessToken.authorization_details) { + const credential = await requestAndParseCredential({ + ...params, + authDetails + }); + // eslint-disable-next-line functional/immutable-data + credentials.push(credential); } - - const mdocCredential = await requestAndParseCredential({ - accessToken, - clientId, - credentialType, - authDetails: mdocAuthDetails, - env, - dPopCryptoContext, - issuerConf, - operationType: "reissuing" - }); - - return { - credentials: [mdocCredential, sdJwtCredential] - }; + return { credentials }; } const credentials = await Promise.all( accessToken.authorization_details.map(authDetails => - requestAndParseCredential({ - accessToken, - clientId, - credentialType, - authDetails, - env, - dPopCryptoContext, - issuerConf, - operationType - }) + requestAndParseCredential({ ...params, authDetails }) ) ); - return { - credentials - }; + return { credentials }; }; const getCredentialConfigurationIds = ( @@ -330,18 +287,3 @@ const requestAndParseCredential = async ({ } }; }; - -const extractCredentialIdFromEC = ( - issuerConf: IssuerConfiguration, - credentialType: string, - format: CredentialFormat -) => { - const { credential_configurations_supported } = - issuerConf.openid_credential_issuer; - const credentialConfig = Object.entries( - credential_configurations_supported - ).find( - ([, config]) => config.scope === credentialType && config.format === format - ); - return credentialConfig ? credentialConfig[0] : undefined; -}; diff --git a/ts/features/itwallet/issuance/hooks/useCredentialEventsTracking.ts b/ts/features/itwallet/issuance/hooks/useCredentialEventsTracking.ts index 315c0c16e67..830f042651e 100644 --- a/ts/features/itwallet/issuance/hooks/useCredentialEventsTracking.ts +++ b/ts/features/itwallet/issuance/hooks/useCredentialEventsTracking.ts @@ -9,8 +9,7 @@ import { trackAddCredentialUnexpectedFailure, trackCredentialInvalidStatusFailure, trackCredentialNotEntitledFailure, - trackItwAddCredentialNotTrustedIssuer, - trackItWalletDeferredIssuing + trackItwAddCredentialNotTrustedIssuer } from "../../analytics"; import { serializeFailureReason, @@ -40,10 +39,6 @@ export const useCredentialEventsTracking = ({ const credential = getMixPanelCredential(credentialType, isItwL3); - if (failure.type === CredentialIssuanceFailureType.ASYNC_ISSUANCE) { - return trackItWalletDeferredIssuing(credential); - } - if ( failure.type === CredentialIssuanceFailureType.INVALID_STATUS && invalidErrorCode === "credential_not_found" diff --git a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialAsyncContinuationScreen.tsx b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialAsyncContinuationScreen.tsx index 99f871c7e3d..e86d93b967f 100644 --- a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialAsyncContinuationScreen.tsx +++ b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialAsyncContinuationScreen.tsx @@ -1,95 +1,22 @@ -import { useFocusEffect } from "@react-navigation/native"; import * as O from "fp-ts/lib/Option"; import { pipe } from "fp-ts/lib/function"; import I18n from "i18next"; -import * as t from "io-ts"; -import { useCallback } from "react"; import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; -import { - IOStackNavigationRouteProps, - useIONavigation -} from "../../../../navigation/params/AppParamsList"; +import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import { useIOSelector } from "../../../../store/hooks"; -import { - getMixPanelCredential, - trackItwHasAlreadyCredential -} from "../../analytics"; -import { itwIsL3EnabledSelector } from "../../common/store/selectors/preferences"; import { getCredentialStatus } from "../../common/utils/itwCredentialStatusUtils"; import { CredentialType } from "../../common/utils/itwMocksUtils"; import { itwCredentialSelector } from "../../credentials/store/selectors"; -import { - itwLifecycleIsITWalletValidSelector, - itwLifecycleIsValidSelector -} from "../../lifecycle/store/selectors"; -import { ItwParamsList } from "../../navigation/ItwParamsList"; import { ITW_ROUTES } from "../../navigation/routes"; -import { ItwIssuanceCredentialTrustIssuerScreen } from "./ItwIssuanceCredentialTrustIssuerScreen"; - -export type ItwIssuanceCredentialAsyncContinuationNavigationParams = { - credentialType: string; -}; - -type ScreenProps = IOStackNavigationRouteProps< - ItwParamsList, - "ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION" ->; - -const routeParams = t.type({ - credentialType: t.literal("MDL") // Only MDL supports the async issuance flow -}); - -const getCredentialType = (params: unknown) => - pipe( - params, - routeParams.decode, - O.fromEither, - O.map(x => x.credentialType) - ); /** - * @deprecated [SIW-2839] This screen is going to be removed soon along with the async issuance - * - * Landing screen to resume the async issuance flow from a deep link. - * We can not assume the route params will be of the expected shape, - * so we guard against invalid values in this screen. + * @deprecated This screen is related to the dismissed async issuance flow. + * It is left here to handle old messages that a user might still have. */ -export const ItwIssuanceCredentialAsyncContinuationScreen = ({ - navigation, - route -}: ScreenProps) => { - const credentialType = getCredentialType(route.params); - - return pipe( - credentialType, - O.fold( - () => ( - navigation.popToTop() - }} - /> - ), - () => - ) - ); -}; - -const InnerComponent = () => { - /** - * Since only MDL supports the async flow, we can safely hardcode the credential type. - * The credential type received as a route param is validated before this component, - * so it is possible to directly use the correct type for the issuance flow. - */ +export const ItwIssuanceCredentialAsyncContinuationScreen = () => { const credentialType = CredentialType.DRIVING_LICENSE; const navigation = useIONavigation(); const credentialOption = useIOSelector(itwCredentialSelector(credentialType)); - const isWalletValid = useIOSelector(itwLifecycleIsValidSelector); - const isItwL3 = useIOSelector(itwLifecycleIsITWalletValidSelector); - const isL3 = useIOSelector(itwIsL3EnabledSelector); const isCredentialValid = pipe( credentialOption, @@ -98,60 +25,20 @@ const InnerComponent = () => { O.getOrElse(() => false) ); - useFocusEffect( - useCallback(() => { - if (isCredentialValid) { - trackItwHasAlreadyCredential({ - credential: getMixPanelCredential(credentialType, isItwL3), - credential_status: "valid" - }); - } - }, [credentialType, isCredentialValid, isItwL3]) - ); - - if (!isWalletValid) { - const ns = "features.itWallet.issuance.walletInstanceNotActive"; - - const copy = isL3 ? `${ns}.itWallet` : `${ns}.documentiSuIo`; - - return ( - - navigation.replace(ITW_ROUTES.MAIN, { - screen: ITW_ROUTES.DISCOVERY.INFO, - params: { - level: isL3 ? "l3" : "l2" - } - }) - }} - secondaryAction={{ - label: I18n.t(`${ns}.secondaryAction`), - onPress: () => navigation.popToTop() - }} - /> - ); - } - if (isCredentialValid) { - const ns = "features.itWallet.issuance.credentialAlreadyAdded" as const; return ( navigation.replace(ITW_ROUTES.MAIN, { screen: ITW_ROUTES.PRESENTATION.CREDENTIAL_DETAIL, @@ -167,9 +54,35 @@ const InnerComponent = () => { } return ( - + navigation.replace(ITW_ROUTES.MAIN, { + screen: ITW_ROUTES.ONBOARDING + }) + }} + secondaryAction={{ + label: I18n.t("global.buttons.notNow"), + onPress: () => navigation.popToTop() + }} /> ); }; diff --git a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialFailureScreen.tsx b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialFailureScreen.tsx index 1f54dba160d..5117edd0d5c 100644 --- a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialFailureScreen.tsx +++ b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialFailureScreen.tsx @@ -9,10 +9,6 @@ import { } from "../../../../components/screens/OperationResultScreenContent"; import { useDebugInfo } from "../../../../hooks/useDebugInfo"; import { useIOSelector } from "../../../../store/hooks"; -import { - fallbackForLocalizedMessageKeys, - getFullLocale -} from "../../../../utils/locale"; import { useAvoidHardwareBackButton } from "../../../../utils/useAvoidHardwareBackButton"; import { trackItwKoStateAction } from "../../analytics"; import { useItwDisableGestureNavigation } from "../../common/hooks/useItwDisableGestureNavigation"; @@ -20,7 +16,6 @@ import { useItwFailureSupportModal, ZendeskSubcategoryValue } from "../../common/hooks/useItwFailureSupportModal"; -import { itwDeferredIssuanceScreenContentSelector } from "../../common/store/selectors/remoteConfig"; import { getClaimsFullLocale } from "../../common/utils/itwClaimsUtils"; import { StatusAssertionError } from "../../common/utils/itwCredentialStatusAssertionUtils.ts"; import { serializeFailureReason } from "../../common/utils/itwStoreUtils"; @@ -78,11 +73,6 @@ const ContentView = ({ failure }: ContentViewProps) => { const issuerConf = ItwCredentialIssuanceMachineContext.useSelector( selectIssuerConfigurationOption ); - const locale = getFullLocale(); - const localeFallback = fallbackForLocalizedMessageKeys(locale); - const deferredIssuanceScreenContent = useIOSelector( - itwDeferredIssuanceScreenContentSelector - ); const isItwL3 = useIOSelector(itwLifecycleIsITWalletValidSelector); const invalidStatusDetails = getCredentialInvalidStatusDetails(failure, { @@ -98,11 +88,6 @@ const ContentView = ({ failure }: ContentViewProps) => { cta_id: "close_issuance" }); }; - const closeAsyncIssuance = () => { - machineRef.send({ - type: "close" - }); - }; useDebugInfo({ failure: serializeFailureReason(failure) @@ -140,23 +125,6 @@ const ContentView = ({ failure }: ContentViewProps) => { : { action: closeAction, secondaryAction: supportModalAction }) }; } - // NOTE: only the mDL supports the async flow, so this error message is specific to mDL - case CredentialIssuanceFailureType.ASYNC_ISSUANCE: - return { - title: - deferredIssuanceScreenContent?.title?.[localeFallback] ?? - I18n.t("features.itWallet.issuance.asyncCredentialError.title"), - subtitle: - deferredIssuanceScreenContent?.description?.[localeFallback] ?? - I18n.t("features.itWallet.issuance.asyncCredentialError.body"), - pictogram: "pending", - action: { - label: I18n.t( - "features.itWallet.issuance.asyncCredentialError.primaryAction" - ), - onPress: closeAsyncIssuance - } - }; // Dynamic errors extracted from the entity configuration, with fallback case CredentialIssuanceFailureType.INVALID_STATUS: { const closeAction = { diff --git a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialTrustIssuerScreen.tsx b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialTrustIssuerScreen.tsx index 99faaeb5854..da95c198065 100644 --- a/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialTrustIssuerScreen.tsx +++ b/ts/features/itwallet/issuance/screens/ItwIssuanceCredentialTrustIssuerScreen.tsx @@ -57,7 +57,6 @@ import { ItwRequestedClaimsList } from "../components/ItwRequestedClaimsList"; export type ItwIssuanceCredentialTrustIssuerNavigationParams = { credentialType?: string; - asyncContinuation?: boolean; // TODO to be removed in [SIW-2839] isUpgrade?: boolean; }; @@ -71,7 +70,7 @@ type ScreenProps = | ItwIssuanceCredentialTrustIssuerNavigationParams; const ItwIssuanceCredentialTrustIssuer = (props: ScreenProps) => { - const { credentialType, asyncContinuation, isUpgrade } = + const { credentialType, isUpgrade } = ("route" in props ? props.route.params : props) ?? {}; const eidOption = useIOSelector(itwCredentialsEidSelector); @@ -98,11 +97,10 @@ const ItwIssuanceCredentialTrustIssuer = (props: ScreenProps) => { machineRef.send({ type: "select-credential", credentialType, - mode: isUpgrade ? "upgrade" : "issuance", - isAsyncContinuation: asyncContinuation // TODO to be removed in [SIW-2839] + mode: isUpgrade ? "upgrade" : "issuance" }); } - }, [credentialType, asyncContinuation, machineRef, isUpgrade]) + }, [credentialType, machineRef, isUpgrade]) ); if (isLoading) { diff --git a/ts/features/itwallet/issuance/screens/__tests__/ItwIssuanceCredentialAsyncContinuationScreen.test.tsx b/ts/features/itwallet/issuance/screens/__tests__/ItwIssuanceCredentialAsyncContinuationScreen.test.tsx deleted file mode 100644 index 2f7a6863a2d..00000000000 --- a/ts/features/itwallet/issuance/screens/__tests__/ItwIssuanceCredentialAsyncContinuationScreen.test.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import * as O from "fp-ts/lib/Option"; -import configureMockStore from "redux-mock-store"; -import { createSelector } from "reselect"; -import { applicationChangeState } from "../../../../../store/actions/application"; -import { appReducer } from "../../../../../store/reducers"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { renderScreenWithNavigationStoreContext } from "../../../../../utils/testWrapper"; -import { StoredCredential } from "../../../common/utils/itwTypesUtils"; -import * as itwCredentialSelectors from "../../../credentials/store/selectors"; -import * as itwLifecycleSelectors from "../../../lifecycle/store/selectors"; -import { ITW_ROUTES } from "../../../navigation/routes"; -import { - ItwIssuanceCredentialAsyncContinuationNavigationParams, - ItwIssuanceCredentialAsyncContinuationScreen -} from "../ItwIssuanceCredentialAsyncContinuationScreen"; - -const mockStoredCredential: StoredCredential = { - credentialType: "mDL", - credentialId: "dc_sd_jwt_mDL", - jwt: { expiration: "2100-01-01T00:00:00Z" }, - parsedCredential: { - expiry_date: { value: "2100-01-01", name: "expiry_date" } - }, - keyTag: "1", - credential: "credential", - format: "dc+sd-jwt", - issuerConf: {} as StoredCredential["issuerConf"] -}; - -describe("ItwIssuanceCredentialAsyncContinuationScreen", () => { - it("it should render the generic error message when route params are invalid", () => { - const componentNoParams = renderComponent(undefined); - expect(componentNoParams).toMatchSnapshot(); - - const componentWrongParams = renderComponent({ credentialType: "invalid" }); - expect(componentWrongParams).toMatchSnapshot(); - }); - - it("it should render the activate wallet screen", () => { - jest - .spyOn(itwLifecycleSelectors, "itwLifecycleIsValidSelector") - .mockReturnValue(false); - - const component = renderComponent({ credentialType: "MDL" }); - expect(component).toMatchSnapshot(); - }); - - it("it should render the document already present screen", () => { - jest - .spyOn(itwLifecycleSelectors, "itwLifecycleIsValidSelector") - .mockReturnValue(true); - - jest - .spyOn(itwCredentialSelectors, "itwCredentialSelector") - .mockImplementation(() => - createSelector( - () => ({}), - () => O.some(mockStoredCredential) - ) - ); - - const component = renderComponent({ credentialType: "MDL" }); - expect(component).toMatchSnapshot(); - }); -}); - -const renderComponent = ( - routeParams?: ItwIssuanceCredentialAsyncContinuationNavigationParams -) => { - const globalState = appReducer(undefined, applicationChangeState("active")); - - const mockStore = configureMockStore(); - const store = mockStore(globalState); - - return renderScreenWithNavigationStoreContext( - ItwIssuanceCredentialAsyncContinuationScreen, - ITW_ROUTES.LANDING.CREDENTIAL_ASYNC_FLOW_CONTINUATION, - routeParams ?? {}, - store - ); -}; diff --git a/ts/features/itwallet/issuance/screens/__tests__/__snapshots__/ItwIssuanceCredentialAsyncContinuationScreen.test.tsx.snap b/ts/features/itwallet/issuance/screens/__tests__/__snapshots__/ItwIssuanceCredentialAsyncContinuationScreen.test.tsx.snap deleted file mode 100644 index 3e72db49a5a..00000000000 --- a/ts/features/itwallet/issuance/screens/__tests__/__snapshots__/ItwIssuanceCredentialAsyncContinuationScreen.test.tsx.snap +++ /dev/null @@ -1,3462 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ItwIssuanceCredentialAsyncContinuationScreen it should render the activate wallet screen 1`] = ` - - - - - - - - - - - - - - - ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Attiva Documenti su IO per continuare - - - - - Per aggiungere i tuoi documenti al Portafoglio è necessario attivare - - - Documenti su IO - - - - - - - - - - Inizia - - - - - - - - - - - - - - Non ora - - - - - - - - - - - - - - - - - - - - -`; - -exports[`ItwIssuanceCredentialAsyncContinuationScreen it should render the document already present screen 1`] = ` - - - - - - - - - - - - - - - ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hai già questo documento - - - - La versione digitale del documento è già presente nel tuo Portafoglio. - - - - - - - - - Vai al documento - - - - - - - - - - - - - - Chiudi - - - - - - - - - - - - - - - - - - - - -`; - -exports[`ItwIssuanceCredentialAsyncContinuationScreen it should render the generic error message when route params are invalid 1`] = ` - - - - - - - - - - - - - - - ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Si è verificato un errore - - - - - - - - - Chiudi - - - - - - - - - - - - - - - - - - - - -`; - -exports[`ItwIssuanceCredentialAsyncContinuationScreen it should render the generic error message when route params are invalid 2`] = ` - - - - - - - - - - - - - - - ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Si è verificato un errore - - - - - - - - - Chiudi - - - - - - - - - - - - - - - - - - - - -`; diff --git a/ts/features/itwallet/machine/credential/__tests__/machine.test.ts b/ts/features/itwallet/machine/credential/__tests__/machine.test.ts index dd02b1840b5..15de336ef89 100644 --- a/ts/features/itwallet/machine/credential/__tests__/machine.test.ts +++ b/ts/features/itwallet/machine/credential/__tests__/machine.test.ts @@ -107,8 +107,6 @@ describe("itwCredentialIssuanceMachine", () => { const closeIssuance = jest.fn(); const storeWalletInstanceAttestation = jest.fn(); const storeCredential = jest.fn(); - const flagCredentialAsRequested = jest.fn(); - const unflagCredentialAsRequested = jest.fn(); const handleSessionExpired = jest.fn(); const trackStartAddCredential = jest.fn(); const trackAddCredential = jest.fn(); @@ -122,7 +120,6 @@ describe("itwCredentialIssuanceMachine", () => { const obtainStatusAssertion = jest.fn(); const isSessionExpired = jest.fn(); - const isDeferredIssuance = jest.fn(); const hasValidWalletInstanceAttestation = jest.fn(); const isStatusError = jest.fn(); const isSkipNavigation = jest.fn(); @@ -140,8 +137,6 @@ describe("itwCredentialIssuanceMachine", () => { closeIssuance, storeWalletInstanceAttestation, storeCredential, - flagCredentialAsRequested, - unflagCredentialAsRequested, handleSessionExpired, trackStartAddCredential, trackAddCredential, @@ -167,7 +162,6 @@ describe("itwCredentialIssuanceMachine", () => { }, guards: { isSessionExpired, - isDeferredIssuance, hasValidWalletInstanceAttestation, isStatusError, isEidExpired, diff --git a/ts/features/itwallet/machine/credential/actions.ts b/ts/features/itwallet/machine/credential/actions.ts index d9a4b6d2a43..fcd8c28d673 100644 --- a/ts/features/itwallet/machine/credential/actions.ts +++ b/ts/features/itwallet/machine/credential/actions.ts @@ -1,7 +1,5 @@ import { IOToast } from "@pagopa/io-app-design-system"; import { ActionArgs, assign } from "xstate"; -import * as O from "fp-ts/lib/Option"; -import { pipe } from "fp-ts/lib/function"; import I18n from "i18next"; import { useIONavigation } from "../../../../navigation/params/AppParamsList"; import ROUTES from "../../../../navigation/routes"; @@ -17,10 +15,6 @@ import { trackWalletDataShare, trackWalletDataShareAccepted } from "../../analytics"; -import { - itwFlagCredentialAsRequested, - itwUnflagCredentialAsRequested -} from "../../common/store/actions/preferences"; import { itwCredentialsRemoveByType, itwCredentialsStore @@ -29,9 +23,7 @@ import { ITW_ROUTES } from "../../navigation/routes"; import { itwWalletInstanceAttestationStore } from "../../walletInstance/store/actions"; import { itwWalletInstanceAttestationSelector } from "../../walletInstance/store/selectors"; import { itwLifecycleIsITWalletValidSelector } from "../../lifecycle/store/selectors"; -import { itwRequestedCredentialsSelector } from "../../common/store/selectors/preferences"; import { itwCredentialsCatalogueByTypesSelector } from "../../credentialsCatalogue/store/selectors"; -import { CredentialType } from "../../common/utils/itwMocksUtils"; import { Context } from "./context"; import { CredentialIssuanceEvents } from "./events"; @@ -142,28 +134,6 @@ export const createCredentialIssuanceActionsImplementation = ( store.dispatch(itwCredentialsStore(context.credentials)); }, - flagCredentialAsRequested: ({ - context - }: ActionArgs< - Context, - CredentialIssuanceEvents, - CredentialIssuanceEvents - >) => { - assert(context.credentialType, "credentialType is undefined"); - store.dispatch(itwFlagCredentialAsRequested(context.credentialType)); - }, - - unflagCredentialAsRequested: ({ - context - }: ActionArgs< - Context, - CredentialIssuanceEvents, - CredentialIssuanceEvents - >) => { - assert(context.credentialType, "credentialType is undefined"); - store.dispatch(itwUnflagCredentialAsRequested(context.credentialType)); - }, - trackStartAddCredential: ({ context }: ActionArgs< @@ -226,46 +196,16 @@ const trackDataShareEvent = ( isAccepted = false ) => { if (context.credentialType) { - const { credentialType, isAsyncContinuation } = context; - const requestedCredentials = itwRequestedCredentialsSelector( - store.getState() - ); + const { credentialType } = context; + if (!credentialType) { + return; + } const isItwL3 = itwLifecycleIsITWalletValidSelector(store.getState()); const credential = getMixPanelCredential(context.credentialType, isItwL3); - const isMdlRequested = requestedCredentials.includes( - CredentialType.DRIVING_LICENSE - ); - - /** Determine the correct phase based on the following conditions: - * - * - `initial_request`: No active request, user clicks on the driving license from the credential selection screen. - * - `request_in_progress`: An ongoing request is active, but the IPZS message has not yet been received, and the user clicks on the driving license from the credential selection screen again. - * - `old_message_request`: No active request, but the user clicks on an old IPZS message. - * - `async_continuation`: An ongoing request is active, and the user opens the IPZS message. - * - * This logic ensures that the phase is accurate regardless of whether - * there is an active MDL request or if the credential is requested - * from ItwCredentialOnboardingSection. - */ - const trackingData = pipe( - O.fromPredicate(() => credentialType === CredentialType.DRIVING_LICENSE)( - credentialType - ), - O.map(() => { - if (isAsyncContinuation) { - // TODO to be removed in [SIW-2839] - return isMdlRequested ? "async_continuation" : "old_message_request"; - } - return isMdlRequested ? "request_in_progress" : "initial_request"; - }), - O.fold( - () => ({ credential }), - phase => ({ credential, phase }) - ) - ); - (isAccepted ? trackWalletDataShareAccepted : trackWalletDataShare)( - trackingData - ); + const trackDataFn = isAccepted + ? trackWalletDataShareAccepted + : trackWalletDataShare; + trackDataFn({ credential, phase: "initial_request" }); } }; diff --git a/ts/features/itwallet/machine/credential/context.ts b/ts/features/itwallet/machine/credential/context.ts index b54d46b12e6..2ffce32b3ef 100644 --- a/ts/features/itwallet/machine/credential/context.ts +++ b/ts/features/itwallet/machine/credential/context.ts @@ -28,11 +28,6 @@ export type Context = { * Flag to indicate if the user has access to the L3 features. */ isItWalletValid: boolean; - /** - * Used to indicate that the flow is coming from the asynchrnous issuance flow for the MDL. - * TODO to be removed in [SIW-2839] - */ - isAsyncContinuation: boolean; /** * The type of the credential being issued. */ @@ -69,7 +64,6 @@ export type Context = { export const InitialContext: Context = { mode: "issuance", isItWalletValid: false, - isAsyncContinuation: false, credentialType: undefined, wiaCryptoContext: undefined, walletInstanceAttestation: undefined, diff --git a/ts/features/itwallet/machine/credential/events.ts b/ts/features/itwallet/machine/credential/events.ts index 03e4d93a34b..70d4d2b83b7 100644 --- a/ts/features/itwallet/machine/credential/events.ts +++ b/ts/features/itwallet/machine/credential/events.ts @@ -5,7 +5,6 @@ export type SelectCredential = { type: "select-credential"; credentialType: string; mode: CredentialIssuanceMode; - isAsyncContinuation?: boolean; // TODO to be removed in [SIW-2839] }; export type ConfirmTrustData = { diff --git a/ts/features/itwallet/machine/credential/failure.ts b/ts/features/itwallet/machine/credential/failure.ts index 75e71862f4c..9d192eb8596 100644 --- a/ts/features/itwallet/machine/credential/failure.ts +++ b/ts/features/itwallet/machine/credential/failure.ts @@ -11,7 +11,6 @@ const { export enum CredentialIssuanceFailureType { UNEXPECTED = "UNEXPECTED", - ASYNC_ISSUANCE = "ASYNC_ISSUANCE", INVALID_STATUS = "INVALID_STATUS", ISSUER_GENERIC = "ISSUER_GENERIC", UNTRUSTED_ISS = "UNTRUSTED_ISS", @@ -24,7 +23,6 @@ export enum CredentialIssuanceFailureType { export type ReasonTypeByFailure = { [CredentialIssuanceFailureType.ISSUER_GENERIC]: Errors.IssuerResponseError; [CredentialIssuanceFailureType.INVALID_STATUS]: WithCredentialMetadata; - [CredentialIssuanceFailureType.ASYNC_ISSUANCE]: Errors.IssuerResponseError; [CredentialIssuanceFailureType.WALLET_PROVIDER_GENERIC]: Errors.WalletProviderResponseError; [CredentialIssuanceFailureType.UNTRUSTED_ISS]: Trust.Errors.FederationError; [CredentialIssuanceFailureType.UNEXPECTED]: unknown; @@ -69,13 +67,6 @@ export const mapEventToFailure = ( }; } - if (isIssuerResponseError(error, Codes.CredentialIssuingNotSynchronous)) { - return { - type: CredentialIssuanceFailureType.ASYNC_ISSUANCE, - reason: error - }; - } - if (isIssuerResponseError(error)) { return { type: CredentialIssuanceFailureType.ISSUER_GENERIC, diff --git a/ts/features/itwallet/machine/credential/guards.ts b/ts/features/itwallet/machine/credential/guards.ts index 60c487f0b0e..b7cfb3c330e 100644 --- a/ts/features/itwallet/machine/credential/guards.ts +++ b/ts/features/itwallet/machine/credential/guards.ts @@ -14,9 +14,6 @@ export const createCredentialIssuanceGuardsImplementation = ( isSessionExpired: ({ event }: { event: CredentialIssuanceEvents }) => "error" in event && event.error instanceof ItwSessionExpiredError, - isDeferredIssuance: ({ context }: { context: Context }) => - context.failure?.type === CredentialIssuanceFailureType.ASYNC_ISSUANCE, - hasValidWalletInstanceAttestation: ({ context }: { context: Context }) => pipe( O.fromNullable(context.walletInstanceAttestation?.jwt), diff --git a/ts/features/itwallet/machine/credential/machine.ts b/ts/features/itwallet/machine/credential/machine.ts index 6eca45ceeea..e37ae19cbf3 100644 --- a/ts/features/itwallet/machine/credential/machine.ts +++ b/ts/features/itwallet/machine/credential/machine.ts @@ -51,8 +51,6 @@ export const itwCredentialIssuanceMachine = setup({ storeWalletInstanceAttestation: notImplemented, storeCredential: notImplemented, - flagCredentialAsRequested: notImplemented, - unflagCredentialAsRequested: notImplemented, /** * Analytics actions @@ -83,7 +81,6 @@ export const itwCredentialIssuanceMachine = setup({ }, guards: { isSessionExpired: notImplemented, - isDeferredIssuance: notImplemented, hasValidWalletInstanceAttestation: notImplemented, isStatusError: notImplemented, isEidExpired: notImplemented, @@ -104,8 +101,7 @@ export const itwCredentialIssuanceMachine = setup({ target: "EvaluateFlow", actions: assign(({ event }) => ({ credentialType: event.credentialType, - mode: event.mode, - isAsyncContinuation: event.isAsyncContinuation ?? false // TODO to be removed in [SIW-2839] + mode: event.mode })) } } @@ -246,10 +242,6 @@ export const itwCredentialIssuanceMachine = setup({ DisplayingTrustIssuer: { entry: ["trackCredentialIssuingDataShare"], always: { - // If we are in the async continuation flow means we are already showing the trust issuer screen - // but on a different route. We need to avoid a navigation to show a "double" navigation animation. - // TODO to be removed in [SIW-2839] - guard: ({ context }) => !context.isAsyncContinuation, actions: "navigateToTrustIssuerScreen" }, on: { @@ -328,12 +320,7 @@ export const itwCredentialIssuanceMachine = setup({ entry: "navigateToCredentialPreviewScreen", on: { "add-to-wallet": { - actions: [ - "storeCredential", - "navigateToWallet", - "trackAddCredential", - "unflagCredentialAsRequested" - ] + actions: ["storeCredential", "navigateToWallet", "trackAddCredential"] }, close: { target: "Completed", @@ -346,16 +333,6 @@ export const itwCredentialIssuanceMachine = setup({ }, Failure: { entry: ["navigateToFailureScreen"], - always: [ - { - guard: "isDeferredIssuance", - actions: "flagCredentialAsRequested" - }, - { - guard: "isStatusError", - actions: "unflagCredentialAsRequested" - } - ], on: { close: { actions: "closeIssuance" diff --git a/ts/features/itwallet/navigation/ItwParamsList.ts b/ts/features/itwallet/navigation/ItwParamsList.ts index 40fea92af3f..af4d5ded04f 100644 --- a/ts/features/itwallet/navigation/ItwParamsList.ts +++ b/ts/features/itwallet/navigation/ItwParamsList.ts @@ -2,7 +2,6 @@ import { ItwDiscoveryInfoScreenNavigationParams } from "../discovery/screens/Itw import { ItwCieInternalAuthAndMrtdScreenParams } from "../identification/cie/screens/ItwCieInternalAuthAndMrtdScreen.tsx"; import { ItwIdentificationCieWarningScreenNavigationParams } from "../identification/cie/screens/ItwIdentificationCieWarningScreen.tsx"; import { ItwIdentificationNavigationParams } from "../identification/common/screens/ItwIdentificationModeSelectionScreen.tsx"; -import { ItwIssuanceCredentialAsyncContinuationNavigationParams } from "../issuance/screens/ItwIssuanceCredentialAsyncContinuationScreen"; import { ItwIssuanceCredentialTrustIssuerNavigationParams } from "../issuance/screens/ItwIssuanceCredentialTrustIssuerScreen"; import { ItwPlaygroundParamsList } from "../playgrounds/navigation/ItwPlaygroundParamsList.ts"; import { ItwPresentationCredentialAttachmentNavigationParams } from "../presentation/details/screens/ItwPresentationCredentialAttachmentScreen"; @@ -67,8 +66,7 @@ export type ItwParamsList = { [ITW_ROUTES.PRESENTATION.EID_VERIFICATION_EXPIRED]: undefined; [ITW_ROUTES.PRESENTATION.PID_DETAIL]: undefined; // LANDING SCREENS - [ITW_ROUTES.LANDING - .CREDENTIAL_ASYNC_FLOW_CONTINUATION]: ItwIssuanceCredentialAsyncContinuationNavigationParams; + [ITW_ROUTES.LANDING.CREDENTIAL_ASYNC_FLOW_CONTINUATION]: undefined; [ITW_ROUTES.LANDING.EID_REISSUANCE]: undefined; // OTHERS [ITW_ROUTES.IDENTITY_NOT_MATCHING_SCREEN]: undefined; diff --git a/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredential.tsx b/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredential.tsx index cacf42b0fb1..87cb6d49578 100644 --- a/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredential.tsx +++ b/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredential.tsx @@ -55,11 +55,11 @@ const ItwOnboardingModuleCredential = ({ onPress, isActive, isDisabled, - isRequested, isUpcoming, isNew, isSelectedCredential, - isCredentialIssuancePending + isCredentialIssuancePending, + isRequested = false }: Props) => { const badge = useMemo((): Badge | undefined => { if (isActive) { diff --git a/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredentialsList.tsx b/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredentialsList.tsx index 3b196d8a1db..0d229ac5c48 100644 --- a/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredentialsList.tsx +++ b/ts/features/itwallet/onboarding/components/ItwOnboardingModuleCredentialsList.tsx @@ -10,7 +10,6 @@ import { isNewCredential, isUpcomingCredential } from "../../common/utils/itwCredentialUtils"; -import { itwRequestedCredentialsSelector } from "../../common/store/selectors/preferences"; import { itwCredentialsTypesSelector } from "../../credentials/store/selectors"; import { itwLifecycleIsITWalletValidSelector, @@ -36,7 +35,6 @@ export const ItwOnboardingModuleCredentialsList = ({ const remotelyDisabledCredentials = useIOSelector( itwDisabledCredentialsSelector ); - const requestedCredentials = useIOSelector(itwRequestedCredentialsSelector); const itwCredentialsTypes = useIOSelector(itwCredentialsTypesSelector); const isITWalletValid = useIOSelector(itwLifecycleIsITWalletValidSelector); const isWalletValid = useIOSelector(itwLifecycleIsValidSelector); @@ -79,7 +77,6 @@ export const ItwOnboardingModuleCredentialsList = ({ type={type} isActive={itwCredentialsTypes.includes(type)} isDisabled={remotelyDisabledCredentials.includes(type)} - isRequested={requestedCredentials.includes(type)} isUpcoming={isUpcomingCredential(type)} isNew={isNewCredential(type)} isCredentialIssuancePending={isCredentialIssuancePending}