Skip to content

Commit

Permalink
Merge branch 'master' into IOCOM-1761-ui-alert-o-bottom-sheet-per-il-…
Browse files Browse the repository at this point in the history
…non-mostrare-piu-e-logica-di-visualizzazione
  • Loading branch information
Vangaorth authored Dec 11, 2024
2 parents 8cc526b + b6afc5c commit a48dbc9
Show file tree
Hide file tree
Showing 24 changed files with 374 additions and 1,251 deletions.
1 change: 0 additions & 1 deletion locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3308,7 +3308,6 @@ features:
expirationDate: "Scadenza"
securityLevel: "Livello di sicurezza"
info: "Ulteriori info su questi dati"
issuedByNew: "Emessa da"
releasedBy: Emissione versione digitale
attachments: "Attachments"
authenticSource: Origine dei dati
Expand Down
1 change: 0 additions & 1 deletion locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3308,7 +3308,6 @@ features:
expirationDate: "Scadenza"
securityLevel: "Livello di sicurezza"
info: "Ulteriori info su questi dati"
issuedByNew: "Emessa da"
releasedBy: Emissione versione digitale
attachments: "Allegati"
authenticSource: Origine dei dati
Expand Down
2 changes: 1 addition & 1 deletion ts/features/fims/common/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const trackDataShareAccepted = (
};

export const trackInAppBrowserOpening = (
serviceId: ServiceId,
serviceId: ServiceId | undefined,
serviceName: string | undefined,
organizationName: string | undefined,
organizationFiscalCode: string | undefined,
Expand Down
6 changes: 3 additions & 3 deletions ts/features/fims/singleSignOn/components/FimsSuccessBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
computeAndTrackDataShareAccepted
} from "../../common/analytics";
import { useAutoFetchingServiceByIdPot } from "../../common/hooks";
import { fimsGetRedirectUrlAndOpenIABAction } from "../store/actions";
import { fimsAcceptConsentsAction } from "../store/actions";
import { FimsClaimsList } from "./FimsClaims";
import { FimsSSOFullScreenError } from "./FimsFullScreenErrors";
import { FimsPrivacyInfo } from "./FimsPrivacyInfo";
Expand Down Expand Up @@ -152,9 +152,9 @@ export const FimsFlowSuccessBody = ({
const state = store.getState();
computeAndTrackDataShareAccepted(serviceId, state);
dispatch(
fimsGetRedirectUrlAndOpenIABAction.request(
fimsAcceptConsentsAction(
// eslint-disable-next-line no-underscore-dangle
{ acceptUrl: consents._links.consent.href, serviceId }
{ acceptUrl: consents._links.consent.href }
)
);
}
Expand Down
82 changes: 82 additions & 0 deletions ts/features/fims/singleSignOn/saga/handleFIMSAcceptedConsents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { ActionType } from "typesafe-actions";
import { call, put, select } from "typed-redux-saga/macro";
import { isCancelledFailure } from "@pagopa/io-react-native-http-client";
import {
fimsAcceptConsentsAction,
fimsAcceptConsentsFailureAction,
fimsSignAndRetrieveInAppBrowserUrlAction
} from "../store/actions";
import { oidcProviderDomainSelector } from "../../../../store/reducers/backendStatus/remoteConfig";
import {
absoluteRedirectUrl,
computeAndTrackAuthenticationError,
deallocateFimsAndRenewFastLoginSession,
followProviderRedirects,
formatHttpClientResponseForMixPanel,
isFastLoginFailure
} from "./sagaUtils";

export function* handleFimsAcceptedConsents(
action: ActionType<typeof fimsAcceptConsentsAction>
) {
const oidcProviderDomain = yield* select(oidcProviderDomainSelector);
if (!oidcProviderDomain) {
const debugMessage = `missing FIMS, domain is ${oidcProviderDomain}`;
yield* call(computeAndTrackAuthenticationError, debugMessage);
yield* put(
fimsAcceptConsentsFailureAction({
errorTag: "GENERIC",
debugMessage
})
);
return;
}
const maybeAcceptUrl = action.payload.acceptUrl;

const acceptUrl = absoluteRedirectUrl(
maybeAcceptUrl ?? "",
oidcProviderDomain
);
if (!acceptUrl) {
const debugMessage = `unable to accept grants, could not build url. obtained URL: ${maybeAcceptUrl}`;
yield* call(computeAndTrackAuthenticationError, debugMessage);
yield* put(
fimsAcceptConsentsFailureAction({
errorTag: "GENERIC",
debugMessage
})
);
return;
}

const rpRedirectResponse = yield* call(
followProviderRedirects,
{ url: acceptUrl, verb: "post" },
oidcProviderDomain
);

if (rpRedirectResponse.type === "failure") {
if (isCancelledFailure(rpRedirectResponse)) {
return;
}
if (isFastLoginFailure(rpRedirectResponse)) {
yield* call(deallocateFimsAndRenewFastLoginSession);
return;
}
const debugMessage = `could not get RelyingParty redirect URL, ${formatHttpClientResponseForMixPanel(
rpRedirectResponse
)}`;
yield* call(computeAndTrackAuthenticationError, debugMessage);
yield* put(
fimsAcceptConsentsFailureAction({
errorTag: "GENERIC",
debugMessage
})
);
return;
}

yield* put(
fimsSignAndRetrieveInAppBrowserUrlAction.request(rpRedirectResponse)
);
}
14 changes: 7 additions & 7 deletions ts/features/fims/singleSignOn/saga/handleFimsAbortOrCancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ import {
nativeRequest
} from "@pagopa/io-react-native-http-client";
import { call, select } from "typed-redux-saga/macro";
import { fimsDomainSelector } from "../../../../store/reducers/backendStatus/remoteConfig";
import { oidcProviderDomainSelector } from "../../../../store/reducers/backendStatus/remoteConfig";
import { fimsPartialAbortUrl } from "../store/selectors";
import { deallocateFimsResourcesAndNavigateBack } from "./handleFimsResourcesDeallocation";
import {
buildAbsoluteUrl,
absoluteRedirectUrl,
computeAndTrackAuthenticationError,
deallocateFimsResourcesAndNavigateBack,
formatHttpClientResponseForMixPanel
} from "./sagaUtils";

const abortTimeoutMillisecondsGenerator = () => 8000;

export function* handleFimsAbortOrCancel() {
yield* call(cancelAllRunningRequests);
const oidcProviderUrl = yield* select(fimsDomainSelector);
const oidcProviderDomain = yield* select(oidcProviderDomainSelector);
const abortUrlMaybePartial = yield* select(fimsPartialAbortUrl);
if (oidcProviderUrl && abortUrlMaybePartial) {
if (oidcProviderDomain && abortUrlMaybePartial) {
const abortAbsoluteUrl = yield* call(
buildAbsoluteUrl,
absoluteRedirectUrl,
abortUrlMaybePartial,
oidcProviderUrl
oidcProviderDomain
);
if (abortAbsoluteUrl) {
const abortResponse = yield* call(nativeRequest, {
Expand Down
Loading

0 comments on commit a48dbc9

Please sign in to comment.