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: [IOCOM-1660] FIMS SSO autogenerated specs #6330

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"io_consumed_pn_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v14.3.0-RELEASE/openapi/consumed/api-piattaforma-notifiche.yaml",
"api_cdc": "assets/CdcSwagger.yml",
"pagopa_api": "assets/paymentManager/spec.json",
"fims_swagger": "assets/FimsSwager.yml",
"pagopa_api_walletv2": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.40/bonus/specs/bpd/pm/walletv2.json",
"pagopa_cobadge_configuration": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.40/pagopa/cobadge/abi_definitions.yml",
"pagopa_privative_configuration": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.40/pagopa/privative/definitions.yml",
Expand All @@ -27,6 +26,8 @@
"pagopa_api_biz_events": "https://raw.githubusercontent.com/pagopa/pagopa-biz-events-service/0.1.57/openapi/openapi_io_patch_lap.json",
"pagopa_api_platform": "https://raw.githubusercontent.com/pagopa/pagopa-infra/v1.64.0/src/domains/shared-app/api/session-wallet/v1/_openapi.json.tpl",
"trial_system": "https://raw.githubusercontent.com/pagopa/io-backend/v14.3.0-RELEASE/api_trial_system.yaml",
"fims_sso": "https://raw.githubusercontent.com/pagopa/io-fims/a93f1a1abf5230f103d9f489b139902b87288061/apps/op-app/openapi.yaml",
"fims_history": "assets/FimsSwager.yml",
"private": true,
"scripts": {
"start": "react-native start",
Expand Down Expand Up @@ -90,7 +91,8 @@
"generate:pagopa-ecommerce-api": "rimraf definitions/pagopa/ecommerce && mkdir -p definitions/pagopa/ecommerce && gen-api-models --api-spec $npm_package_pagopa_api_ecommerce --out-dir ./definitions/pagopa/ecommerce --no-strict --response-decoders --request-types --client",
"generate:pagopa-biz-events-api": "rimraf definitions/pagopa/biz-events && mkdir -p definitions/pagopa/biz-events && gen-api-models --api-spec $npm_package_pagopa_api_biz_events --out-dir ./definitions/pagopa/biz-events --no-strict --response-decoders --request-types --client",
"generate:pagopa-platform-api": "rimraf definitions/pagopa/platform && mkdir -p definitions/pagopa/platform && gen-api-models --api-spec $npm_package_pagopa_api_platform --out-dir ./definitions/pagopa/platform --no-strict --response-decoders --request-types --client",
"generate:fims": "rimraf definitions/fims && mkdir -p definitions/fims && gen-api-models --api-spec $npm_package_fims_swagger --out-dir ./definitions/fims --no-strict --response-decoders --request-types --client",
"generate:fims_sso": "rimraf definitions/fims_sso && mkdir -p definitions/fims_sso && gen-api-models --api-spec $npm_package_fims_sso --out-dir ./definitions/fims_sso --no-strict --request-types --response-decoders --client",
"generate:fims_history": "rimraf definitions/fims_history && mkdir -p definitions/fims_history && gen-api-models --api-spec $npm_package_fims_history --out-dir ./definitions/fims_history --no-strict --response-decoders --request-types --client",
"generate:payments": "npm-run-all generate:pagopa-walletv3-api generate:pagopa-ecommerce-api generate:pagopa-biz-events-api generate:pagopa-platform-api",
"generate": "npm-run-all generate:*",
"locales_unused": "ts-node --skip-project -O '{\"lib\":[\"es2015\"]}' scripts/unused-locales.ts",
Expand Down Expand Up @@ -241,7 +243,7 @@
"@babel/preset-typescript": "^7.23.3",
"@babel/runtime": "^7.20.0",
"@jambit/eslint-plugin-typed-redux-saga": "^0.4.0",
"@pagopa/openapi-codegen-ts": "^13.2.0",
"@pagopa/openapi-codegen-ts": "^14.0.0",
"@react-native-community/eslint-config": "^3.2.0",
"@react-native/eslint-config": "^0.72.2",
"@react-native/metro-config": "^0.72.12",
Expand Down
2 changes: 1 addition & 1 deletion ts/features/fims/history/api/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createClient } from "../../../../../definitions/fims/client";
import { createClient } from "../../../../../definitions/fims_history/client";
import { defaultRetryingFetch } from "../../../../utils/fetch";

