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-1918] Add iPatente CTA in MDL details screen #6577

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
58a10e4
chore: adjust margins
mastro993 Dec 19, 2024
eb9164b
chore: add CTA
mastro993 Dec 19, 2024
5c051d6
chore: update backend status definitions
mastro993 Dec 20, 2024
cff2916
refactor: move itw remote config selectors
mastro993 Dec 20, 2024
df4931f
chore: add iPatente CTA in MDL credential detail
mastro993 Dec 20, 2024
9dc29ae
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Dec 20, 2024
09b57ba
fix: lint errors
mastro993 Dec 20, 2024
4b032e1
CTA copy fixes
thisisjp Dec 26, 2024
c0eaac3
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 2, 2025
44ba629
chore: rename
mastro993 Jan 2, 2025
4a2d74f
fix: merge
mastro993 Jan 2, 2025
689ea7f
fix: tests
mastro993 Jan 3, 2025
55f9d3e
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 7, 2025
3132d70
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 8, 2025
337529e
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 9, 2025
950f672
fix: imports
mastro993 Jan 9, 2025
b44bc9d
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 9, 2025
a019281
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
RiccardoMolinari95 Jan 10, 2025
96d0232
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 13, 2025
17c0d3a
fix: imports
mastro993 Jan 13, 2025
e82edf3
fix: mocks
mastro993 Jan 13, 2025
7170af2
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 13, 2025
3d2141f
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 14, 2025
1609128
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
RiccardoMolinari95 Jan 14, 2025
483cdf2
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
RiccardoMolinari95 Jan 14, 2025
ff6d671
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 14, 2025
eadfceb
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 15, 2025
aa6a98c
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
mastro993 Jan 15, 2025
7eec56b
Merge branch 'master' into SIW-1918-add-ipatente-cta-in-mdl-details-s…
RiccardoMolinari95 Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3518,6 +3518,7 @@ features:
requestAssistance: "Something wrong?"
showClaimValues: "Show claim values"
hideClaimValues: "Hide claim values"
openIPatente: "Vai al servizio punti patente"
thisisjp marked this conversation as resolved.
Show resolved Hide resolved
dialogs:
remove:
title: Vuoi rimuovere il documento dal Portafoglio?
Expand Down
1 change: 1 addition & 0 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3518,6 +3518,7 @@ features:
requestAssistance: "Qualcosa non torna?"
showClaimValues: "Mostra gli attributi del documento"
hideClaimValues: "Nascondi gli attributi del documento"
openIPatente: "Vai al servizio punti patente"
thisisjp marked this conversation as resolved.
Show resolved Hide resolved
dialogs:
remove:
title: Vuoi rimuovere il documento dal Portafoglio?
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-api-models.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

IO_BACKEND_VERSION=v16.4.0-RELEASE
IO_SERVICES_METADATA_VERSION=1.0.51
IO_SERVICES_METADATA_VERSION=1.0.52

declare -a apis=(
# Backend APIs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import {
} from "..";
import { GlobalState } from "../../../../../../store/reducers/types";
import { itwIsWalletEmptySelector } from "../../../../credentials/store/selectors";
import { itwLifecycleIsValidSelector } from "../../../../lifecycle/store/selectors";
import { itwIsFeedbackBannerHiddenSelector } from "../preferences";
import {
isItwEnabledSelector,
isItwFeedbackBannerEnabledSelector
} from "../../../../../../store/reducers/backendStatus/remoteConfig";
import { itwLifecycleIsValidSelector } from "../../../../lifecycle/store/selectors";
} from "../remoteConfig";

type JestMock = ReturnType<typeof jest.fn>;

Expand All @@ -24,13 +24,10 @@ jest.mock("../preferences", () => ({
itwIsFeedbackBannerHiddenSelector: jest.fn()
}));

jest.mock(
"../../../../../../store/reducers/backendStatus/remoteConfig",
() => ({
isItwEnabledSelector: jest.fn(),
isItwFeedbackBannerEnabledSelector: jest.fn()
})
);
jest.mock("../remoteConfig", () => ({
isItwEnabledSelector: jest.fn(),
isItwFeedbackBannerEnabledSelector: jest.fn()
}));

