diff --git a/package.json b/package.json index 62dcb2c4aa3..b97b9fd5746 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", @@ -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", @@ -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", diff --git a/ts/features/fims/history/api/client.ts b/ts/features/fims/history/api/client.ts index 08f9fdc2f90..6ff81abe17a 100644 --- a/ts/features/fims/history/api/client.ts +++ b/ts/features/fims/history/api/client.ts @@ -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) => diff --git a/ts/features/fims/history/components/FimsHistoryListItem.tsx b/ts/features/fims/history/components/FimsHistoryListItem.tsx index f0357a22c83..6901c42dbb2 100644 --- a/ts/features/fims/history/components/FimsHistoryListItem.tsx +++ b/ts/features/fims/history/components/FimsHistoryListItem.tsx @@ -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"; diff --git a/ts/features/fims/history/components/FimsHistoryNonEmptyContent.tsx b/ts/features/fims/history/components/FimsHistoryNonEmptyContent.tsx index e51fa3aefed..a946f5930c6 100644 --- a/ts/features/fims/history/components/FimsHistoryNonEmptyContent.tsx +++ b/ts/features/fims/history/components/FimsHistoryNonEmptyContent.tsx @@ -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"; diff --git a/ts/features/fims/history/store/actions/index.ts b/ts/features/fims/history/store/actions/index.ts index 86189135805..0abf53af36f 100644 --- a/ts/features/fims/history/store/actions/index.ts +++ b/ts/features/fims/history/store/actions/index.ts @@ -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 = { diff --git a/ts/features/fims/history/store/reducer/index.ts b/ts/features/fims/history/store/reducer/index.ts index 2b3632c213b..47760f0f359 100644 --- a/ts/features/fims/history/store/reducer/index.ts +++ b/ts/features/fims/history/store/reducer/index.ts @@ -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, diff --git a/ts/features/fims/singleSignOn/components/FimsClaims.tsx b/ts/features/fims/singleSignOn/components/FimsClaims.tsx index 64a35eba9f2..9d49dc9d225 100644 --- a/ts/features/fims/singleSignOn/components/FimsClaims.tsx +++ b/ts/features/fims/singleSignOn/components/FimsClaims.tsx @@ -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) => ( @@ -21,7 +21,7 @@ const ClaimListItem = ({ label }: ClaimsListItemProps) => ( ); type ClaimsListProps = { - claims: ReadonlyArray; + claims: ReadonlyArray; }; type ClaimsListItemProps = { label?: string }; diff --git a/ts/features/fims/singleSignOn/components/FimsSuccessBody.tsx b/ts/features/fims/singleSignOn/components/FimsSuccessBody.tsx index bbe2ada1e9b..75cfd1295c5 100644 --- a/ts/features/fims/singleSignOn/components/FimsSuccessBody.tsx +++ b/ts/features/fims/singleSignOn/components/FimsSuccessBody.tsx @@ -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 @@ -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, diff --git a/ts/features/fims/singleSignOn/saga/handleFimsGetConsentsList.ts b/ts/features/fims/singleSignOn/saga/handleFimsGetConsentsList.ts index f290b095e32..4b425b5bb19 100644 --- a/ts/features/fims/singleSignOn/saga/handleFimsGetConsentsList.ts +++ b/ts/features/fims/singleSignOn/saga/handleFimsGetConsentsList.ts @@ -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, @@ -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, @@ -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, @@ -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( () => { diff --git a/ts/features/fims/singleSignOn/store/actions/index.ts b/ts/features/fims/singleSignOn/store/actions/index.ts index a2a1c5a2f12..3b241682ea8 100644 --- a/ts/features/fims/singleSignOn/store/actions/index.ts +++ b/ts/features/fims/singleSignOn/store/actions/index.ts @@ -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"; @@ -21,7 +21,7 @@ export const fimsGetConsentsListAction = createAsyncAction( "FIMS_GET_CONSENTS_LIST_REQUEST", "FIMS_GET_CONSENTS_LIST_SUCCESS", "FIMS_GET_CONSENTS_LIST_FAILURE" -)(); +)(); // note: IAB==InAppBrowser export const fimsGetRedirectUrlAndOpenIABAction = createAsyncAction( diff --git a/ts/features/fims/singleSignOn/store/reducers/index.ts b/ts/features/fims/singleSignOn/store/reducers/index.ts index bd4e49892ba..53058b179cf 100644 --- a/ts/features/fims/singleSignOn/store/reducers/index.ts +++ b/ts/features/fims/singleSignOn/store/reducers/index.ts @@ -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, @@ -29,7 +29,7 @@ export type FimsErrorStateType = { }; export type FimsSSOState = { - consentsData: pot.Pot; + consentsData: pot.Pot; ctaText?: string; currentFlowState: FimsFlowStateTags; relyingPartyServiceId?: ServiceId; diff --git a/ts/features/fims/singleSignOn/store/selectors/index.ts b/ts/features/fims/singleSignOn/store/selectors/index.ts index c262a0b6149..1d46f9f1ce7 100644 --- a/ts/features/fims/singleSignOn/store/selectors/index.ts +++ b/ts/features/fims/singleSignOn/store/selectors/index.ts @@ -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"; @@ -31,7 +31,7 @@ export const fimsPartialAbortUrl = (state: GlobalState) => pipe(state, fimsConsentsDataSelector, abortUrlFromConsentsPot, O.toUndefined); export const abortUrlFromConsentsPot = ( - consentsPot: pot.Pot + consentsPot: pot.Pot ) => pipe( consentsPot, diff --git a/ts/features/fims/singleSignOn/types/index.ts b/ts/features/fims/singleSignOn/types/index.ts deleted file mode 100644 index b88d548d85b..00000000000 --- a/ts/features/fims/singleSignOn/types/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as t from "io-ts"; - -const singleLinkType = t.type({ - href: t.string -}); - -const linksType = t.type({ - abort: singleLinkType, - consent: singleLinkType -}); - -const claimType = t.partial({ - name: t.string, - display_name: t.string -}); - -const redirectionType = t.partial({ - display_name: t.string -}); - -export const ConsentData = t.type({ - _links: linksType, - service_id: t.string, - redirect: redirectionType, - type: t.string, - user_metadata: t.readonlyArray(claimType) -}); - -export type FimsClaimType = t.TypeOf; -export type ConsentData = t.TypeOf; diff --git a/yarn.lock b/yarn.lock index 27fe26d9e55..04f23a97943 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"