export const createFimsClient = (baseUrl: string) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as React from "react";
import { StyleSheet, View } from "react-native";
import { ServiceId } from "../../../../../definitions/backend/ServiceId";
import { ServicePublic } from "../../../../../definitions/backend/ServicePublic";
import { Consent } from "../../../../../definitions/fims/Consent";
import { Consent } from "../../../../../definitions/fims_history/Consent";
import I18n from "../../../../i18n";
import { dateToAccessibilityReadableFormat } from "../../../../utils/accessibility";
import { potFoldWithDefault } from "../../../../utils/pot";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Divider, IOStyles } from "@pagopa/io-app-design-system";
import { FlashList } from "@shopify/flash-list";
import * as React from "react";
import { ConsentsResponseDTO } from "../../../../../definitions/fims/ConsentsResponseDTO";
import { ConsentsResponseDTO } from "../../../../../definitions/fims_history/ConsentsResponseDTO";
import * as RemoteValue from "../../../../common/model/RemoteValue";
import { FooterActions } from "../../../../components/ui/FooterActions";
import { useFooterActionsMeasurements } from "../../../../hooks/useFooterActionsMeasurements";
Expand Down
2 changes: 1 addition & 1 deletion ts/features/fims/history/store/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
createAsyncAction,
createStandardAction
} from "typesafe-actions";
import { ConsentsResponseDTO } from "../../../../../../definitions/fims/ConsentsResponseDTO";
import { ConsentsResponseDTO } from "../../../../../../definitions/fims_history/ConsentsResponseDTO";
import { FimsExportSuccessStates } from "../reducer";