describe("itwDiscoveryBannerSelector", () => {
beforeEach(() => {
Expand Down
12 changes: 6 additions & 6 deletions ts/features/itwallet/common/store/selectors/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
isItwEnabledSelector,
isItwFeedbackBannerEnabledSelector
} from "../../../../../store/reducers/backendStatus/remoteConfig";
import { GlobalState } from "../../../../../store/reducers/types";
import {
itwCredentialsEidStatusSelector,
itwIsWalletEmptySelector
} from "../../../credentials/store/selectors";
import { itwLifecycleIsValidSelector } from "../../../lifecycle/store/selectors";
import {
itwIsFeedbackBannerHiddenSelector,
itwIsDiscoveryBannerHiddenSelector
itwIsDiscoveryBannerHiddenSelector,
itwIsFeedbackBannerHiddenSelector
} from "./preferences";
import {
isItwEnabledSelector,
isItwFeedbackBannerEnabledSelector
} from "./remoteConfig";

/**
* Returns if the discovery banner should be rendered. The banner is rendered if:
Expand Down
121 changes: 121 additions & 0 deletions ts/features/itwallet/common/store/selectors/remoteConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import * as O from "fp-ts/lib/Option";
import { pipe } from "fp-ts/lib/function";
import { Platform } from "react-native";
import { createSelector } from "reselect";
import { GlobalState } from "../../../../../store/reducers/types";
import {
getAppVersion,
isVersionSupported
} from "../../../../../utils/appVersion";

const emptyArray: ReadonlyArray<string> = []; // to avoid unnecessary rerenders

const itwRemoteConfigSelector = (state: GlobalState) =>
pipe(
state.remoteConfig,
O.map(config => config.itw)
);

/**
* Return the remote config about IT-WALLET enabled/disabled
* if there is no data or the local Feature Flag is disabled,
* false is the default value -> (IT-WALLET disabled)
*/
export const isItwEnabledSelector = createSelector(
itwRemoteConfigSelector,
(itwConfig): boolean =>
pipe(
itwConfig,
O.map(
itw =>
isVersionSupported(
Platform.OS === "ios"
? itw.min_app_version.ios
: itw.min_app_version.android,
getAppVersion()
) && itw.enabled
),
O.getOrElse(() => false)
)
);

/**
* Returns the authentication methods that are disabled.
* If there is no data, an empty array is returned as the default value.
*/
export const itwDisabledIdentificationMethodsSelector = createSelector(
itwRemoteConfigSelector,
(itwConfig): ReadonlyArray<string> =>
pipe(
itwConfig,
O.chainNullableK(itw => itw.disabled_identification_methods),
O.getOrElse(() => emptyArray)
)
);

/**
* Return whether the IT Wallet feedback banner is remotely enabled.
*/
export const isItwFeedbackBannerEnabledSelector = createSelector(
itwRemoteConfigSelector,
itwConfig =>
pipe(
itwConfig,
O.map(itw => itw.feedback_banner_visible),
O.getOrElse(() => false)
)
);

/**
* Return whether the Wallet activation is disabled.
* This is purely a "cosmetic" configuration to disable UI elements,
* it does not disable the entire IT Wallet feature.
*/
export const itwIsActivationDisabledSelector = createSelector(
itwRemoteConfigSelector,
itwConfig =>
pipe(
itwConfig,
O.chainNullableK(itw => itw.wallet_activation_disabled),
O.getOrElse(() => false)
)
);

/**
* Return IT Wallet credentials that have been disabled remotely.
*/
export const itwDisabledCredentialsSelector = createSelector(
itwRemoteConfigSelector,
itwConfig =>
pipe(
itwConfig,
O.chainNullableK(itw => itw.disabled_credentials),
O.getOrElse(() => emptyArray)
)
);

/**
* 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.
*/
export const itwIsIPatenteCtaEnabledSelector = createSelector(
itwRemoteConfigSelector,
itwConfig =>
pipe(
itwConfig,
O.map(itw => itw.ipatente_cta_visible),
O.getOrElse(() => false)
)
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ import {
H1,
VSpacer
} from "@pagopa/io-app-design-system";
import { useFocusEffect } from "@react-navigation/native";
import * as React from "react";
import { StyleSheet } from "react-native";
import { useFocusEffect } from "@react-navigation/native";
import { AnimatedImage } from "../../../../components/AnimatedImage";
import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel";
import I18n from "../../../../i18n";
import { useIOSelector } from "../../../../store/hooks";
import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp";
import { useOnFirstRender } from "../../../../utils/hooks/useOnFirstRender";
import ItwMarkdown from "../../common/components/ItwMarkdown";
import { selectIsLoading } from "../../machine/eid/selectors";
import { ItwEidIssuanceMachineContext } from "../../machine/provider";
import { tosConfigSelector } from "../../../tos/store/selectors";
import {
trackItWalletActivationStart,
trackItWalletIntroScreen,
trackOpenItwTos
} from "../../analytics";
import { useIOSelector } from "../../../../store/hooks";
import { isItwActivationDisabledSelector } from "../../../../store/reducers/backendStatus/remoteConfig";
import { tosConfigSelector } from "../../../tos/store/selectors";
import ItwMarkdown from "../../common/components/ItwMarkdown";
import { itwIsActivationDisabledSelector } from "../../common/store/selectors/remoteConfig";
import { selectIsLoading } from "../../machine/eid/selectors";
import { ItwEidIssuanceMachineContext } from "../../machine/provider";

/**
* This is the screen that shows the information about the discovery process
Expand All @@ -36,7 +36,7 @@ const ItwDiscoveryInfoScreen = () => {

const machineRef = ItwEidIssuanceMachineContext.useActorRef();
const isLoading = ItwEidIssuanceMachineContext.useSelector(selectIsLoading);
const itwActivationDisabled = useIOSelector(isItwActivationDisabledSelector);
const itwActivationDisabled = useIOSelector(itwIsActivationDisabledSelector);
const tosConfig = useIOSelector(tosConfigSelector);
const privacyAndTosUrl = tosConfig.tos_url;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
trackItWalletIDMethod,
trackItWalletIDMethodSelected
} from "../../analytics";
import { itwDisabledIdentificationMethodsSelector } from "../../../../store/reducers/backendStatus/remoteConfig";
import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader";
import { isCIEAuthenticationSupportedSelector } from "../../machine/eid/selectors";
import { itwDisabledIdentificationMethodsSelector } from "../../common/store/selectors/remoteConfig";

export const ItwIdentificationModeSelectionScreen = () => {
const machineRef = ItwEidIssuanceMachineContext.useActorRef();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { Errors } from "@pagopa/io-react-native-wallet";
import { sequenceS } from "fp-ts/lib/Apply";
import { constNull, pipe } from "fp-ts/lib/function";
import * as O from "fp-ts/lib/Option";
import { constNull, pipe } from "fp-ts/lib/function";
import React from "react";
import {
OperationResultScreenContent,
OperationResultScreenContentProps
} from "../../../../components/screens/OperationResultScreenContent";
import { useDebugInfo } from "../../../../hooks/useDebugInfo";
import I18n from "../../../../i18n";
import { useIOSelector } from "../../../../store/hooks";
import { getFullLocale } from "../../../../utils/locale";
import { useAvoidHardwareBackButton } from "../../../../utils/useAvoidHardwareBackButton";
import { trackWalletCreationFailed } from "../../analytics";
import { useItwDisableGestureNavigation } from "../../common/hooks/useItwDisableGestureNavigation";
import { itwDeferredIssuanceScreenContentSelector } from "../../common/store/selectors/remoteConfig";
import { getClaimsFullLocale } from "../../common/utils/itwClaimsUtils";
import { StatusAttestationError } from "../../common/utils/itwCredentialStatusAttestationUtils";
import { serializeFailureReason } from "../../common/utils/itwStoreUtils";
import { IssuerConfiguration } from "../../common/utils/itwTypesUtils";
import {
CredentialIssuanceFailure,
Expand All @@ -26,10 +30,6 @@ import {
} from "../../machine/credential/selectors";
import { ItwCredentialIssuanceMachineContext } from "../../machine/provider";
import { useCredentialEventsTracking } from "../hooks/useCredentialEventsTracking";
import { useIOSelector } from "../../../../store/hooks";
import { itwDeferredIssuanceScreenContentSelector } from "../../../../store/reducers/backendStatus/remoteConfig";
import { getFullLocale } from "../../../../utils/locale";
import { serializeFailureReason } from "../../common/utils/itwStoreUtils";

export const ItwIssuanceCredentialFailureScreen = () => {
const failureOption =
Expand Down
4 changes: 2 additions & 2 deletions ts/features/itwallet/navigation/useItwLinkingOptions.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PathConfigMap } from "@react-navigation/native";
import { AppParamsList } from "../../../navigation/params/AppParamsList";
import { useIOSelector } from "../../../store/hooks";
import { isItwEnabledSelector } from "../common/store/selectors/remoteConfig";
import { itwLifecycleIsValidSelector } from "../lifecycle/store/selectors";
import { isItwEnabledSelector } from "../../../store/reducers/backendStatus/remoteConfig";
import { AppParamsList } from "../../../navigation/params/AppParamsList";
import { ITW_ROUTES } from "./routes";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ import {
VStack
} from "@pagopa/io-app-design-system";
import { useFocusEffect } from "@react-navigation/native";
import { constFalse, pipe } from "fp-ts/lib/function";
import * as O from "fp-ts/lib/Option";
import { constFalse, pipe } from "fp-ts/lib/function";
import React, { useCallback } from "react";
import { StyleSheet, View } from "react-native";
import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader";
import I18n from "../../../../i18n";
import { useIONavigation } from "../../../../navigation/params/AppParamsList";
import { useIODispatch, useIOSelector } from "../../../../store/hooks";
import {
isItwEnabledSelector,
itwDisabledCredentialsSelector
} from "../../../../store/reducers/backendStatus/remoteConfig";
import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp";
import { cgnActivationStart } from "../../../bonus/cgn/store/actions/activation";
import {
Expand All @@ -32,6 +28,10 @@ import {
} from "../../analytics";
import { ItwDiscoveryBannerOnboarding } from "../../common/components/discoveryBanner/ItwDiscoveryBannerOnboarding";
import { itwRequestedCredentialsSelector } from "../../common/store/selectors/preferences";
import {
isItwEnabledSelector,
itwDisabledCredentialsSelector
} from "../../common/store/selectors/remoteConfig";
import { CredentialType } from "../../common/utils/itwMocksUtils";
import { itwCredentialsTypesSelector } from "../../credentials/store/selectors";
import { itwLifecycleIsValidSelector } from "../../lifecycle/store/selectors";
Expand Down
Loading
Loading