Skip to content

Commit a6a7134

Browse files
feat(IT Wallet): [SIW-1901] Deferred issuance for credential (#6549)
## Short description This PR introduces the handling of remote configuration for the `ItwIssuanceCredentialFailureScreen`. If a `deferred_issuance_screen_content` is present in `itw` config, the title and description from the remote config are used. Otherwise, fallback values are used. ## List of changes proposed in this pull request - add a new selector `itwDeferredIssuanceScreenContentSelector` in remote config ## How to test Using a proxy, add the following object to the `itw` remote config. Also, check the normal scenario without this object to ensure fallback values are used correctly. ``` "deferred_issuance_screen_content": { "title": { "it-IT": "La Motorizzazione Civile ha preso in carico la tua richiesta", "en-EN": "La Motorizzazione Civile ha preso in carico la tua richiesta" }, "description": { "it-IT": "Riceverai un messaggio in app per continuare appena La Motorizzazione Civile l'avrà elaborata.\n\nIn periodi di alta richiesta il processo potrebbe richiede alcune ore o alcuni giorni.", "en-EN": "Riceverai un messaggio in app per continuare appena La Motorizzazione Civile l'avrà elaborata.\n\nIn periodi di alta richiesta il processo potrebbe richiede alcune ore o alcuni giorni." } } ```
1 parent 47c6573 commit a6a7134

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"io_session_manager_api": "https://raw.githubusercontent.com/pagopa/io-auth-n-identity-domain/[email protected]/apps/io-session-manager/api/internal.yaml",
66
"io_session_manager_public_api": "https://raw.githubusercontent.com/pagopa/io-auth-n-identity-domain/[email protected]/apps/io-session-manager/api/public.yaml",
77
"io_public_api": "https://raw.githubusercontent.com/pagopa/io-backend/v16.4.0-RELEASE/api_public.yaml",
8-
"io_content_specs": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.50/definitions.yml",
8+
"io_content_specs": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.51/definitions.yml",
99
"io_cgn_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v16.4.0-RELEASE/api_cgn.yaml",
1010
"io_cgn_merchants_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v16.4.0-RELEASE/api_cgn_operator_search.yaml",
1111
"api_fci": "https://raw.githubusercontent.com/pagopa/io-backend/v16.4.0-RELEASE/api_io_sign.yaml",

ts/features/itwallet/issuance/screens/ItwIssuanceCredentialFailureScreen.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ import {
2626
} from "../../machine/credential/selectors";
2727
import { ItwCredentialIssuanceMachineContext } from "../../machine/provider";
2828
import { useCredentialEventsTracking } from "../hooks/useCredentialEventsTracking";
29+
import { useIOSelector } from "../../../../store/hooks";
30+
import { itwDeferredIssuanceScreenContentSelector } from "../../../../store/reducers/backendStatus/remoteConfig";
31+
import { getFullLocale } from "../../../../utils/locale";
2932

3033
export const ItwIssuanceCredentialFailureScreen = () => {
3134
const failureOption =
@@ -60,6 +63,10 @@ const ContentView = ({ failure }: ContentViewProps) => {
6063
const issuerConf = ItwCredentialIssuanceMachineContext.useSelector(
6164
selectIssuerConfigurationOption
6265
);
66+
const locale = getFullLocale();
67+
const deferredIssuanceScreenContent = useIOSelector(
68+
itwDeferredIssuanceScreenContentSelector
69+
);
6370

6471
const invalidStatusDetails = getCredentialInvalidStatusDetails(failure, {
6572
credentialType,
@@ -109,12 +116,12 @@ const ContentView = ({ failure }: ContentViewProps) => {
109116
// NOTE: only the mDL supports the async flow, so this error message is specific to mDL
110117
case CredentialIssuanceFailureType.ASYNC_ISSUANCE:
111118
return {
112-
title: I18n.t(
113-
"features.itWallet.issuance.asyncCredentialError.title"
114-
),
115-
subtitle: I18n.t(
116-
"features.itWallet.issuance.asyncCredentialError.body"
117-
),
119+
title:
120+
deferredIssuanceScreenContent?.title?.[locale] ??
121+
I18n.t("features.itWallet.issuance.asyncCredentialError.title"),
122+
subtitle:
123+
deferredIssuanceScreenContent?.description?.[locale] ??
124+
I18n.t("features.itWallet.issuance.asyncCredentialError.body"),
118125
pictogram: "pending",
119126
action: {
120127
label: I18n.t(

ts/store/reducers/backendStatus/remoteConfig.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,16 @@ export const itwDisabledCredentialsSelector = createSelector(
416416
O.getOrElse(() => emptyArray)
417417
)
418418
);
419+
420+
/**
421+
* Return the remote config content for the deferred issuance screen content.
422+
*/
423+
export const itwDeferredIssuanceScreenContentSelector = createSelector(
424+
remoteConfigSelector,
425+
remoteConfig =>
426+
pipe(
427+
remoteConfig,
428+
O.map(config => config.itw.deferred_issuance_screen_content),
429+
O.toUndefined
430+
)
431+
);

0 commit comments

Comments
 (0)