export type FimsHistoryGetPayloadType = {
Expand Down
2 changes: 1 addition & 1 deletion ts/features/fims/history/store/reducer/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as pot from "@pagopa/ts-commons/lib/pot";
import { getType } from "typesafe-actions";
import { ConsentsResponseDTO } from "../../../../../../definitions/fims/ConsentsResponseDTO";
import { ConsentsResponseDTO } from "../../../../../../definitions/fims_history/ConsentsResponseDTO";
import {
remoteError,
remoteLoading,
Expand Down
4 changes: 2 additions & 2 deletions ts/features/fims/singleSignOn/components/FimsClaims.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Divider, H6, Icon, IOColors } from "@pagopa/io-app-design-system";
import * as React from "react";
import { View, StyleSheet } from "react-native";
import { FimsClaimType } from "../types";
import { Claim } from "../../../../../definitions/fims_sso/Claim";

export const FimsClaimsList = ({ claims }: ClaimsListProps) => (
<View style={styles.grantsList}>
Expand All @@ -21,7 +21,7 @@ const ClaimListItem = ({ label }: ClaimsListItemProps) => (
</View>
);
type ClaimsListProps = {
claims: ReadonlyArray<FimsClaimType>;
claims: ReadonlyArray<Claim>;
};
type ClaimsListItemProps = { label?: string };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { logoForService } from "../../../services/home/utils";
import { useAutoFetchingServiceByIdPot } from "../../common/utils/hooks";
import { fimsGetRedirectUrlAndOpenIABAction } from "../store/actions";
import { fimsErrorTagSelector } from "../store/selectors";
import { ConsentData } from "../types";
import { Consent } from "../../../../../definitions/fims_sso/Consent";
import {
computeAndTrackDataShare,
computeAndTrackDataShareAccepted
Expand All @@ -40,7 +40,7 @@ import { FimsClaimsList } from "./FimsClaims";
import { FimsSSOFullScreenError } from "./FimsFullScreenErrors";
import { FimsPrivacyInfo } from "./FimsPrivacyInfo";

type FimsSuccessBodyProps = { consents: ConsentData; onAbort: () => void };
type FimsSuccessBodyProps = { consents: Consent; onAbort: () => void };

export const FimsFlowSuccessBody = ({
consents,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ActionType, isActionOf } from "typesafe-actions";
import { fimsTokenSelector } from "../../../../store/reducers/authentication";
import { fimsDomainSelector } from "../../../../store/reducers/backendStatus";
import { fimsGetConsentsListAction } from "../store/actions";
import { ConsentData } from "../types";
import { Consent } from "../../../../../definitions/fims_sso/Consent";
import { deallocateFimsAndRenewFastLoginSession } from "./handleFimsResourcesDeallocation";
import {
computeAndTrackAuthenticationError,
Expand Down Expand Up @@ -63,8 +63,6 @@ export function* handleFimsGetConsentsList(

yield* call(setCookie, fimsProviderDomain, "/", "_io_fims_token", fimsToken);

// TODO:: use with future BE lang implementation -- const lang = getLocalePrimaryWithFallback();

const fimsCTAUrlResponse = yield* call(nativeRequest, {
verb: "get",
followRedirects: false,
Expand Down Expand Up @@ -105,6 +103,7 @@ export function* handleFimsGetConsentsList(
return;
}

// TODO:: use with future BE lang implementation -- const lang = getLocalePrimaryWithFallback();
const getConsentsResult = yield* call(nativeRequest, {
verb: "get",
followRedirects: true,
Expand Down Expand Up @@ -156,7 +155,7 @@ const decodeSuccessfulConsentsResponse = (
pipe(
getConsentsResult.body,
E.tryCatchK(JSON.parse, identity),
E.map(ConsentData.decode),
E.map(Consent.decode),
E.flatten,
E.foldW(
() => {
Expand Down
4 changes: 2 additions & 2 deletions ts/features/fims/singleSignOn/store/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
createAsyncAction,
createStandardAction
} from "typesafe-actions";
import { ConsentData } from "../../types";
import { Consent } from "../../../../../../definitions/fims_sso/Consent";
import { FimsErrorStateType } from "../reducers";
import { ServiceId } from "../../../../../../definitions/backend/ServiceId";

Expand All @@ -21,7 +21,7 @@ export const fimsGetConsentsListAction = createAsyncAction(
"FIMS_GET_CONSENTS_LIST_REQUEST",
"FIMS_GET_CONSENTS_LIST_SUCCESS",
"FIMS_GET_CONSENTS_LIST_FAILURE"
)<FimsGetConsentsListRequestType, ConsentData, FimsErrorStateType>();
)<FimsGetConsentsListRequestType, Consent, FimsErrorStateType>();

// note: IAB==InAppBrowser
export const fimsGetRedirectUrlAndOpenIABAction = createAsyncAction(
Expand Down
4 changes: 2 additions & 2 deletions ts/features/fims/singleSignOn/store/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getType } from "typesafe-actions";
import { ServiceId } from "../../../../../../definitions/backend/ServiceId";
import { startApplicationInitialization } from "../../../../../store/actions/application";
import { Action } from "../../../../../store/actions/types";
import { ConsentData } from "../../types";
import { Consent } from "../../../../../../definitions/fims_sso/Consent";
import { shouldRestartFimsAuthAfterFastLoginFailure } from "../../utils";
import {
fimsCancelOrAbortAction,
Expand All @@ -29,7 +29,7 @@ export type FimsErrorStateType = {
};

export type FimsSSOState = {
consentsData: pot.Pot<ConsentData, FimsErrorStateType>;
consentsData: pot.Pot<Consent, FimsErrorStateType>;
ctaText?: string;
currentFlowState: FimsFlowStateTags;
relyingPartyServiceId?: ServiceId;
Expand Down
4 changes: 2 additions & 2 deletions ts/features/fims/singleSignOn/store/selectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as O from "fp-ts/lib/Option";
import { GlobalState } from "../../../../../store/reducers/types";
import { isStrictNone } from "../../../../../utils/pot";
import { getDomainFromUrl } from "../../saga/sagaUtils";
import { ConsentData } from "../../types";
import { Consent } from "../../../../../../definitions/fims_sso/Consent";
import { foldFimsFlowStateK } from "../../utils";
import { FIMS_SSO_ERROR_TAGS, FimsErrorStateType } from "../reducers";
import { isDebugModeEnabledSelector } from "../../../../../store/reducers/debug";
Expand All @@ -31,7 +31,7 @@ export const fimsPartialAbortUrl = (state: GlobalState) =>
pipe(state, fimsConsentsDataSelector, abortUrlFromConsentsPot, O.toUndefined);

export const abortUrlFromConsentsPot = (
consentsPot: pot.Pot<ConsentData, FimsErrorStateType>
consentsPot: pot.Pot<Consent, FimsErrorStateType>
) =>
pipe(
consentsPot,
Expand Down
30 changes: 0 additions & 30 deletions ts/features/fims/singleSignOn/types/index.ts

This file was deleted.

8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2127,10 +2127,10 @@
resolved "https://registry.yarnpkg.com/@pagopa/io-react-native-zendesk/-/io-react-native-zendesk-0.3.29.tgz#ada8dab8a9ef15e126275baace2084491148bac8"
integrity sha512-CskFyF0Sz+EC/ZyJNNMFEX/Avjyn6cKRwE2K+XSTGWDKYLImPraA8YozTljclCdv3DOxk3ZklUsieMG25PfnSw==

"@pagopa/openapi-codegen-ts@^13.2.0":
version "13.2.0"
resolved "https://registry.yarnpkg.com/@pagopa/openapi-codegen-ts/-/openapi-codegen-ts-13.2.0.tgz#ed55405c979b582dc11a8a9b900adc45b6c7379d"
integrity sha512-EKo4CJReQPT8z3a6P35p3eW86VIy9gcLOVrxIj8VR5bWRhVDfFjwAmpth9pIGQ0QXPmGuylbJbWQmWHrbGLnaA==
"@pagopa/openapi-codegen-ts@^14.0.0":
version "14.0.0"
resolved "https://registry.yarnpkg.com/@pagopa/openapi-codegen-ts/-/openapi-codegen-ts-14.0.0.tgz#06ed67ec4259323820005d8e05ceb4ad8b2acb53"
integrity sha512-xnyC3I5gBuR3zeaXVyYP3Tcl2CEpB8NP9vJmEqWUY4tdAfj4HeREQgZ+gKinevZ+4CIlQljPo60IclB8rXHiag==
dependencies:
"@pagopa/ts-commons" "^10.15.0"
fs-extra "^6.0.0"
Expand Down
Loading